diff options
author | snek <snek@deno.com> | 2024-10-24 09:13:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-24 09:13:54 +0200 |
commit | 79a3ad2b950009f560641cea359d7deb6f7a61ac (patch) | |
tree | a775ff101d1513b24a8cc0afc80fdcbd4c6c9074 /ext/napi/build.rs | |
parent | 27df42f659ae7b77968d31363ade89addb516ea1 (diff) |
feat: support node-api in denort (#26389)
exposes node-api symbols in denort so that `deno compile` can run native
addons.
Diffstat (limited to 'ext/napi/build.rs')
-rw-r--r-- | ext/napi/build.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ext/napi/build.rs b/ext/napi/build.rs new file mode 100644 index 000000000..8705830a9 --- /dev/null +++ b/ext/napi/build.rs @@ -0,0 +1,22 @@ +// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +fn main() { + let symbols_file_name = match std::env::consts::OS { + "android" | "freebsd" | "openbsd" => { + "generated_symbol_exports_list_linux.def".to_string() + } + os => format!("generated_symbol_exports_list_{}.def", os), + }; + let symbols_path = std::path::Path::new(".") + .join(symbols_file_name) + .canonicalize() + .expect( + "Missing symbols list! Generate using tools/napi/generate_symbols_lists.js", + ); + + println!("cargo:rustc-rerun-if-changed={}", symbols_path.display()); + + let path = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap()) + .join("napi_symbol_path.txt"); + std::fs::write(path, symbols_path.as_os_str().as_encoded_bytes()).unwrap(); +} |