| Age | Commit message (Collapse) | Author |
|
Add a clippy-json target to the ninja script.
This is useful for rust-analyzer, which requires an "external check
command" to function when not using cargo.
This also changes the --emit option in the clippy script to "emit",
without this, clippy will fail with errors about missing
libraries. These would normally be created with the normal compilation
target, but we can't rely on that, because if it fails, clippy-json
never runs, and you won't get error messages to the LSP.
|
|
Include the real crate name, with "_" instead of "-" and without
the Meson-specific "+foo" suffix.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Allows version selector to open the correct IDE.
|
|
This adds support for DEF files to rust and removes
some hasattr duck typing.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Since commit 44ce04537 ("cargo: Add library API version into its name", 2025-10-28),
the target names provided by cargo subprojects have a suffix corresponding to the
library API; for example, the target that used to be "gtk4" is now "gtk4+0_10".
This however is an implementation detail, and the change broke rust_dependency_maps
that expected to use the crate name.
While the target name is preferrable, and will work great when Meson is able
to create dependency maps by itself (as is the case for the Cargo interpreter),
preserve the old behavior by checking also the entry corresponding to the result
of _get_rust_crate_name.
Reported-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
On OS/2,
1. a shared libary has '.dll' suffix
2. a length of DLL name should not be longer than 8 chars
3. an import library is used to link against a DLL
4. an import library has '_dll.a' suffix.
|
|
|
|
|
|
The Rust compiler will need these to check the rust_nightly option.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
The rustc invocation performs both compilation and linking, so it should include
link-phase arguments for LTO or sanitizers. RustCompiler has been taught how
to include these arguments, so now add them.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
These produce a linked build product like binaries and Rust-ABI dylibs.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Of course, this checking isn't actually doing what it claims, as it
doesn't actually stop you from writing at target like:
```meson
build_target(
'foo',
'srcs/main.c',
c_pch : 'src/pch.h',
)
```
|
|
This really isn't a list because it's not homogenous data, it's really
`tuple[str, str | None] | None`, but we're using list length to decide
what to do with it, and that makes for strict null issues, as an
accurate annotation would be `list[str | None]`, which would require a
lot of `is not None` checking. By using a tuple we don't need to keep
checking length, which is more expensive than null checking.
To ensure correctness I annotated some things in the VS backend
|
|
If the dependency version contains a space:
dependency('glib-2.0', version: '>= 2.40.0')
Then the --target-glib version has a space:
--target-glib ' 2.40.0'
The quotes and space have no effect on valac. Tidy the output.
|
|
Place the build products in a directory of the specified name
somewhere within the build directory. This allows use of the target
that includes a specific directory name:
#include <subdir/configure.h>
This also allows creating targets with the same basename by using
different subdirectory names.
v2:
Move build_subdir to Target class.
Error if path separator in build_dir
v3:
Rename to 'build_subdir' to make it clear that the name is
appended to a meson-specific build directory, and does not
provide the user with a way to define the overall meson build
hierarchy.
Allow build_subdir to include path separators.
Support 'build_subdir' for configure_file.
build_subdir must not exist in the source directory and
must not contain '..'
Add documentation and tests
v4:
Rebase and prepare for version 1.9.1
Add failing test case when build_subdir is present in the
project.
Add release note snippet
v5:
Clarify wording on restrictions on the value of build_subdir. Use
the same wording in each place this restriction is described.
v6:
Move path validation to shared function, validate_build_subdir,
instead of duplicating the tests in two places.
v7:
Update version numbers to 1.10.0
Add TypedDict updates.
Remove spurious build_subdir instance variable
v8:
Oops, missed one version number update.
Signed-off-by: Keith Packard <keithp@keithp.com>
|
|
If a CustomTargetIndex is passed as an argument to a test, running meson
test (with no test glob) does not automatically build the custom_target
before running the test, because CustomTargetIndex outputs are not added
as prerequisites to the meson-test-prereq and meson-benchmark-prereq
targets.
Fixes: #14743
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
They are duplicates of what is already in compilers and have no state. Just
use compilers.
Fixes: #15082
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Allow multiple targets for the same crate name, which is useful when the
same crate is used for both the host and the build machine.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
_get_rust_dependency_name was less lenient in accepting targets containing
invalid characters for a crate name. This made it impossible to link to
those targets without using a dependency map. Use the same algorithm to
do the conversion.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
This allows us to do a lot less proxy checking for vala, and lot more
"If this thing says it's going to output vala, it's going to output
vala. By only setting them when they use vala, we can also be sure that
the fields aren't meaningless.
|
|
When a Rust target depends on an intermediate Rust library (.rlib) which
itself has a dependency on a native static library, Meson's generated
rustc command line failed to collect and propagate the search paths for
these indirect native dependencies, leading to a linker error:
error: linking with `cc` failed: exit status: 1
= note: rust-lld: error: unable to find library -l:libf.a
collect2: error: ld returned 1 exit status
The root cause is that the intermediate .rlib's metadata correctly
stores the requirement to link the native library (via the -l flag),
but it does not store the library's search path (the -L flag); the
responsibility for providing the search path is therefore deferred
to the final link command.
Ensures that search paths for all transitive dependencies are collected,
allowing the final linker invocation to find and correctly link the
required native libraries.
Reported-by: Martin Kletzander <nert.pinx@gmail.com>
Fixes: 018d22482 ("ninjabackend: unify conversion from path to -L/-l", 2025-10-08)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
No one is accessing backend.interpreter anymore, get rid of it
to avoid future temptations.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
The interpreter's build_def_files are the only remaining piece
of interpreter state used by the backend. Compute it once
and store it in build, using a property to ensure that it's initialized
and accessed correctly.
This also removes one of the cases in which introspection uses the
interpreter object.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
All that is needed is the subdir, pass it explicitly (and make it
an optional argument so that the backend does not have to pass it).
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Objects like targets already store the environment in which they
were created, do the same for Generator: pass it to the constructor
and use it in process_files.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
When a structured source contains non rust files, the backend may select
such a file to treat as the main file. That doesn't work obviously, so
instead filter the main file such that it must be a rust file.
|
|
This reverts https://github.com/mesonbuild/meson/pull/15107
Explicit objections regarding the design were raised and not answered,
so it shouldn't have been merged. It needs to be discussed and
revisited.
|
|
|
|
There are a lot of spelled out unions for these types, lets reduce that
number
|
|
On Windows, rustc searches both FOO.lib and libFOO.a when passed -lfoo.
This means that the check for nonstandard names in the Unix sense is
too struct, and indeed it breaks passing for example -lkernel32 (which
adds kernel32.lib to the link).
Fix this by special casing Windows. Extract the logic to the Rust
compiler class for clarity.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
The variable for the .a here is called "a", not "lib".
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
`rustc --crate-type staticlib --print native-static-libs` doesn't print
the default libraries being linked with rustc by default, at least not
with rustc 1.89.0 (29483883e 2025-08-04).
Stripping those by default, such as ws2_32 on win32, prevents from
linking programs using sockets (ex qemu).
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|