About Social Code
aboutsummaryrefslogtreecommitdiff
path: root/subprojects/packagefiles/rustix/meson.build
blob: 9239c9c1038fcf6d7ac5f11992ee05287e0a90b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Copyright © 2025 Google
# SPDX-License-Identifier: MIT

project(
  'rustix',
  'rust',
  version : '0.38.31',
  license : 'Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT',
)

errno = subproject('errno').get_variable('lib')
libc = subproject('libc').get_variable('lib')
linux_raw_sys = subproject('linux-raw-sys').get_variable('lib')
bitflags = subproject('bitflags').get_variable('lib')

rustix_args = []
if host_machine.system() == 'linux' or host_machine.system() == 'android'
  rustix_args += [
  '--cfg', 'linux_raw',
  '--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"',
]
endif

lib = static_library(
  'rustix',
  'src/lib.rs',
  override_options : ['rust_std=2021', 'build.rust_std=2021'],
  link_with : [errno, libc, linux_raw_sys, bitflags],
  rust_abi : 'rust',
  native : true,
  rust_args: rustix_args,
)

dep_rustix = declare_dependency(
  link_with : [lib, errno, libc, linux_raw_sys, bitflags]
)