build.rs 419 B

123456789101112
  1. use std::env;
  2. fn main() {
  3. println!("cargo:rerun-if-env-changed=CARGO_CFG_BPF_TARGET_ARCH");
  4. if let Ok(arch) = env::var("CARGO_CFG_BPF_TARGET_ARCH") {
  5. println!("cargo:rustc-cfg=bpf_target_arch=\"{arch}\"");
  6. } else {
  7. let arch = env::var("HOST").unwrap();
  8. let arch = arch.split_once('-').map_or(&*arch, |x| x.0);
  9. println!("cargo:rustc-cfg=bpf_target_arch=\"{arch}\"");
  10. }
  11. }