Skip to content

Commit

Permalink
v23.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
TerrorJack committed Oct 19, 2024
1 parent ad9ba3e commit 82f41e3
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 16 deletions.
91 changes: 87 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:
workflow_dispatch:

jobs:
build:
name: build
x86_64-linux:
name: x86_64-linux
runs-on: ubuntu-24.04
steps:

Expand Down Expand Up @@ -40,16 +40,99 @@ jobs:
--volume $PWD:/workspace \
--workdir /workspace \
rust:alpine-mimalloc \
/workspace/build.sh
/workspace/build-alpine.sh
- name: upload-artifact
uses: actions/upload-artifact@v4
with:
name: node-linux-x86_64
path: node-v*-linux-x64-static.tar.xz

- name: test-node
run: |
tar xJf node-v*-linux-x64-static.tar.xz
export PATH=$PWD/node-v*-linux-x64-static/bin:$PATH
npm install @bjorn3/browser_wasi_shim
aarch64-linux:
name: aarch64-linux
runs-on: ubuntu-24.04
steps:

- name: setup-podman
uses: TerrorJack/setup-podman@master

- name: checkout
uses: actions/checkout@v4

- name: build-node
run: |
podman run \
--init \
--network host \
--rm \
--tmpfs /tmp:exec \
--volume $PWD:/workspace \
--workdir /workspace \
chimeralinux/chimera \
/workspace/build-chimera.sh
- name: upload-artifact
uses: actions/upload-artifact@v4
with:
name: node-linux-x64-static
name: node-linux-aarch64
path: node-v*-linux-x64-static.tar.xz

- name: test-node
run: |
tar xJf node-v*-linux-x64-static.tar.xz
export PATH=$PWD/node-v*-linux-x64-static/bin:$PATH
npm install @bjorn3/browser_wasi_shim
darwin:
name: ${{ matrix.arch }}-darwin
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- arch: aarch64
os: macos-15
- arch: x86_64
os: macos-15-large
steps:

- name: setup-xcode
run: |
sudo xcode-select --switch /Applications/Xcode_16.1.app
- name: checkout
uses: actions/checkout@v4

- name: build-node
run: |
set -euo pipefail
node_ver=v23.0.0
pushd "$(mktemp -d)"
curl -f -L --retry 5 https://github.com/nodejs/node/archive/refs/tags/$node_ver.tar.gz | tar xz --strip-components=1
patch -p1 -i $GITHUB_WORKSPACE/bump-v8-wasm-limits.diff
make -j$(curl -f -L --retry 5 https://gitlab.haskell.org/ghc/ghc/-/raw/master/mk/detect-cpu-count.sh | sh) binary CONFIG_FLAGS="--v8-disable-maglev"
mv node-$node_ver-*.tar.xz $GITHUB_WORKSPACE
popd
- name: upload-artifact
uses: actions/upload-artifact@v4
with:
name: node-darwin-${{ matrix.arch }}
path: node-v*.tar.xz

- name: test-node
run: |
tar xJf node-v*.tar.xz
export PATH=$PWD/node-v*/bin:$PATH
npm install @bjorn3/browser_wasi_shim
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# `node-static`

Highly opinionated x86_64-linux nodejs build, fully statically linked,
with increased V8 wasm limits, pointer compression and mimalloc.
Should be fast when it works, but it doesn't work with native addons,
so don't use it in your project unless you know what you're doing.
Highly opinionated nodejs build, fully statically linked with
musl/mimalloc on linux, with increased V8 wasm limits. Don't use it in
your own project unless you know what you're doing.
7 changes: 3 additions & 4 deletions build.sh → build-alpine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -eu

node_ver=v22.9.0
node_ver=v23.0.0

apk add \
linux-headers \
Expand All @@ -12,12 +12,11 @@ apk add \
cd "$(mktemp -d)"

curl -f -L --retry 5 https://nodejs.org/dist/$node_ver/node-$node_ver.tar.xz | tar xJ --strip-components=1
sed -i -e '/v8_enable_sandbox/d' configure.py
patch -p1 -i /workspace/bump-v8-wasm-limits.diff
patch -p1 -i /workspace/use-etc-ssl-certs.patch
patch -p1 -i /workspace/use-etc-ssl-certs.diff

make -j"$(nproc)" binary \
CONFIG_FLAGS="--experimental-enable-pointer-compression --fully-static --openssl-use-def-ca-store" \
CONFIG_FLAGS="--fully-static --openssl-use-def-ca-store --v8-disable-maglev" \
VARIATION="static"

mv node-$node_ver-linux-x64-static.tar.xz /workspace
37 changes: 37 additions & 0 deletions build-chimera.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh

set -eu

node_ver=v23.0.0

apk add --no-interactive \
base-cross-aarch64 \
bsdtar \
chimerautils-extra \
curl \
gmake \
libatomic-chimera-cross-aarch64-static \
libatomic-chimera-devel-static \
libcxx-cross-aarch64-static \
libcxx-devel-static \
libcxxabi-cross-aarch64-static \
libcxxabi-devel-static \
libunwind-cross-aarch64-static \
libunwind-devel-static \
linux-headers \
linux-headers-cross-aarch64 \
musl-cross-aarch64-static \
musl-devel-static \
python

cd "$(mktemp -d)"

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

CC=aarch64-chimera-linux-musl-clang CXX=aarch64-chimera-linux-musl-clang++ CC_host=clang CXX_host=clang++ gmake -j"$(nproc)" binary \
CONFIG_FLAGS="--dest-cpu=arm64 --fully-static --openssl-use-def-ca-store --v8-disable-maglev" \
VARIATION="static"

mv node-$node_ver-linux-x64-static.tar.xz /workspace
4 changes: 2 additions & 2 deletions bump-v8-wasm-limits.diff
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
diff --git a/deps/v8/src/wasm/wasm-limits.h b/deps/v8/src/wasm/wasm-limits.h
index c2a2fe6a50..56e3acd4e1 100644
index e3f8b94b..abd09e1e 100644
--- a/deps/v8/src/wasm/wasm-limits.h
+++ b/deps/v8/src/wasm/wasm-limits.h
@@ -28,8 +28,8 @@ constexpr size_t kSpecMaxMemory64Pages = 262'144; // 16GB
// The limits are agreed upon with other engines for consistency.
constexpr size_t kV8MaxWasmTypes = 1'000'000;
constexpr size_t kV8MaxWasmFunctions = 1'000'000;
constexpr size_t kV8MaxWasmDefinedFunctions = 1'000'000;
-constexpr size_t kV8MaxWasmImports = 100'000;
-constexpr size_t kV8MaxWasmExports = 100'000;
+constexpr size_t kV8MaxWasmImports = 1'000'000;
Expand Down
4 changes: 2 additions & 2 deletions use-etc-ssl-certs.patch → use-etc-ssl-certs.diff
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/deps/openssl/openssl/include/internal/cryptlib.h b/deps/openssl/openssl/include/internal/cryptlib.h
index 329ef62..9a8df64 100644
index 934d4b08..d45248e5 100644
--- a/deps/openssl/openssl/include/internal/cryptlib.h
+++ b/deps/openssl/openssl/include/internal/cryptlib.h
@@ -56,7 +56,7 @@ DEFINE_LHASH_OF(MEM);
@@ -66,7 +66,7 @@ DEFINE_LHASH_OF(MEM);
# ifndef OPENSSL_SYS_VMS
# define X509_CERT_AREA OPENSSLDIR
# define X509_CERT_DIR OPENSSLDIR "/certs"
Expand Down

0 comments on commit 82f41e3

Please sign in to comment.