-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
27 lines (23 loc) · 900 Bytes
/
build.rs
File metadata and controls
27 lines (23 loc) · 900 Bytes
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
use std::env;
use std::path::Path;
fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let vendor_dir = Path::new(&manifest_dir).join("vendor").join("seccomp");
// Copy vendor seccomp binaries to OUT_DIR if they exist
for arch in &["x64", "arm64"] {
let src_dir = vendor_dir.join(arch);
let dst_dir = Path::new(&out_dir).join("vendor").join("seccomp").join(arch);
if src_dir.exists() {
std::fs::create_dir_all(&dst_dir).ok();
for file in &["unix-block.bpf", "apply-seccomp"] {
let src = src_dir.join(file);
if src.exists() {
let dst = dst_dir.join(file);
std::fs::copy(&src, &dst).ok();
}
}
}
}
println!("cargo:rerun-if-changed=vendor/seccomp");
}