Skip to content

Commit

Permalink
Musl: add arm64 build
Browse files Browse the repository at this point in the history
Closes #133
  • Loading branch information
jerbob92 authored and bblanchon committed Oct 11, 2023
1 parent aad7031 commit 76fff42
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 5 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/build-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,18 @@ jobs:
target_cpu: x86
enable_v8: true

linux_musl_arm64:
name: Linux musl arm64
uses: ./.github/workflows/build.yml
with:
branch: ${{ github.event.inputs.branch }}
version: ${{ github.event.inputs.version }}
is_debug: ${{ github.event.inputs.is_debug == 'true' }}
target_os: linux
target_cpu: arm64
target_libc: musl
enable_v8: false

linux_musl_x64:
name: Linux musl x64
uses: ./.github/workflows/build.yml
Expand Down Expand Up @@ -631,6 +643,7 @@ jobs:
- linux_arm_v8
- linux_arm64
- linux_arm64_v8
- linux_musl_arm64
- linux_musl_x64
- linux_musl_x64_v8
- linux_musl_x86
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
/staging/
/build/
*.tgz
/*-musl-cross/
/*-musl*-cross/
/android-ndk*
/conda/out/
44 changes: 44 additions & 0 deletions patches/musl/toolchain.gn
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,47 @@ gcc_toolchain("x64") {
is_clang = false
}
}

gcc_toolchain("arm") {
toolprefix = "arm-linux-musleabihf-"

cc = "${toolprefix}gcc"
cxx = "${toolprefix}g++"

readelf = "${toolprefix}readelf"
nm = "${toolprefix}nm"
ar = "${toolprefix}ar"
ld = cxx

extra_ldflags = "-static-libgcc -static-libstdc++"

toolchain_args = {
current_cpu = "arm"
current_os = "linux"

use_remoteexec = false
is_clang = false
}
}

gcc_toolchain("arm64") {
toolprefix = "aarch64-linux-musl-"

cc = "${toolprefix}gcc"
cxx = "${toolprefix}g++"

readelf = "${toolprefix}readelf"
nm = "${toolprefix}nm"
ar = "${toolprefix}ar"
ld = cxx

extra_ldflags = "-static-libgcc -static-libstdc++"

toolchain_args = {
current_cpu = "arm64"
current_os = "linux"

use_remoteexec = false
is_clang = false
}
}
10 changes: 10 additions & 0 deletions steps/01-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ case "$TARGET_OS" in
MUSL_VERSION="x86_64-linux-musl-cross"
PACKAGES="g++-10"
;;

arm)
MUSL_VERSION="arm-linux-musleabihf-cross"
PACKAGES="g++-10"
;;

arm64)
MUSL_VERSION="aarch64-linux-musl-cross"
PACKAGES="g++-10"
;;
esac

[ -d "$MUSL_VERSION" ] || curl -L "$MUSL_URL/$MUSL_VERSION.tgz" | tar xz
Expand Down
16 changes: 12 additions & 4 deletions steps/08-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,20 @@ case "$OS" in
linux)
case "$CPU" in
arm)
PREFIX="arm-linux-gnueabihf-"
SUFFIX="-10"
if [ "$TARGET_LIBC" == "musl" ]; then
PREFIX="arm-linux-musleabihf-"
else
PREFIX="arm-linux-gnueabihf-"
SUFFIX="-10"
fi
;;
arm64)
PREFIX="aarch64-linux-gnu-"
SUFFIX="-10"
if [ "$TARGET_LIBC" == "musl" ]; then
PREFIX="aarch64-linux-musl-"
else
PREFIX="aarch64-linux-gnu-"
SUFFIX="-10"
fi
;;
x86)
if [ "$TARGET_LIBC" == "musl" ]; then
Expand Down

0 comments on commit 76fff42

Please sign in to comment.