Commit Graph

74 Commits

Author SHA1 Message Date
Dylan Baker a78992dd81 interpreter: move handling of module stability to interpreter
Thanks to `ModuleInfo`, all modules are just named `foo.py` instead of
`unstable_foo.py`, which simplifies the import method a bit. This also
allows for accurate FeatureNew/FeatureDeprecated use, as we know when
the module was added and if/when it was stabilized.
2022-08-17 16:25:36 -04:00
Dylan Baker e062dcdfcc allplatformstests: use subTests with test_warning_location 2022-08-17 16:25:36 -04:00
Hemmo Nieminen 952dd7773d mtest: unify parsed and non-parsed output handling
Use the same routines to handle output both when parsing the output and
when not. Also fixes broken stderr handling for parsed tests.
2022-08-07 20:48:42 +03:00
Daan De Meyer f774609b09 Only reconfigure if configure options actually changed
Currently, if we run "meson configure -Doption=value", meson will
do a reconfigure when running "ninja build" afterwards, even if
the new value is the same one that was already configured previously.

To avoid this unnecessary reconfigure, let's use replace_if_different()
instead of unconditionally replacing the conf file in coredata's save()
function.
2022-07-31 20:43:27 +03:00
Justin Blanchard ec388fe7c2 ar linker: detect the "osx ld" case (where generating thin archives won't work) based on host OS, not build OS. 2022-07-21 22:00:00 -07:00
Eli Schwartz 8afcca2d26
tests: skip template test for windows shared fortran
This is only supported with gfortran, see "test cases/fortran/6 dynamic"
for more details. Skip it explicitly here too.
2022-07-11 17:58:02 -04:00
Jussi Pakkanen befd26985c Fix test case numbers. 2022-07-07 10:04:51 -07:00
Eli Schwartz c151988b39
intro-install_plan: fix destinations for build_targets with custom install_dir
There are a couple issues that combine to make the current handling a
bit confusing.

- we call it "install_dir_name" but it is only ever the class default

- CustomTarget always has it set to None, and then we check if it is
  None then create a different variable with a safe fallback. The if is
  useless -- it cannot fail, but if it did we'd get an undefined
  variable error when we tried to use `dir_name`

Remove the special handling for CustomTarget. Instead, just always
accept None as a possible value of outdir_name when constructing install
data, and, if it is None, fall back to {prefix}/outdir regardless of
what type it used to be.
2022-06-09 20:37:26 -04:00
Vili Väinölä 18e2f8b2b3 Fix sandbox violation when using subproject as a symlink
Fix "Tried to grab file outside current (sub)project" error when subproject exists within
a source tree but it is used through a symlink. Using subprojects as symlinks is very useful
feature when migrating an existing codebase to meson that all sources do not need to be
immediately moved to subprojects folder.
2022-06-01 12:32:53 -07:00
Zbigniew Jędrzejewski-Szmek 8afdecb039 Reword message in warning
"targetting" is verb-derived adjective, which sort-of-works here, but
makes the whole sentence awkward, because there's no verb. Let's just
use present simple.
2022-05-19 07:18:43 -04:00
Simon McVittie 65ea833d58 Require CMake 3.14 for all tests that use the cmake module
Older versions are not supported by the cmake module since 0.62.

This avoids having to hard-code the linux-bionic-gcc CI job as being
unable to run these tests, which leaves other older environments like
Debian 10 still trying to run them (and failing).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-10 07:56:59 -04:00
Fredrik Salomonsson ef0c38f90a unittests: Add test_pkgconfig_relocatable to allplatformstests
Test that the pkgconfig prefix is actually relocatable when
pkgconfig.relocatable=true and is not when
pkgconfig.relocatable=false.
2022-04-19 17:35:08 -04:00
Jussi Pakkanen 2fcd3a4174 Add regression test for Python dist. 2022-04-13 21:27:22 +03:00
Marvin Scholz 34ea8fdf98 unittests: move get_convincing_fake_env_and_cc to run_tests.py 2022-03-31 10:55:55 +02:00
Marvin Scholz 9e597ce905 unittests: add underscore prefix tests
Tests the two new detection methods for the underscore prefix
against what is detected in the binary. Contrary to the in-the-wild
failures, we can trust the binary here as we do not get any additional
flags that influence the binary contents in this test environment.
2022-03-31 10:55:55 +02:00
Jussi Pakkanen 1c3191be55 Condense test directory names. 2022-03-29 02:12:02 +03:00
Xavier Claessens f2d21bf8a9 Make compilers list per subproject
Previously subprojects inherited languages already added by main
project, or any previous subproject. This change to have a list of
compilers per interpreters, which means that if a subproject does not
add 'c' language  it won't be able to compile .c files any more, even if
main project added the 'c' language.

This delays processing list of compilers until the interpreter adds the
BuildTarget into its list of targets. That way the interpreter can add
missing languages instead of duplicating that logic into BuildTarget for
the cython case.
2022-03-24 12:27:06 -04:00
Jussi Pakkanen 69ade4f4cf
Merge pull request #9339 from dcbaker/submit/structured_sources
Structured Sources
2022-03-13 01:01:55 +02:00
Jussi Pakkanen 6ec6e0c9ec Replace freezing regex with plain text operations.
The regex in question causes Python's regex parser to freeze
indefinitely in certain Python versions. That might be due
to a bug or because the re does infinite backtracking and it just
happened to work on earlier implementations.
2022-03-09 16:31:12 +02:00
Dylan Baker 7d1431a060 build: plumb structured sources into BuildTargets 2022-03-07 12:33:33 -08:00
Xavier Claessens 01e92dc543 Fix default install tag for shared lib symlinks
Versioned shared libraries should have .so file in devel, .so.1 and
.so.1.2.3 in runtime.

Fixes: #9811
2022-03-07 09:27:02 -05:00
Jan Tojnar df451f1013 meson: Allow directory options outside of prefix
This bring us in line with Autotools and CMake and it is useful
for platforms like Nix, which install projects
into multiple independent prefixes.

As a consequence, `get_option` might return absolute paths for some
directory options, if a directory outside of prefix is passed.

This is technically a backwards incompatible change but its effect
should be minimal, thanks to widespread use of `join_paths`/`/` operator
and pkg-config generator module. It should only cause an issue when
a path were constructed by concatenating the value of directory path option.

Also remove a comment about commonpath since we do not use that since
<00f5dadd5b>.

Fixes: https://github.com/mesonbuild/meson/issues/2561
2022-02-09 11:04:59 -05:00
Daniel Mensinger 2e2ca5a877 cmake: ci: Skip tests on Ubuntu Bionic where CMake is stuck on 3.10 2022-02-03 11:25:59 -05:00
Paolo Bonzini 7a975d75cf unittests: check that "verbose: true" works on tests
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-02-01 09:05:27 +01:00
Nirbheek Chauhan 2512c25c0b ninja backend: Fix usage of same constants file for native and cross
For example:
```
meson builddir \
        --native-file vs2019-paths.txt \
        --native-file vs2019-win-x64.txt \
        --cross-file vs2019-paths.txt \
        --cross-file vs2019-win-arm64.txt
```
This was causing the error:

> ERROR: Multiple producers for Ninja target "/path/to/vs2019-paths.txt". Please rename your targets.

Fix it by using a set() when generating the list of regen files, and
add a test for it too.
2022-01-30 02:13:42 +05:30
Dylan Baker 574525673f interpreterobjects: use typed_* for configuration_data.set*
This removes the ability to use ConfigurationData as a dict, but
restricting the inputs to `str | int | bool`. This may be a little too
soon for this, and we may want to wait on that part, it's only bee 8
months since we started warning about this.
2022-01-18 17:53:29 -05:00
Eli Schwartz 98a41ec24e
manually clean up some python 3.6 era code 2022-01-10 18:36:57 -05:00
Jussi Pakkanen 117ba23071 Condense test directory numbers for rc1. 2022-01-02 19:07:36 +02:00
Nirbheek Chauhan 37b122b87e unit tests: Don't check quoting with multiple libs
pkgconf has a bug on MSYS2 due to which prefixes with spaces are not
handled correctly if the library has a Requires: on another library
and both have prefixes with spaces in them.

See: https://github.com/pkgconf/pkgconf/issues/238

So move the unit test to libanswer.pc instead of libfoo.pc till that
is fixed.
2021-12-22 12:12:11 +05:30
Nirbheek Chauhan 06b1132f82 Set RPATH for all non-system libs with absolute paths
If a pkg-config dependency has multiple libraries in it, which is the
most common case when it has a Requires: directive, or when it has
multiple -l args in Libs: (rare), then we don't add -Wl,-rpath
directives to it when linking.

The existing test wasn't catching it because it was linking to
a pkgconfig file with a single library in it. Update the test to
demonstrate this.

This function was originally added for shared libraries in the source
directory, which explains the name:
https://github.com/mesonbuild/meson/pull/2397

However, since now it is also used for linking to *all* non-system
shared libraries that we link to with absolute paths:
https://github.com/mesonbuild/meson/pull/3092

But that PR is incomplete / wrong, because only adding RPATHs for
dependencies that specify a single library, which is simply
inconsistent. Things will work for some dependencies and not work for
others, with no logical reason for it.

We should add RPATHs for *all* libraries. There are no special length
limits for RPATHs that I can find.

For ELF, DT_RPATH or DT_RUNPATH are used, which are just stored in
a string table (DT_STRTAB). The maximum length is only a problem when
editing pre-existing tags.

For Mach-O, each RPATH is stored in a separate LC_RPATH entry so there
are no length issues there either.

Fixes https://github.com/mesonbuild/meson/issues/9543

Fixes https://github.com/mesonbuild/meson/issues/4372
2021-12-22 12:12:11 +05:30
Eli Schwartz bea735dd76
make sure files arguments to compiler.compiles and friends, performs rebuild
If the compiler check is updated as a string in meson.build, we force
rebuild, which is a good thing since the outcome of that check changes
the configuration context and can enable or disable parts of the build.

If the compiler check came from a files() object then we didn't add a
regen rule on those files.

Fixes #1656
2021-11-28 11:52:36 -05:00
Nirbheek Chauhan af5993fffd shared_module: Add soname when used as a link target
Emit a detailed deprecation warning that explains what to do instead.
Also add a unittest.

```
DEPRECATION: target prog links against shared module mymod, which is incorrect.
             This will be an error in the future, so please use shared_library() for mymod instead.
             If shared_module() was used for mymod because it has references to undefined symbols,
             use shared_libary() with `override_options: ['b_lundef=false']` instead.
```

Fixes https://github.com/mesonbuild/meson/issues/9492
2021-11-24 23:18:53 +05:30
Dylan Baker bd9d981871 unit tests: Extend prebuilt test to test intermediate
This provides coverage for the bug:
https://github.com/mesonbuild/meson/issues/9542
2021-11-24 02:23:57 +05:30
Dylan Baker 457e2d9812 unittests: use UnitTest.addCleanup a bit 2021-11-24 02:23:57 +05:30
Paolo Bonzini 8581a2b122 interpreter: extract_objects provides a valid source
This ensures that there is no warnings when running meson on
test cases/common/22 object extraction.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-11-23 18:10:15 +05:30
Eli Schwartz 8dbb0ee476
Feature kwargs decorator: automatically report the nodes which trigger an issue 2021-11-20 20:48:30 -05:00
Xavier Claessens 3902bd4ef1 Fix add_install_script() ignoring install_tag
Fixes: #9454
2021-10-27 20:49:28 -04:00
Xavier Claessens ef255db73a test_clang_format: Do not assume meson source is in git
Fixes: #9437
2021-10-27 15:32:57 -04:00
Eli Schwartz 739de7b088
unittests: use better assert methods
assertTrue and assertFalse are recommended against, if you can get a
more specific assertion. And sometimes it is considerably shorter, for
example we have a custom assertPathExists which we can take advantage
of.
2021-10-26 20:53:43 -04:00
Eli Schwartz 67792fc223
do not save unused variable
Constructing a PackageDefinition is enough to assert that it raises an
error.
2021-10-26 20:53:43 -04:00
Eli Schwartz e0b86a8d38
remove unused variable
It never made sense here to save self.init() which returns a string
containing a log or stdout or something, and which was never actually
used.

Also we then overwrote the variable with a pathname...
2021-10-26 20:53:42 -04:00
Eli Schwartz 7b53c26501
remove dead code that is immediately overridden
In commit d932cd9fb4, we migrated to
meson's own static linker definition, and the old code that hardcoded
two of the possible exelists should have been removed in the process.
2021-10-26 20:53:42 -04:00
Eli Schwartz 1979132a9d
do not save variable when all we want is the side effect of popping it
It's redefined on every loop iteration, and as the comment says, we just
want to make sure the next loop skips a value.
2021-10-26 20:53:41 -04:00
Paolo Bonzini 5e96730d7d introspect: include choices for array options
There was even a test covering this, but it did not fail due to a typo.
2021-10-14 09:04:25 -04:00
Christian Clauss a5020857f3 Fix typos discovered by codespell 2021-10-10 16:12:25 -04:00
Xavier Claessens 32b7cbd4a7 clangformat: Only format files tracked by git by default 2021-10-10 14:13:35 -04:00
Eli Schwartz 0a3a9fa0c3
ar linker: generate thin archives for uninstalled static libraries
Since they will never be used outside of the build directory, they do
not need to literally contain the .o files, and references will be
sufficient.

This covers a major use of object libraries, which is that the static
library would potentially take up a lot of space by including another
copy of every .o file.

Fixes #9292
Fixes #8057
Fixes #2129
2021-10-10 13:32:22 -04:00
Eli Schwartz e8a85fa8a2
various python neatness cleanups
All changes were created by running

"pyupgrade --py3-only"

and committing the results. Although this has been performed in the
past, newer versions of pyupgrade can automatically catch more
opportunities, notably list comprehensions can use generators instead,
in the following cases:
- unpacking into function arguments as function(*generator)
- unpacking into assignments of the form x, y = generator
- as the argument to some builtin functions such as min/max/sorted

Also catch a few creeping cases of new code added using older styles.
2021-10-04 16:29:30 -04:00
Dylan Baker 73dd21036c rust: dependencies need to cause a rebuild/relink not just reorder
Otherwise changes to a dependency don't propogate
2021-10-01 12:21:31 -07:00
Xavier Claessens d2fa6d5080 Make custom_target() name argument optional 2021-09-30 12:26:19 -04:00