feat(target): add support for powerpc64le-unknown-linux-gnu (#2023)
* refactor: remove unused ci.ts * feat(target): add support for powerpc64le-unknown-linux-gnu
This commit is contained in:
parent
7ae562352a
commit
0fa755d30a
11 changed files with 102 additions and 126 deletions
67
.github/workflows/test-release.yaml
vendored
67
.github/workflows/test-release.yaml
vendored
|
@ -238,6 +238,61 @@ jobs:
|
||||||
run: yarn build:test -- --target ${{ matrix.settings.target }} --release
|
run: yarn build:test -- --target ${{ matrix.settings.target }} --release
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
build_for_test_in_docker:
|
||||||
|
name: build - ${{ matrix.settings.target }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
settings:
|
||||||
|
- target: powerpc64le-unknown-linux-gnu
|
||||||
|
setup: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y gcc-powerpc64le-linux-gnu
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
cache: 'yarn'
|
||||||
|
|
||||||
|
- name: Install
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
targets: ${{ matrix.settings.target }}
|
||||||
|
|
||||||
|
- name: Cache cargo
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
target
|
||||||
|
key: stable-ubuntu-latest-${{ matrix.settings.target }}-cargo-cache
|
||||||
|
|
||||||
|
- name: Setup toolchain
|
||||||
|
run: ${{ matrix.settings.setup }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --immutable --mode=skip-build
|
||||||
|
|
||||||
|
- name: Cross build native tests
|
||||||
|
run: yarn build:test -- --target ${{ matrix.settings.target }} --release
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.settings.target }}-example
|
||||||
|
path: examples/napi/*.node
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.settings.target }}-example-compat
|
||||||
|
path: examples/napi-compat-mode/index.node
|
||||||
|
|
||||||
build_in_docker:
|
build_in_docker:
|
||||||
name: build - ${{ matrix.settings.target }}
|
name: build - ${{ matrix.settings.target }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -304,7 +359,9 @@ jobs:
|
||||||
test_in_docker:
|
test_in_docker:
|
||||||
name: Test - ${{ matrix.settings.target }} - ${{ matrix.node }}
|
name: Test - ${{ matrix.settings.target }} - ${{ matrix.node }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build_in_docker
|
needs:
|
||||||
|
- build_in_docker
|
||||||
|
- build_for_test_in_docker
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -320,6 +377,12 @@ jobs:
|
||||||
args: '--platform linux/arm64'
|
args: '--platform linux/arm64'
|
||||||
arch: 'arm64'
|
arch: 'arm64'
|
||||||
libc: 'gnu'
|
libc: 'gnu'
|
||||||
|
- image: 'node:{:version}-slim'
|
||||||
|
target: powerpc64le-unknown-linux-gnu
|
||||||
|
args: '--platform linux/ppc64le'
|
||||||
|
arch: 'ppc64'
|
||||||
|
libc: 'gnu'
|
||||||
|
without-lerna: true
|
||||||
- image: 'node:{:version}-alpine'
|
- image: 'node:{:version}-alpine'
|
||||||
target: x86_64-unknown-linux-musl
|
target: x86_64-unknown-linux-musl
|
||||||
args: ''
|
args: ''
|
||||||
|
@ -369,7 +432,7 @@ jobs:
|
||||||
ulimit -c &&
|
ulimit -c &&
|
||||||
ulimit -c unlimited &&
|
ulimit -c unlimited &&
|
||||||
ulimit -c &&
|
ulimit -c &&
|
||||||
yarn test
|
${{ matrix.settings.without-lerna && 'yarn test:without-lerna' || 'yarn test' }}
|
||||||
- name: List files
|
- name: List files
|
||||||
run: |
|
run: |
|
||||||
ls -la .
|
ls -la .
|
||||||
|
|
|
@ -79,6 +79,12 @@ jobs:
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install gcc-riscv64-linux-gnu -y
|
sudo apt-get install gcc-riscv64-linux-gnu -y
|
||||||
build: ${packageManager} build --platform --target riscv64gc-unknown-linux-gnu
|
build: ${packageManager} build --platform --target riscv64gc-unknown-linux-gnu
|
||||||
|
- host: ubuntu-latest
|
||||||
|
target: 'powerpc64le-unknown-linux-gnu'
|
||||||
|
setup: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install gcc-powerpc64le-linux-gnu -y
|
||||||
|
build: ${packageManager} build --platform --target powerpc64le-unknown-linux-gnu
|
||||||
- host: ubuntu-latest
|
- host: ubuntu-latest
|
||||||
target: 'wasm32-wasi-preview1-threads'
|
target: 'wasm32-wasi-preview1-threads'
|
||||||
build: ${packageManager} build --platform --target wasm32-wasi-preview1-threads
|
build: ${packageManager} build --platform --target wasm32-wasi-preview1-threads
|
||||||
|
|
|
@ -136,6 +136,8 @@ function requireNative() {
|
||||||
} else {
|
} else {
|
||||||
${requireTuple('linux-riscv64-gnu')}
|
${requireTuple('linux-riscv64-gnu')}
|
||||||
}
|
}
|
||||||
|
} else if (process.arch === 'ppc64') {
|
||||||
|
${requireTuple('linux-ppc64-gnu')}
|
||||||
} else if (process.arch === 's390x') {
|
} else if (process.arch === 's390x') {
|
||||||
${requireTuple('linux-s390x-gnu')}
|
${requireTuple('linux-s390x-gnu')}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -121,6 +121,13 @@ Generated by [AVA](https://avajs.dev).
|
||||||
platformArchABI: 'linux-riscv64-gnu',
|
platformArchABI: 'linux-riscv64-gnu',
|
||||||
triple: 'riscv64gc-unknown-linux-gnu',
|
triple: 'riscv64gc-unknown-linux-gnu',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
abi: 'gnu',
|
||||||
|
arch: 'ppc64',
|
||||||
|
platform: 'linux',
|
||||||
|
platformArchABI: 'linux-ppc64-gnu',
|
||||||
|
triple: 'powerpc64le-unknown-linux-gnu',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
abi: 'wasi',
|
abi: 'wasi',
|
||||||
arch: 'wasm32',
|
arch: 'wasm32',
|
||||||
|
|
Binary file not shown.
|
@ -1,117 +0,0 @@
|
||||||
import { TargetTriple } from './target.js'
|
|
||||||
|
|
||||||
export const CIConfig: Partial<
|
|
||||||
Record<
|
|
||||||
TargetTriple,
|
|
||||||
{
|
|
||||||
host: string
|
|
||||||
build_image?: string
|
|
||||||
build_setup?: string[]
|
|
||||||
test?: boolean
|
|
||||||
test_image?: string
|
|
||||||
test_setup?: string[]
|
|
||||||
yarn_cpu?: string
|
|
||||||
yarn_libc?: string
|
|
||||||
}
|
|
||||||
>
|
|
||||||
> = {
|
|
||||||
'x86_64-apple-darwin': {
|
|
||||||
host: 'macos-latest',
|
|
||||||
},
|
|
||||||
'x86_64-pc-windows-msvc': {
|
|
||||||
host: 'windows-latest',
|
|
||||||
},
|
|
||||||
'i686-pc-windows-msvc': {
|
|
||||||
host: 'windows-latest',
|
|
||||||
test: false,
|
|
||||||
},
|
|
||||||
'x86_64-unknown-linux-gnu': {
|
|
||||||
host: 'ubuntu-latest',
|
|
||||||
build_image: 'ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian',
|
|
||||||
},
|
|
||||||
'x86_64-unknown-linux-musl': {
|
|
||||||
host: 'ubuntu-latest',
|
|
||||||
build_image: 'ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine',
|
|
||||||
test_image: 'node:${{ matrix.node }}-alpine',
|
|
||||||
yarn_libc: 'musl',
|
|
||||||
},
|
|
||||||
'aarch64-apple-darwin': {
|
|
||||||
host: 'macos-latest',
|
|
||||||
build_setup: [
|
|
||||||
'sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*',
|
|
||||||
'export CC=$(xcrun -f clang)',
|
|
||||||
'export CXX=$(xcrun -f clang++)',
|
|
||||||
'export SDK_ROOT=$(xcrun --sdk macosx --show-sdk-path)',
|
|
||||||
'export CFLAGS="-isysroot $SDK_ROOT -isystem $SDK_ROOT"',
|
|
||||||
],
|
|
||||||
test: false,
|
|
||||||
},
|
|
||||||
'aarch64-unknown-linux-gnu': {
|
|
||||||
host: 'ubuntu-latest',
|
|
||||||
build_image: 'ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64',
|
|
||||||
build_setup: [
|
|
||||||
'sudo apt-get update',
|
|
||||||
'sudo apt-get install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu -y',
|
|
||||||
'export CARGO_BUILD_TARGET=x86_64-unknown-linux-gnu',
|
|
||||||
],
|
|
||||||
test_image: 'ghcr.io/napi-rs/napi-rs/nodejs:aarch64-${{ matrix.node }}',
|
|
||||||
yarn_cpu: 'arm64',
|
|
||||||
},
|
|
||||||
'aarch64-unknown-linux-musl': {
|
|
||||||
host: 'ubuntu-latest',
|
|
||||||
build_image: 'ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine',
|
|
||||||
build_setup: ['rustup target add aarch64-unknown-linux-musl'],
|
|
||||||
test_image: 'multiarch/alpine:aarch64-latest-stable',
|
|
||||||
test_setup: ['apk add nodejs npm yarn'],
|
|
||||||
yarn_cpu: 'arm64',
|
|
||||||
yarn_libc: 'musl',
|
|
||||||
},
|
|
||||||
'aarch64-pc-windows-msvc': {
|
|
||||||
host: 'windows-latest',
|
|
||||||
test: false,
|
|
||||||
},
|
|
||||||
'armv7-unknown-linux-gnueabihf': {
|
|
||||||
host: 'ubuntu-latest',
|
|
||||||
build_setup: [
|
|
||||||
'sudo apt-get update',
|
|
||||||
'sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -y',
|
|
||||||
],
|
|
||||||
yarn_cpu: 'arm',
|
|
||||||
test_image: 'ghcr.io/napi-rs/napi-rs/nodejs:armhf-${{ matrix.node }}',
|
|
||||||
},
|
|
||||||
'armv7-unknown-linux-musleabihf': {
|
|
||||||
host: 'ubuntu-latest',
|
|
||||||
test: false,
|
|
||||||
yarn_cpu: 'arm',
|
|
||||||
yarn_libc: 'musl',
|
|
||||||
},
|
|
||||||
'aarch64-linux-android': {
|
|
||||||
host: 'ubuntu-latest',
|
|
||||||
build_setup: [
|
|
||||||
'export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"',
|
|
||||||
'export CC="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"',
|
|
||||||
'export CXX="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++"',
|
|
||||||
'export PATH="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}"',
|
|
||||||
],
|
|
||||||
test: false,
|
|
||||||
},
|
|
||||||
'armv7-linux-androideabi': {
|
|
||||||
host: 'ubuntu-latest',
|
|
||||||
build_setup: [
|
|
||||||
'export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"',
|
|
||||||
'export CC="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"',
|
|
||||||
'export CXX="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang++"',
|
|
||||||
'export PATH="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}"',
|
|
||||||
],
|
|
||||||
test: false,
|
|
||||||
},
|
|
||||||
'riscv64gc-unknown-linux-gnu': {
|
|
||||||
host: 'ubuntu-latest',
|
|
||||||
build_setup: [
|
|
||||||
'sudo apt-get update',
|
|
||||||
'sudo apt-get install g++-riscv64-linux-gnu gcc-riscv64-linux-gnu -y',
|
|
||||||
],
|
|
||||||
// No official nodejs docker image for riscv64
|
|
||||||
test: false,
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,4 +1,3 @@
|
||||||
export * from './ci.js'
|
|
||||||
export * from './log.js'
|
export * from './log.js'
|
||||||
export * from './misc.js'
|
export * from './misc.js'
|
||||||
export * from './target.js'
|
export * from './target.js'
|
||||||
|
|
|
@ -23,6 +23,7 @@ export const AVAILABLE_TARGETS = [
|
||||||
'armv7-linux-androideabi',
|
'armv7-linux-androideabi',
|
||||||
'universal-apple-darwin',
|
'universal-apple-darwin',
|
||||||
'riscv64gc-unknown-linux-gnu',
|
'riscv64gc-unknown-linux-gnu',
|
||||||
|
'powerpc64le-unknown-linux-gnu',
|
||||||
'wasm32-wasi-preview1-threads',
|
'wasm32-wasi-preview1-threads',
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
|
@ -38,6 +39,7 @@ export const DEFAULT_TARGETS = [
|
||||||
export const TARGET_LINKER: Record<string, string> = {
|
export const TARGET_LINKER: Record<string, string> = {
|
||||||
'aarch64-unknown-linux-musl': 'aarch64-linux-musl-gcc',
|
'aarch64-unknown-linux-musl': 'aarch64-linux-musl-gcc',
|
||||||
'riscv64gc-unknown-linux-gnu': 'riscv64-linux-gnu-gcc',
|
'riscv64gc-unknown-linux-gnu': 'riscv64-linux-gnu-gcc',
|
||||||
|
'powerpc64le-unknown-linux-gnu': 'powerpc64le-linux-gnu-gcc',
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://nodejs.org/api/process.html#process_process_arch
|
// https://nodejs.org/api/process.html#process_process_arch
|
||||||
|
@ -63,6 +65,7 @@ const CpuToNodeArch: Record<string, NodeJSArch> = {
|
||||||
i686: 'ia32',
|
i686: 'ia32',
|
||||||
armv7: 'arm',
|
armv7: 'arm',
|
||||||
riscv64gc: 'riscv64',
|
riscv64gc: 'riscv64',
|
||||||
|
powerpc64le: 'ppc64',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const NodeArchToCpu: Record<string, string> = {
|
export const NodeArchToCpu: Record<string, string> = {
|
||||||
|
@ -71,6 +74,7 @@ export const NodeArchToCpu: Record<string, string> = {
|
||||||
ia32: 'i686',
|
ia32: 'i686',
|
||||||
arm: 'armv7',
|
arm: 'armv7',
|
||||||
riscv64: 'riscv64gc',
|
riscv64: 'riscv64gc',
|
||||||
|
ppc64: 'powerpc64le',
|
||||||
}
|
}
|
||||||
|
|
||||||
const SysToNodePlatform: Record<string, Platform> = {
|
const SysToNodePlatform: Record<string, Platform> = {
|
||||||
|
|
|
@ -297,6 +297,18 @@ function requireNative() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} else if (process.arch === 'ppc64') {
|
||||||
|
try {
|
||||||
|
return require('./example.linux-ppc64-gnu.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return require('@examples/napi-linux-ppc64-gnu')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
|
||||||
} else if (process.arch === 's390x') {
|
} else if (process.arch === 's390x') {
|
||||||
try {
|
try {
|
||||||
return require('./example.linux-s390x-gnu.node')
|
return require('./example.linux-s390x-gnu.node')
|
||||||
|
|
|
@ -309,12 +309,12 @@ module.exports.platformArchTriples = {
|
||||||
abi: 'gnu',
|
abi: 'gnu',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
powerpc64le: [
|
ppc64: [
|
||||||
{
|
{
|
||||||
triple: 'powerpc64le-unknown-linux-gnu',
|
triple: 'powerpc64le-unknown-linux-gnu',
|
||||||
platformArchABI: 'linux-powerpc64le-gnu',
|
platformArchABI: 'linux-ppc64-gnu',
|
||||||
platform: 'linux',
|
platform: 'linux',
|
||||||
arch: 'powerpc64le',
|
arch: 'ppc64',
|
||||||
abi: 'gnu',
|
abi: 'gnu',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -310,12 +310,12 @@ export const platformArchTriples = {
|
||||||
"abi": "gnu"
|
"abi": "gnu"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"powerpc64le": [
|
"ppc64": [
|
||||||
{
|
{
|
||||||
"triple": "powerpc64le-unknown-linux-gnu",
|
"triple": "powerpc64le-unknown-linux-gnu",
|
||||||
"platformArchABI": "linux-powerpc64le-gnu",
|
"platformArchABI": "linux-ppc64-gnu",
|
||||||
"platform": "linux",
|
"platform": "linux",
|
||||||
"arch": "powerpc64le",
|
"arch": "ppc64",
|
||||||
"abi": "gnu"
|
"abi": "gnu"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue