1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-28 10:09:20 -05:00
denoland-deno/tools/napi/generate_symbols_lists.js
Luke Channings fa22956a86
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 <dj.srivastava23@gmail.com>
2022-10-15 20:51:04 +05:30

20 lines
676 B
JavaScript
Executable file

#!/usr/bin/env -S deno run --unstable --allow-read --allow-write
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
import exports from "../../cli/napi_sym/symbol_exports.json" assert {
type: "json",
};
for await (const os of ["linux", "macos", "windows"]) {
let def = os === "windows" ? "LIBRARY\nEXPORTS\n" : "";
const prefix = os === "windows" ? " " : os === "macos" ? "_" : "";
for (const symbol of exports.symbols) {
def += `${prefix}${symbol}\n`;
}
const defUrl = new URL(
`../../cli/generated_symbol_exports_list_${os}.def`,
import.meta.url,
);
await Deno.writeTextFile(defUrl.pathname, def, { create: true });
}