Skip to content

Commit 360da69

Browse files
committed
refactor: Implement pkgforge scripts
- Utilize debloated scripts for installing OpenGL, GTK4 and libxml. - Delegate tasks to quick-sharun and uruntime2appimage. - Modify generics to support script defaults, directories, environment variables and cleanup.
1 parent e1fdd85 commit 360da69

File tree

4 files changed

+45
-123
lines changed

4 files changed

+45
-123
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
with:
7575
name: ghostty-appimage-${{ matrix.arch }}
7676
retention-days: 7
77-
path: /tmp/ghostty-build/Ghostty*-${{ matrix.arch }}.AppImage*
77+
path: dist
7878

7979
tag:
8080
name: "👻 Tip Tag"

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,9 @@ Sessionx.vim
2020
tags
2121
# Persistent undo
2222
[._]*.un~
23+
24+
AppDir
25+
ghostty-*
26+
quick-sharun
27+
uruntime2appimage
28+
dist

build.sh

Lines changed: 17 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,22 @@ set -eux
44

55
ARCH="$(uname -m)"
66
GHOSTTY_VERSION="$(cat VERSION)"
7-
TMP_DIR="/tmp/ghostty-build"
8-
APP_DIR="${TMP_DIR}/ghostty.AppDir"
97
PUB_KEY="RWQlAjJC23149WL2sEpT/l0QKy7hMIFhYdQOFy0Z7z7PbneUgvlsnYcV"
10-
UPINFO="gh-releases-zsync|$(echo "${GITHUB_REPOSITORY}" | tr '/' '|')|latest|Ghostty-*$ARCH.AppImage.zsync"
11-
APPDATA_FILE="${PWD}/assets/ghostty.appdata.xml"
12-
DESKTOP_FILE="${PWD}/assets/ghostty.desktop"
13-
LIBS2BUNDLE="./bin/ghostty /usr/lib/libEGL* /usr/lib/gdk-pixbuf-*/*/*/*"
8+
9+
export ADD_HOOKS="self-updater.bg.hook"
10+
export UPINFO="gh-releases-zsync|$(echo "${GITHUB_REPOSITORY}" | tr '/' '|')|latest|Ghostty-*$ARCH.AppImage.zsync"
11+
export URUNTIME_PRELOAD=1
12+
export DEPLOY_OPENGL=1
13+
1414
BUILD_ARGS="
1515
--summary all \
16-
--prefix ${APP_DIR} \
1716
-Doptimize=ReleaseFast \
1817
-Dcpu=baseline \
1918
-Dpie=true \
2019
-Demit-docs \
2120
-Dgtk-wayland=true \
2221
-Dgtk-x11=true"
2322

24-
rm -rf "${TMP_DIR}"
25-
26-
mkdir -p -- "${TMP_DIR}" "${APP_DIR}/share/metainfo" "${APP_DIR}/shared/lib"
27-
28-
cd "${TMP_DIR}"
29-
3023
if [ "${GHOSTTY_VERSION}" = "tip" ]; then
3124
wget "https://github.com/ghostty-org/ghostty/releases/download/tip/ghostty-source.tar.gz" -O "ghostty-${GHOSTTY_VERSION}.tar.gz"
3225
wget "https://github.com/ghostty-org/ghostty/releases/download/tip/ghostty-source.tar.gz.minisig" -O "ghostty-${GHOSTTY_VERSION}.tar.gz.minisig"
@@ -45,76 +38,26 @@ tar -xzmf "ghostty-${GHOSTTY_VERSION}.tar.gz"
4538
rm "ghostty-${GHOSTTY_VERSION}.tar.gz" \
4639
"ghostty-${GHOSTTY_VERSION}.tar.gz.minisig"
4740

48-
BUILD_DIR="ghostty-${GHOSTTY_VERSION}"
4941
BUILD_ARGS="${BUILD_ARGS} -Dversion-string=${GHOSTTY_VERSION}"
5042

51-
cd "${TMP_DIR}/${BUILD_DIR}"
52-
5343
#Fetch Zig Cache
5444
if [ -f './nix/build-support/fetch-zig-cache.sh' ]; then
5545
ZIG_GLOBAL_CACHE_DIR=/tmp/offline-cache ./nix/build-support/fetch-zig-cache.sh
5646
BUILD_ARGS="${BUILD_ARGS} --system /tmp/offline-cache/p"
5747
fi
5848

5949
# Build Ghostty with zig
60-
zig build ${BUILD_ARGS}
61-
62-
# Prepare AppImage -- Configure launcher script, metainfo and desktop file with icon.
63-
cd "${APP_DIR}"
64-
65-
cp "${APPDATA_FILE}" "share/metainfo/com.mitchellh.ghostty.appdata.xml"
66-
cp "${DESKTOP_FILE}" "share/applications/com.mitchellh.ghostty.desktop"
67-
68-
ln -s "com.mitchellh.ghostty.desktop" "share/applications/ghostty.desktop"
69-
ln -s "share/applications/com.mitchellh.ghostty.desktop" .
70-
ln -s "share/icons/hicolor/256x256/apps/com.mitchellh.ghostty.png" .
71-
ln -s "share/icons/hicolor/256x256/apps/com.mitchellh.ghostty.png" .DirIcon
72-
73-
# bundle all libs
74-
xvfb-run -a -- sharun l -p -v -e -s -k ${LIBS2BUNDLE}
75-
76-
# preload libpixbufloader /w ld-preload-open as svg icons breaks
77-
# either on ghostty tab bar or gnome-text-editor while config edit or both :(
78-
mv ./shared/lib/gdk-pixbuf-2.0 ./
79-
cp -rv /opt/path-mapping.so ./shared/lib/
80-
cp -rv gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader_svg.so ./shared/lib/
81-
82-
echo 'path-mapping.so' >./.preload
83-
echo 'PATH_MAPPING=/usr/lib/gdk-pixbuf-2.0:${SHARUN_DIR}/gdk-pixbuf-2.0' >>./.env
84-
85-
echo 'GHOSTTY_RESOURCES_DIR=${SHARUN_DIR}/share/ghostty' >>./.env
86-
echo 'unset ARGV0' >>./.env
87-
88-
ln -s ./bin/ghostty ./AppRun
89-
./sharun -g
90-
91-
VERSION="$(./AppRun --version | awk 'FNR==1 {print $2}')"
92-
if [ -z "${VERSION}" ]; then
93-
echo "ERROR: Could not get version from ghostty binary"
94-
exit 1
95-
fi
96-
97-
GHOSTTY_APPIMAGE="Ghostty-${VERSION}-${ARCH}.AppImage"
98-
99-
cd "${TMP_DIR}"
100-
101-
# create app image
102-
cp "$(command -v uruntime)" ./uruntime
103-
cp "$(command -v uruntime-lite)" ./uruntime-lite
104-
105-
# persist mount for faster launch times
106-
sed -i 's|URUNTIME_MOUNT=[0-9]|URUNTIME_MOUNT=0|' ./uruntime-lite
50+
(
51+
cd "ghostty-${GHOSTTY_VERSION}"
52+
zig build ${BUILD_ARGS}
53+
)
10754

108-
# update info
109-
./uruntime-lite --appimage-addupdinfo "${UPINFO}"
55+
export OUTNAME="Ghostty-${GHOSTTY_VERSION}-${ARCH}.AppImage"
56+
export DESKTOP="./ghostty-${GHOSTTY_VERSION}/zig-out/share/applications/com.mitchellh.ghostty.desktop"
57+
export ICON="./ghostty-${GHOSTTY_VERSION}/zig-out/share/icons/hicolor/256x256/apps/com.mitchellh.ghostty.png"
11058

111-
echo "Generating AppImage"
112-
./uruntime --appimage-mkdwarfs -f \
113-
--set-owner 0 --set-group 0 \
114-
--no-history --no-create-timestamp \
115-
--compression zstd:level=22 -S26 -B8 \
116-
--header uruntime-lite -i "${APP_DIR}" \
117-
-o "${GHOSTTY_APPIMAGE}"
59+
./quick-sharun ./ghostty-${GHOSTTY_VERSION}/zig-out/bin/ghostty
60+
./uruntime2appimage
11861

119-
echo "Generating Zsync file"
120-
zsyncmake ./*.AppImage -u ./*.AppImage
62+
mkdir -p ./dist
63+
mv -v ./*.AppImage* ./dist

setup.sh

Lines changed: 21 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,35 @@ ARCH="$(uname -m)"
1919
ZIG_VERSION="${ZIG_VERSION:-0.13.0}"
2020
PANDOC_VERSION="$(get_latest_gh_release 'jgm/pandoc')"
2121
MINISIGN_VERSION="$(get_latest_gh_release 'jedisct1/minisign')"
22-
SHARUN_VERSION="$(get_latest_gh_release 'VHSgunzo/sharun')"
23-
URUNTIME_VERSION="$(get_latest_gh_release 'VHSgunzo/uruntime')"
24-
25-
GITHUB_BASE="https://github.com"
26-
PANDOC_BASE="${GITHUB_BASE}/jgm/pandoc/releases/download/${PANDOC_VERSION}"
27-
MINISIGN_URL="${GITHUB_BASE}/jedisct1/minisign/releases/download/${MINISIGN_VERSION}/minisign-${MINISIGN_VERSION}-linux.tar.gz"
28-
URUNTIME_URL="${GITHUB_BASE}/VHSgunzo/uruntime/releases/download/${URUNTIME_VERSION}/uruntime-appimage-dwarfs-${ARCH}"
29-
URUNTIME_LITE_URL="${GITHUB_BASE}/VHSgunzo/uruntime/releases/download/${URUNTIME_VERSION}/uruntime-appimage-dwarfs-lite-${ARCH}"
30-
LLVM_BASE="${GITHUB_BASE}/pkgforge-dev/llvm-libs-debloated/releases/download/continuous"
22+
23+
GH_BASE="https://github.com"
24+
GH_USER_CONTENT="https://raw.githubusercontent.com"
25+
26+
PANDOC_BASE="${GH_BASE}/jgm/pandoc/releases/download/${PANDOC_VERSION}"
27+
MINISIGN_URL="${GH_BASE}/jedisct1/minisign/releases/download/${MINISIGN_VERSION}/minisign-${MINISIGN_VERSION}-linux.tar.gz"
3128
ZIG_URL="https://ziglang.org/download/${ZIG_VERSION}/zig-linux-${ARCH}-${ZIG_VERSION}.tar.xz"
32-
SHARUN_URL="${GITHUB_BASE}/VHSgunzo/sharun/releases/download/${SHARUN_VERSION}/sharun-${ARCH}"
33-
LD_PRELOAD_OPEN="${GITHUB_BASE}/fritzw/ld-preload-open.git"
29+
30+
DEBLOATED_PKGS="${GH_USER_CONTENT}/pkgforge-dev/Anylinux-AppImages/refs/heads/main/useful-tools/get-debloated-pkgs.sh"
31+
SHARUN="${GH_USER_CONTENT}/pkgforge-dev/Anylinux-AppImages/refs/heads/main/useful-tools/quick-sharun.sh"
32+
URUNTIME="${GH_USER_CONTENT}/pkgforge-dev/Anylinux-AppImages/refs/heads/main/useful-tools/uruntime2appimage.sh"
3433

3534
case "${ARCH}" in
3635
"x86_64")
3736
PANDOC_URL="${PANDOC_BASE}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz"
38-
LLVM_URL="${LLVM_BASE}/llvm-libs-nano-x86_64.pkg.tar.zst"
39-
LIBXML_URL="${LLVM_BASE}/libxml2-iculess-x86_64.pkg.tar.zst"
40-
MESA_URL="${LLVM_BASE}/mesa-mini-x86_64.pkg.tar.zst"
4137
;;
4238
"aarch64")
4339
PANDOC_URL="${PANDOC_BASE}/pandoc-${PANDOC_VERSION}-linux-arm64.tar.gz"
44-
LLVM_URL="${LLVM_BASE}/llvm-libs-nano-aarch64.pkg.tar.xz"
45-
LIBXML_URL="${LLVM_BASE}/libxml2-iculess-aarch64.pkg.tar.xz"
46-
MESA_URL="${LLVM_BASE}/mesa-mini-aarch64.pkg.tar.xz"
4740
;;
4841
*)
4942
echo "Unsupported ARCH: '${ARCH}'"
5043
exit 1
5144
;;
5245
esac
5346

54-
# Debloated llvm and libxml2 without libicudata
55-
wget "${LLVM_URL}" -O /tmp/llvm-libs.pkg.tar.zst
56-
wget "${LIBXML_URL}" -O /tmp/libxml2.pkg.tar.zst
57-
wget "${MESA_URL}" -O /tmp/mesa-mini.pkg.tar.zst
58-
pacman -U --noconfirm /tmp/*.pkg.tar.zst
47+
# Install Debloated Pkgs
48+
wget "${DEBLOATED_PKGS}" -O /tmp/get-debloated-pkgs.sh
49+
chmod a+x /tmp/get-debloated-pkgs.sh
50+
sh /tmp/get-debloated-pkgs.sh --add-opengl --prefer-nano gtk4-mini libxml2-mini
5951

6052
# Download & install other dependencies
6153
# zig: https://ziglang.org
@@ -65,17 +57,6 @@ wget "${ZIG_URL}" -O /tmp/zig-linux.tar.xz
6557
tar -xJf /tmp/zig-linux.tar.xz -C /opt
6658
ln -s "/opt/zig-linux-${ARCH}-${ZIG_VERSION}/zig" /usr/local/bin/zig
6759

68-
# uruntime: https://github.com/VHSgunzo/uruntime
69-
rm -rf /usr/local/bin/uruntime
70-
wget "${URUNTIME_URL}" -O /tmp/uruntime
71-
chmod +x /tmp/uruntime
72-
mv /tmp/uruntime /usr/local/bin/uruntime
73-
74-
rm -rf /usr/local/bin/uruntime-lite
75-
wget "${URUNTIME_LITE_URL}" -O /tmp/uruntime-lite
76-
chmod +x /tmp/uruntime-lite
77-
mv /tmp/uruntime-lite /usr/local/bin/uruntime-lite
78-
7960
# minisign: https://github.com/jedisct1/minisign
8061
rm -rf /usr/local/bin/minisign
8162
wget "${MINISIGN_URL}" -O /tmp/minisign-linux.tar.gz
@@ -88,21 +69,13 @@ wget "${PANDOC_URL}" -O /tmp/pandoc-linux.tar.gz
8869
tar -xzf /tmp/pandoc-linux.tar.gz -C /tmp
8970
mv /tmp/"pandoc-${PANDOC_VERSION}"/bin/* /usr/local/bin
9071

91-
# sharun: https://github.com/VHSgunzo/sharun
92-
rm -rf /usr/local/bin/sharun
93-
wget "${SHARUN_URL}" -O /usr/local/bin/sharun
94-
chmod +x /usr/local/bin/sharun
95-
96-
# ld-preload-open: https://github.com/fritzw/ld-preload-open
97-
rm -rf /opt/path-mapping.so
98-
git clone "${LD_PRELOAD_OPEN}"
99-
(
100-
cd ld-preload-open
101-
make all
102-
mv ./path-mapping.so ../
103-
)
104-
rm -rf ld-preload-open
105-
mv ./path-mapping.so /opt/path-mapping.so
72+
# Sharun
73+
wget "${SHARUN}" -O quick-sharun
74+
chmod +x quick-sharun
75+
76+
# Sharun
77+
wget "${URUNTIME}" -O uruntime2appimage
78+
chmod +x uruntime2appimage
10679

10780
# Cleanup
10881
pacman -Scc --noconfirm

0 commit comments

Comments
 (0)