mesa/subprojects/packagefiles/rustix-1-rs/meson.build
LingMan 49446a62c0 meson: specify minimal target meson version for rust subprojects
Silences several meson warnings like:
```
../subprojects/equivalent-1.0.1/meson.build:9: WARNING: Project does not target a minimum version but uses feature introduced in '1.3.0': rust_abi arg in static_library.
```

The target of 1.7.0 was chosen since that's the minimal required meson version of the rust components in mesa anyway.

Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38814>
2025-12-12 17:28:49 +00:00

65 lines
1.6 KiB
Meson

# Copyright © 2025 Google
# SPDX-License-Identifier: MIT
project(
'rustix-1-rs',
'rust',
version : '1.1.2',
license : 'Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT',
meson_version : '>= 1.7.0',
)
errno = subproject('errno-0.3-rs').get_variable('lib')
libc = subproject('libc-0.2-rs').get_variable('lib')
bitflags = subproject('bitflags-2-rs').get_variable('lib')
rustix_args = []
os_deps = []
if host_machine.system() == 'linux' or host_machine.system() == 'android'
rustix_args += [
'--cfg', 'libc',
'--cfg', 'feature="use-libc"',
'--cfg', 'linux_like',
'--cfg', 'linux_kernel',
'--cfg', 'feature="std"',
'--cfg', 'feature="alloc"',
'--cfg', 'feature="event"',
'--cfg', 'feature="fs"',
'--cfg', 'feature="mm"',
'--cfg', 'feature="net"',
'--cfg', 'feature="param"',
'--cfg', 'feature="pipe"',
]
elif host_machine.system() == 'darwin' or host_machine.system() == 'macos'
rustix_args += [
'--cfg', 'apple',
'--cfg', 'bsd',
'--cfg', 'libc',
'--cfg', 'feature="use-libc"',
'--cfg', 'feature="std"',
'--cfg', 'feature="alloc"',
'--cfg', 'feature="fs"',
'--cfg', 'feature="net"',
'--cfg', 'feature="pipe"',
]
elif host_machine.system() == 'windows'
rustix_args += [
'--cfg', 'libc',
'--cfg', 'feature="use-libc"',
]
os_deps += subproject('windows-sys-0.6-rs').get_variable('lib')
endif
lib = static_library(
'rustix',
'src/lib.rs',
override_options : ['rust_std=2021', 'build.rust_std=2021', 'warning_level=0'],
link_with : [errno, libc, bitflags] + os_deps,
rust_abi : 'rust',
rust_args: rustix_args,
)
dep_rustix = declare_dependency(
link_with : [lib, errno, libc, bitflags] + os_deps,
)