33set -e
44
55export ARCH=" $( uname -m) "
6+ export APPIMAGE_EXTRACT_AND_RUN=1
67
78GHOSTTY_VERSION=" $( cat VERSION) "
89TMP_DIR=" /tmp/ghostty-build"
@@ -11,6 +12,7 @@ PUB_KEY="RWQlAjJC23149WL2sEpT/l0QKy7hMIFhYdQOFy0Z7z7PbneUgvlsnYcV"
1112UPINFO=" gh-releases-zsync|$( echo " ${GITHUB_REPOSITORY:- no-user/ no-repo} " | tr ' /' ' |' ) |latest|*$ARCH .AppImage.zsync"
1213APPDATA_FILE=" ${PWD} /assets/ghostty.appdata.xml"
1314DESKTOP_FILE=" ${PWD} /assets/ghostty.desktop"
15+ LIB4BN=" https://raw.githubusercontent.com/VHSgunzo/sharun/refs/heads/main/lib4bin"
1416
1517rm -rf " ${TMP_DIR} "
1618
@@ -49,59 +51,34 @@ zig build \
4951
5052cd " ${APP_DIR} "
5153
52- # bundle all libs
53- ldd ./usr/bin/ghostty | awk -F" [> ]" ' {print $4}' | xargs -I {} cp --update=none -v {} ./usr/lib
54-
55- # ld-linux contains x86-64 instead of x86_64
56- case " ${ARCH} " in
57- " x86_64" )
58- ld_linux=" ld-linux-x86-64.so.2"
59- ;;
60- " aarch64" )
61- ld_linux=" ld-linux-aarch64.so.1"
62- ;;
63- * )
64- echo " Unsupported ARCH: '${ARCH} '"
65- exit 1
66- ;;
67- esac
54+ cp " ${APPDATA_FILE} " " usr/share/metainfo/com.mitchellh.ghostty.appdata.xml"
6855
69- cp -v /usr/lib/libpthread.so.0 ./usr/lib
56+ # Fix Gnome dock issues -- StartupWMClass attribute needs to be present.
57+ cp " ${DESKTOP_FILE} " " usr/share/applications/com.mitchellh.ghostty.desktop"
58+ # WezTerm has this, it might be useful.
59+ ln -s " com.mitchellh.ghostty.desktop" " usr/share/applications/ghostty.desktop"
7060
71- if ! mv ./usr/lib/${ld_linux} ./ld-linux.so; then
72- cp -v /usr/lib/${ARCH} -linux-gnu/${ld_linux} ./ld-linux.so
73- fi
61+ ln -s " usr/share/applications/com.mitchellh.ghostty.desktop" .
62+ ln -s " usr/share/icons/hicolor/256x256/apps/com.mitchellh.ghostty.png" .
7463
75- strip -s -R .comment --strip-unneeded ./usr/lib/lib*
64+ # bundle all libs
65+ wget " $LIB4BN " -O ./lib4bin
66+ chmod +x ./lib4bin
67+ xvfb-run -a -- ./lib4bin -p -v -e -s -k ./usr/bin/ghostty /usr/lib/libEGL*
68+ rm -rf ./usr/bin
7669
7770# Prepare AppImage -- Configure launcher script, metainfo and desktop file with icon.
78- cat << 'EOF ' >./AppRun
79- #!/usr/bin/env sh
80-
81- HERE="$(dirname "$(readlink -f "$0")")"
82- unset ARGV0
83- export GHOSTTY_RESOURCES_DIR="${HERE}/usr/share/ghostty"
84- exec "${HERE}"/ld-linux.so --library-path "${HERE}"/usr/lib "${HERE}"/usr/bin/ghostty "$@"
85- EOF
71+ echo ' unset ARGV0' > ./.env
72+ echo ' GHOSTTY_RESOURCES_DIR=${SHARUN_DIR}/usr/share/ghostty' >> ./.env
73+ ln -s ./bin/ghostty ./AppRun
74+ ./sharun -g
8675
87- chmod +x AppRun
88-
89- export VERSION=" $( ./AppRun --version 2> /dev/null | awk ' FNR==1 {print $2}' ) "
76+ export VERSION=" $( ./AppRun --version | awk ' FNR==1 {print $2}' ) "
9077if [ -z " $VERSION " ]; then
9178 echo " ERROR: Could not get version from ghostty binary"
9279 exit 1
9380fi
9481
95- cp " ${APPDATA_FILE} " " usr/share/metainfo/com.mitchellh.ghostty.appdata.xml"
96-
97- # Fix Gnome dock issues -- StartupWMClass attribute needs to be present.
98- cp " ${DESKTOP_FILE} " " usr/share/applications/com.mitchellh.ghostty.desktop"
99- # WezTerm has this, it might be useful.
100- ln -s " com.mitchellh.ghostty.desktop" " usr/share/applications/ghostty.desktop"
101-
102- ln -s " usr/share/applications/com.mitchellh.ghostty.desktop" .
103- ln -s " usr/share/icons/hicolor/256x256/apps/com.mitchellh.ghostty.png" .
104-
10582cd " ${TMP_DIR} "
10683
10784# create app image
0 commit comments