Skip to content

Commit 7e2671f

Browse files
committed
v23.5.0
1 parent da2370c commit 7e2671f

File tree

6 files changed

+180
-125
lines changed

6 files changed

+180
-125
lines changed

.github/actions/darwin/action.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/actions/linux/action.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 77 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,69 +7,106 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
x86_64-linux:
11-
name: x86_64-linux
10+
linux:
11+
name: ${{ matrix.arch }}-linux
1212
runs-on:
13-
- X64
13+
- ${{ matrix.runner_tag }}
1414
- Linux
1515
- podman
1616
strategy:
1717
matrix:
1818
include:
1919
- arch: x86_64
20+
runner_tag: X64
21+
- arch: aarch64
22+
runner_tag: ARM64
2023
steps:
2124
- name: checkout
2225
uses: actions/checkout@v4
2326

24-
- name: build-linux-node
25-
uses: ./.github/actions/linux
27+
- name: build-image
28+
run: |
29+
pushd "$(mktemp -d)"
30+
curl -f -L --retry 5 https://github.com/tweag/rust-alpine-mimalloc/archive/refs/heads/master.tar.gz | tar xz --strip-components=1
31+
podman build \
32+
--network host \
33+
--pull \
34+
--squash-all \
35+
--tag rust:alpine-mimalloc \
36+
.
37+
popd
2638
27-
aarch64-linux:
28-
name: aarch64-linux
29-
runs-on:
30-
- ARM64
31-
- Linux
32-
- podman
33-
strategy:
34-
matrix:
35-
include:
36-
- arch: aarch64
37-
steps:
38-
- name: checkout
39-
uses: actions/checkout@v4
39+
- name: build-node
40+
run: |
41+
podman run \
42+
--init \
43+
--network host \
44+
--rm \
45+
--tmpfs /tmp:exec \
46+
--volume $PWD:/workspace \
47+
--workdir /workspace \
48+
rust:alpine-mimalloc \
49+
/workspace/build-alpine.sh
4050
41-
- name: build-linux-node
42-
uses: ./.github/actions/linux
51+
- name: upload-artifact
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: node-linux-${{ matrix.arch }}
55+
path: dist/node-v*.tar.xz
4356

44-
aarch64-darwin:
45-
name: aarch64-darwin
57+
- name: test-node
58+
run: |
59+
pushd dist
60+
tar xJf node-v*.tar.xz --strip-components=1
61+
export PATH=$PWD/bin:$PATH
62+
npm install @bjorn3/browser_wasi_shim
63+
popd
64+
65+
darwin:
66+
name: ${{ matrix.arch }}-darwin
4667
runs-on:
47-
- ARM64
68+
- ${{ matrix.runner_tag }}
4869
- macOS
4970
strategy:
5071
matrix:
5172
include:
5273
- arch: aarch64
74+
runner_tag: ARM64
75+
- arch: x86_64
76+
runner_tag: X64
5377
steps:
5478
- name: checkout
5579
uses: actions/checkout@v4
5680

57-
- name: build-darwin-node
58-
uses: ./.github/actions/darwin
81+
- name: build-node
82+
run: |
83+
set -euo pipefail
5984
60-
x86_64-darwin:
61-
needs: aarch64-darwin
62-
name: x86_64-darwin
63-
runs-on:
64-
- X64
65-
- macOS
66-
strategy:
67-
matrix:
68-
include:
69-
- arch: x86_64
70-
steps:
71-
- name: checkout
72-
uses: actions/checkout@v4
85+
node_ver=v23.5.0
86+
87+
pushd "$(mktemp -d)"
88+
89+
curl -f -L --retry 5 https://github.com/nodejs/node/archive/refs/tags/$node_ver.tar.gz | tar xz --strip-components=1
90+
patch -p1 -i $GITHUB_WORKSPACE/bump-v8-wasm-limits.diff
91+
patch -p1 -i $GITHUB_WORKSPACE/lto.diff
92+
93+
make -j$(curl -f -L --retry 5 https://gitlab.haskell.org/ghc/ghc/-/raw/master/mk/detect-cpu-count.sh | sh) binary CONFIG_FLAGS="--enable-lto --v8-disable-maglev"
94+
95+
mkdir $GITHUB_WORKSPACE/dist
96+
mv node-$node_ver-*.tar.xz $GITHUB_WORKSPACE/dist
97+
98+
popd
99+
100+
- name: upload-artifact
101+
uses: actions/upload-artifact@v4
102+
with:
103+
name: node-darwin-${{ matrix.arch }}
104+
path: dist/node-v*.tar.xz
73105

74-
- name: build-darwin-node
75-
uses: ./.github/actions/darwin
106+
- name: test-node
107+
run: |
108+
pushd dist
109+
tar xJf node-v*.tar.xz --strip-components=1
110+
export PATH=$PWD/bin:$PATH
111+
npm install @bjorn3/browser_wasi_shim
112+
popd

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# `node-static`
22

33
Highly opinionated nodejs build, fully statically linked with
4-
musl/mimalloc on linux, with increased V8 wasm limits. Don't use it in
5-
your own project unless you know what you're doing.
4+
musl/mimalloc on linux, with increased V8 wasm limits and LLVM
5+
ThinLTO. Don't use it in your own project unless you know what you're
6+
doing.

build-alpine.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,27 @@
22

33
set -eu
44

5-
node_ver=v23.4.0
5+
node_ver=v23.5.0
66

77
apk add \
8+
clang \
89
linux-headers \
10+
llvm \
911
python3 \
1012
xz
1113

1214
cd "$(mktemp -d)"
1315

1416
curl -f -L --retry 5 https://nodejs.org/dist/$node_ver/node-$node_ver.tar.xz | tar xJ --strip-components=1
1517
patch -p1 -i /workspace/bump-v8-wasm-limits.diff
18+
patch -p1 -i /workspace/lto.diff
1619
patch -p1 -i /workspace/use-etc-ssl-certs.diff
1720

1821
make -j"$(nproc)" binary \
19-
CONFIG_FLAGS="--fully-static --openssl-use-def-ca-store --v8-disable-maglev" \
22+
AR=llvm-ar \
23+
CC=clang \
24+
CXX=clang++ \
25+
CONFIG_FLAGS="--enable-lto --fully-static --openssl-use-def-ca-store --v8-disable-maglev" \
2026
VARIATION="static"
2127

2228
mkdir /workspace/dist

lto.diff

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
diff --git a/common.gypi b/common.gypi
2+
index 23196aae..4a3d643b 100644
3+
--- a/common.gypi
4+
+++ b/common.gypi
5+
@@ -185,9 +185,9 @@
6+
'MSVC_runtimeType': 2 # MultiThreadedDLL (/MD)
7+
}],
8+
['clang==1', {
9+
- 'lto': ' -flto ', # Clang
10+
+ 'lto': ' -flto=thin ', # Clang
11+
}, {
12+
- 'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ', # GCC
13+
+ 'lto': ' -flto=auto -fuse-linker-plugin -fno-fat-lto-objects ', # GCC
14+
}],
15+
],
16+
},
17+
diff --git a/deps/cares/configure b/deps/cares/configure
18+
index 76b0ddf3..08b743b3 100755
19+
--- a/deps/cares/configure
20+
+++ b/deps/cares/configure
21+
@@ -16126,11 +16126,6 @@ _LT_EOF
22+
23+
24+
_lt_libdeps_save_CFLAGS=$CFLAGS
25+
-case "$CC $CFLAGS " in #(
26+
-*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
27+
-*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
28+
-*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
29+
-esac
30+
31+
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
32+
(eval $ac_compile) 2>&5
33+
diff --git a/deps/cares/m4/libtool.m4 b/deps/cares/m4/libtool.m4
34+
index c4c02946..9f3d3662 100755
35+
--- a/deps/cares/m4/libtool.m4
36+
+++ b/deps/cares/m4/libtool.m4
37+
@@ -7537,11 +7537,6 @@ _LT_EOF
38+
])
39+
40+
_lt_libdeps_save_CFLAGS=$CFLAGS
41+
-case "$CC $CFLAGS " in #(
42+
-*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
43+
-*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
44+
-*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
45+
-esac
46+
47+
dnl Parse the compiler output and extract the necessary
48+
dnl objects, libraries and library flags.
49+
diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py
50+
index 5f2c097f..42dad126 100644
51+
--- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py
52+
+++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py
53+
@@ -638,7 +638,7 @@ class XcodeSettings:
54+
# if the system clang isn't used, DYLD_LIBRARY_PATH needs to contain the
55+
# path to the libLTO.dylib that matches the used clang.
56+
if self._Test("LLVM_LTO", "YES", default="NO"):
57+
- cflags.append("-flto")
58+
+ cflags.append("-flto=thin")
59+
60+
self._AppendPlatformVersionMinFlags(cflags)
61+
62+
@@ -1101,7 +1101,7 @@ class XcodeSettings:
63+
# For static libraries, no dSYMs are created.
64+
result = []
65+
if (
66+
- self._Test("GCC_GENERATE_DEBUGGING_SYMBOLS", "YES", default="YES")
67+
+ self._Test("GCC_GENERATE_DEBUGGING_SYMBOLS", "YES", default="NO")
68+
and self._Test(
69+
"DEBUG_INFORMATION_FORMAT", "dwarf-with-dsym", default="dwarf"
70+
)
71+
diff --git a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py
72+
index f567542b..604f6895 100644
73+
--- a/tools/gyp/pylib/gyp/xcode_emulation.py
74+
+++ b/tools/gyp/pylib/gyp/xcode_emulation.py
75+
@@ -638,7 +638,7 @@ class XcodeSettings:
76+
# if the system clang isn't used, DYLD_LIBRARY_PATH needs to contain the
77+
# path to the libLTO.dylib that matches the used clang.
78+
if self._Test("LLVM_LTO", "YES", default="NO"):
79+
- cflags.append("-flto")
80+
+ cflags.append("-flto=thin")
81+
82+
self._AppendPlatformVersionMinFlags(cflags)
83+
84+
@@ -1101,7 +1101,7 @@ class XcodeSettings:
85+
# For static libraries, no dSYMs are created.
86+
result = []
87+
if (
88+
- self._Test("GCC_GENERATE_DEBUGGING_SYMBOLS", "YES", default="YES")
89+
+ self._Test("GCC_GENERATE_DEBUGGING_SYMBOLS", "YES", default="NO")
90+
and self._Test(
91+
"DEBUG_INFORMATION_FORMAT", "dwarf-with-dsym", default="dwarf"
92+
)

0 commit comments

Comments
 (0)