Add support for linuxstatic armv7 binaries

This commit is contained in:
Sören Beye 2021-05-28 19:11:01 +02:00 committed by Jesse Chan
parent 7530a93030
commit 27e00d1d72
3 changed files with 22 additions and 6 deletions

View File

@ -11,12 +11,17 @@ jobs:
fail-fast: false
matrix:
target-node: [10, 12, 14, 16]
target-arch: [x64, arm64]
target-arch: [x64, arm64, armv7]
include:
- target-arch: x64
target-toolchain: x86_64
target-triple: x86_64-linux-musl
host-arch: x86_64
- target-arch: arm64
target-toolchain: aarch64
target-triple: aarch64-linux-musl
host-arch: x86_64
- target-arch: armv7
target-triple: armv7l-linux-musleabihf
host-arch: i686
steps:
- uses: actions/checkout@v2
@ -28,7 +33,8 @@ jobs:
uses: docker/build-push-action@v2
with:
build-args: |
TARGET_TOOLCHAIN_ARCH=${{ matrix.target-toolchain }}
HOST_ARCH=${{ matrix.host-arch }}
TARGET_TRIPLE=${{ matrix.target-triple }}
PKG_FETCH_OPTION_a=${{ matrix.target-arch }}
PKG_FETCH_OPTION_n=node${{ matrix.target-node }}
PKG_FETCH_OPTION_p=linuxstatic

View File

@ -1,6 +1,7 @@
ARG TARGET_TOOLCHAIN_ARCH
ARG HOST_ARCH=x86_64
ARG TARGET_TRIPLE=aarch64-linux-musl
FROM muslcc/x86_64:$TARGET_TOOLCHAIN_ARCH-linux-musl
FROM muslcc/$HOST_ARCH:$TARGET_TRIPLE
ARG PKG_FETCH_OPTION_a
ARG PKG_FETCH_OPTION_n

View File

@ -179,6 +179,15 @@ async function compileOnUnix(
args.push('--dest-cpu', cpu);
}
if (targetArch === 'armv7') {
const { CFLAGS = '', CXXFLAGS = '' } = process.env;
process.env.CFLAGS = `${CFLAGS} -marm -mcpu=cortex-a7`;
process.env.CXXFLAGS = `${CXXFLAGS} -marm -mcpu=cortex-a7`;
args.push('--with-arm-float-abi=hard');
args.push('--with-arm-fpu=vfpv3');
}
if (hostArch !== targetArch) {
log.warn('Cross compiling!');
log.warn('You are responsible for appropriate env like CC, CC_host, etc.');