2024-12-16 17:01:47 -08:00
|
|
|
# Copyright © 2025 Google
|
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
|
|
project(
|
2025-09-26 15:03:43 -07:00
|
|
|
'rustix-1-rs',
|
2024-12-16 17:01:47 -08:00
|
|
|
'rust',
|
2025-09-26 08:44:23 -07:00
|
|
|
version : '1.1.2',
|
2024-12-16 17:01:47 -08:00
|
|
|
license : 'Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT',
|
2025-12-04 17:15:36 +01:00
|
|
|
meson_version : '>= 1.7.0',
|
2024-12-16 17:01:47 -08:00
|
|
|
)
|
|
|
|
|
|
2025-07-22 08:43:52 +02:00
|
|
|
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')
|
2024-12-16 17:01:47 -08:00
|
|
|
|
|
|
|
|
rustix_args = []
|
2025-09-26 15:03:43 -07:00
|
|
|
os_deps = []
|
|
|
|
|
|
2024-12-16 17:01:47 -08:00
|
|
|
if host_machine.system() == 'linux' or host_machine.system() == 'android'
|
|
|
|
|
rustix_args += [
|
2025-06-20 14:39:53 -07:00
|
|
|
'--cfg', 'libc',
|
|
|
|
|
'--cfg', 'feature="use-libc"',
|
2025-09-26 15:03:43 -07:00
|
|
|
'--cfg', 'linux_like',
|
|
|
|
|
'--cfg', 'linux_kernel',
|
2024-12-16 17:01:47 -08:00
|
|
|
'--cfg', 'feature="std"',
|
|
|
|
|
'--cfg', 'feature="alloc"',
|
|
|
|
|
'--cfg', 'feature="event"',
|
|
|
|
|
'--cfg', 'feature="fs"',
|
|
|
|
|
'--cfg', 'feature="mm"',
|
|
|
|
|
'--cfg', 'feature="net"',
|
|
|
|
|
'--cfg', 'feature="param"',
|
|
|
|
|
'--cfg', 'feature="pipe"',
|
2025-09-26 15:03:43 -07:00
|
|
|
]
|
|
|
|
|
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')
|
2024-12-16 17:01:47 -08:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
lib = static_library(
|
|
|
|
|
'rustix',
|
|
|
|
|
'src/lib.rs',
|
2025-12-04 15:37:18 +01:00
|
|
|
override_options : ['rust_std=2021', 'build.rust_std=2021', 'warning_level=0'],
|
2025-09-26 15:03:43 -07:00
|
|
|
link_with : [errno, libc, bitflags] + os_deps,
|
2024-12-16 17:01:47 -08:00
|
|
|
rust_abi : 'rust',
|
|
|
|
|
rust_args: rustix_args,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
dep_rustix = declare_dependency(
|
2025-09-26 15:03:43 -07:00
|
|
|
link_with : [lib, errno, libc, bitflags] + os_deps,
|
2024-12-16 17:01:47 -08:00
|
|
|
)
|