xbintsc 0.3.13 → 0.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -22
- package/README.zh-CN.md +20 -19
- package/bin/xbintsc.js +1 -2
- package/dist/src/cli/main.js +4 -1
- package/dist/src/cli/main.js.map +1 -1
- package/dist/src/codegen/generator/calls/access.js +13 -0
- package/dist/src/codegen/generator/calls/access.js.map +1 -1
- package/dist/src/codegen/generator/calls/invocation.js +8 -2
- package/dist/src/codegen/generator/calls/invocation.js.map +1 -1
- package/dist/src/codegen/generator/context.d.ts +6 -0
- package/dist/src/codegen/generator/context.js +24 -2
- package/dist/src/codegen/generator/context.js.map +1 -1
- package/dist/src/codegen/generator/expressions/primary.js +5 -0
- package/dist/src/codegen/generator/expressions/primary.js.map +1 -1
- package/dist/src/codegen/generator/tables.d.ts +5 -6
- package/dist/src/codegen/generator/tables.js +5 -6
- package/dist/src/codegen/generator/tables.js.map +1 -1
- package/dist/src/driver/compiler.js +15 -3
- package/dist/src/driver/compiler.js.map +1 -1
- package/dist/src/driver/index.d.ts +1 -2
- package/dist/src/driver/index.js +1 -2
- package/dist/src/driver/index.js.map +1 -1
- package/dist/src/driver/modules.d.ts +1 -1
- package/dist/src/driver/modules.js +235 -25
- package/dist/src/driver/modules.js.map +1 -1
- package/dist/src/driver/paths.d.ts +0 -9
- package/dist/src/driver/paths.js +0 -31
- package/dist/src/driver/paths.js.map +1 -1
- package/dist/src/driver/toolchain-provider.d.ts +10 -10
- package/dist/src/driver/toolchain-provider.js +9 -38
- package/dist/src/driver/toolchain-provider.js.map +1 -1
- package/dist/src/driver/toolchain.js +8 -2
- package/dist/src/driver/toolchain.js.map +1 -1
- package/dist/src/extensions/native.d.ts +2 -3
- package/dist/src/extensions/native.js +2 -3
- package/dist/src/extensions/native.js.map +1 -1
- package/dist/src/extensions/node/fs/fs-ops.d.ts +5 -2
- package/dist/src/extensions/node/fs/fs-ops.js +45 -6
- package/dist/src/extensions/node/fs/fs-ops.js.map +1 -1
- package/dist/src/extensions/node/fs/index.d.ts +6 -2
- package/dist/src/extensions/node/fs/index.js +22 -3
- package/dist/src/extensions/node/fs/index.js.map +1 -1
- package/dist/src/extensions/node/fs-promises/index.d.ts +4 -3
- package/dist/src/extensions/node/fs-promises/index.js +31 -3
- package/dist/src/extensions/node/fs-promises/index.js.map +1 -1
- package/dist/tests/cli/main.test.js +8 -0
- package/dist/tests/cli/main.test.js.map +1 -1
- package/dist/tests/driver/compiler.test.js +28 -1
- package/dist/tests/driver/compiler.test.js.map +1 -1
- package/dist/tests/driver/modules.test.js +91 -4
- package/dist/tests/driver/modules.test.js.map +1 -1
- package/dist/tests/driver/paths.test.js +1 -9
- package/dist/tests/driver/paths.test.js.map +1 -1
- package/dist/tests/driver/toolchain-provider.test.js +12 -79
- package/dist/tests/driver/toolchain-provider.test.js.map +1 -1
- package/dist/tests/e2e/compile-node.test.js +240 -0
- package/dist/tests/e2e/compile-node.test.js.map +1 -1
- package/dist/tests/e2e/compile.test.js +12 -0
- package/dist/tests/e2e/compile.test.js.map +1 -1
- package/dist/tests/e2e/harness.js +11 -8
- package/dist/tests/e2e/harness.js.map +1 -1
- package/dist/tests/e2e/native-extensions.test.d.ts +4 -5
- package/dist/tests/e2e/native-extensions.test.js +6 -7
- package/dist/tests/e2e/native-extensions.test.js.map +1 -1
- package/dist/tests/e2e/node-modules.test.js +1 -1
- package/dist/tests/e2e/node-modules.test.js.map +1 -1
- package/dist/tests/e2e/npm-modules.test.d.ts +9 -0
- package/dist/tests/e2e/npm-modules.test.js +55 -0
- package/dist/tests/e2e/npm-modules.test.js.map +1 -0
- package/dist/tests/e2e/runtime-coverage.test.d.ts +11 -0
- package/dist/tests/e2e/runtime-coverage.test.js +646 -0
- package/dist/tests/e2e/runtime-coverage.test.js.map +1 -0
- package/package.json +1 -2
- package/runtime/ext_node/buffer/parts/prototype.inc +7 -0
- package/runtime/ext_node/buffer/parts/search.inc +8 -4
- package/runtime/ext_node/child_process/child_process.c +5 -0
- package/runtime/ext_node/fs/constants.c +113 -0
- package/runtime/ext_node/fs/copy_ops.c +145 -0
- package/runtime/ext_node/fs/dir.c +101 -0
- package/runtime/ext_node/fs/fd_ops.c +405 -0
- package/runtime/ext_node/fs/fs_common.h +388 -5
- package/runtime/ext_node/fs/fs_ops.c +100 -139
- package/runtime/ext_node/fs/glob.c +232 -0
- package/runtime/ext_node/fs/link_ops.c +91 -0
- package/runtime/ext_node/fs/meta_ops.c +403 -0
- package/runtime/ext_node/fs/promises.c +275 -60
- package/runtime/ext_node/fs/read_file.c +8 -4
- package/runtime/ext_node/fs/watch.c +52 -0
- package/runtime/ext_node/fs/write_file.c +20 -11
- package/runtime/ext_node/stream/stream.c +19 -2
- package/runtime/rt.h +8 -0
- package/runtime/rt_internal.h +10 -23
- package/runtime/xt_ext.h +0 -1
- package/runtime/xt_io.c +24 -3
- package/runtime/xt_stdlib2/helpers.inc +2 -4
- package/scripts/build-runtime.ts +7 -8
- package/scripts/coverage-runtime.ts +4 -4
- package/scripts/package-release.ts +12 -84
- package/src/cli/main.ts +4 -1
- package/src/codegen/generator/calls/access.ts +15 -0
- package/src/codegen/generator/calls/invocation.ts +8 -2
- package/src/codegen/generator/context.ts +30 -2
- package/src/codegen/generator/expressions/primary.ts +5 -0
- package/src/codegen/generator/tables.ts +5 -6
- package/src/driver/compiler.ts +16 -3
- package/src/driver/index.ts +1 -9
- package/src/driver/modules.ts +251 -26
- package/src/driver/paths.ts +0 -31
- package/src/driver/toolchain-provider.ts +12 -45
- package/src/driver/toolchain.ts +7 -2
- package/src/extensions/native.ts +2 -3
- package/src/extensions/node/fs/fs-ops.ts +48 -6
- package/src/extensions/node/fs/index.ts +25 -3
- package/src/extensions/node/fs-promises/index.ts +33 -4
- package/dist/src/driver/toolchain-download.d.ts +0 -50
- package/dist/src/driver/toolchain-download.js +0 -102
- package/dist/src/driver/toolchain-download.js.map +0 -1
- package/dist/tests/driver/toolchain-download.test.d.ts +0 -1
- package/dist/tests/driver/toolchain-download.test.js +0 -53
- package/dist/tests/driver/toolchain-download.test.js.map +0 -1
- package/scripts/fetch-toolchain.ts +0 -101
- package/src/driver/toolchain-download.ts +0 -135
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
* Node's `fs/promises` module.
|
|
3
3
|
*
|
|
4
4
|
* There is no asynchronous I/O scheduler, so each function wraps the matching
|
|
5
|
-
* synchronous `fs` implementation in an already-
|
|
6
|
-
* `writeFile`, `mkdir`, `readdir`, `stat`, `rm`,
|
|
7
|
-
* from `fs/promises
|
|
5
|
+
* synchronous `fs` implementation in an already-settled promise (rejected on
|
|
6
|
+
* failure). `readFile`, `writeFile`, `mkdir`, `readdir`, `stat`, `rm`,
|
|
7
|
+
* `open` (a `FileHandle`), ... are therefore importable from `fs/promises`.
|
|
8
|
+
* `constants` is re-exported as a value getter.
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
import type { NodeModule } from "../module.js";
|
|
11
12
|
import { resolveFrom } from "../module.js";
|
|
12
|
-
import type { BuiltinFunction } from "../../registry.js";
|
|
13
|
+
import type { BuiltinFunction, ModuleExports } from "../../registry.js";
|
|
13
14
|
|
|
14
15
|
const builtins: Readonly<Record<string, BuiltinFunction>> = {
|
|
15
16
|
readFile: { symbol: "xt_node_p_read_file" },
|
|
@@ -22,10 +23,32 @@ const builtins: Readonly<Record<string, BuiltinFunction>> = {
|
|
|
22
23
|
rmdir: { symbol: "xt_node_p_rmdir" },
|
|
23
24
|
rename: { symbol: "xt_node_p_rename" },
|
|
24
25
|
copyFile: { symbol: "xt_node_p_copy_file" },
|
|
26
|
+
cp: { symbol: "xt_node_p_cp" },
|
|
25
27
|
realpath: { symbol: "xt_node_p_realpath" },
|
|
26
28
|
stat: { symbol: "xt_node_p_stat" },
|
|
27
29
|
lstat: { symbol: "xt_node_p_lstat" },
|
|
30
|
+
statfs: { symbol: "xt_node_p_statfs" },
|
|
28
31
|
access: { symbol: "xt_node_p_access" },
|
|
32
|
+
open: { symbol: "xt_node_p_open" },
|
|
33
|
+
chmod: { symbol: "xt_node_p_chmod" },
|
|
34
|
+
lchmod: { symbol: "xt_node_p_lchmod" },
|
|
35
|
+
chown: { symbol: "xt_node_p_chown" },
|
|
36
|
+
lchown: { symbol: "xt_node_p_lchown" },
|
|
37
|
+
truncate: { symbol: "xt_node_p_truncate" },
|
|
38
|
+
utimes: { symbol: "xt_node_p_utimes" },
|
|
39
|
+
lutimes: { symbol: "xt_node_p_lutimes" },
|
|
40
|
+
link: { symbol: "xt_node_p_link" },
|
|
41
|
+
symlink: { symbol: "xt_node_p_symlink" },
|
|
42
|
+
readlink: { symbol: "xt_node_p_readlink" },
|
|
43
|
+
mkdtemp: { symbol: "xt_node_p_mkdtemp" },
|
|
44
|
+
opendir: { symbol: "xt_node_p_opendir" },
|
|
45
|
+
glob: { symbol: "xt_node_p_glob" },
|
|
46
|
+
watch: { symbol: "xt_node_p_watch" },
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const exports: ModuleExports = {
|
|
50
|
+
...builtins,
|
|
51
|
+
constants: { valueSymbol: "xt_fs_constants" },
|
|
29
52
|
};
|
|
30
53
|
|
|
31
54
|
export const fsPromisesModule: NodeModule = {
|
|
@@ -35,7 +58,13 @@ export const fsPromisesModule: NodeModule = {
|
|
|
35
58
|
resolveFrom(import.meta.url, "../../../../runtime/ext_node/fs/read_file.c"),
|
|
36
59
|
resolveFrom(import.meta.url, "../../../../runtime/ext_node/fs/write_file.c"),
|
|
37
60
|
resolveFrom(import.meta.url, "../../../../runtime/ext_node/fs/fs_ops.c"),
|
|
61
|
+
resolveFrom(import.meta.url, "../../../../runtime/ext_node/fs/fd_ops.c"),
|
|
62
|
+
resolveFrom(import.meta.url, "../../../../runtime/ext_node/fs/meta_ops.c"),
|
|
63
|
+
resolveFrom(import.meta.url, "../../../../runtime/ext_node/fs/link_ops.c"),
|
|
64
|
+
resolveFrom(import.meta.url, "../../../../runtime/ext_node/fs/copy_ops.c"),
|
|
65
|
+
resolveFrom(import.meta.url, "../../../../runtime/ext_node/fs/constants.c"),
|
|
38
66
|
resolveFrom(import.meta.url, "../../../../runtime/ext_node/fs/promises.c"),
|
|
39
67
|
],
|
|
40
68
|
builtins: () => builtins,
|
|
69
|
+
exports: () => exports,
|
|
41
70
|
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Which toolchain xbintsc bundles for each host.
|
|
3
|
-
*
|
|
4
|
-
* The end goal is that `build` needs no user-installed compiler. Per the
|
|
5
|
-
* recorded decisions (see `doc/requirements.md`):
|
|
6
|
-
*
|
|
7
|
-
* Linux -> the official LLVM release (clang + lld + llvm-ar)
|
|
8
|
-
* Windows -> llvm-mingw (clang + lld + the MinGW-w64 sysroot/CRT/import libs)
|
|
9
|
-
* macOS -> nothing; the Xcode Command Line Tools are the prerequisite
|
|
10
|
-
*
|
|
11
|
-
* This module only maps a host to a pinned download; the actual fetch lives in
|
|
12
|
-
* `scripts/fetch-toolchain.ts`.
|
|
13
|
-
*/
|
|
14
|
-
/** Pinned LLVM release used for the Linux bundle. */
|
|
15
|
-
export declare const LLVM_VERSION = "18.1.8";
|
|
16
|
-
/** Pinned llvm-mingw release used for the Windows bundle. */
|
|
17
|
-
export declare const LLVM_MINGW_VERSION = "20260908";
|
|
18
|
-
export interface ToolchainDownload {
|
|
19
|
-
/** Download URL. */
|
|
20
|
-
readonly url: string;
|
|
21
|
-
/** Suggested local file name for the archive. */
|
|
22
|
-
readonly archive: string;
|
|
23
|
-
/** Archive type. Both are unpacked with `tar` (bsdtar reads zip). */
|
|
24
|
-
readonly kind: "tar.xz" | "zip";
|
|
25
|
-
/** Leading path segments to strip while extracting. */
|
|
26
|
-
readonly stripComponents: number;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* The toolchain to bundle for a host, or undefined when the host's own SDK is
|
|
30
|
-
* used instead (macOS: the Xcode Command Line Tools).
|
|
31
|
-
*/
|
|
32
|
-
export declare function toolchainDownload(platform?: string, arch?: string): ToolchainDownload | undefined;
|
|
33
|
-
export interface SupportLibrary {
|
|
34
|
-
/** Candidate download URLs, tried in order. */
|
|
35
|
-
readonly urls: readonly string[];
|
|
36
|
-
/** Local file name for the downloaded `.deb`. */
|
|
37
|
-
readonly archive: string;
|
|
38
|
-
/** Path inside the extracted `.deb` data tree. */
|
|
39
|
-
readonly member: string;
|
|
40
|
-
/** File name placed in `vendor/<os>-<arch>/lib/`. */
|
|
41
|
-
readonly dest: string;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Extra shared libraries the bundled toolchain needs but that are not part of
|
|
45
|
-
* the OS C library. The official Linux LLVM build links the legacy
|
|
46
|
-
* `libtinfo.so.5` soname, which current distributions no longer ship, so we
|
|
47
|
-
* bundle it (from the Ubuntu `libtinfo5` package) into `vendor/<os>-<arch>/lib`
|
|
48
|
-
* and point `LD_LIBRARY_PATH` at that directory.
|
|
49
|
-
*/
|
|
50
|
-
export declare function toolchainSupportLibraries(platform?: string, arch?: string): readonly SupportLibrary[];
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Which toolchain xbintsc bundles for each host.
|
|
3
|
-
*
|
|
4
|
-
* The end goal is that `build` needs no user-installed compiler. Per the
|
|
5
|
-
* recorded decisions (see `doc/requirements.md`):
|
|
6
|
-
*
|
|
7
|
-
* Linux -> the official LLVM release (clang + lld + llvm-ar)
|
|
8
|
-
* Windows -> llvm-mingw (clang + lld + the MinGW-w64 sysroot/CRT/import libs)
|
|
9
|
-
* macOS -> nothing; the Xcode Command Line Tools are the prerequisite
|
|
10
|
-
*
|
|
11
|
-
* This module only maps a host to a pinned download; the actual fetch lives in
|
|
12
|
-
* `scripts/fetch-toolchain.ts`.
|
|
13
|
-
*/
|
|
14
|
-
/** Pinned LLVM release used for the Linux bundle. */
|
|
15
|
-
export const LLVM_VERSION = "18.1.8";
|
|
16
|
-
/** Pinned llvm-mingw release used for the Windows bundle. */
|
|
17
|
-
export const LLVM_MINGW_VERSION = "20260908";
|
|
18
|
-
/**
|
|
19
|
-
* The toolchain to bundle for a host, or undefined when the host's own SDK is
|
|
20
|
-
* used instead (macOS: the Xcode Command Line Tools).
|
|
21
|
-
*/
|
|
22
|
-
export function toolchainDownload(platform = process.platform, arch = process.arch) {
|
|
23
|
-
if (platform === "linux") {
|
|
24
|
-
if (arch === "x64") {
|
|
25
|
-
return {
|
|
26
|
-
url: `https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-18.04.tar.xz`,
|
|
27
|
-
archive: `clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu.tar.xz`,
|
|
28
|
-
kind: "tar.xz",
|
|
29
|
-
stripComponents: 1,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
if (arch === "arm64") {
|
|
33
|
-
return {
|
|
34
|
-
url: `https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-aarch64-linux-gnu.tar.xz`,
|
|
35
|
-
archive: `clang+llvm-${LLVM_VERSION}-aarch64-linux-gnu.tar.xz`,
|
|
36
|
-
kind: "tar.xz",
|
|
37
|
-
stripComponents: 1,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
if (platform === "win32" && arch === "x64") {
|
|
43
|
-
return {
|
|
44
|
-
url: `https://github.com/mstorsjo/llvm-mingw/releases/download/${LLVM_MINGW_VERSION}/llvm-mingw-${LLVM_MINGW_VERSION}-ucrt-x86_64.zip`,
|
|
45
|
-
archive: `llvm-mingw-${LLVM_MINGW_VERSION}-ucrt-x86_64.zip`,
|
|
46
|
-
kind: "zip",
|
|
47
|
-
stripComponents: 1,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
if (platform === "win32" && arch === "arm64") {
|
|
51
|
-
// The llvm-mingw `aarch64` package is the Windows-on-ARM host build; its
|
|
52
|
-
// clang targets aarch64 by default, so a native Windows ARM64 runner gets
|
|
53
|
-
// native MinGW-w64 binaries with no MSVC dependency.
|
|
54
|
-
return {
|
|
55
|
-
url: `https://github.com/mstorsjo/llvm-mingw/releases/download/${LLVM_MINGW_VERSION}/llvm-mingw-${LLVM_MINGW_VERSION}-ucrt-aarch64.zip`,
|
|
56
|
-
archive: `llvm-mingw-${LLVM_MINGW_VERSION}-ucrt-aarch64.zip`,
|
|
57
|
-
kind: "zip",
|
|
58
|
-
stripComponents: 1,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
// macOS (and any other host) uses the system SDK; nothing to bundle.
|
|
62
|
-
return undefined;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Extra shared libraries the bundled toolchain needs but that are not part of
|
|
66
|
-
* the OS C library. The official Linux LLVM build links the legacy
|
|
67
|
-
* `libtinfo.so.5` soname, which current distributions no longer ship, so we
|
|
68
|
-
* bundle it (from the Ubuntu `libtinfo5` package) into `vendor/<os>-<arch>/lib`
|
|
69
|
-
* and point `LD_LIBRARY_PATH` at that directory.
|
|
70
|
-
*/
|
|
71
|
-
export function toolchainSupportLibraries(platform = process.platform, arch = process.arch) {
|
|
72
|
-
if (platform === "linux" && arch === "x64") {
|
|
73
|
-
return [
|
|
74
|
-
{
|
|
75
|
-
urls: [
|
|
76
|
-
"https://security.ubuntu.com/ubuntu/pool/main/n/ncurses/libtinfo5_6.1-1ubuntu1.18.04.1_amd64.deb",
|
|
77
|
-
"https://archive.ubuntu.com/ubuntu/pool/main/n/ncurses/libtinfo5_6.1-1ubuntu1.18.04.1_amd64.deb",
|
|
78
|
-
],
|
|
79
|
-
archive: "libtinfo5.deb",
|
|
80
|
-
member: "lib/x86_64-linux-gnu/libtinfo.so.5.9",
|
|
81
|
-
dest: "libtinfo.so.5",
|
|
82
|
-
},
|
|
83
|
-
];
|
|
84
|
-
}
|
|
85
|
-
if (platform === "linux" && arch === "arm64") {
|
|
86
|
-
// The aarch64 release build links the same removed `libtinfo.so.5` soname as
|
|
87
|
-
// the x86_64 one; arm64 packages live in the Ubuntu ports archive.
|
|
88
|
-
return [
|
|
89
|
-
{
|
|
90
|
-
urls: [
|
|
91
|
-
"https://ports.ubuntu.com/ubuntu-ports/pool/main/n/ncurses/libtinfo5_6.1-1ubuntu1.18.04.1_arm64.deb",
|
|
92
|
-
"http://ports.ubuntu.com/ubuntu-ports/pool/main/n/ncurses/libtinfo5_6.1-1ubuntu1.18.04.1_arm64.deb",
|
|
93
|
-
],
|
|
94
|
-
archive: "libtinfo5.deb",
|
|
95
|
-
member: "lib/aarch64-linux-gnu/libtinfo.so.5.9",
|
|
96
|
-
dest: "libtinfo.so.5",
|
|
97
|
-
},
|
|
98
|
-
];
|
|
99
|
-
}
|
|
100
|
-
return [];
|
|
101
|
-
}
|
|
102
|
-
//# sourceMappingURL=toolchain-download.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toolchain-download.js","sourceRoot":"","sources":["../../../src/driver/toolchain-download.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,qDAAqD;AACrD,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC;AACrC,6DAA6D;AAC7D,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAa7C;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,WAAmB,OAAO,CAAC,QAAQ,EACnC,OAAe,OAAO,CAAC,IAAI;IAE3B,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;YACnB,OAAO;gBACL,GAAG,EAAE,kEAAkE,YAAY,eAAe,YAAY,uCAAuC;gBACrJ,OAAO,EAAE,cAAc,YAAY,0BAA0B;gBAC7D,IAAI,EAAE,QAAQ;gBACd,eAAe,EAAE,CAAC;aACnB,CAAC;QACJ,CAAC;QACD,IAAI,IAAI,KAAK,OA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,EAAE,CAAC;QAC7C,6EAA6E;QAC7E,mEAAmE;QACnE,OAAO;YACL;gBACE,IAAI,EAAE;oBACJ,oGAAoG;oBACpG,mGAAmG;iBACpG;gBACD,OAAO,EAAE,eAAe;gBACxB,MAAM,EAAE,uCAAuC;gBAC/C,IAAI,EAAE,eAAe;aACtB;SACF,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { LLVM_MINGW_VERSION, LLVM_VERSION, toolchainDownload, toolchainSupportLibraries, } from "../../src/driver/toolchain-download.js";
|
|
3
|
-
describe("toolchainDownload", () => {
|
|
4
|
-
it("maps Linux x64 to the pinned LLVM release", () => {
|
|
5
|
-
const target = toolchainDownload("linux", "x64");
|
|
6
|
-
expect(target?.url).toContain(`llvmorg-${LLVM_VERSION}`);
|
|
7
|
-
expect(target?.url).toContain("x86_64-linux-gnu");
|
|
8
|
-
expect(target?.kind).toBe("tar.xz");
|
|
9
|
-
expect(target?.stripComponents).toBe(1);
|
|
10
|
-
});
|
|
11
|
-
it("maps Linux arm64 to the pinned LLVM release", () => {
|
|
12
|
-
const target = toolchainDownload("linux", "arm64");
|
|
13
|
-
expect(target?.url).toContain("aarch64-linux-gnu");
|
|
14
|
-
expect(target?.kind).toBe("tar.xz");
|
|
15
|
-
});
|
|
16
|
-
it("maps Windows x64 to the pinned llvm-mingw release", () => {
|
|
17
|
-
const target = toolchainDownload("win32", "x64");
|
|
18
|
-
expect(target?.url).toContain(`llvm-mingw-${LLVM_MINGW_VERSION}`);
|
|
19
|
-
expect(target?.url).toContain("ucrt-x86_64");
|
|
20
|
-
expect(target?.kind).toBe("zip");
|
|
21
|
-
expect(target?.stripComponents).toBe(1);
|
|
22
|
-
});
|
|
23
|
-
it("maps Windows arm64 to the pinned llvm-mingw release", () => {
|
|
24
|
-
const target = toolchainDownload("win32", "arm64");
|
|
25
|
-
expect(target?.url).toContain(`llvm-mingw-${LLVM_MINGW_VERSION}`);
|
|
26
|
-
expect(target?.url).toContain("ucrt-aarch64");
|
|
27
|
-
expect(target?.kind).toBe("zip");
|
|
28
|
-
expect(target?.stripComponents).toBe(1);
|
|
29
|
-
});
|
|
30
|
-
it("does not bundle a toolchain on macOS", () => {
|
|
31
|
-
expect(toolchainDownload("darwin", "arm64")).toBeUndefined();
|
|
32
|
-
expect(toolchainDownload("darwin", "x64")).toBeUndefined();
|
|
33
|
-
});
|
|
34
|
-
it("bundles libtinfo.so.5 for Linux x64", () => {
|
|
35
|
-
const libraries = toolchainSupportLibraries("linux", "x64");
|
|
36
|
-
expect(libraries).toHaveLength(1);
|
|
37
|
-
expect(libraries[0]?.dest).toBe("libtinfo.so.5");
|
|
38
|
-
expect(libraries[0]?.urls.length).toBeGreaterThan(0);
|
|
39
|
-
});
|
|
40
|
-
it("bundles libtinfo.so.5 for Linux arm64", () => {
|
|
41
|
-
const libraries = toolchainSupportLibraries("linux", "arm64");
|
|
42
|
-
expect(libraries).toHaveLength(1);
|
|
43
|
-
expect(libraries[0]?.dest).toBe("libtinfo.so.5");
|
|
44
|
-
expect(libraries[0]?.member).toContain("aarch64-linux-gnu");
|
|
45
|
-
expect(libraries[0]?.urls.length).toBeGreaterThan(0);
|
|
46
|
-
});
|
|
47
|
-
it("requests no support libraries on other hosts", () => {
|
|
48
|
-
expect(toolchainSupportLibraries("darwin", "arm64")).toEqual([]);
|
|
49
|
-
expect(toolchainSupportLibraries("win32", "x64")).toEqual([]);
|
|
50
|
-
expect(toolchainSupportLibraries("win32", "arm64")).toEqual([]);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
//# sourceMappingURL=toolchain-download.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toolchain-download.test.js","sourceRoot":"","sources":["../../../tests/driver/toolchain-download.test.ts"],"names":[],"mappings":"A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,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,SAAS,GAAG,yBAAyB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9D,MAAM,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACjD,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAC5D,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,CAAC,yBAAyB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACjE,MAAM,CAAC,yBAAyB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC9D,MAAM,CAAC,yBAAyB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Download the pinned toolchain that xbintsc bundles for this host into
|
|
4
|
-
* `vendor/<os>-<arch>/`, so `build` needs no user-installed compiler:
|
|
5
|
-
*
|
|
6
|
-
* Linux -> official LLVM release (clang + lld + llvm-ar) plus the legacy
|
|
7
|
-
* `libtinfo.so.5` shared library the official build still needs
|
|
8
|
-
* Windows -> llvm-mingw (clang + lld + MinGW-w64 CRT/import libraries)
|
|
9
|
-
* macOS -> nothing; the Xcode Command Line Tools are the prerequisite
|
|
10
|
-
*
|
|
11
|
-
* Requires `curl`, `tar` and (on Linux) `ar` on PATH; all are present on
|
|
12
|
-
* GitHub-hosted runners. Pass `--force` to refetch an existing toolchain.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import { copyFileSync, existsSync, mkdirSync, rmSync } from "node:fs";
|
|
16
|
-
import { spawnSync } from "node:child_process";
|
|
17
|
-
import { join } from "node:path";
|
|
18
|
-
import { tmpdir } from "node:os";
|
|
19
|
-
import { platformSlug, vendorRootDir } from "../src/driver/paths.js";
|
|
20
|
-
import { toolchainDownload, toolchainSupportLibraries } from "../src/driver/toolchain-download.js";
|
|
21
|
-
|
|
22
|
-
const force = process.argv.includes("--force");
|
|
23
|
-
const target = toolchainDownload();
|
|
24
|
-
|
|
25
|
-
if (!target) {
|
|
26
|
-
console.log(
|
|
27
|
-
`xbintsc: no bundled toolchain for ${platformSlug()}; using the system SDK (macOS: Xcode Command Line Tools)`,
|
|
28
|
-
);
|
|
29
|
-
process.exit(0);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const vendorDir = join(vendorRootDir(), platformSlug());
|
|
33
|
-
const clangName = process.platform === "win32" ? "clang.exe" : "clang";
|
|
34
|
-
const clangPath = join(vendorDir, "bin", clangName);
|
|
35
|
-
|
|
36
|
-
function run(command: string, args: readonly string[], cwd?: string): void {
|
|
37
|
-
const result = spawnSync(command, [...args], { stdio: "inherit", cwd });
|
|
38
|
-
if (result.status !== 0) {
|
|
39
|
-
console.error(`xbintsc: command failed: ${command} ${args.join(" ")}`);
|
|
40
|
-
process.exit(result.status ?? 1);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** Download the first reachable URL to `dest`, failing after the last one. */
|
|
45
|
-
function download(urls: readonly string[], dest: string): void {
|
|
46
|
-
for (const url of urls) {
|
|
47
|
-
console.log(`xbintsc: downloading ${url}`);
|
|
48
|
-
const result = spawnSync("curl", ["-fL", "--retry", "3", "-o", dest, url], { stdio: "inherit" });
|
|
49
|
-
if (result.status === 0) return;
|
|
50
|
-
console.log("xbintsc: download failed, trying the next mirror");
|
|
51
|
-
}
|
|
52
|
-
console.error(`xbintsc: could not download ${dest}`);
|
|
53
|
-
process.exit(1);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const workDir = join(tmpdir(), `xbintsc-toolchain-${process.pid}`);
|
|
57
|
-
rmSync(workDir, { recursive: true, force: true });
|
|
58
|
-
mkdirSync(workDir, { recursive: true });
|
|
59
|
-
|
|
60
|
-
if (existsSync(clangPath) && !force) {
|
|
61
|
-
console.log(`xbintsc: toolchain already present at ${vendorDir}`);
|
|
62
|
-
} else {
|
|
63
|
-
const archivePath = join(workDir, target.archive);
|
|
64
|
-
download([target.url], archivePath);
|
|
65
|
-
console.log(`xbintsc: extracting into ${vendorDir}`);
|
|
66
|
-
mkdirSync(vendorDir, { recursive: true });
|
|
67
|
-
// `tar` here is bsdtar on macOS/Windows and GNU tar on Linux; both accept
|
|
68
|
-
// `--strip-components`, and bsdtar also unpacks the `.zip` used on Windows.
|
|
69
|
-
run("tar", ["-xf", archivePath, "-C", vendorDir, `--strip-components=${target.stripComponents}`]);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Shared libraries the bundled toolchain needs but the OS does not provide.
|
|
73
|
-
const supportLibraries = toolchainSupportLibraries();
|
|
74
|
-
if (supportLibraries.length > 0) {
|
|
75
|
-
const libDir = join(vendorDir, "lib");
|
|
76
|
-
mkdirSync(libDir, { recursive: true });
|
|
77
|
-
for (const library of supportLibraries) {
|
|
78
|
-
const dest = join(libDir, library.dest);
|
|
79
|
-
if (existsSync(dest) && !force) {
|
|
80
|
-
console.log(`xbintsc: already bundled ${library.dest}`);
|
|
81
|
-
continue;
|
|
82
|
-
}
|
|
83
|
-
const debPath = join(workDir, library.archive);
|
|
84
|
-
download(library.urls, debPath);
|
|
85
|
-
const debDir = join(workDir, `deb-${library.dest}`);
|
|
86
|
-
mkdirSync(debDir, { recursive: true });
|
|
87
|
-
// A `.deb` is an `ar` archive whose `data.tar.*` member holds the files.
|
|
88
|
-
run("ar", ["x", debPath], debDir);
|
|
89
|
-
run("tar", ["-xf", join(debDir, "data.tar.xz"), "-C", debDir]);
|
|
90
|
-
copyFileSync(join(debDir, library.member), dest);
|
|
91
|
-
console.log(`xbintsc: bundled ${library.dest}`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
rmSync(workDir, { recursive: true, force: true });
|
|
96
|
-
|
|
97
|
-
if (!existsSync(clangPath)) {
|
|
98
|
-
console.error(`xbintsc: expected ${clangPath} after extraction`);
|
|
99
|
-
process.exit(1);
|
|
100
|
-
}
|
|
101
|
-
console.log(`xbintsc: done -> ${clangPath}`);
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Which toolchain xbintsc bundles for each host.
|
|
3
|
-
*
|
|
4
|
-
* The end goal is that `build` needs no user-installed compiler. Per the
|
|
5
|
-
* recorded decisions (see `doc/requirements.md`):
|
|
6
|
-
*
|
|
7
|
-
* Linux -> the official LLVM release (clang + lld + llvm-ar)
|
|
8
|
-
* Windows -> llvm-mingw (clang + lld + the MinGW-w64 sysroot/CRT/import libs)
|
|
9
|
-
* macOS -> nothing; the Xcode Command Line Tools are the prerequisite
|
|
10
|
-
*
|
|
11
|
-
* This module only maps a host to a pinned download; the actual fetch lives in
|
|
12
|
-
* `scripts/fetch-toolchain.ts`.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/** Pinned LLVM release used for the Linux bundle. */
|
|
16
|
-
export const LLVM_VERSION = "18.1.8";
|
|
17
|
-
/** Pinned llvm-mingw release used for the Windows bundle. */
|
|
18
|
-
export const LLVM_MINGW_VERSION = "20260908";
|
|
19
|
-
|
|
20
|
-
export interface ToolchainDownload {
|
|
21
|
-
/** Download URL. */
|
|
22
|
-
readonly url: string;
|
|
23
|
-
/** Suggested local file name for the archive. */
|
|
24
|
-
readonly archive: string;
|
|
25
|
-
/** Archive type. Both are unpacked with `tar` (bsdtar reads zip). */
|
|
26
|
-
readonly kind: "tar.xz" | "zip";
|
|
27
|
-
/** Leading path segments to strip while extracting. */
|
|
28
|
-
readonly stripComponents: number;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* The toolchain to bundle for a host, or undefined when the host's own SDK is
|
|
33
|
-
* used instead (macOS: the Xcode Command Line Tools).
|
|
34
|
-
*/
|
|
35
|
-
export function toolchainDownload(
|
|
36
|
-
platform: string = process.platform,
|
|
37
|
-
arch: string = process.arch,
|
|
38
|
-
): ToolchainDownload | undefined {
|
|
39
|
-
if (platform === "linux") {
|
|
40
|
-
if (arch === "x64") {
|
|
41
|
-
return {
|
|
42
|
-
url: `https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-18.04.tar.xz`,
|
|
43
|
-
archive: `clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu.tar.xz`,
|
|
44
|
-
kind: "tar.xz",
|
|
45
|
-
stripComponents: 1,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
if (arch === "arm64") {
|
|
49
|
-
return {
|
|
50
|
-
url: `https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-aarch64-linux-gnu.tar.xz`,
|
|
51
|
-
archive: `clang+llvm-${LLVM_VERSION}-aarch64-linux-gnu.tar.xz`,
|
|
52
|
-
kind: "tar.xz",
|
|
53
|
-
stripComponents: 1,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (platform === "win32" && arch === "x64") {
|
|
60
|
-
return {
|
|
61
|
-
url: `https://github.com/mstorsjo/llvm-mingw/releases/download/${LLVM_MINGW_VERSION}/llvm-mingw-${LLVM_MINGW_VERSION}-ucrt-x86_64.zip`,
|
|
62
|
-
archive: `llvm-mingw-${LLVM_MINGW_VERSION}-ucrt-x86_64.zip`,
|
|
63
|
-
kind: "zip",
|
|
64
|
-
stripComponents: 1,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (platform === "win32" && arch === "arm64") {
|
|
69
|
-
// The llvm-mingw `aarch64` package is the Windows-on-ARM host build; its
|
|
70
|
-
// clang targets aarch64 by default, so a native Windows ARM64 runner gets
|
|
71
|
-
// native MinGW-w64 binaries with no MSVC dependency.
|
|
72
|
-
return {
|
|
73
|
-
url: `https://github.com/mstorsjo/llvm-mingw/releases/download/${LLVM_MINGW_VERSION}/llvm-mingw-${LLVM_MINGW_VERSION}-ucrt-aarch64.zip`,
|
|
74
|
-
archive: `llvm-mingw-${LLVM_MINGW_VERSION}-ucrt-aarch64.zip`,
|
|
75
|
-
kind: "zip",
|
|
76
|
-
stripComponents: 1,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// macOS (and any other host) uses the system SDK; nothing to bundle.
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface SupportLibrary {
|
|
85
|
-
/** Candidate download URLs, tried in order. */
|
|
86
|
-
readonly urls: readonly string[];
|
|
87
|
-
/** Local file name for the downloaded `.deb`. */
|
|
88
|
-
readonly archive: string;
|
|
89
|
-
/** Path inside the extracted `.deb` data tree. */
|
|
90
|
-
readonly member: string;
|
|
91
|
-
/** File name placed in `vendor/<os>-<arch>/lib/`. */
|
|
92
|
-
readonly dest: string;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Extra shared libraries the bundled toolchain needs but that are not part of
|
|
97
|
-
* the OS C library. The official Linux LLVM build links the legacy
|
|
98
|
-
* `libtinfo.so.5` soname, which current distributions no longer ship, so we
|
|
99
|
-
* bundle it (from the Ubuntu `libtinfo5` package) into `vendor/<os>-<arch>/lib`
|
|
100
|
-
* and point `LD_LIBRARY_PATH` at that directory.
|
|
101
|
-
*/
|
|
102
|
-
export function toolchainSupportLibraries(
|
|
103
|
-
platform: string = process.platform,
|
|
104
|
-
arch: string = process.arch,
|
|
105
|
-
): readonly SupportLibrary[] {
|
|
106
|
-
if (platform === "linux" && arch === "x64") {
|
|
107
|
-
return [
|
|
108
|
-
{
|
|
109
|
-
urls: [
|
|
110
|
-
"https://security.ubuntu.com/ubuntu/pool/main/n/ncurses/libtinfo5_6.1-1ubuntu1.18.04.1_amd64.deb",
|
|
111
|
-
"https://archive.ubuntu.com/ubuntu/pool/main/n/ncurses/libtinfo5_6.1-1ubuntu1.18.04.1_amd64.deb",
|
|
112
|
-
],
|
|
113
|
-
archive: "libtinfo5.deb",
|
|
114
|
-
member: "lib/x86_64-linux-gnu/libtinfo.so.5.9",
|
|
115
|
-
dest: "libtinfo.so.5",
|
|
116
|
-
},
|
|
117
|
-
];
|
|
118
|
-
}
|
|
119
|
-
if (platform === "linux" && arch === "arm64") {
|
|
120
|
-
// The aarch64 release build links the same removed `libtinfo.so.5` soname as
|
|
121
|
-
// the x86_64 one; arm64 packages live in the Ubuntu ports archive.
|
|
122
|
-
return [
|
|
123
|
-
{
|
|
124
|
-
urls: [
|
|
125
|
-
"https://ports.ubuntu.com/ubuntu-ports/pool/main/n/ncurses/libtinfo5_6.1-1ubuntu1.18.04.1_arm64.deb",
|
|
126
|
-
"http://ports.ubuntu.com/ubuntu-ports/pool/main/n/ncurses/libtinfo5_6.1-1ubuntu1.18.04.1_arm64.deb",
|
|
127
|
-
],
|
|
128
|
-
archive: "libtinfo5.deb",
|
|
129
|
-
member: "lib/aarch64-linux-gnu/libtinfo.so.5.9",
|
|
130
|
-
dest: "libtinfo.so.5",
|
|
131
|
-
},
|
|
132
|
-
];
|
|
133
|
-
}
|
|
134
|
-
return [];
|
|
135
|
-
}
|