Commit Graph

378 Commits

Author SHA1 Message Date
Xavier Claessens 6ec0b535ba external-project: Add typing annotation 2020-09-13 13:54:47 -04:00
Xavier Claessens 9d338200da external-project: New module to build configure/make projects
This adds an experimental meson module to build projects with other
build systems.

Closes: #4316
2020-09-13 13:54:47 -04:00
Daniel Mensinger e681235e5f
typing: fix code review 2020-09-08 20:15:58 +02:00
Daniel Mensinger 47373a2438
typing: get rid of most T.cast 2020-09-08 20:15:58 +02:00
Daniel Mensinger 23818fc5a3
typing: more fixes 2020-09-08 20:15:58 +02:00
Daniel Mensinger a4f4379c44
typing: fully annotate scripts 2020-09-08 20:15:56 +02:00
Paolo Bonzini 492afe50a4 environment: use ExternalProgram to find ninja
This allows the NINJA environment variable to support all the Windows special
cases, especially allowing an absolute path without extension.

Based on a patch by Yonggang Luo.

Fixes: #7659
Suggested-by: Nirbheek Chauhan <nirbheek@centricular.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-04 15:38:12 +02:00
Nirbheek Chauhan 104b80a75c symbolextractor: Handle PermissionError when running tool
I can't reproduce this, but it is definitely possible. In this case
what we should do is the same as when the tool is not found.

Fixes https://github.com/mesonbuild/meson/issues/7605
2020-09-02 17:06:52 +00:00
Christoph Reiter da1b6d0a9f meson_exe: Remove two unused functions 2020-08-30 23:37:46 +03:00
Jussi Pakkanen 7d0393342a Dedup final install rpath. 2020-08-30 18:58:11 +03:00
Eli Schwartz 86b47250c6 simplify shutil usage by invoking copy2 where appropriate
It's equivalent to copyfile + copystat with the same arguments.
2020-08-20 23:47:54 +03:00
Jussi Pakkanen 91c5b37970 Better log message on rpath error. 2020-08-07 21:13:46 -04:00
Alan Coopersmith e801e0435e symbolextractor: use try/finally in solaris_syms when wrapping gnu_syms
As suggested by dcbaker in
https://github.com/mesonbuild/meson/pull/7370#pullrequestreview-436872661

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-07 17:12:06 -07:00
georgev93 5acd8acd51 Move mesonbuild/cmake/data/run_ctgt.py to mesonbuild/scripts/cmake_run_ctgt.py, as well as enclose everything in a run() function so it can be called by `meson --internal cmake_run_ctgt ...`. Also, include mesonbuild/cmake/data/ in the msi package. 2020-06-30 23:50:10 +03:00
Alan Coopersmith 45793b6ee2 symbolextractor: Add support for Solaris
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-06-22 15:00:17 -07:00
Cary Converse a198e5d191 coverage: llvm-cov support 2020-06-17 23:02:50 -04:00
Jon Turney 9f0e75bb40 Also adjust PATH in gtkdochelper for Cygwin
Also do Windows loader specific PATH adjustment (to emulate rpath) in
gtkdochelper for Cygwin.
2020-06-13 18:48:35 +00:00
Jussi Pakkanen 751ea3df72
Merge pull request #7103 from dankegel/bug4027-rpath-remember
Let .pc files and LDFLAGS provide rpaths.
2020-05-18 23:17:34 +03:00
Antoine Jacoutot bf34b97112 symbolextractor: add OpenBSD support 2020-05-18 11:00:42 -07:00
Dan Kegel d7235c5905 Let .pc files specify rpath.
Fixes #4027
2020-05-16 20:25:58 +00:00
Nirbheek Chauhan 717a2ae128 symbolextractor: Do not store the size of code objects
This will almost always change and cause a relink of everything. Our
other symbol extractor implementations do not store this either. We
only need to store the size of data objects, since that necessitates
a relink due to copy relocations.

Drastically reduces the amount of relinking required in gstreamer and
gtk on Linux.
2020-05-15 08:40:21 +00:00
Chun-wei Fan 89bd55b9da gtkdochelper.py: Ignore UnicodeEncodeError when printing output
Windows cmd.exe consoles may be using a code page that might choke
print() when we are outputting the output from calling gtk-doc.  Let's
just ignore the error when it happens and print as much as we could in
this situation.
2020-04-21 00:17:36 +03:00
Chun-wei Fan 415c9e14e7 gtkdochelper.py: Support Windows cmd.exe consoles
On Windows, prepend the commands to call the gtk-doc scripts using the
currently-used Python executable, since Windows cmd.exe consoles do not
support shebang lines.
2020-04-21 00:17:36 +03:00
Pino Toscano 626522965f symbolextractor: add support for hurd
Use the GNU toolchain for that.
2020-04-10 11:29:35 -07:00
Pino Toscano a2b8ed1446 symbolextractor: rename linux_syms to gnu_syms
It is not specific to Linux but works with the GNU toolchain, so
give it a better name.

No functional changes.
2020-04-10 11:29:35 -07:00
Jussi Pakkanen 9c604320a0
Merge pull request #6637 from mesonbuild/nirbheek/implement-symbolextractor-windows
Implement symbolextractor on windows + some cleanups/fixes
2020-02-23 20:23:03 +02:00
Nirbheek Chauhan 04e89d0867 symbolextractor: Add support for Cygwin 2020-02-22 06:49:34 +05:30
Nirbheek Chauhan cbd143844d symbolextractor: Add support for clang-cl
Requires the latest LLVm 9.0 release which implements the `-list`
argument to `llvm-lib` and ships with an implementation of `nm` called
`llvm-nm`.
2020-02-22 06:49:34 +05:30
Nirbheek Chauhan cace70c64e symbolextractor: Add a Windows implementation
Supports both MSVC and MinGW toolchains. Checks for MSVC first, then
falls back to MinGW.
2020-02-22 06:49:34 +05:30
Nirbheek Chauhan 5dcbf10a1b ninjabackend: Pass the import library to SHSYM
We actually use this while linking on Windows, and hence we need to
extract symbols from this file, and not the DLL.

However, we cannot pass it instead of the DLL because it's an optional
output of the compiler. It will not be written out at all if there are
no symbols in the DLL, and we cannot know that at configure time. This
means we cannot describe it as an output of any ninja target, or the
input of any ninja target. We must pass it as an argument without
semantic meaning.
2020-02-22 06:49:34 +05:30
Nirbheek Chauhan 2860bd0385 depfixer: Ignore more extensions that can't need RPATH fixes
Generated headers, PDB files, import libraries, etc.

Speed-up in gst-build on Windows:

```
meson install
before: 5.4 seconds
after:  5.1 seconds

meson install --only-changed
before: 2.7 seconds
after:  1.6 seconds
```
2020-02-17 23:58:20 +05:30
Nirbheek Chauhan 561a284c51 depfixer: Cache searching of install_name_tool
This gives a significant speedup in large projects such as gst-build
since now we only search for the tool once. Speed-up on Windows:

```
meson install:
before: 15.3 seconds
after:   5.4 seconds

meson install --only-changed:
before: 11.6 seconds
after:   2.7 seconds
```
2020-02-17 23:58:20 +05:30
Nirbheek Chauhan feb82e0f0f symbolextractor: Add typing hints 2020-02-17 22:48:19 +05:30
Nirbheek Chauhan 901bbc36d9 symbolextractor: Support passing arguments to tools
This is how we parse all env vars for tools in Meson. Do the same here
too for consistency.
2020-02-17 22:48:19 +05:30
Nirbheek Chauhan 6fe7af5809 symbolextractor: Print a warning if required tools not found
Also write out a dummy symbols file if the tool wasn't found or didn't
work instead of just spewing an exception.
2020-02-17 22:48:11 +05:30
Nirbheek Chauhan 431283b35d symbolextractor: Correctly filter undefined symbols on macOS
-g is --extern-only and -P is --format=posix. We were missing
--defined-only for some reason, which we pass to `nm` on Linux.
This avoids having to manually filter later.
2020-02-16 20:43:27 +05:30
Nirbheek Chauhan 77d163a0e9 symbolextractor: Print one warning when no implementation found
So people know why all their binaries are getting relinked. Do this
only once per build-dir by writing a file to meson-private.
2020-02-16 03:11:51 +05:30
Alberto García Hierro ffa9459eed commandrunner: Forward KeyboardInterrupt to command
Some commands, notably gdb, use ctrl+c themselves to perform actions
without exiting. Instead of making meson exit and thus, kill the
subprocess, ignore the KeyboardInterrupt and continue waiting for
the child.
2019-11-17 13:54:38 +02:00
Binh Nguyen f6758f2434 Prevent install_name_tool to run on EXE when cross compile on OSX 2019-11-12 20:39:23 +02:00
Marc-André Lureau 1ed70e22b9 Add source tags targets 2019-10-22 20:48:24 +03:00
Jussi Pakkanen cce172432b Use run-clang-tidy when available. 2019-10-21 20:34:41 +03:00
Daniel Mensinger 80ec5e9d28 Fix all flake8 warnings 2019-10-20 17:44:43 +03:00
Jussi Pakkanen d3b389f349 Add clang-tidy target. Closes #2383. 2019-10-01 22:02:51 +03:00
Ting-Wei Lan 0390b673f1 Find clang-format with alternative names
This is similar to what we currently do for scan-build except there is
no environment variable to choose a specific clang-format to run. If an
environment variable is needed for better control, we can add it later.
2019-09-29 00:11:15 +08:00
Gabriel Ganne e7197895b2 uniform scan-build detection process
Detect scan-build the same way when trying to launch it and when
generating the target.
The detection method is:
  1. look within SCANBUILD env variable
  2. shutil.which('scan-build')
  3. *on non-linux platforms only*: go through all the possible
     name candidates and test them individually.

The third step is added following this comment
https://github.com/mesonbuild/meson/pull/5857#issuecomment-528305788
However, going through a list of all the possible candidates is neither
easily maintainable nor performant, and is therefore skipped on
platforms that should not require such a step (currently, only Linux
platforms).

This is a follow-up to the issue raised by @lantw44 during PR:
https://github.com/mesonbuild/meson/pull/5857
2019-09-14 05:51:36 +03:00
Aleksey Gurtovoy 75daed27bc mesonlib.split_args/quote_arg/join_args 2019-09-05 23:42:47 +03:00
Thibault Saunier 42c5e4fe2b wine: Try to get the short paths when generating WINEPATH
The size of WINEPATH is limited (1024 [until recently]), we
can very easily reach that limit, and even the new one (2048) so
try to keep path as small as possible by using the shortPath
version of paths.

Also assert that we do not reach the new hard limit.

And avoid having duplicates in the list of path.

[until recently]: https://bugs.winehq.org/show_bug.cgi?id=45810
2019-08-24 06:43:47 -04:00
Xavier Claessens 44ac680e55 gtkdoc: Use find_program() to get gtkdoc tools
This will allow using gtk-doc as a subproject instead of having to
install it on the system. It also has the side effect of failing at
configuration time with a proper message if gtkdoc is not installed,
instead of failing at build time with a python backtrace.
2019-08-04 21:40:55 +03:00
Jussi Pakkanen 2e6df380f1
Merge pull request #5644 from bonzini/meson-exe-cmdline
Show command line in `ninja -v` for `capture: true` custom targets and generators
2019-08-03 01:28:27 +03:00
Michael Hirsch, Ph.D 7aecfb1540 remove unreachable code 2019-08-02 14:31:22 +03:00
Jussi Pakkanen 7ce2a24f42 Made dist a top level command. 2019-07-23 23:26:46 +03:00
Paolo Bonzini d34e532020 backends: do not split command and arguments in ExecutableSerialisation
This is not needed anymore, just make a single field with the whole
command line.
2019-07-19 00:17:29 +02:00
Paolo Bonzini b4d313b058 backends: remove unnecessary fields from ExecutableSerialisation
"exe.is_cross and exe.needs_exe_wrapper" is the same condition under which
meson chooses whether to include the exe_wrapper.  meson_exe has an assertion
for that, but now that meson_exe does not need anymore exe.is_cross,
we can simplify the code if we just "trust" meson to do the right thing.

Remove both fields from ExecutableSerialisation and just test the presence
of the wrapper, and also remove the executable basename which is only
used to "beautify" an assertion failure.
2019-07-19 00:17:29 +02:00
Paolo Bonzini ed348b7da8 backends: discover java/mono wrapper at generation time
Move the magic to execute jar and .exe files from "meson --internal exe"
to the backend, so that "ninja -v" shows more clearly what is happening.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-07-19 00:17:29 +02:00
Paolo Bonzini 8239d71025 backends: create ExecutableSerialisation in meson_exe if possible
If meson_exe is only being used to capture the output of the command,
we can skip going through a pickled ExecutableSerialization object.
This makes "ninja -v" output more useful.
2019-07-19 00:17:29 +02:00
Daniel Mensinger bc0f510ef1 fix all flake8 issues 2019-07-18 23:43:29 +03:00
Marc-André Lureau 451a32d1c8 meson: skip captured write if content didn't change
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-07-15 19:11:47 +00:00
Norbert Nemec 4b25253bfd Reference error code as hex value and improve comment 2019-07-10 01:03:01 +03:00
Norbert Nemec 62c975659f diagnostics for missing DLLs on Windows in meson_exe.py 2019-07-10 01:03:01 +03:00
Jussi Pakkanen ba6c0cab8f Use the same directory names for dist so that ccache works. Closes #5583. 2019-07-01 21:11:39 +03:00
Dylan Baker 6e4e0028a1 meson_exe: Don't assert that we need an exe_wrapper when we say we don't need one
Fixes cross compiling mesa from x86_64 -> x86 on an x86_64 system.

Fixes #5567
2019-06-27 21:06:41 +03:00
Christoph Reiter 27c5d9f16f gnome.yelp(): Fix media symlink fallback path
When the media file for a specific language doesn't exist we try to symlink
it to the C one. If symlinking fails we need to fall back to copying the C
one like in the non-symlink case.

The fallback code path didn't set the source so this always failed.

Also check if the C fallback exists before trying to symlink/copy, otherwise
we crash if C isn't the first lang we try.
2019-06-06 19:15:04 +03:00
Daniel Mensinger 3581839f4c
Fix unused variables warnings 2019-04-29 12:22:50 +02:00
Daniel Mensinger bf98ffca9e
Fix blind exceptions 2019-04-29 12:16:06 +02:00
Dylan Baker 5678468c2c Don't use len() to test for container emptiness
I ran the numbers once before (it's in the meson history) but it's
*much* faster to *not* use len for testing if a container is empty or
not.
2019-04-25 12:28:51 -07:00
Richard Kjerstadius 48ee6a6148 Add gcovr 4.2 support
The out-of-source build syntax for gcovr 4.2 is different compared to
previous versions and therefore an update was needed. In researching the
most appropriate solution it was found that any gcovr version older than
3.3 always resulted in 0% coverage. Because of this, rather than adding
an additional layer of logic, some already existing logic was modified
to ensure correct syntax for the new version, while versions older than
3.3 are flagged as not supported.

Closes mesonbuild#5089.
2019-04-24 20:05:21 +02:00
Jussi Pakkanen 8b42dc9274 Update list of potential scan-build binaries. Closes #5287. 2019-04-22 21:44:03 +03:00
Konstantin 841995cddf i18n: add args keyword to merge_file
* i18n: add args keyword to merge_file

* i18n: add testcase to msgfmt args
2019-04-22 14:54:05 +03:00
Vladimír Čunát e4f3894582 dist: recurse into git submodules 2019-04-21 23:13:01 +03:00
Arkadiusz Hiler 690dd723f4 Add symbol sizes to .symbols files
If we change a symbol size (e.g. array) in a .c file that is a part of
.so, executables that use it are not re-linked resulting in a runtime
error:

"Symbol xyz has different size in shared object, consider re-linking"

Adding symbol sizes to .symbol files fixes this issue.
2019-04-04 22:10:40 +03:00
jonathan MERCIER ff299eb36b Read file as utf8 on python3 2019-04-03 21:42:15 +03:00
Jussi Pakkanen e3e83e2acd Also format headers with Clang-Format. Closes #5184. 2019-04-01 01:26:53 +03:00
Eli Schwartz 4f9ecbee09 gettext: prefer POTFILES.in if it exists
If POTFILES.in exists, then it will have come from autotools, in which
case it is explicitly the file passed to xgettext -f, and the POTFILES
file itself is generated by autotools as a proxy file which eventually
gets inlined into the final Makefile as a variable "POTFILES = ......"

In this case, attempting to use POTFILES as the input file will simply
result in syntax errors and the inability to find files with a literal
trailing " \" in the name. Usually POTFILES will not exist at all, and
we would fallback on POTFILES.in, but if the source tree happens to be
dirty, this would result in errors. Since it's never going to be right
to use it, we can just do the right thing from the start and carry on.
2019-03-28 23:22:23 +02:00
Dylan Baker e279775511 dist: Handle git worktrees, which have a .git file instead of dir
This is the second most straight forward stupid way of handling
this (with usiing os.path.exists) as the most stupid obvious way. The
only major advantage is that having .git as something other than a
file or directory still doesn't register.

Fixes: #3378
2019-01-30 23:20:49 +02:00
Jussi Pakkanen 1fca654055 Add a clang-format target. 2018-12-30 00:50:00 +02:00
William A. Kennington III 61d462706a coverage: Also remove source_root prefixes
The code our projects care about verifying coverage for mostly lives in
the source_root with the exception of the generated source files in
build_root. This change cleans up the output so we don't have prefixed
paths on our source files anymore.
2018-12-16 20:24:05 +02:00
Jussi Pakkanen c66d4c144a Better Python exe detector. Closes #4614. 2018-12-12 16:15:18 +02:00
Mohammed Sadiq 41a98d0fdd coverage: Print summary after gcovr html generation
summary from stdout is often used by Automated builds to show build details

The --print-summary option was added to gcovr in v3.2, since html output
was added only in 3.1, limitting support to 3.2 won’t be a big deal.

--print-summary is not enabled for text/xml report generation as it will
result in meson not supporting any gcovr version less than 3.2.
2018-12-02 19:47:42 +02:00
Marvin Scholz fc3e2f5ad0 depfixer: Do not try to fix rpaths of dlls 2018-10-25 19:30:02 +03:00
Jon Turney 93f7b83bf5 Fix flake8 'imported but unused' reports
$ flake8 | grep F401
./mesonbuild/minstall.py:15:1: F401 'gzip' imported but unused
./mesonbuild/backend/backends.py:26:1: F401 '..compilers.get_macos_dylib_install_name' imported but unused
./mesonbuild/backend/backends.py:29:1: F401 'functools.lru_cache' imported but unused
./mesonbuild/scripts/dist.py:27:1: F401 'mesonbuild.dependencies.ExternalProgram' imported but unused
2018-10-24 19:11:46 +03:00
David Seifert 3a8911a07f Do not try to remove duplicate RPATH entries on macOS 2018-10-14 23:50:52 +03:00
Mohammed Sadiq 25fef3d1fa coverage: fix lcov branch coverage generation
lcov branch coverage are disabled by default.  So branch
coverage has to be enabled for every stage to make them work.

Fixes https://github.com/mesonbuild/meson/issues/4319
2018-10-09 22:43:27 +03:00
Guido Günther 1e7aea65e6 scanbuild: Split SCANBUILD using shlex
This allows invocations like

    SCANBUILD="scan-build --status-bugs" ninja scan-build

Closes: #4334
2018-10-08 20:21:32 +03:00
Jan Tojnar c0c075c129 Make custom dist scripts accept arguments.
meson.add_dist_script, introduced in #3906, did not accept any arguments
other than script name. Since all other meson.add_*_script methods
do accept args, this makes the dist script accept them as well.
2018-10-04 21:20:57 +03:00
dx-mon 65cb7b0241 Fixed the lack of stdout being displayed when not in capture mode for meson_exe (meson --internal exe) 2018-10-04 00:17:35 +03:00
Jussi Pakkanen ca4c8de09f
Merge pull request #4261 from rossburton/cross
WIP RFC gnome.py cross improvements
2018-09-28 12:56:40 -07:00
Nirbheek Chauhan 4a8210e81c dist: Warn if there are uncommitted changes in the repository
Closes https://github.com/mesonbuild/meson/issues/1977
2018-09-28 12:55:59 -07:00
Nirbheek Chauhan cbbab82b70 dist: Make usage of period in messages consistent
Having a period at the end of sentences in messages is confusing when
a file or path is being outputted, and is inconsistent when not.

This is part of an ongoing effort to fix this inconsistency across the
message outputs everywhere in Meson.
2018-09-28 12:55:59 -07:00
Ross Burton 1efcca637b gtkdochelper: show full command if it fails
Instead of showing just the command invoked, it's useful when debugging to also
show all of the arguments.
2018-09-28 17:18:24 +01:00
Marco Trevisan (Treviño) 5bec6c28e7 gnome: add support for `module_version`
gtk-doc for autotools has the concept of module version, that is used to define
the module install path and the devhelp2 basename.

Add a `module_version` parameter to gnome.gtkdoc to replicate the same behavior.
Updated the test checking that the install_dir is properly computed (if not
passed), and that the .devhelp2 file has proper name.

https://gitlab.gnome.org/GNOME/gtk-doc/blob/GTK_DOC_1_29/buildsystems/autotools/gtk-doc.make#L269
2018-09-21 09:13:21 +02:00
Jussi Pakkanen b86f2fd17f
Merge pull request #4016 from thiblahute/hotdoc
modules: Add an 'hotdoc' module
2018-08-29 21:18:26 +03:00
Thibault Saunier 378bd4df0e modules: Add an 'hotdoc' module
hotdoc: http://github.com/hotdoc/hotdoc/
2018-08-28 18:18:40 -03:00
Jussi Pakkanen fb770e1e3d Add support for custom dist scripts. 2018-08-27 23:35:29 +03:00
Christoph Reiter 69a65006f2 gtkdoc: set PATH on Windows when executing gtkdoc-scangobj. Fixes #3307
The code was adding the library paths to LD_LIBRARY_PATH, but that
doesn't work on Windows where they need to be added to PATH instead.

Move the environ handling into gtkdoc_run_check() and add paths to PATH
instead of LD_LIBRARY_PATH when on Windows.

This fixes the gtk-doc build for glib on Windows
(in case glib isn't installed already)
2018-08-07 04:42:03 -07:00
Jussi Pakkanen 543a49a29c
Merge pull request #3799 from rossburton/gtkdoc
scripts/gtkdochelper: add support for --run
2018-07-31 19:37:00 +03:00
Ross Burton d365bde555 scripts/gtkdochelper: add support for --run
gtkdoc-scangobj has a --run argument that specifies a wrapper to be used when
executing the GObject scanner.  Typically this can be libtool but it is also
useful in cross-compilation environments.

This patch adds support for this argument to the gtkdochelper so that tools
using the helper can pass --run if required.
2018-07-09 23:44:35 +01:00
Nirbheek Chauhan e8dae2b966 cross: Be more permissive about not-found exe_wrapper
We used to immediately try to use whatever exe_wrapper was defined in
the cross file, but some people generate the cross file once and use
it for several projects, most of which do not even need an exe wrapper
to build.

Now we're a bit more resilient. We quietly fall back to using
non-exe-wrapper paths for compiler checks and skip the sanity check.
However, if some code needs the exe wrapper, f.ex., if you run a built
executable using custom_target() or run_target(), we will error out
during setup.

Tests will, of course, continue to error out when you run them if the
exe wrapper was not found. We don't want people's tests to silently
"pass" (aka skip) because of a bad CI setup.

Closes https://github.com/mesonbuild/meson/issues/3562

This commit also adds a test for the behaviour of exe_wrapper in these
cases, and refactors the unit tests a bit for it.
2018-07-09 05:39:40 +05:30
Nirbheek Chauhan 416a00308f cross: Use ExternalProgram for cross-file exe_wrapper
We already have code to fetch and find binaries specified in a cross
file, so use the same code for exe_wrapper. This allows us to handle
the same corner-cases that were fixed for other cross binaries.
2018-07-09 04:09:46 +05:30
Niclas Moeslund Overby c70a051e93 java: remove manifest classpath from installed jar 2018-07-03 22:12:17 +02:00
Xavier Claessens 32c22ec492 gtkdoc: Use generated types file if there is one
Closes: #3773.
2018-06-26 22:58:45 +03:00