Ghostty-per-Projekt-Builder: Template + make/rebuild-Skripte
- ghostty-template/Ghostty.app: lokal gebautes Ghostty v1.3.1 mit DockTilePlugin-Patch (eigenes Dock-Icon ueber Contents/Resources/DockIcon.png) - make-ghostty-app.sh: erzeugt pro Projekt eine App; Slots fuer icon/workdir/command/theme/bg/fg/font/font-size - rebuild-template.sh: baut Template lokal neu (nur Xcode, kein Zig/VM), gepinnt auf vendor/libghostty v1.3.1 - ghostty-template/dock-icon.patch: der DockTilePlugin-Patch - icons/robotunits.png - enthaelt zudem die vorausgehende MiniTerm/libghostty-Integration
This commit is contained in:
Executable
+89
@@ -0,0 +1,89 @@
|
||||
#!/usr/bin/env bash
|
||||
# Baut das gepatchte Ghostty-Template (ghostty-template/Ghostty.app) lokal neu —
|
||||
# OHNE VM, OHNE Zig. Der kritische Zig-Kern liegt bereits als
|
||||
# vendor/libghostty/lib/libghostty.a vor; hier laeuft nur noch reines Xcode.
|
||||
#
|
||||
# Voraussetzungen:
|
||||
# - Volles Xcode (CommandLineTools reichen NICHT). Per `xcodes` installierbar.
|
||||
# - vendor/libghostty/lib/libghostty.a (arm64) + vendor/libghostty/include
|
||||
# - Installierte /Applications/Ghostty.app (liefert die Shell-Ressourcen)
|
||||
#
|
||||
# WICHTIG: libghostty.a ist auf Ghostty v1.3.1 gepinnt. Ein Versionssprung
|
||||
# erfordert einen NEUEN libghostty.a-Build (Zig, nur in macOS-15-VM moeglich —
|
||||
# siehe vendor/libghostty/README.md). Dieses Skript baut nur das App-Bundle neu.
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
GHOSTTY_VERSION="${1:-v1.3.1}"
|
||||
VENDOR="$SCRIPT_DIR/vendor/libghostty"
|
||||
BUILD="$SCRIPT_DIR/.ghostty-build"
|
||||
SRC="$BUILD/ghostty-src"
|
||||
INSTALLED="/Applications/Ghostty.app"
|
||||
|
||||
# --- Xcode (volles) finden ---
|
||||
find_xcode() {
|
||||
local p
|
||||
p="$(xcode-select -p 2>/dev/null || true)"
|
||||
[[ "$p" == *Xcode*/Contents/Developer ]] && { echo "$p"; return; }
|
||||
for c in /Applications/Xcode*.app \
|
||||
"$HOME/Library/Application Support/com.robotsandpencils.xcodes/Xcode.app"; do
|
||||
[[ -d "$c/Contents/Developer" ]] && { echo "$c/Contents/Developer"; return; }
|
||||
done
|
||||
return 1
|
||||
}
|
||||
DEVELOPER_DIR="$(find_xcode)" || { echo "Volles Xcode nicht gefunden." >&2; exit 1; }
|
||||
export DEVELOPER_DIR
|
||||
echo ">> Xcode: $(xcodebuild -version | head -1)"
|
||||
|
||||
# --- Vorbedingungen ---
|
||||
[[ -f "$VENDOR/lib/libghostty.a" ]] || { echo "fehlt: $VENDOR/lib/libghostty.a" >&2; exit 1; }
|
||||
[[ -d "$INSTALLED/Contents/Resources" ]] || { echo "fehlt: $INSTALLED (Shell-Ressourcen)" >&2; exit 1; }
|
||||
|
||||
# --- 1. Source holen ---
|
||||
mkdir -p "$BUILD"
|
||||
if [[ ! -d "$SRC/.git" ]]; then
|
||||
rm -rf "$SRC"
|
||||
git clone --depth 1 --branch "$GHOSTTY_VERSION" https://github.com/ghostty-org/ghostty.git "$SRC"
|
||||
else
|
||||
git -C "$SRC" fetch --depth 1 origin "$GHOSTTY_VERSION"
|
||||
git -C "$SRC" checkout -f FETCH_HEAD
|
||||
fi
|
||||
|
||||
# --- 2. Patch anwenden (idempotent) ---
|
||||
cd "$SRC"
|
||||
git checkout -- "macos/Sources/Features/Custom App Icon/DockTilePlugin.swift" 2>/dev/null || true
|
||||
git apply "$SCRIPT_DIR/ghostty-template/dock-icon.patch"
|
||||
echo ">> Patch angewandt"
|
||||
|
||||
# --- 3. xcframework aus libghostty.a (Header MIT module.modulemap aus src/include) ---
|
||||
OUT_XCF="$SRC/macos/GhosttyKit.xcframework"
|
||||
rm -rf "$OUT_XCF"
|
||||
xcodebuild -create-xcframework \
|
||||
-library "$VENDOR/lib/libghostty.a" \
|
||||
-headers "$SRC/include" \
|
||||
-output "$OUT_XCF" >/dev/null
|
||||
echo ">> GhosttyKit.xcframework verpackt"
|
||||
|
||||
# --- 4. Shell-Ressourcen einspeisen (sonst CpResource-Fehler) ---
|
||||
SHARE="$SRC/zig-out/share"
|
||||
mkdir -p "$SHARE"
|
||||
for n in zsh vim terminfo man nvim locale fish ghostty bat bash-completion; do
|
||||
rm -rf "$SHARE/$n"
|
||||
cp -R "$INSTALLED/Contents/Resources/$n" "$SHARE/$n"
|
||||
done
|
||||
echo ">> Shell-Ressourcen eingespeist"
|
||||
|
||||
# --- 5. App bauen (arm64, ReleaseLocal, ohne Signing) ---
|
||||
cd "$SRC/macos"
|
||||
xcodebuild -project Ghostty.xcodeproj -target Ghostty -configuration ReleaseLocal \
|
||||
SYMROOT="$BUILD/out" ARCHS=arm64 ONLY_ACTIVE_ARCH=YES \
|
||||
CLANG_MODULE_CACHE_PATH="$BUILD/modulecache" \
|
||||
CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY="" \
|
||||
build >/dev/null
|
||||
echo ">> App gebaut"
|
||||
|
||||
# --- 6. Template ersetzen ---
|
||||
DST="$SCRIPT_DIR/ghostty-template/Ghostty.app"
|
||||
rm -rf "$DST"
|
||||
cp -R "$BUILD/out/ReleaseLocal/Ghostty.app" "$DST"
|
||||
echo ">> Template aktualisiert: $DST"
|
||||
Reference in New Issue
Block a user