1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-23 15:16:54 -05:00
denoland-deno/ext/napi/build.rs
snek 79a3ad2b95
feat: support node-api in denort (#26389)
exposes node-api symbols in denort so that `deno compile` can run native
addons.
2024-10-24 09:13:54 +02:00

22 lines
782 B
Rust

// 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();
}