aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend
AgeCommit message (Collapse)AuthorFilesLines
2022-04-14Fix typo in commentBen Brown1-1/+1
2022-03-31allow RunTarget to skip wrapping due to envEli Schwartz2-8/+10
Forcing serialization on when writing out the build rule makes very little sense. It was always "forced" on because we mandated a couple of environment variables due to legacy reasons. Add an attribute to RunTarget to say that a given target doesn't *need* those environment variables, and let ninja optimize them away and run the command directly if set.
2022-03-31Handle same Framework multiple times in Xcode.Jussi Pakkanen1-2/+4
2022-03-31Handle feed and capture in xcodebackend.Jussi Pakkanen1-1/+2
2022-03-30Fix typos in Xcode backend.Jussi Pakkanen1-3/+3
2022-03-29Target: Stop passing environment in method argsXavier Claessens1-3/+3
2022-03-29Replace backend.get_option_for_target() with target.get_option()Xavier Claessens4-51/+36
That method had nothing specific to the backend, it's purely a Target method. This allows to cache the OptionOverrideProxy object on the Target instance instead of creating a new one for each option lookup.
2022-03-23Add support for cython_argsTristan Partin1-0/+1
cython_args was previoously ignored by Meson.
2022-03-23ninja backend: do not fatally error on compdb failureEli Schwartz1-1/+1
We print a warning if a compilation database isn't successfully generated, which is good, because that gives some visibility in case the user really wanted to use the compdb. But warnings default to being fatal with --fatal-meson-warnings, which is not so good, because this isn't a very important warning at all, and we'd rather not error out in such cases when building works fine and a random bonus IDE feature doesn't work. Mark this particular warning as non-fatal. Fixes side issue in https://github.com/mesonbuild/wrapdb/pull/343#issuecomment-1074545609
2022-03-22OptionOverrideProxy: Handle per-subproject optionsXavier Claessens1-8/+5
2022-03-22backends: Stop separating base and compiler optionsXavier Claessens4-19/+13
Since OptionKey is used we can mix all options together in a single dictionary. That's already what we do in coredata.options.
2022-03-22Add ability to add resources to jarsTristan Partin1-5/+9
Previously Meson lacked the ability to add resources to jar files. Fixes #9945
2022-03-21ninja: fix handling of rust structured_sources in rare caseDylan Baker1-4/+11
In the even that all of the inputs are generated, and they're all generated into the same folder, and there are no subfolders, we would fail to correctly handle all of the files after the main file. Let's fix that.t
2022-03-18structured_sources: fix subdir handlingDylan Baker1-6/+2
We currently don't handle subdirectories correctly in structured_sources, which is problematic. To make this easier to handle correctly, I've simply changed `structured_sources` to only use Files and not strings as an implementation detail.
2022-03-14mtest: fix logic bug that broke tests where the cmd is a Windows found programEli Schwartz1-0/+2
In this case, the test fname might have an implicit extension and cannot be found by `os.path.isfile()`. We cannot use `shutil.which()` to handle platform differences, because not all test fnames are executable -- for example Java jars. The test representation does have an "is built" attribute which in theory should work here, because all built targets definitely have their full filename known to Meson, but it turns out to be misnamed. Rename it correctly and add an actual "is built" attribute to check. Tests which aren't built by Meson can be assumed to exist without consulting their existence on the filesystem. Fixes #10027
2022-03-13Merge pull request #9339 from dcbaker/submit/structured_sourcesJussi Pakkanen1-0/+55
Structured Sources
2022-03-09install: Add --strip optionXavier Claessens1-2/+4
2022-03-07treewide: string-quote the first argument to T.castEli Schwartz1-2/+2
Using future annotations, type annotations become strings at runtime and don't impact performance. This is not possible to do with T.cast though, because it is a function argument instead of an annotation. Quote the type argument everywhere in order to have the same effect as future annotations. This also allows linters to better detect in some cases that a given import is typing-only.
2022-03-07backends/ninja: Add support for structured sources with rustDylan Baker1-0/+43
2022-03-07backend/ninja: add rules to copy files to the build dirDylan Baker1-0/+12
2022-03-07Fix default install tag for shared lib symlinksXavier Claessens2-9/+13
Versioned shared libraries should have .so file in devel, .so.1 and .so.1.2.3 in runtime. Fixes: #9811
2022-02-28devenv: Do not prepend empty list to PATH and LD_LIBRARY_PATHXavier Claessens1-7/+9
2022-02-28backends: Cache creation of install dataXavier Claessens1-0/+1
It is created twice for ninja and for introspection.
2022-02-16flake8: fix various whitespace errors with badly aligned codeEli Schwartz1-1/+1
2022-02-16flake8: fix typoed whitespace surrounding tokensEli Schwartz1-1/+1
2022-02-14shared module: Allow linking on AndroidNirbheek Chauhan1-1/+1
Android requires shared modules that use symbols from other shared modules to be linked before they can be dlopen()ed in the correct order. Not doing so leads to a missing symbol error: https://github.com/android/ndk/issues/201 We need to always allow linking for this. Also add a soname, although it's not confirmed that it's needed, and it doesn't really hurt if it isn't needed.
2022-02-10ninjabackend: fix rust program names with dashesAlyssa Ross1-1/+2
This substitution matches the behaviour of rustc[1] when inferring crate name based on file name. [1]: https://github.com/rust-lang/rust/tree/4e8fb743ccbec27344b2dd42de7057f41d4ebfdd/compiler/rustc_session/src/output.rs#L88
2022-02-02Merge pull request #9834 from bonzini/test-verbose-kwargJussi Pakkanen1-1/+3
New keyword argument `verbose` for tests and benchmarks
2022-02-02ninjabackend: treat link_whole_targets like link_targets for Rust targetsZach Reizner1-2/+5
For static library crates that depend on other internal static library crates, all link_with targets get promoted to link_whole targets. Due to a bug, only link_with targets are considered when generating a Rust target for the ninja backend. This made it impossible to link a Rust static library with another internal Rust static library. This change fixes that issue by chaining link_whole_targets with link_targets, just like many other languages within the ninja backend.
2022-02-01minstall: stop running ldconfig for the userEli Schwartz1-3/+1
This was a nice idea in theory, but in practice it had various problems: - On the only platform where ldconfig is expected to be run, it is really slow, even when the user uses a non-default prefix and ldconfig doesn't even have permission to run, nor can do anything useful due to ld.so.conf state - On FreeBSD, it bricked the system: #9592 - On cross builds, it should not be used and broke installing, because ldconfig may not be runnable without binfmt + qemu: #9707 - it prints weird and confusing errors in the common "custom prefix" layout: #9241 Some of these problems can be or have been fixed. But it's a constant source of footguns and complaints and for something that was originally supposed to be just "it's the right thing to do anyway, so just do it automatically" it is entirely too risky. Ultimately I do not think there is justification for keeping this feature in since it doesn't actually make everyone happy. Better for users to decide whether they need this themselves. This is anyways the case for cmake and autotools and generally any other build system, so it should not be too intimidating... Fixes #9721
2022-02-01interpreter: support for forcibly verbose logging of some testsPaolo Bonzini1-1/+1
Add a new keyword argument to test() and benchmark(), completing the implementation of the feature. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-02-01mtest: support for forcibly verbose logging of some testsPaolo Bonzini1-1/+3
Store in TestSerialisation whether a particular test must always be logged verbosely. This is particularly useful for long-running tests or when a single Meson test() is wrapping an external test harness. In this case, TAP can be used by the external harness and Meson will log each subtest as it runs. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-02-01backends/ninja: generate symlink aliases for rust/cs/swift libraries tooEli Schwartz1-1/+3
Basically the last thing we did during target processing was to generate shlib symlinks for e.g. libfoo.so -> libfoo.so.1. In some cases we would dispatch to another function and return early, though, which meant we never got far enough to generate the symlinks. This then led to breakage when people tried to compile against libfoo.so This surely breaks -uninstalled.pc usage, and also caused problems in https://github.com/rust-lang/rust/pull/90260
2022-01-30ninja backend: Fix usage of same constants file for native and crossNirbheek Chauhan1-7/+7
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-27flake8: fix wonky comment styleEli Schwartz1-1/+1
2022-01-18build: Fix return types of a couple of methodsDylan Baker1-1/+1
These don't return `Target`, they return `BuildTarget | CustomTarget | CustomTargetIndex`
2022-01-12ninja backend: Fix custom_target() console: kwarg when using envDeclan Qian1-1/+2
When a custom_target() uses an env, meson uses a wrapper script to run the executable. This breaks the console: kwarg because the wrapper script buffers the output. Fix it by setting the verbose flag which will not buffer output.
2022-01-10first pass at migrating to dataclassesEli Schwartz1-111/+96
In some cases, init variables that accept None as a sentinel and immediately overwrite with [], are migrated to dataclass field factories. \o/ Note: dataclasses by default cannot provide eq methods, as they then become unhashable. In the future we may wish to opt into declaring them frozen, instead/additionally.
2022-01-10clean up even more function signatures in preparation for dataclassesEli Schwartz1-2/+2
Names used in init functions are sometimes pointlessly different from the class instance attributes they are immediately assigned to. They would make more sense if defined properly.
2021-12-22Don't wipe out RPATHs specified by dependenciesNirbheek Chauhan1-1/+7
Since we scan all dependencies for build-only RPATHs now (which are removed on install), we must take care not to add build-only RPATHs pointing to directories that dependencies explicitly add -Wl,-rpath link args for, otherwise the paths will get wiped on install. Caught by LinuxlikeTests::test_usage_pkgconfig_prefixes
2021-12-22Set RPATH for all non-system libs with absolute pathsNirbheek Chauhan1-28/+27
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-11install: Don't run ldconfig on cross buildsDylan Baker1-2/+5
Even if we install without a DESTDIR set, we should never update ldconfig when cross compiling. Fixes #9707
2021-12-06allow passing a CustomTargetIndex as argument to a testPaolo Bonzini1-3/+5
Fixes: #7585 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-12-06pass all outputs of a custom_target as arguments to a testPaolo Bonzini1-12/+19
Meson was passing only the first output and warning about it. To do this easily, refactor construct_target_rel_path to return a list. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-12-06Fix performance regression in build file generationcomplexoctonion1-1/+2
Re-use any already determined rpaths for a target. Fixes #9695
2021-12-05rename exe_runner to exe_wrapper everywhereEli Schwartz1-3/+3
I don't understand the purpose of this confusing API naming split.
2021-12-01add install_symlink functionPablo Correa Gómez1-0/+20
Allows installing symlinks directly from meson, which can become useful in multiple scenarios. Current main use is to help moving forward #9557
2021-11-28fix BSD ldconfig handling (#9631)Eli Schwartz1-1/+3
For libraries installed to libdir, it's not expected to have rpath hooked up. But for non-default libdirs, the path might not get searched by default. `ldconfig -m <libdir>` is convenient here, as it will programmatically add a new directory to search for shared libraries, so the resulting installed programs work out of the box. Include the dragonfly BSD platform name, which doesn't match the 'bsd' catch-all pattern.
2021-11-27Fix '# Visual Studio <>' comment in sln files with VS backendLuke Elliott7-5/+20
such that Visual Studio Version Selector works.
2021-11-25Stop backend_startup_project from erasing the last project in a VS solutionLuke Elliott1-1/+1
if it is not the specified project.