mirror of
https://github.com/denoland/deno.git
synced 2024-12-11 18:17:48 -05:00
79a3ad2b95
exposes node-api symbols in denort so that `deno compile` can run native addons.
22 lines
782 B
Rust
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();
|
|
}
|