-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
40 lines (35 loc) · 1.11 KB
/
build.rs
File metadata and controls
40 lines (35 loc) · 1.11 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
use std::env;
use std::path::PathBuf;
use std::process::Command;
fn main() {
// Link against librpifwcrypto
println!("cargo:rustc-link-lib=rpifwcrypto");
// Re-run if the header changes
println!("cargo:rerun-if-changed=/usr/include/rpifwcrypto.h");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
let bindings_file = out_path.join("rpifwcrypto_bindings.rs");
// Generate bindings using the bindgen CLI tool
let status = Command::new("bindgen")
.args([
"/usr/include/rpifwcrypto.h",
"--output",
bindings_file.to_str().unwrap(),
"--use-core",
"--allowlist-function",
"rpi_fw_crypto_.*",
"--allowlist-type",
"RPI_FW_CRYPTO_.*",
"--allowlist-var",
"RPI_FW_CRYPTO_.*|ARM_CRYPTO_.*",
"--",
"-include",
"stdint.h",
"-include",
"stddef.h",
])
.status()
.expect("Failed to execute bindgen");
if !status.success() {
panic!("bindgen failed with status: {}", status);
}
}