diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /third_party/rust/authenticator/build.rs | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/authenticator/build.rs')
-rw-r--r-- | third_party/rust/authenticator/build.rs | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/third_party/rust/authenticator/build.rs b/third_party/rust/authenticator/build.rs new file mode 100644 index 0000000000..c972d85b89 --- /dev/null +++ b/third_party/rust/authenticator/build.rs @@ -0,0 +1,56 @@ +#[cfg(all(target_os = "linux", feature = "binding-recompile"))] +extern crate bindgen; + +#[cfg(all(target_os = "linux", feature = "binding-recompile"))] +use std::path::PathBuf; + +#[cfg(any(not(target_os = "linux"), not(feature = "binding-recompile")))] +fn main() {} + +#[cfg(all(target_os = "linux", feature = "binding-recompile"))] +fn main() { + let bindings = bindgen::Builder::default() + .header("src/linux/hidwrapper.h") + .whitelist_var("_HIDIOCGRDESCSIZE") + .whitelist_var("_HIDIOCGRDESC") + .generate() + .expect("Unable to get hidraw bindings"); + + let out_path = PathBuf::new(); + let name = if cfg!(target_arch = "x86") { + "ioctl_x86.rs" + } else if cfg!(target_arch = "x86_64") { + "ioctl_x86_64.rs" + } else if cfg!(all(target_arch = "mips", target_endian = "big")) { + "ioctl_mipsbe.rs" + } else if cfg!(all(target_arch = "mips", target_endian = "little")) { + "ioctl_mipsle.rs" + } else if cfg!(all(target_arch = "mips64", target_endian = "little")) { + "ioctl_mips64le.rs" + } else if cfg!(all(target_arch = "powerpc", target_endian = "little")) { + "ioctl_powerpcle.rs" + } else if cfg!(all(target_arch = "powerpc", target_endian = "big")) { + "ioctl_powerpcbe.rs" + } else if cfg!(all(target_arch = "powerpc64", target_endian = "little")) { + "ioctl_powerpc64le.rs" + } else if cfg!(all(target_arch = "powerpc64", target_endian = "big")) { + "ioctl_powerpc64be.rs" + } else if cfg!(all(target_arch = "arm", target_endian = "little")) { + "ioctl_armle.rs" + } else if cfg!(all(target_arch = "arm", target_endian = "big")) { + "ioctl_armbe.rs" + } else if cfg!(all(target_arch = "aarch64", target_endian = "little")) { + "ioctl_aarch64le.rs" + } else if cfg!(all(target_arch = "aarch64", target_endian = "big")) { + "ioctl_aarch64be.rs" + } else if cfg!(all(target_arch = "s390x", target_endian = "big")) { + "ioctl_s390xbe.rs" + } else if cfg!(all(target_arch = "riscv64", target_endian = "little")) { + "ioctl_riscv64.rs" + } else { + panic!("architecture not supported"); + }; + bindings + .write_to_file(out_path.join("src").join("linux").join(name)) + .expect("Couldn't write hidraw bindings"); +} |