Skip to content

Commit 7659ada

Browse files
committed
Port recent libbpf-cargo build.rs changes to libbpf-rs
For testing purposes, libbpf-rs also maintains a build script that can be used to generate files necessary for running the test suite. Port over commit 704543e ("Use runtime CARGO_CFG_TARGET_ARCH in build-script") as well as commit abc9eeb ("Fix __TARGET_ARCH_xx define for riscv64,loongarch64,sparc64,mips64") from libbpf-cargo to libbpf-rs' build script. Signed-off-by: Daniel Müller <[email protected]>
1 parent abc9eeb commit 7659ada

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

libbpf-rs/build.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,17 @@ fn prepare_test_files(crate_root: &Path) {
185185
let obj = Path::new(&src).with_extension("o");
186186
let src = src_dir.join(&src);
187187
let dst = bin_dir.join(obj);
188-
let arch = option_env!("CARGO_CFG_TARGET_ARCH").unwrap_or(ARCH);
188+
let arch = env::var("CARGO_CFG_TARGET_ARCH");
189+
let arch = arch.as_deref().unwrap_or(ARCH);
189190
let arch = match arch {
190191
"x86_64" => "x86",
191192
"aarch64" => "arm64",
192193
"powerpc64" => "powerpc",
193194
"s390x" => "s390",
195+
"riscv64" => "riscv",
196+
"loongarch64" => "loongarch",
197+
"sparc64" => "sparc",
198+
"mips64" => "mips",
194199
x => x,
195200
};
196201

0 commit comments

Comments
 (0)