From fa22956a8616c34482b10bb3ae1aed76ad017c3e Mon Sep 17 00:00:00 2001 From: Luke Channings <461449+LukeChannings@users.noreply.github.com> Date: Sat, 15 Oct 2022 16:21:04 +0100 Subject: refactor(build): better handle old glibc (#16238) Follow-up to #16208. - Refactors build.rs behaviour to use `-exported_symbols_list` / `--export-dynamic-symbol-list` - Since all build systems now rely on a symbols list file, I have added `generate_exported_symbols_list`, which derives the symbol list file depending on the platform, which makes `tools/napi/generate_link_win.js` redundant. - Fixes a missed instance of `i8` being used instead of `c_char` Co-authored-by: Divy Srivastava --- cli/napi/README.md | 6 +++--- cli/napi/mod.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'cli/napi') diff --git a/cli/napi/README.md b/cli/napi/README.md index 7f46d9797..210d89b18 100644 --- a/cli/napi/README.md +++ b/cli/napi/README.md @@ -44,10 +44,10 @@ pub fn napi_get_boolean( } ``` -Update the Windows `.def` file using the script: +Update the generated symbol lists using the script: ``` -deno run --allow-write tools/napi/generate_link_win.js +deno run --allow-write tools/napi/generate_symbols_lists.js ``` Add a test in [`/test_napi`](../../test_napi/). You can also refer to Node.js @@ -109,7 +109,7 @@ unsafe extern "C" fn napi_register_module_v1( ) -> napi_value { ... + boolean::init(env, exports); - + exports } ``` diff --git a/cli/napi/mod.rs b/cli/napi/mod.rs index 8982a732a..1712632a5 100644 --- a/cli/napi/mod.rs +++ b/cli/napi/mod.rs @@ -7,13 +7,13 @@ //! Symbols to be exported are now defined in this JSON file. //! The `#[napi_sym]` macro checks for missing entries and panics. //! -//! `./tools/napi/generate_link_win.js` is used to generate the LINK `cli/exports.def` on Windows, +//! `./tools/napi/generate_symbols_list.js` is used to generate the LINK `cli/exports.def` on Windows, //! which is also checked into git. //! //! To add a new napi function: //! 1. Place `#[napi_sym]` on top of your implementation. //! 2. Add the function's identifier to this JSON list. -//! 3. Finally, run `./tools/napi/generate_link_win.js` to update `cli/exports.def`. +//! 3. Finally, run `./tools/napi/generate_symbols_list.js` to update `cli/generated_symbol_exports_list_*.def`. pub mod r#async; pub mod env; -- cgit v1.2.3