Skip to content
Merged
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
1 change: 0 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
runs-on: ubuntu-24.04
container:
image: ghcr.io/pkgforge-dev/archlinux:latest
options: "--privileged --cap-add SYS_ADMIN --device /dev/fuse"
steps:
- name: Checkout ghostty-appimage
uses: actions/checkout@v4
Expand Down
61 changes: 19 additions & 42 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -e

export ARCH="$(uname -m)"
export APPIMAGE_EXTRACT_AND_RUN=1

GHOSTTY_VERSION="$(cat VERSION)"
TMP_DIR="/tmp/ghostty-build"
Expand All @@ -11,6 +12,7 @@ PUB_KEY="RWQlAjJC23149WL2sEpT/l0QKy7hMIFhYdQOFy0Z7z7PbneUgvlsnYcV"
UPINFO="gh-releases-zsync|$(echo "${GITHUB_REPOSITORY:-no-user/no-repo}" | tr '/' '|')|latest|*$ARCH.AppImage.zsync"
APPDATA_FILE="${PWD}/assets/ghostty.appdata.xml"
DESKTOP_FILE="${PWD}/assets/ghostty.desktop"
LIB4BN="https://raw.githubusercontent.com/VHSgunzo/sharun/refs/heads/main/lib4bin"

rm -rf "${TMP_DIR}"

Expand Down Expand Up @@ -49,59 +51,34 @@ zig build \

cd "${APP_DIR}"

# bundle all libs
ldd ./usr/bin/ghostty | awk -F"[> ]" '{print $4}' | xargs -I {} cp --update=none -v {} ./usr/lib

# ld-linux contains x86-64 instead of x86_64
case "${ARCH}" in
"x86_64")
ld_linux="ld-linux-x86-64.so.2"
;;
"aarch64")
ld_linux="ld-linux-aarch64.so.1"
;;
*)
echo "Unsupported ARCH: '${ARCH}'"
exit 1
;;
esac
cp "${APPDATA_FILE}" "usr/share/metainfo/com.mitchellh.ghostty.appdata.xml"

cp -v /usr/lib/libpthread.so.0 ./usr/lib
# Fix Gnome dock issues -- StartupWMClass attribute needs to be present.
cp "${DESKTOP_FILE}" "usr/share/applications/com.mitchellh.ghostty.desktop"
# WezTerm has this, it might be useful.
ln -s "com.mitchellh.ghostty.desktop" "usr/share/applications/ghostty.desktop"

if ! mv ./usr/lib/${ld_linux} ./ld-linux.so; then
cp -v /usr/lib/${ARCH}-linux-gnu/${ld_linux} ./ld-linux.so
fi
ln -s "usr/share/applications/com.mitchellh.ghostty.desktop" .
ln -s "usr/share/icons/hicolor/256x256/apps/com.mitchellh.ghostty.png" .

strip -s -R .comment --strip-unneeded ./usr/lib/lib*
# bundle all libs
wget "$LIB4BN" -O ./lib4bin
chmod +x ./lib4bin
xvfb-run -a -- ./lib4bin -p -v -e -s -k ./usr/bin/ghostty /usr/lib/libEGL*
rm -rf ./usr/bin

# Prepare AppImage -- Configure launcher script, metainfo and desktop file with icon.
cat <<'EOF' >./AppRun
#!/usr/bin/env sh

HERE="$(dirname "$(readlink -f "$0")")"
unset ARGV0
export GHOSTTY_RESOURCES_DIR="${HERE}/usr/share/ghostty"
exec "${HERE}"/ld-linux.so --library-path "${HERE}"/usr/lib "${HERE}"/usr/bin/ghostty "$@"
EOF
echo 'unset ARGV0' > ./.env
echo 'GHOSTTY_RESOURCES_DIR=${SHARUN_DIR}/usr/share/ghostty' >> ./.env
ln -s ./bin/ghostty ./AppRun
./sharun -g

chmod +x AppRun

export VERSION="$(./AppRun --version 2>/dev/null | awk 'FNR==1 {print $2}')"
export VERSION="$(./AppRun --version | awk 'FNR==1 {print $2}')"
if [ -z "$VERSION" ]; then
echo "ERROR: Could not get version from ghostty binary"
exit 1
fi

cp "${APPDATA_FILE}" "usr/share/metainfo/com.mitchellh.ghostty.appdata.xml"

# Fix Gnome dock issues -- StartupWMClass attribute needs to be present.
cp "${DESKTOP_FILE}" "usr/share/applications/com.mitchellh.ghostty.desktop"
# WezTerm has this, it might be useful.
ln -s "com.mitchellh.ghostty.desktop" "usr/share/applications/ghostty.desktop"

ln -s "usr/share/applications/com.mitchellh.ghostty.desktop" .
ln -s "usr/share/icons/hicolor/256x256/apps/com.mitchellh.ghostty.png" .

cd "${TMP_DIR}"

# create app image
Expand Down
17 changes: 12 additions & 5 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,37 +29,44 @@ esac
rm -rf "/usr/share/libalpm/hooks/package-cleanup.hook"

# Update & install OS base dependencies
buildPkgs="base-devel freetype2 oniguruma wget fuse file zsync appstream"
buildPkgs="base-devel freetype2 oniguruma wget mesa file zsync appstream xorg-server-xvfb patchelf binutils strace"
ghosttyPkgs="gtk4 libadwaita"
pacman -Syu --noconfirm
pacman -Syw --noconfirm ${buildPkgs} ${ghosttyPkgs}
pacman -Syq --needed --noconfirm ${buildPkgs} ${ghosttyPkgs}

# Add debloated version of llvm-libs
LLVM_URL="$(wget https://api.github.com/repos/pkgforge-dev/llvm-libs-debloated/releases -O - \
| sed 's/[()",{} ]/\n/g' | grep -i "https.*nano.*$ARCH.pkg.tar.*" | head -1)"
wget "$LLVM_URL" -O ./llvm-libs.pkg.tar.zst
pacman -U --noconfirm ./llvm-libs.pkg.tar.zst
rm -f ./llvm-libs.pkg.tar.zst

# Download & install other dependencies
# appimagetool: https://github.com/AppImage/appimagetool
if [ ! -f '/usr/local/bin/appimagetool' ]; then
wget -q "${APPIMAGE_URL}" -O /tmp/appimagetool.AppImage
wget "${APPIMAGE_URL}" -O /tmp/appimagetool.AppImage
chmod +x /tmp/appimagetool.AppImage
mv /tmp/appimagetool.AppImage /usr/local/bin/appimagetool
fi

# minisign: https://github.com/jedisct1/minisign
if [ ! -f '/usr/local/bin/minisign' ]; then
wget -q "${MINISIGN_URL}" -O /tmp/minisign-linux.tar.gz
wget "${MINISIGN_URL}" -O /tmp/minisign-linux.tar.gz
tar -xzf /tmp/minisign-linux.tar.gz -C /tmp
mv /tmp/minisign-linux/"${ARCH}"/minisign /usr/local/bin
fi

# zig: https://ziglang.org
if [ ! -d "/opt/zig-linux-${ARCH}-${ZIG_VERSION}" ]; then
wget -q "${ZIG_URL}" -O /tmp/zig-linux.tar.xz
wget "${ZIG_URL}" -O /tmp/zig-linux.tar.xz
tar -xf /tmp/zig-linux.tar.xz -C /opt
ln -s "/opt/zig-linux-${ARCH}-${ZIG_VERSION}/zig" /usr/local/bin/zig
fi

# pandoc: https://github.com/jgm/pandoc
if [ ! -f '/usr/local/bin/pandoc' ]; then
wget -q "${PANDOC_URL}" -O /tmp/pandoc-linux.tar.gz
wget "${PANDOC_URL}" -O /tmp/pandoc-linux.tar.gz
tar -xzf /tmp/pandoc-linux.tar.gz -C /tmp
mv /tmp/"pandoc-${PANDOC_VERSION}"/bin/* /usr/local/bin
fi
Expand Down
Loading