Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Linux ARM64 binaries #401

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 28 additions & 8 deletions .github/workflows/early-access.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ jobs:
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, macOS-12, macos-14, windows-latest ]
os: [ ubuntu-latest, linux-arm64, macOS-12, macos-14, windows-latest ]
gu-binary: [ gu, gu.cmd ]
exclude:
- os: ubuntu-latest
gu-binary: gu.cmd
- os: linux-arm64
gu-binary: gu.cmd
- os: macOS-12
gu-binary: gu.cmd
- os: macos-14
Expand Down Expand Up @@ -56,22 +58,40 @@ jobs:
run: |
TMP_DIR=$(mktemp -d)
pushd $TMP_DIR
curl -LOJ http://more.musl.cc/10/x86_64-linux-musl/x86_64-linux-musl-native.tgz
tar -xvf x86_64-linux-musl-native.tgz
case $MATRIX_OS in
ubuntu-latest)
curl -LOJ https://musl.cc/x86_64-linux-musl-native.tgz
tar -xvf x86_64-linux-musl-native.tgz
TOOLCHAIN_DIR=$TMP_DIR/x86_64-linux-musl-native
;;
linux-arm64)
curl -LOJ https://musl.cc/aarch64-linux-musl-native.tgz
tar -xvf aarch64-linux-musl-native.tgz
TOOLCHAIN_DIR=$TMP_DIR/aarch64-linux-musl-native
# Symlink x86_64-linux-musl-gcc to aarch64-linux-musl-gcc as native-image expects the former to be present
# See https://www.graalvm.org/dev/reference-manual/native-image/guides/build-static-executables/
ln -s $TOOLCHAIN_DIR/bin/aarch64-linux-musl-gcc $TOOLCHAIN_DIR/bin/x86_64-linux-musl-gcc
;;
*)
echo 'Unexpected CPU architecture!'
exit 1
;;
esac

curl -LOJ https://zlib.net/fossils/zlib-1.3.tar.gz
tar -xzf zlib-1.3.tar.gz
cd zlib-1.3

TOOLCHAIN_DIR=$TMP_DIR/x86_64-linux-musl-native
CC=$TOOLCHAIN_DIR/bin/gcc

./configure --prefix=$TOOLCHAIN_DIR --static
make
make install

echo "TOOLCHAIN_DIR=$TOOLCHAIN_DIR" >> $GITHUB_OUTPUT
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-latest' || matrix.os == 'linux-arm64'
env:
MATRIX_OS: ${{ matrix.os }}

- name: Cache Maven packages
id: restore-maven-package-cache
Expand All @@ -86,12 +106,12 @@ jobs:
PATH=${TOOLCHAIN_DIR}/bin:$PATH; mvn -B -Pnative package
env:
TOOLCHAIN_DIR: ${{ steps.prepare-musl.outputs.TOOLCHAIN_DIR }}
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-latest' || matrix.os == 'linux-arm64'

- name: Build static native image for Windows / macOS
run: |
mvn -B -Pnative package
if: matrix.os != 'ubuntu-latest'
if: matrix.os != 'ubuntu-latest' && matrix.os != 'linux-arm64'

- name: Create distribution
run: mvn -B -Pdist package -DskipTests
Expand Down Expand Up @@ -134,7 +154,7 @@ jobs:

- name: Move build artifacts to correct folder
run: |
targets=("ubuntu-latest" "macOS-latest" "macos-14" "windows-latest")
targets=("ubuntu-latest" "linux-arm64" "macOS-latest" "macos-14" "windows-latest")

mkdir -p artifacts

Expand Down
36 changes: 28 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,13 @@ jobs:
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, macOS-12, macos-14, windows-latest ]
os: [ ubuntu-latest, linux-arm64, macOS-12, macos-14, windows-latest ]
gu-binary: [ gu, gu.cmd ]
exclude:
- os: ubuntu-latest
gu-binary: gu.cmd
- os: linux-arm64
gu-binary: gu.cmd
- os: macOS-12
gu-binary: gu.cmd
- os: macos-14
Expand Down Expand Up @@ -115,22 +117,40 @@ jobs:
run: |
TMP_DIR=$(mktemp -d)
pushd $TMP_DIR
curl -LOJ http://more.musl.cc/10/x86_64-linux-musl/x86_64-linux-musl-native.tgz
tar -xvf x86_64-linux-musl-native.tgz
case $MATRIX_OS in
ubuntu-latest)
curl -LOJ https://musl.cc/x86_64-linux-musl-native.tgz
tar -xvf x86_64-linux-musl-native.tgz
TOOLCHAIN_DIR=$TMP_DIR/x86_64-linux-musl-native
;;
linux-arm64)
curl -LOJ https://musl.cc/aarch64-linux-musl-native.tgz
tar -xvf aarch64-linux-musl-native.tgz
TOOLCHAIN_DIR=$TMP_DIR/aarch64-linux-musl-native
# Symlink x86_64-linux-musl-gcc to aarch64-linux-musl-gcc as native-image expects the former to be present
# See https://www.graalvm.org/dev/reference-manual/native-image/guides/build-static-executables/
ln -s $TOOLCHAIN_DIR/bin/aarch64-linux-musl-gcc $TOOLCHAIN_DIR/bin/x86_64-linux-musl-gcc
;;
*)
echo 'Unexpected CPU architecture!'
exit 1
;;
esac

curl -LOJ https://zlib.net/fossils/zlib-1.3.tar.gz
tar -xzf zlib-1.3.tar.gz
cd zlib-1.3

TOOLCHAIN_DIR=$TMP_DIR/x86_64-linux-musl-native
CC=$TOOLCHAIN_DIR/bin/gcc

./configure --prefix=$TOOLCHAIN_DIR --static
make
make install

echo "TOOLCHAIN_DIR=$TOOLCHAIN_DIR" >> $GITHUB_OUTPUT
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-latest' || matrix.os == 'linux-arm64'
env:
MATRIX_OS: ${{ matrix.os }}

- name: Cache Maven packages
uses: actions/cache@v4.0.2
Expand All @@ -144,12 +164,12 @@ jobs:
PATH=${TOOLCHAIN_DIR}/bin:$PATH; mvn -B -Pnative package
env:
TOOLCHAIN_DIR: ${{ steps.prepare-musl.outputs.TOOLCHAIN_DIR }}
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-latest' || matrix.os == 'linux-arm64'

- name: Build static native image for Windows / macOS
run: |
mvn -B -Pnative package
if: matrix.os != 'ubuntu-latest'
if: matrix.os != 'ubuntu-latest' && matrix.os != 'linux-arm64'

- name: Create distribution
run: mvn -B -Pdist package -DskipTests
Expand Down Expand Up @@ -208,7 +228,7 @@ jobs:

- name: Move build artifacts to correct folder
run: |
targets=("ubuntu-latest" "macOS-latest" "macos-14" "windows-latest")
targets=("ubuntu-latest" "linux-arm64" "macOS-latest" "macos-14" "windows-latest")

mkdir -p artifacts

Expand Down
12 changes: 10 additions & 2 deletions jreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ distributions:
localPlugs:
- network
architectures:
- buildOn: [amd64]
runOn: [amd64]
- buildOn: [amd64, arm64]
runOn: [amd64, arm64]
repository:
active: RELEASE
name: mcs-snap
Expand All @@ -91,10 +91,18 @@ distributions:
platform: linux-x86_64
extraProperties:
graalVMNativeImage: true
- path: ./{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-linux-arm64.zip
platform: linux-arm64
extraProperties:
graalVMNativeImage: true
- path: ./{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-linux-x86_64.tar.gz
platform: linux-x86_64
extraProperties:
graalVMNativeImage: true
- path: ./{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-linux-arm64.tar.gz
platform: linux-arm64
extraProperties:
graalVMNativeImage: true
- path: ./{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-windows-x86_64.zip
platform: windows-x86_64
- path: ./{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-osx-x86_64.zip
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/it/mulders/mcs/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ private static void setUpProxy() {
System.setProperty("https.proxyPort", Integer.toString(uri.getPort()));
}
} catch (URISyntaxException e) {
System.err.println("Error while setting up proxy from environment: HTTP_PROXY=[%s], HTTPS_PROXY=[%s]"
.formatted(httpProxy, httpsProxy));
System.err.printf(
"Error while setting up proxy from environment: HTTP_PROXY=[%s], HTTPS_PROXY=[%s]%n",
httpProxy, httpsProxy);
}
}

Expand Down
Loading