Commit Graph

8786 Commits

Author SHA1 Message Date
Chun-wei Fan ada6236f76 i18n module: Invoke itstool with the full command line
Certain envs may not support invoking itstool by itself directly as a script
as shebang lines are not supported, such as under cmd.exe shells on Windows,
that are normally used for Visual Studio (and the like, such as clang-cl)
builds.

This will call the corresponding interpreter to invoke itstool when needed, so
that itstool can be properly run, even if shebang lines are not supported by
the env.

This will fix building appstream on Windows using clang-cl, for instance.
2023-10-26 01:12:14 -04:00
Dudemanguy e9e098b73e build: improve the warning for executables with the same name
adb1a360b9 added the feature and also the
usual meson-style warning to users that might be using the feature but
were not targeting a new enough meson version. Well unfortunately the
warning both doesn't actually work (it didn't take different directories
into account) and is also really slow because it creates an O(N^2) loop
for checking this.

Instead, rework this by adding an additional set that stores a tuple
containing the target name and its subdirectory. We only add this tuple
if the target is an executable since it is the only time it will be
relevant. After that, simply check if the name + subdir combination
already exists in the set along with the target being executable. If so,
then we execute FeatureNew which may possibly warn. This is a simply
O(1) lookup which is way faster. Fixes #12404.
2023-10-25 23:43:40 +03:00
Eli Schwartz ae7a9b0f44 fix the repr for OrderedSet to actually execute correctly
Old:
```
OrderedSet("'foo'", "'bar'", "'baz'")
```

New:
```
OrderedSet(['foo', 'bar', 'baz'])
```

The old one looked nasty *and* was totally non-functional.
2023-10-20 18:07:05 -04:00
Eli Schwartz 34ac2e4af6 fix ninja backend rules containing internal enum reprs
Partially reverts commit 1624354f33 which
moved a bunch of stuff from strings to enums. The issue here is that
Compiler.mode is not just, or primarily, something we compare, but is
instead written in as e.g. `rule c_{compiler.mode}` to build.ninja, so
this identifier needs to be a string.

Ultimately, the issue is that the commit tried to rewrite a bunch of
things called "mode" that had a couple of TODOs saying to use enums...
but it rewrote everything called "mode" regardless of whether it was a
function kwarg or a compiler property, even though the TODO only applied
to one of them.
2023-10-20 18:07:05 -04:00
Eli Schwartz 1cf0ed0997 add missing imports for future annotations 2023-10-20 18:07:05 -04:00
Tristan Partin 46cedeb431 Support -j as a shorthand for --num-processes
We already use -j to support parallelism in meson compile. So let's add
the same for meson test and meson subprojects.
2023-10-20 12:49:38 -04:00
Dylan Baker e6e07f46ea modules/rust: remove missed cargs.extend() 2023-10-20 20:21:08 +05:30
Xavier Claessens bf9314e00d pkgconfig: Allow setting both pkgconfig and pkg-config
This was previously allowed for different usage. Keep allowing it, but
with non fatal deprecation notice, and ignore the value from legacy
pkgconfig.
2023-10-19 15:20:22 -04:00
Sam James 7b7d2e060b mtest: set ASAN_OPTIONS and UBSAN_OPTIONS to abort by default
Do as we do for MALLOC_PERTURB and set a sensible value for both ASAN_OPTIONS
and UBSAN_OPTIONS to abort on failure and give more helpful output at the
same time. We do not set these options if the user has exported a value
themselves to allow override.

In the last week alone, I've observed two cases where people were expecting
sanitizers to abort on failure and were surprised when it didn't:
1) 252d693797
2) c47df433f7

Correct this - which is in-line with meson's DWIM/DTRT philosophy.

Signed-off-by: Sam James <sam@gentoo.org>
2023-10-19 14:47:19 -04:00
Xavier Claessens e2a87afa52 rust: Always link dll and exe with the correct vscrt
This fixes missing flags in the link_whole case and link failure for
static libraries.
2023-10-19 08:13:57 -04:00
Xavier Claessens 361f7484d2 Remove duplicated code to canonicalize b_vscrt option value
Add a common function that infers vscrt from buildtype in Compiler base
class.
2023-10-19 08:13:57 -04:00
Dylan Baker e419184a9b interpreter: use typed_kwargs for build_target.objects 2023-10-17 08:09:06 -07:00
Dylan Baker d5bdcf1145 interpreter: use typed_kwargs for build_target.resources 2023-10-17 08:09:06 -07:00
Dylan Baker 1abdd9dd61 interpreter: use typed_kwargs for build_target.name_suffix 2023-10-17 08:09:06 -07:00
Dylan Baker 9f80a069ec interpreter: use typed_kwargs for build_target.name_prefix 2023-10-17 08:09:06 -07:00
Dylan Baker 4386419a86 interpreter: use typed_kwargs for build_target.link_depends 2023-10-17 08:09:06 -07:00
Dylan Baker d38bf5fbb0 interpreter: use typed_kwargs for build_target.gnu_symbol_visibility 2023-10-17 08:09:06 -07:00
Dylan Baker 0f23dc5b03 interpreter: use typed_kwargs for build_target.link_language 2023-10-17 08:09:06 -07:00
Dylan Baker e06ae90677 interpreter: use typed_kwargs for build_target.install_rpath 2023-10-17 08:09:06 -07:00
Dylan Baker b02d23206a interpreter: use typed_kwargs for build_target.build_rpath 2023-10-17 08:09:06 -07:00
Dylan Baker a3444d31db interpreter: use typed_kwargs for build_target.implicit_include_directories 2023-10-17 08:09:06 -07:00
Dylan Baker ca32ffc157 interpreter: use typed_kwargs for build_target.extra_files 2023-10-17 08:09:06 -07:00
Dylan Baker 357abf51c5 interpreter: use typed_kwargs for build_target.native 2023-10-17 08:09:06 -07:00
Dylan Baker 2fc8729078 interpreter: use typed_kwargs for build_target.install_mode 2023-10-17 08:09:06 -07:00
Dylan Baker bae2e13b39 interpreter: use typed_kwargs for build_target.install 2023-10-17 08:09:06 -07:00
Dylan Baker 507d8bf4d7 interpreter: use typed_kwargs for build_target.build_by_default
This allows a little bit of cleanup in the build layer, since there is
code now that would always be true and we shouldn't do that.
2023-10-17 08:09:06 -07:00
Nirbheek Chauhan bd0ab92bba msubprojects: Fix typo 'any way' -> 'anyway' 2023-10-17 13:02:23 +05:30
Xavier Claessens 746c4eff48 msubprojects: Fix crash if wrapdb_version is in bad format
Fixes: #12378
2023-10-17 13:02:23 +05:30
Dylan Baker 5fcf347661 modules/rust: only use include and define args from global/project args 2023-10-17 12:58:09 +05:30
Dylan Baker 658fe7243b modules/rust: remove rust_crate_type for test() method
This is required to test non-executable targets when they set an
explicit type.
2023-10-16 17:31:12 -07:00
Dylan Baker 74771d2119 compilers/d: use DFeatures for get_features_args 2023-10-16 13:28:32 -07:00
Dylan Baker 6599c32fd3 compilers/d: remove duplicate method from subclass
The DCompiler and DmDLikeCompiler classes both implement the exact same
`get_feature_args()` method. The DmdLikeCompiler inherits the DCompiler.
As such, removing it doesn't change the behavior of anything, but
decreases the chances of bugs being introduced, as well as LoC.
2023-10-16 13:28:32 -07:00
Dylan Baker b2f681c92a build: use a TypedDict for d_features
This allows for better type checking.
2023-10-16 13:28:32 -07:00
Dylan Baker 7c101413d0 interpreter: use typed_kwargs for build_target.d_unittest 2023-10-16 13:28:32 -07:00
Dylan Baker 2048d1333e interpreter: use typed_kwargs for build_target.d_module_versions 2023-10-16 13:28:32 -07:00
Dylan Baker 9b1efa37fd interpreter: use typed_kwargs for build_target.d_import_dirs 2023-10-16 13:28:32 -07:00
Dylan Baker 19beb070e8 interpreter: use typed_kwargs for build_target.d_debug 2023-10-16 13:28:32 -07:00
Nirbheek Chauhan 4ebe03713d ninjabackend: Use the right ranlib for static linker rules
Fixes https://github.com/mesonbuild/meson/issues/12349
2023-10-12 09:31:04 -07:00
Mattijs Korpershoek 4ae75eef16 cpp: use -nostlib++ instead of -nostlib for custom cpp_stdlib
The <lang>_stdlib can be used in cross files to use a custom standard library
for a given language.

When cpp_stdlib is used in a cross file, meson passes
* -nostdinc++ to the compiler
* -nostlib to the linker

According to [1] (gcc) and [2] (clang), we should pass -nostlib++ to the linker
when we don't want to link to the standard C++ library.
Currently, we pass -nostlib.

Fix this by implementing a C++ specific get_no_stdlib_link_args() function.

[1] https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#index-nostdlib_002b_002b
[2] https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-nostdlib
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-10-12 20:15:42 +05:30
Tristan Partin c0a5da8649 Use -idirafter when adding Apple framework include paths
System headers will continue to "preempt" the framework headers. This
should allow both <GStreamer/gst/gst.h> and <gst/gst.h>
2023-10-12 05:13:55 +05:30
Ada 4c9927e8b7 Fix MSVC linker error LNK1170 with long rspfiles
The MSVC linker errors out if a line in the rspfile is too long.
The resolution is to use the built-in ninja keyword $in_newline instead of $in, which splits each input into separate lines.
2023-10-12 02:48:45 +05:30
Charles Brunet 208b31faf1 MSVCDynamicLinker: prevent duplicated /nologo argument 2023-10-12 02:48:18 +05:30
Nirbheek Chauhan 3c6f04b294 msubprojects: Checkout if the branch is tracking upstream
A rebase of the current branch is the wrong thing to do if the
revision (branch) specified in the wrap changed, which is the case in
the majority of cases, such as when switching from one release branch
to another.
2023-10-11 23:48:13 +05:30
Nirbheek Chauhan b78aa8f9e9 msubprojects: Abort the rebase if there's conflicts
Don't leave the subproject tree in a broken / conflicting state. The
user is most likely not a git expert who will know what magic command
to run to fix their source tree.
2023-10-11 23:48:13 +05:30
Xavier Claessens 3af0632c3d cargo: Use rust_abi and rust.proc_macro() instead of rust_crate_type 2023-10-09 21:13:58 -04:00
Xavier Claessens dc329f0f04 interpreter: Add support for cargo subproject 2023-10-09 21:13:58 -04:00
Xavier Claessens ea42d2d019 cargo: Fix '1.0.45' version conversion
The middle 0 was wrongly dropped.
2023-10-09 21:13:58 -04:00
Xavier Claessens 019a0c38c6 cargo: Support all crate library types 2023-10-09 21:13:58 -04:00
Xavier Claessens d6bf48cd7e cargo: Package description is optional 2023-10-09 21:13:58 -04:00
Xavier Claessens 3a16da39ad cargo: Add support for rust_dependency_map 2023-10-09 21:13:58 -04:00