22
33set -e
44
5+ preload_lib () {
6+ [ -f " $1 " ] && [ -d " $2 " ] && mv " $1 " " $2 "
7+ }
8+
59export ARCH=" $( uname -m) "
610export APPIMAGE_EXTRACT_AND_RUN=1
711
@@ -15,7 +19,7 @@ DESKTOP_FILE="${PWD}/assets/ghostty.desktop"
1519LIB4BN=" https://raw.githubusercontent.com/VHSgunzo/sharun/refs/heads/main/lib4bin"
1620BUILD_ARGS="
1721 --summary all \
18- --prefix ${APP_DIR} /usr \
22+ --prefix ${APP_DIR} \
1923 -Doptimize=ReleaseFast \
2024 -Dcpu=baseline \
2125 -Dpie=true \
@@ -26,7 +30,7 @@ BUILD_ARGS="
2630
2731rm -rf " ${TMP_DIR} "
2832
29- mkdir -p -- " ${TMP_DIR} " " ${APP_DIR} /usr " " ${APP_DIR} /usr/lib " " ${APP_DIR} /usr/share/metainfo "
33+ mkdir -p -- " ${TMP_DIR} " " ${APP_DIR} /share/metainfo " " ${APP_DIR} /shared/preload "
3034
3135cd " ${TMP_DIR} "
3236
@@ -60,23 +64,26 @@ zig build ${BUILD_ARGS}
6064
6165cd " ${APP_DIR} "
6266
63- cp " ${APPDATA_FILE} " " usr/ share/metainfo/com.mitchellh.ghostty.appdata.xml"
64- cp " ${DESKTOP_FILE} " " usr/ share/applications/com.mitchellh.ghostty.desktop"
67+ cp " ${APPDATA_FILE} " " share/metainfo/com.mitchellh.ghostty.appdata.xml"
68+ cp " ${DESKTOP_FILE} " " share/applications/com.mitchellh.ghostty.desktop"
6569
66- ln -s " com.mitchellh.ghostty.desktop" " usr/ share/applications/ghostty.desktop"
67- ln -s " usr/ share/applications/com.mitchellh.ghostty.desktop" .
68- ln -s " usr/ share/icons/hicolor/256x256/apps/com.mitchellh.ghostty.png" .
70+ ln -s " com.mitchellh.ghostty.desktop" " share/applications/ghostty.desktop"
71+ ln -s " share/applications/com.mitchellh.ghostty.desktop" .
72+ ln -s " share/icons/hicolor/256x256/apps/com.mitchellh.ghostty.png" .
6973
7074# bundle all libs
7175wget " $LIB4BN " -O ./lib4bin
7276chmod +x ./lib4bin
73- xvfb-run -a -- ./lib4bin -p -v -e -s -k ./usr/bin/ghostty /usr/lib/libEGL*
74- rm -rf ./usr/bin
77+ xvfb-run -a -- ./lib4bin -p -v -e -s -k ./bin/ghostty /usr/lib/libEGL*
7578
7679# Prepare AppImage -- Configure launcher script, metainfo and desktop file with icon.
77- echo ' GHOSTTY_RESOURCES_DIR=${SHARUN_DIR}/usr/ share/ghostty' >> ./.env
80+ echo ' GHOSTTY_RESOURCES_DIR=${SHARUN_DIR}/share/ghostty' >> ./.env
7881echo ' unset ARGV0' >> ./.env
7982
83+ preload_lib " shared/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader_svg.so" " shared/preload"
84+
85+ [ -d ' shared/lib/gdk-pixbuf-2.0' ] && rm -rf shared/lib/gdk-pixbuf-2.0
86+
8087ln -s ./bin/ghostty ./AppRun
8188./sharun -g
8289
0 commit comments