From b6094567a78fbeda9775619ba5cf4372d0a2ca3e Mon Sep 17 00:00:00 2001 From: Gurchetan Singh Date: Fri, 26 Sep 2025 15:03:43 -0700 Subject: [PATCH] subprojects: rustix: enable windows + macos build support This is a matter of adding the right dependencies and using them. Reviewed-by: David Gilhooley --- .../packagefiles/rustix-1-rs/meson.build | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/subprojects/packagefiles/rustix-1-rs/meson.build b/subprojects/packagefiles/rustix-1-rs/meson.build index 457728381a7..b46fdb423e6 100644 --- a/subprojects/packagefiles/rustix-1-rs/meson.build +++ b/subprojects/packagefiles/rustix-1-rs/meson.build @@ -2,7 +2,7 @@ # SPDX-License-Identifier: MIT project( - 'rustix', + 'rustix-1-rs', 'rust', version : '1.1.2', license : 'Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT', @@ -13,12 +13,14 @@ 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', 'linux_like', - '--cfg', 'linux_kernel', '--cfg', 'libc', '--cfg', 'feature="use-libc"', + '--cfg', 'linux_like', + '--cfg', 'linux_kernel', '--cfg', 'feature="std"', '--cfg', 'feature="alloc"', '--cfg', 'feature="event"', @@ -27,18 +29,36 @@ if host_machine.system() == 'linux' or host_machine.system() == 'android' '--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'], - link_with : [errno, libc, bitflags], + link_with : [errno, libc, bitflags] + os_deps, rust_abi : 'rust', rust_args: rustix_args, ) dep_rustix = declare_dependency( - link_with : [lib, errno, libc, bitflags] + link_with : [lib, errno, libc, bitflags] + os_deps, )