Commit Graph

700 Commits

Author SHA1 Message Date
Dylan Baker 751f6fb90f run_unitests: Add a test for DependencyFactory ordering 2020-01-29 09:11:24 -08:00
Dylan Baker af4acc8e05 run_unittests: Add a chdir context manager
Because seriously
2020-01-29 09:11:24 -08:00
makise-homura 6300007396 Fix broken link on Elbrus Fortran compiler
Error is raised due to Elbrus Fortran compiler can't
generate debug information for now, because it's a 2-step
compiler where 1st step is code conversion from Fortran to C,
so debug information which C compiler would produce, is useless.
2020-01-27 22:35:26 +03:00
makise-homura 7ca53e40a3 ObjC/ObjC++ compilers are not available for Elbrus, so don't fail 2020-01-27 22:35:26 +03:00
Xavier Claessens b74ece344f Support multiple args to message() and warning() 2020-01-26 07:51:16 -05:00
Xavier Claessens f54f27b1a8 Fix required dependency() not failing when wrap-mode=nofallback
When a dependency is required, not found on the system, and its fallback
is disabled with --wrap-mode=nofallback, meson should abort instead of
returning not-found.
2020-01-25 08:51:46 -05:00
Nirbheek Chauhan 8be4802b0b unit tests: summary() test does not fail on Windows anymore 2020-01-24 02:53:34 +05:30
Nirbheek Chauhan e99e742454 summary: Ensure that output is deterministic
Use OrderedDict instead of dict() to ensure that the order is the same
every time, and change the unit test to check for that.
2020-01-24 02:53:34 +05:30
Nirbheek Chauhan 4d93a11427 unit tests: Open all documentation as utf-8
Fixes compatibility of unit tests with Python 3.5.2 on Ubuntu 16.04
2020-01-24 02:53:34 +05:30
Mike Gilbert b51ba60b80 test_pkgconfig_gen_deps: set PKG_CONFIG_SYSTEM_LIBRARY_PATH=/usr/lib
pkgconf automatically prunes "system library paths" from its output. The
system library paths depend on the system toolchain. A common value on a
64-bit system is as follows:

/lib64:/usr/lib64:/usr/local/lib64

So, if -L/usr/lib64 appears in the Libs section, it will be pruned from
the output of pkg-config --libs.

The pc files generated for this test contain something like this:

libdir=/usr/lib
Libs: -L${libdir} ...

pkgconf may not consider /usr/lib to be a system library path, so it is
not pruned as the test expects. To work around this, override the
compiled-in list of paths via the PKG_CONFIG_SYSTEM_LIBRARY_PATH
environment variable.

Fixes: https://github.com/mesonbuild/meson/issues/6004
2020-01-22 14:10:54 -08:00
Dylan Baker 255fa5a320 tests: Add a test case for finding ld 2020-01-22 23:39:33 +02:00
Dylan Baker 730a7b296f environment: Replace LD with <LANG>LD
The rust code is ugly, because rust is annoying. It doesn't invoke a
linker directly (unless that linker is link.exe or lld-link.exe),
instead it invokes the C compiler (gcc or clang usually) to do it's
linking. Meson doesn't have good abstractions for this, though we
probably should because some of the D compilers do the same thing.
Either that or we should just call the c compiler directly, like vala
does.

This changes the public interface for meson, which we don't do unless we
absolutely have to. In this case I think we need to do it. A fair number
of projects have already been using 'ld' in their cross/native files to
get the ld binary and call it directly in custom_targets or generators,
and we broke that. While we could hit this problem again names like
`c_ld` and `cpp_ld` are far less likely to cause collisions than `ld`.
Additionally this gives a way to set the linker on a per-compiler basis,
which is probably in itself very useful.

Fixes #6442
2020-01-22 23:39:33 +02:00
Stéphane Cerveau 958df63dac envconfig: add pkg_config_libdir property
In order to unify the use of sysroot in the cross-file,
the pkg_config_libdir can now be passed directly in the file.
2020-01-22 15:42:13 -05:00
Nirbheek Chauhan bd17c9ad4f tests: Add a unit test for checksums
Adds a CI dependency on the `pefile` python module.
2020-01-22 19:34:05 +05:30
Xavier Claessens 711969c3b5 wrap: Fix support of file:// URLs
Fixes: #6445
2020-01-17 11:36:37 -05:00
Nirbheek Chauhan 04e275cdcc find_program: Always use USERPROFILE instead of HOME
On MSYS2 and MSYS, Python reads HOME instead of USERPROFILE, which
gets the path wrong.

Serves me right for not writing a test!!
2020-01-15 01:45:14 +05:30
Eli Schwartz 71bbcc7669 pkgconfig module: add FeatureNew for requires: dependency('foo')
Introduced in https://github.com/mesonbuild/meson/pull/3131
2020-01-09 22:08:03 -05:00
Jussi Pakkanen c2b1e7d58c Rename test dirs to sequential order. 2020-01-08 13:21:00 +02:00
Ting-Wei Lan 04e08f5a1f PkgConfigDependency: Sort -L flags according to PKG_CONFIG_PATH
When there is more than one path in PKG_CONFIG_PATH. It is almost always
preferred to find things in the order specified by PKG_CONFIG_PATH
instead of assuming pkg-config returns flags in a meaningful order.

For example:

/usr/local/lib/libgtk-3.so.0
/usr/local/lib/pkgconfig/gtk+-3.0.pc
/usr/local/lib/libcanberra-gtk3.so
/usr/local/lib/pkgconfig/libcanberra-gtk3.pc
/home/mesonuser/.local/lib/libgtk-3.so.0
/home/mesonuser/.local/lib/pkgconfig/gtk+-3.0.pc

PKG_CONFIG_PATH="/home/mesonuser/.local/lib/pkgconfig:/usr/local/lib/pkgconfig"

libcanberra-gtk3 is a library which depends on gtk+-3.0. The dependency
is mentioned in the .pc file with 'Requires', so flags from gtk+-3.0 are
used in both dynamic and static linking.

Assume the user wants to compile an application which needs both
libcanberra-gtk3 and gtk+-3.0. The application depends on features added
in the latest version of gtk+-3.0, which can be found in the home
directory of the user but not in /usr/local. When meson asks pkg-config
for linker flags of libcanberra-gtk3, pkg-config picks
/usr/local/lib/pkgconfig/libcanberra-gtk3.pc and
/home/mesonuser/.local/lib/pkgconfig/gtk+-3.0.pc. Since these two
libraries come from different prefixes, there will be two -L arguments
in the output of pkg-config. If -L/usr/local/lib is put before
-L/home/mesonuser/.local/lib, meson will find both libraries in
/usr/local/lib instead of picking libgtk-3.so.0 from the home directory.

This can result in linking failure such as undefined references error
when meson decides to put linker arguments of libcanberra-gtk3 before
linker arguments of gtk+-3.0. When both /usr/local/lib/libgtk-3.so.0 and
/home/mesonuser/.local/lib/libgtk-3.so.0 are present on the command
line, the linker chooses the first one and ignores the second one. If
the application needs new symbols that are only available in the second
one, the linker will throw an error because of missing symbols.

To resolve the issue, we should reorder -L flags according to
PKG_CONFIG_PATH ourselves before using it to find the full path of
library files. This makes sure that we always follow the preferences of
users, without depending on the unreliable part of pkg-config output.

Fixes https://github.com/mesonbuild/meson/issues/4271.
2019-12-18 11:34:24 -05:00
Jussi Pakkanen 3122bac28a
Merge pull request #4649 from dcbaker/summary-function
Add a summary() function for configuration summarization
2019-12-18 01:17:27 +02:00
Dylan Baker 614372aa55 mlog: Add a log_once function
There are a number of cases where we end up spamming users with the same
message over and over again, which is really annoying. This solves that.
2019-12-13 09:57:05 -05:00
Xavier Claessens 38953d8ee3 summary: Add bool_yn keyword argument 2019-12-12 18:30:17 -05:00
Xavier Claessens 49082f9669 summary: Allow section with no title, and passing key/value separately 2019-12-12 18:30:17 -05:00
Xavier Claessens 6e865a2330 Add a summary() function for configuration summarization
Based on patch from Dylan Baker.

Fixes #757
2019-12-12 18:30:17 -05:00
Paolo Bonzini 3778a34979 mintro: include test protocol in introspection data 2019-12-13 00:47:10 +02:00
Jussi Pakkanen 17dd9e5bff
Merge pull request #6207 from dcbaker/linker-option
Add a way to select the dynamic linker meson uses
2019-12-11 23:29:33 +02:00
Daniel Mensinger fc800a2cb8 mintro: Add version key to --scan-dependencies (fixes #6287) 2019-12-10 20:17:21 +02:00
Xavier Claessens 1dda7cde39 run_unittests: Disable pytest with python <= 3.5
It's causing issues in some CI runners, it looks like it could be that
bug: https://github.com/pytest-dev/pytest-xdist/issues/204.
2019-12-10 18:02:41 +02:00
Xavier Claessens 552e78da4d assert(): Make message argument optional 2019-12-10 18:02:41 +02:00
Xavier Claessens 1298f71b1c dist: Add --include-subprojects option 2019-12-08 20:21:43 +02:00
Dylan Baker 875ef354d0 compilers: Rework the CompilerArgs to be less awful
There are two awful things about CompilerArgs, one is that it directly
inherits from list, and there are a lot of subtle gotcahs with
inheriting from builtin types. The second is that the class allows
arguments to be passed in whatever order. That's bad. This also fully
annotates the CompilerArgs class, so mypy can type check it for us.
2019-12-05 22:15:40 +02:00
Dylan Baker f8aa17d8e6 run_unittests: Add tests for LD on windows 2019-12-03 13:08:42 -08:00
Dylan Baker 75c1874bb3 run_unittests: Add unittests for ld overriding 2019-12-03 13:08:42 -08:00
Dylan Baker 8091b4c744 Intel: Dump worthless Xild abstractions
This dumps xild on mac and linux. After a lot of reading and banging my
head I've discovered we (meson) don't care about xild, xild is only
useful if your invoke ld directly (not through icc/icpc) and you want to
do ipo/lto/wpo. Instead just make icc report what it's actually doing,
invoking ld or ld64 (for linux and mac respectively) directly. This
allows us to get -fuse-ld working on linux.
2019-12-03 13:08:42 -08:00
Dylan Baker 71e3fac5af run_unittests: remove unused PatchModule class 2019-12-02 16:39:06 -08:00
Dylan Baker ef9aeb188e Allow selecting the dynamic linker
This uses the normal meson mechanisms, an LD environment variable or via
cross/native files.

Fixes: #6057
2019-12-02 16:39:06 -08:00
Michael Hirsch, Ph.D 83b4e981c4 Use strict function prototypes 2019-11-18 22:21:36 +02:00
Jussi Pakkanen bf800101c2
Merge pull request #6182 from mensinda/depInfo
Better dependency logs
2019-11-17 14:29:47 +02:00
Daniel Mensinger c361181cd9
mintro: dependencies: added version key 2019-11-14 18:16:47 +01:00
Paulo Neves 07389e23bc coredata: CmdLineFileParser no longer interpolates strings.
Previously if a user tried to pass a command line build
option that contained a '%' character the command line
parser assumed that there was string interpolation to be
done. As there is no sense in such a scenario no code
provides any input for the interpolation. This then leads to
a failure.

In this commit we specifically override the defaults in
ConfigParser and set interpolation to None, which disables
command line build option interpolation.

Fixes #6157
2019-11-13 22:04:15 +02:00
Jussi Pakkanen 2a73517e08 Revert "Add `-Wl,-rpath-link` for secondary dependencies"
This reverts commit 7b9c348102.

Closes #6027.
2019-11-13 17:46:34 +02:00
Marvin Scholz 273d6e75ea dependencies/pkgconfig: Fix error reporting
The stderr of pkg-config was never used, leading to no details about
failures at all in exception messages.
2019-11-07 17:50:00 +05:30
Wolfgang Stöggl f037e7ef45 Fix typos found by codespell
- Typos were found by codespell v1.16.0
2019-11-06 09:55:30 -05:00
Michael Hirsch, Ph.D bbe6db08e3 Minit templates modularization 2019-11-02 23:34:58 +02:00
Aleksey Gurtovoy 6eee9e48bb MSVC: support -LIBPATH
Fixes #6101 (with a test), following up #5881
2019-10-29 22:40:13 +02:00
Orlando Wingbrant 9ee9a1e1b2 Fix for issue #4499, multiple entries per file in install-log.txt 2019-10-23 22:37:45 +03:00
Jussi Pakkanen f96a8cbdf5 Test that running configure on a build dir works. 2019-10-22 22:32:34 +03:00
Daniel Mensinger 80ec5e9d28 Fix all flake8 warnings 2019-10-20 17:44:43 +03:00
Jussi Pakkanen 7bc7ff1433 Do not try to run dist test with VS backend. 2019-10-20 13:30:17 +03:00
Ross Burton a1a8772034 Add test case to verify identity cross builds
A build with a cross file should always be identified as a cross build, even if
the host and build machine are identical.  This was the case in 0.50, regressed
in 0.51, and is fixed again in 0.52, so add a test case to ensure it doesn't
regress again.
2019-10-15 23:46:35 +03:00