Skip to content

Commit

Permalink
feat: add support for LoongArch (#5749)
Browse files Browse the repository at this point in the history
feat: add support for loongarch
  • Loading branch information
darkyzhou authored Dec 6, 2024
1 parent d3464e4 commit 4d6b077
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/build-and-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ jobs:
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
- host: ubuntu-latest
target: loongarch64-unknown-linux-gnu
docker: ghcr.io/darkyzhou/napi-rs-nodejs-rust:trixie-loongarch64
build: >-
set -e &&
npm run build:napi -- --release --target loongarch64-unknown-linux-gnu
name: Build ${{ matrix.settings.name || matrix.settings.target }}
runs-on: ${{ matrix.settings.host }}
timeout-minutes: 30
Expand Down
1 change: 1 addition & 0 deletions native.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const bindingsByPlatformAndArch = {
linux: {
arm: { base: 'linux-arm-gnueabihf', musl: 'linux-arm-musleabihf' },
arm64: { base: 'linux-arm64-gnu', musl: 'linux-arm64-musl' },
loong64: { base: 'linux-loongarch64-gnu', musl: null },
ppc64: { base: 'linux-powerpc64le-gnu', musl: null },
riscv64: { base: 'linux-riscv64-gnu', musl: null },
s390x: { base: 'linux-s390x-gnu', musl: null },
Expand Down
3 changes: 3 additions & 0 deletions npm/linux-loongarch64-gnu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `@rollup/rollup-linux-loongarch64-gnu`

This is the **loongarch64-unknown-linux-gnu** binary for `rollup`
22 changes: 22 additions & 0 deletions npm/linux-loongarch64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "@rollup/rollup-linux-loongarch64-gnu",
"version": "0.0.0",
"os": [
"linux"
],
"cpu": [
"loong64"
],
"files": [
"rollup.linux-loongarch64-gnu.node"
],
"description": "Native bindings for Rollup",
"author": "Lukas Taegert-Atkinson",
"homepage": "https://rollupjs.org/",
"license": "MIT",
"repository": "rollup/rollup",
"libc": [
"glibc"
],
"main": "./rollup.linux-loongarch64-gnu.node"
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"armv7-unknown-linux-gnueabihf",
"armv7-unknown-linux-musleabihf",
"i686-pc-windows-msvc",
"loongarch64-unknown-linux-gnu",
"riscv64gc-unknown-linux-gnu",
"powerpc64le-unknown-linux-gnu",
"s390x-unknown-linux-gnu",
Expand Down
2 changes: 1 addition & 1 deletion rust/bindings_napi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ xxhash = { path = "../xxhash" }
[target.'cfg(not(any(target_os = "linux", target_os = "freebsd")))'.dependencies]
mimalloc-rust = { version = "0.2.1" }

[target.'cfg(any(all(target_os = "linux", not(all(target_env = "musl", target_arch = "aarch64"))), all(target_os = "freebsd", not(target_arch = "aarch64"))))'.dependencies]
[target.'cfg(any(all(target_os = "linux", not(all(target_env = "musl", target_arch = "aarch64")), not(target_arch = "loongarch64")), all(target_os = "freebsd", not(target_arch = "aarch64"))))'.dependencies]
mimalloc-rust = { version = "0.2.1", features = ["local-dynamic-tls"] }

[build-dependencies]
Expand Down
1 change: 1 addition & 0 deletions rust/bindings_napi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use parse_ast::parse_ast;

#[cfg(all(
not(all(target_os = "linux", target_env = "musl", target_arch = "aarch64")),
not(all(target_os = "linux", target_arch = "loongarch64")),
not(all(target_os = "freebsd", target_arch = "aarch64")),
not(debug_assertions)
))]
Expand Down

0 comments on commit 4d6b077

Please sign in to comment.