Skip to content

Commit e0afecf

Browse files
author
psadi
committed
add support arm test
1 parent bb9fdf0 commit e0afecf

File tree

3 files changed

+58
-31
lines changed

3 files changed

+58
-31
lines changed

.github/workflows/ci.yaml

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
---
21
name: Build
3-
42
on:
53
workflow_dispatch: {}
64
pull_request:
@@ -14,32 +12,47 @@ jobs:
1412
actions: read
1513
security-events: write
1614
contents: write
17-
name: Build Ghostty
18-
runs-on: ubuntu-latest
15+
name: Build Ghostty (${{ matrix.arch }})
16+
runs-on: ubuntu-24.04
1917
strategy:
2018
matrix:
21-
container: [ "ubuntu:24.04", "arm64v8/ubuntu:24.04" ]
22-
container:
23-
image: ${{ matrix.container }}
24-
options: "--privileged --cap-add SYS_ADMIN --device /dev/fuse"
19+
include:
20+
- arch: aarch64
21+
platform: linux/arm64
22+
- arch: x86_64
23+
platform: linux/amd64
2524
steps:
2625
- name: Checkout ghostty-appimage
2726
uses: actions/checkout@v4
2827
with:
2928
persist-credentials: false
3029

31-
- name: Setup Build Env
32-
run: ./setup.sh
30+
- name: Set up QEMU
31+
uses: docker/setup-qemu-action@v3
32+
continue-on-error: true
33+
34+
- name: Set up Docker Buildx
35+
uses: docker/setup-buildx-action@v3
36+
continue-on-error: true
3337

34-
- name: Build Ghostty
35-
run: ./build.sh
38+
- name: Build in Docker
39+
run: |
40+
docker run --rm --privileged \
41+
--cap-add SYS_ADMIN \
42+
--device /dev/fuse \
43+
--platform ${{ matrix.platform }} \
44+
-v ${{ github.workspace }}:/work \
45+
-v /tmp:/tmp \
46+
-w /work \
47+
ubuntu:24.04 \
48+
bash -c "./setup.sh && ./build.sh"
3649
3750
- name: Upload Artifact
3851
uses: actions/upload-artifact@v4
3952
with:
40-
name: ghostty-appimage
53+
name: ghostty-appimage-${{ matrix.arch }}
4154
retention-days: 7
42-
path: /tmp/ghostty-build/Ghostty-*-x86_64.AppImage*
55+
path: /tmp/ghostty-build/Ghostty-*-${{ matrix.arch }}.AppImage*
4356

4457
release_appimage:
4558
permissions:
@@ -48,18 +61,19 @@ jobs:
4861
contents: write
4962
name: "Upload binaries to current release"
5063
runs-on: ubuntu-latest
51-
if: ${{ github.event_name == 'release' }}
64+
#if: ${{ github.event_name == 'release' }}
5265
needs: "build_appimage"
5366
steps:
5467
- uses: actions/download-artifact@v4
5568
with:
56-
name: ghostty-appimage
69+
pattern: ghostty-appimage-*
70+
merge-multiple: true
5771

5872
- name: Upload binaries to release
5973
uses: svenstaro/upload-release-action@v2
6074
with:
6175
repo_token: ${{ secrets.GITHUB_TOKEN }}
62-
file: ./Ghostty-*-x86_64.AppImage*
76+
file: ./Ghostty-*-*.AppImage*
6377
tag: ${{ github.ref }}
6478
overwrite: true
6579
file_glob: true

build.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ GHOSTTY_VERSION="1.0.1"
88

99
# Detect latest version numbers when jq is available.
1010
if command -v jq >/dev/null 2>&1; then
11-
if [ "$1" = "latest" ]; then
11+
if [ "${1}" = "latest" ]; then
1212
GHOSTTY_VERSION="$(
1313
curl -s https://api.github.com/repos/ghostty-org/ghostty/tags |
1414
jq '[.[] | select(.name != "tip") | .name | ltrimstr("v")] | sort_by(split(".") | map(tonumber)) | last'
@@ -47,23 +47,36 @@ sed -i 's/linkSystemLibrary2("bzip2", dynamic_link_opts)/linkSystemLibrary2("bz2
4747
# Fetch Zig Cache
4848
ZIG_GLOBAL_CACHE_DIR=/tmp/offline-cache ./nix/build-support/fetch-zig-cache.sh
4949

50+
case "${ARCH}" in
51+
"x86_64")
52+
ld_linux="ld-linux-x86-64.so.2"
53+
ZIG_BUILD_OPTS="-Dcpu=baseline -Dtarget=x86-linux-gnu"
54+
;;
55+
"aarch64")
56+
ld_linux="ld-linux-aarch64.so.1"
57+
ZIG_BUILD_OPTS="-Dcpu=armv8 -Dtarget=aarch64-linux-gnu"
58+
;;
59+
*) ;;
60+
esac
61+
5062
# Build Ghostty with zig
5163
zig build \
5264
--summary all \
5365
--prefix "${APP_DIR}/usr" \
5466
--system /tmp/offline-cache/p \
5567
-Doptimize=ReleaseFast \
56-
-Dcpu=baseline \
5768
-Dpie=true \
5869
-Demit-docs \
70+
${ZIG_BUILD_OPTS} \
5971
-Dversion-string="${GHOSTTY_VERSION}"
6072

6173
cd "${APP_DIR}"
6274

6375
# bundle all libs
6476
ldd ./usr/bin/ghostty | awk -F"[> ]" '{print $4}' | xargs -I {} cp --update=none -v {} ./usr/lib
65-
if ! mv ./usr/lib/ld-linux-x86-64.so.2 ./; then
66-
cp -v /lib64/ld-linux-x86-64.so.2 ./
77+
78+
if ! mv ./usr/lib/${ld_linux} ./ld-linux.so; then
79+
cp -v /lib64/${ld_linux} ./ld-linux.so
6780
fi
6881

6982
# Prepare AppImage -- Configure launcher script, metainfo and desktop file with icon.
@@ -72,10 +85,9 @@ cat <<'EOF' >./AppRun
7285
7386
HERE="$(dirname "$(readlink -f "$0")")"
7487
75-
export TERM=xterm-256color
7688
export GHOSTTY_RESOURCES_DIR="${HERE}/usr/share/ghostty"
7789
78-
exec "${HERE}"/ld-linux-x86-64.so.2 --library-path "${HERE}"/usr/lib "${HERE}"/usr/bin/ghostty "$@"
90+
exec "${HERE}"/ld-linux.so --library-path "${HERE}"/usr/lib "${HERE}"/usr/bin/ghostty "$@"
7991
EOF
8092

8193
chmod +x AppRun

setup.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
set -e
44

55
export DEBIAN_FRONTEND="noninteractive"
6+
export ARCH="$(uname -m)"
67

78
ZIG_VERSION="0.13.0"
89
MINISIGN_URL="https://github.com/jedisct1/minisign/releases/download/0.11/minisign-0.11-linux.tar.gz"
@@ -29,22 +30,22 @@ apt-get -qq update && apt-get -qq -y upgrade && apt-get -qq -y install ${buildPk
2930

3031
# download & install other dependencies
3132
# appimagetool: https://github.com/AppImage/appimagetool
32-
wget -q "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage"
33-
install appimagetool-x86_64.AppImage /usr/local/bin/appimagetool
33+
wget -q "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-${ARCH}.AppImage"
34+
install "appimagetool-${ARCH}.AppImage" /usr/local/bin/appimagetool
3435

3536
# minisign: https://github.com/jedisct1/minisign
3637
wget -q "${MINISIGN_URL}" -O "minisign-linux.tar.gz"
3738
tar -xzf "minisign-linux.tar.gz"
38-
mv minisign-linux/x86_64/minisign /usr/local/bin
39+
mv minisign-linux/"${ARCH}"/minisign /usr/local/bin
3940

4041
# zig: https://ziglang.org
41-
wget -q "https://ziglang.org/download/${ZIG_VERSION}/zig-linux-x86_64-${ZIG_VERSION}.tar.xz"
42-
tar -xf "zig-linux-x86_64-${ZIG_VERSION}.tar.xz" -C /opt
43-
ln -s "/opt/zig-linux-x86_64-${ZIG_VERSION}/zig" /usr/local/bin/zig
42+
wget -q "https://ziglang.org/download/${ZIG_VERSION}/zig-linux-${ARCH}-${ZIG_VERSION}.tar.xz"
43+
tar -xf "zig-linux-${ARCH}-${ZIG_VERSION}.tar.xz" -C /opt
44+
ln -s "/opt/zig-linux-${ARCH}-${ZIG_VERSION}/zig" /usr/local/bin/zig
4445

4546
# cleanup
4647
rm -r \
47-
"appimagetool-x86_64.AppImage" \
48+
"appimagetool-${ARCH}.AppImage" \
4849
"minisign-linux.tar.gz" \
4950
"minisign-linux" \
50-
"zig-linux-x86_64-${ZIG_VERSION}.tar.xz"
51+
"zig-linux-${ARCH}-${ZIG_VERSION}.tar.xz"

0 commit comments

Comments
 (0)