Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,34 @@ jobs:
yarn napi build --platform --release --esm --output-dir . --target aarch64-unknown-linux-musl --js binding.js --dts binding.d.ts
artifact: index.linux-arm64-musl.node

# ── Linux 32-bit (cross-compiled) ─────────────────────────────────
# Old release lines (e.g. Electron's armv7l / linux-ia32 builds) still
# install this package, so keep shipping 32-bit prebuilds. There are no
# native 32-bit runners, so these are cross-compiled and flagged
# `cross: true` to skip the smoke test below (the host's 64-bit node
# can't load a 32-bit .node).
- name: linux-ia32-gnu
os: ubuntu-latest
cross: true
# i686 isn't in @napi-rs/cross-toolchain, but an x86_64 host can target
# it directly with gcc-multilib (gcc -m32), which also builds zlib-ng.
build: |
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib
rustup target add i686-unknown-linux-gnu
yarn napi build --platform --release --esm --output-dir . --target i686-unknown-linux-gnu --js binding.js --dts binding.d.ts
artifact: index.linux-ia32-gnu.node

- name: linux-arm-gnueabihf
os: ubuntu-latest
cross: true
# --use-napi-cross pulls @napi-rs/cross-toolchain and wires up the
# armv7 linker / CC / sysroot (used to cross-compile zlib-ng too).
build: |
rustup target add armv7-unknown-linux-gnueabihf
yarn napi build --platform --release --esm --output-dir . --target armv7-unknown-linux-gnueabihf --use-napi-cross --js binding.js --dts binding.d.ts
artifact: index.linux-arm-gnueabihf.node

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
Expand Down Expand Up @@ -170,7 +198,7 @@ jobs:
run: node scripts/strip-binding-fallbacks.js

- name: Smoke test (native targets only)
if: ${{ !matrix.docker && (!contains(matrix.name, 'arm64') || contains(matrix.os, 'arm') || matrix.os == 'macos-latest') }}
if: ${{ !matrix.docker && !matrix.cross && (!contains(matrix.name, 'arm64') || contains(matrix.os, 'arm') || matrix.os == 'macos-latest') }}
run: yarn test

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
Expand Down
39 changes: 39 additions & 0 deletions .yarn/patches/@napi-rs-cli-npm-3.6.2-b710c59d43.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
diff --git a/dist/cli.js b/dist/cli.js
index 5787d8d0398b48987f9e59a628770259cf9c830c..260f2a7f742c3a14fbabb7b67c6121311a99a703 100755
--- a/dist/cli.js
+++ b/dist/cli.js
@@ -802,6 +802,8 @@ function requireNative() {
${requireTuple("linux-ppc64-gnu")}
} else if (process.arch === 's390x') {
${requireTuple("linux-s390x-gnu")}
+ } else if (process.arch === 'ia32') {
+ ${requireTuple("linux-ia32-gnu")}
} else {
loadErrors.push(new Error(\`Unsupported architecture on Linux: \${process.arch}\`))
}
diff --git a/dist/index.cjs b/dist/index.cjs
index 8f467564ab9b95d009c562cb9a78aa513b6d2bb2..291d75aca1095ce67e80ced2de16b5cd59c161c0 100644
--- a/dist/index.cjs
+++ b/dist/index.cjs
@@ -827,6 +827,8 @@ function requireNative() {
${requireTuple("linux-ppc64-gnu")}
} else if (process.arch === 's390x') {
${requireTuple("linux-s390x-gnu")}
+ } else if (process.arch === 'ia32') {
+ ${requireTuple("linux-ia32-gnu")}
} else {
loadErrors.push(new Error(\`Unsupported architecture on Linux: \${process.arch}\`))
}
diff --git a/dist/index.js b/dist/index.js
index e2bfc6368247a58ea3a712bb156e15b440bf139a..f74f13e7189be927cedbd4fd5ba9dd4ca335e6f9 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -801,6 +801,8 @@ function requireNative() {
${requireTuple("linux-ppc64-gnu")}
} else if (process.arch === 's390x') {
${requireTuple("linux-s390x-gnu")}
+ } else if (process.arch === 'ia32') {
+ ${requireTuple("linux-ia32-gnu")}
} else {
loadErrors.push(new Error(\`Unsupported architecture on Linux: \${process.arch}\`))
}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
"x86_64-unknown-linux-gnu",
"aarch64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"aarch64-unknown-linux-musl"
"aarch64-unknown-linux-musl",
"i686-unknown-linux-gnu",
"armv7-unknown-linux-gnueabihf"
]
},
"scripts": {
Expand Down Expand Up @@ -60,7 +62,7 @@
"url": "https://github.com/electron/extract-zip"
},
"devDependencies": {
"@napi-rs/cli": "^3.6.2",
"@napi-rs/cli": "patch:@napi-rs/cli@npm%3A3.6.2#~/.yarn/patches/@napi-rs-cli-npm-3.6.2-b710c59d43.patch",
"extract-zip": "2.0.1",
"yazl": "3.3.1"
}
Expand Down
2 changes: 2 additions & 0 deletions scripts/check-prebuilds.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const EXPECTED = {
'aarch64-unknown-linux-gnu': 'index.linux-arm64-gnu.node',
'x86_64-unknown-linux-musl': 'index.linux-x64-musl.node',
'aarch64-unknown-linux-musl': 'index.linux-arm64-musl.node',
'i686-unknown-linux-gnu': 'index.linux-ia32-gnu.node',
'armv7-unknown-linux-gnueabihf': 'index.linux-arm-gnueabihf.node',
};

const dir = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
Expand Down
32 changes: 30 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@electron-internal/extract-zip@workspace:."
dependencies:
"@napi-rs/cli": "npm:^3.6.2"
"@napi-rs/cli": "patch:@napi-rs/cli@npm%3A3.6.2#~/.yarn/patches/@napi-rs-cli-npm-3.6.2-b710c59d43.patch"
extract-zip: "npm:2.0.1"
yazl: "npm:3.3.1"
languageName: unknown
Expand Down Expand Up @@ -256,7 +256,7 @@ __metadata:
languageName: node
linkType: hard

"@napi-rs/cli@npm:^3.6.2":
"@napi-rs/cli@npm:3.6.2":
version: 3.6.2
resolution: "@napi-rs/cli@npm:3.6.2"
dependencies:
Expand Down Expand Up @@ -284,6 +284,34 @@ __metadata:
languageName: node
linkType: hard

"@napi-rs/cli@patch:@napi-rs/cli@npm%3A3.6.2#~/.yarn/patches/@napi-rs-cli-npm-3.6.2-b710c59d43.patch":
version: 3.6.2
resolution: "@napi-rs/cli@patch:@napi-rs/cli@npm%3A3.6.2#~/.yarn/patches/@napi-rs-cli-npm-3.6.2-b710c59d43.patch::version=3.6.2&hash=058488"
dependencies:
"@inquirer/prompts": "npm:^8.0.0"
"@napi-rs/cross-toolchain": "npm:^1.0.3"
"@napi-rs/wasm-tools": "npm:^1.0.1"
"@octokit/rest": "npm:^22.0.1"
clipanion: "npm:^4.0.0-rc.4"
colorette: "npm:^2.0.20"
emnapi: "npm:^1.9.1"
es-toolkit: "npm:^1.41.0"
js-yaml: "npm:^4.1.0"
obug: "npm:^2.0.0"
semver: "npm:^7.7.3"
typanion: "npm:^3.14.0"
peerDependencies:
"@emnapi/runtime": ^1.7.1
peerDependenciesMeta:
"@emnapi/runtime":
optional: true
bin:
napi: dist/cli.js
napi-raw: cli.mjs
checksum: 10c0/73681d26ce5100769c231f12494ef4af673455e073b72507d0404a8e927342dcfd49df8e612dc517e263add37acab4832203fd6965825e7e871ea93796f9e003
languageName: node
linkType: hard

"@napi-rs/cross-toolchain@npm:^1.0.3":
version: 1.0.3
resolution: "@napi-rs/cross-toolchain@npm:1.0.3"
Expand Down
Loading