diff options
| author | Dan Callahan <d.callahan@f5.com> | 2024-02-27 15:15:42 +0000 |
|---|---|---|
| committer | Dan Callahan <d.callahan@f5.com> | 2024-02-27 15:15:42 +0000 |
| commit | d76761901c4084bcdbc5a449e9bbb47d56b7093c (patch) | |
| tree | b4b7b4e3d588b73a2adcc0094cab466d9194c679 /src/wasm-wasi-component/build.rs | |
| parent | c43629880472bba8d389dfb0b7ae6d883b0ba499 (diff) | |
| parent | 088117008c9e8f397a58cc8d8070ce047beff12f (diff) | |
| download | unit-1.32.0-1.tar.gz unit-1.32.0-1.tar.bz2 | |
Merge tag '1.32.0' into branches/packaging1.32.0-1
Unit 1.32.0 release.
Diffstat (limited to '')
| -rw-r--r-- | src/wasm-wasi-component/build.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/wasm-wasi-component/build.rs b/src/wasm-wasi-component/build.rs new file mode 100644 index 00000000..5ea74f17 --- /dev/null +++ b/src/wasm-wasi-component/build.rs @@ -0,0 +1,33 @@ +use std::env; +use std::path::PathBuf; + +fn main() { + // Tell cargo to invalidate the built crate whenever the wrapper changes + println!("cargo:rerun-if-changed=wrapper.h"); + + let bindings = bindgen::Builder::default() + .clang_args(["-I", "../"]) + .clang_args(["-I", "../../build/include"]) + .header("./wrapper.h") + // only generate bindings for `nxt_*` header files + .allowlist_file(".*nxt_.*.h") + // generates an "improper_ctypes" warning and we don't need it anyway + .blocklist_function("nxt_vsprintf") + // Tell cargo to invalidate the built crate whenever any of the + // included header files changed. + .parse_callbacks(Box::new(bindgen::CargoCallbacks)) + // disable some features which aren't necessary + .layout_tests(false) + .derive_debug(false) + .generate() + .expect("Unable to generate bindings"); + + cc::Build::new() + .object("../../build/src/nxt_unit.o") + .compile("nxt-unit"); + + let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); + bindings + .write_to_file(out_path.join("bindings.rs")) + .expect("Couldn't write bindings!"); +} |
