| 1 |
# Copyright © 2025 Google |
| 2 |
# SPDX-License-Identifier: MIT |
| 3 |
|
| 4 |
project( |
| 5 |
'rustix-1-rs', |
| 6 |
'rust', |
| 7 |
version : '1.1.2', |
| 8 |
license : 'Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT', |
| 9 |
meson_version : '>= 1.7.0', |
| 10 |
) |
| 11 |
|
| 12 |
errno = subproject('errno-0.3-rs').get_variable('lib') |
| 13 |
libc = subproject('libc-0.2-rs').get_variable('lib') |
| 14 |
bitflags = subproject('bitflags-2-rs').get_variable('lib') |
| 15 |
|
| 16 |
rustix_args = [] |
| 17 |
os_deps = [] |
| 18 |
|
| 19 |
if host_machine.system() == 'linux' or host_machine.system() == 'android' |
| 20 |
rustix_args += [ |
| 21 |
'--cfg', 'libc', |
| 22 |
'--cfg', 'feature="use-libc"', |
| 23 |
'--cfg', 'linux_like', |
| 24 |
'--cfg', 'linux_kernel', |
| 25 |
'--cfg', 'feature="std"', |
| 26 |
'--cfg', 'feature="alloc"', |
| 27 |
'--cfg', 'feature="event"', |
| 28 |
'--cfg', 'feature="fs"', |
| 29 |
'--cfg', 'feature="mm"', |
| 30 |
'--cfg', 'feature="net"', |
| 31 |
'--cfg', 'feature="param"', |
| 32 |
'--cfg', 'feature="pipe"', |
| 33 |
] |
| 34 |
elif host_machine.system() == 'darwin' or host_machine.system() == 'macos' |
| 35 |
rustix_args += [ |
| 36 |
'--cfg', 'apple', |
| 37 |
'--cfg', 'bsd', |
| 38 |
'--cfg', 'libc', |
| 39 |
'--cfg', 'feature="use-libc"', |
| 40 |
'--cfg', 'feature="std"', |
| 41 |
'--cfg', 'feature="alloc"', |
| 42 |
'--cfg', 'feature="fs"', |
| 43 |
'--cfg', 'feature="net"', |
| 44 |
'--cfg', 'feature="pipe"', |
| 45 |
] |
| 46 |
elif host_machine.system() == 'windows' |
| 47 |
rustix_args += [ |
| 48 |
'--cfg', 'libc', |
| 49 |
'--cfg', 'feature="use-libc"', |
| 50 |
] |
| 51 |
os_deps += subproject('windows-sys-0.6-rs').get_variable('lib') |
| 52 |
endif |
| 53 |
|
| 54 |
lib = static_library( |
| 55 |
'rustix', |
| 56 |
'src/lib.rs', |
| 57 |
override_options : ['rust_std=2021', 'build.rust_std=2021', 'warning_level=0'], |
| 58 |
link_with : [errno, libc, bitflags] + os_deps, |
| 59 |
rust_abi : 'rust', |
| 60 |
rust_args: rustix_args, |
| 61 |
) |
| 62 |
|
| 63 |
dep_rustix = declare_dependency( |
| 64 |
link_with : [lib, errno, libc, bitflags] + os_deps, |
| 65 |
) |