Skip to content

Commit

Permalink
Add linux arm musl build (#5471)
Browse files Browse the repository at this point in the history
* Add linux arm musl build

* Use strip = true in Cargo.toml instead
  • Loading branch information
sapphi-red committed Apr 15, 2024
1 parent 7275328 commit 49ed6d9
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 26 deletions.
41 changes: 18 additions & 23 deletions .github/workflows/build-and-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,13 @@ jobs:
target: x86_64-apple-darwin
build: >-
set -e &&
npm run build:napi -- --release &&
strip -x *.node
npm run build:napi -- --release
- host: macos-latest
target: aarch64-apple-darwin
build: >-
set -e &&
rustup target add aarch64-apple-darwin &&
npm run build:napi -- --release --target aarch64-apple-darwin &&
strip -x *.node
npm run build:napi -- --release --target aarch64-apple-darwin
# Linux
- host: ubuntu-latest
Expand All @@ -123,14 +121,13 @@ jobs:
build: >-
set -e &&
rustup target add x86_64-unknown-linux-gnu &&
npm run build:napi -- --release --target x86_64-unknown-linux-gnu &&
strip *.node
npm run build:napi -- --release --target x86_64-unknown-linux-gnu
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: >-
set -e &&
npm run build:napi -- --release && strip *.node
npm run build:napi -- --release
- host: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
zig: true
Expand All @@ -139,8 +136,13 @@ jobs:
sudo apt-get install gcc-arm-linux-gnueabihf -y
build: >-
set -e &&
npm run build:napi -- --release --target armv7-unknown-linux-gnueabihf &&
arm-linux-gnueabihf-strip *.node
npm run build:napi -- --release --target armv7-unknown-linux-gnueabihf
- host: ubuntu-latest
target: armv7-unknown-linux-musleabihf
zig: true
build: >-
set -e &&
npm run build:napi -- --release --target armv7-unknown-linux-musleabihf
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
Expand All @@ -149,8 +151,7 @@ jobs:
export JEMALLOC_SYS_WITH_LG_PAGE=16 &&
rustup default nightly-2023-10-05 &&
rustup target add aarch64-unknown-linux-gnu &&
npm run build:napi -- --release --target aarch64-unknown-linux-gnu &&
aarch64-unknown-linux-gnu-strip *.node
npm run build:napi -- --release --target aarch64-unknown-linux-gnu
- host: ubuntu-latest
target: aarch64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
Expand All @@ -159,20 +160,17 @@ jobs:
export JEMALLOC_SYS_WITH_LG_PAGE=16 &&
rustup default nightly-2023-10-05 &&
rustup target add aarch64-unknown-linux-musl &&
RUSTFLAGS='-C target-feature=-crt-static -C linker=aarch64-linux-musl-gcc' npm run build:napi -- --release --target aarch64-unknown-linux-musl &&
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node
RUSTFLAGS='-C target-feature=-crt-static -C linker=aarch64-linux-musl-gcc' npm run build:napi -- --release --target aarch64-unknown-linux-musl
- host: ubuntu-latest
target: armv7-linux-androideabi
build: >-
set -e &&
npm run build:napi -- --release --target armv7-linux-androideabi &&
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
npm run build:napi -- --release --target armv7-linux-androideabi
- host: ubuntu-latest
target: aarch64-linux-android
build: >-
set -e &&
npm run build:napi -- --release --target aarch64-linux-android &&
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
npm run build:napi -- --release --target aarch64-linux-android
- host: ubuntu-latest
target: riscv64gc-unknown-linux-gnu
setup: |
Expand All @@ -181,8 +179,7 @@ jobs:
build: >-
set -e &&
rustup target add riscv64gc-unknown-linux-gnu &&
npm run build:napi -- --release --target riscv64gc-unknown-linux-gnu &&
riscv64-linux-gnu-strip *.node
npm run build:napi -- --release --target riscv64gc-unknown-linux-gnu
- host: ubuntu-latest
target: powerpc64le-unknown-linux-gnu
setup: |
Expand All @@ -191,8 +188,7 @@ jobs:
build: >-
set -e &&
export CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_LINKER=powerpc64le-linux-gnu-gcc && rustup target add powerpc64le-unknown-linux-gnu &&
npm run build:napi -- --release --target powerpc64le-unknown-linux-gnu &&
powerpc64le-linux-gnu-strip *.node
npm run build:napi -- --release --target powerpc64le-unknown-linux-gnu
- host: ubuntu-latest
target: s390x-unknown-linux-gnu
setup: |
Expand All @@ -202,8 +198,7 @@ jobs:
set -e &&
export CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc &&
rustup target add s390x-unknown-linux-gnu &&
npm run build:napi -- --release --target s390x-unknown-linux-gnu &&
s390x-linux-gnu-strip *.node
npm run build:napi -- --release --target s390x-unknown-linux-gnu
name: Build ${{ matrix.settings.name || matrix.settings.target }}
runs-on: ${{ matrix.settings.host }}
timeout-minutes: 30
Expand Down
2 changes: 1 addition & 1 deletion native.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const bindingsByPlatformAndArch = {
x64: { base: 'darwin-x64' }
},
linux: {
arm: { base: 'linux-arm-gnueabihf', musl: null },
arm: { base: 'linux-arm-gnueabihf', musl: 'linux-arm-musleabihf' },
arm64: { base: 'linux-arm64-gnu', musl: 'linux-arm64-musl' },
ppc64: { base: 'linux-powerpc64le-gnu', musl: null },
riscv64: { base: 'linux-riscv64-gnu', musl: null },
Expand Down
3 changes: 3 additions & 0 deletions npm/linux-arm-musleabihf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `@rollup/rollup-linux-arm-musleabihf`

This is the **armv7-unknown-linux-musleabihf** binary for `rollup`
19 changes: 19 additions & 0 deletions npm/linux-arm-musleabihf/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@rollup/rollup-linux-arm-musleabihf",
"version": "0.0.0",
"os": [
"linux"
],
"cpu": [
"arm"
],
"files": [
"rollup.linux-arm-musleabihf.node"
],
"description": "Native bindings for Rollup",
"author": "Lukas Taegert-Atkinson",
"homepage": "https://rollupjs.org/",
"license": "MIT",
"repository": "rollup/rollup",
"main": "./rollup.linux-arm-musleabihf.node"
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"aarch64-unknown-linux-musl",
"armv7-linux-androideabi",
"armv7-unknown-linux-gnueabihf",
"armv7-unknown-linux-musleabihf",
"i686-pc-windows-msvc",
"riscv64gc-unknown-linux-gnu",
"powerpc64le-unknown-linux-gnu",
Expand Down Expand Up @@ -120,7 +121,7 @@
"@codemirror/view": "^6.26.1",
"@jridgewell/sourcemap-codec": "^1.4.15",
"@mermaid-js/mermaid-cli": "^10.8.0",
"@napi-rs/cli": "^2.18.0",
"@napi-rs/cli": "^2.18.1",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-buble": "^1.0.3",
"@rollup/plugin-commonjs": "^25.0.7",
Expand Down
1 change: 1 addition & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[profile.release]
lto = true
strip = true

[workspace]
resolver = "2"
Expand Down

0 comments on commit 49ed6d9

Please sign in to comment.