From f510426c8d335ac179d89a267b4036478619e1cb Mon Sep 17 00:00:00 2001 From: superrob1500 Date: Sun, 12 Oct 2025 21:37:25 +0200 Subject: [PATCH] add extra dependency installs --- ghostty-build-update.sh | 70 +++++++++++++++++++++++++++++++---------- 1 file changed, 53 insertions(+), 17 deletions(-) diff --git a/ghostty-build-update.sh b/ghostty-build-update.sh index d3affb4..279c707 100644 --- a/ghostty-build-update.sh +++ b/ghostty-build-update.sh @@ -1,6 +1,6 @@ #!/bin/bash #Script to build ghostty from source. It automatically grabs required zig version binary. -#v1.0 +#v1.0.1 set -euo pipefail @@ -27,11 +27,11 @@ command_exists() { command -v "$1" >/dev/null 2>&1; } info() { echo "==> $*"; } error() { echo "ERROR: $*" >&2; exit 1; } -# Create the build directory if it doesn't exist +# === Create build directory === mkdir -p "$BUILD_DIR" cd "$BUILD_DIR" -# === Pick version from tags === +# === Version selection === choose_version() { info "Fetching available Ghostty versions from GitHub..." local tags @@ -78,7 +78,7 @@ resolve_zig_version() { 1.0.*|1.1.*) echo "0.13.0" ;; 1.2.*) echo "0.14.1" ;; tip) echo "0.14.1" ;; - v*) + v*) local ver="${GHOSTTY_VERSION#v}" case "$ver" in 1.0.*|1.1.*) echo "0.13.0" ;; @@ -90,7 +90,7 @@ resolve_zig_version() { esac } -# === Download standalone Zig === +# === Download Zig standalone binary === setup_zig() { local zig_version="$1" local os=$(uname -s | tr '[:upper:]' '[:lower:]') @@ -129,26 +129,62 @@ setup_zig() { info "Using Zig at $(command -v zig) ($(zig version))" } -# === Install system deps (Linux only) === +# === Install build dependencies === install_deps_linux() { + if ! command_exists apt-get && ! command_exists pacman && ! command_exists dnf; then + error "No supported package manager found (apt, pacman, dnf). Install dependencies manually." + fi + + local distro="" + if [ -f /etc/os-release ]; then + . /etc/os-release + distro="$ID" + fi + if command_exists apt-get; then + info "Installing dependencies via apt-get..." sudo apt-get update - sudo apt-get install -y \ - git libgtk-4-dev libgtk4-layer-shell-dev libadwaita-1-dev \ - gettext libxml2-utils pkg-config curl tar xz-utils + + # Base packages + sudo apt-get install -y git libgtk-4-dev gettext libxml2-utils pkg-config curl tar xz-utils g++ + + # Harfbuzz dev libraries + sudo apt-get install -y libharfbuzz-dev libharfbuzz-gobject0 + + # GTK Blueprint compiler + sudo apt-get install -y blueprint-compiler + + # libadwaita and gtk-layer-shell packages + case "$distro" in + ubuntu) + sudo apt-get install -y libadwaita-1-dev libgtk-layer-shell-dev + ;; + debian) + sudo apt-get install -y libadwaita-dev libgtk4-layer-shell-dev + ;; + *) + sudo apt-get install -y libadwaita-dev libadwaita-1-dev libgtk4-layer-shell-dev libgtk-layer-shell-dev || true + ;; + esac + + # Verify critical pkg-config dependencies + for pkg in gtk4 adw-1 gtk4-layer-shell; do + if ! pkg-config --exists "$pkg"; then + error "Missing required development package: $pkg. Did apt-get install succeed?" + fi + done + elif command_exists pacman; then sudo pacman -Sy --noconfirm \ - git gtk4 gtk4-layer-shell libadwaita gettext pkgconf curl tar xz + git gtk4 gtk4-layer-shell libadwaita gettext pkgconf curl tar xz g++ blueprint-compiler harfbuzz elif command_exists dnf; then sudo dnf install -y \ git gtk4-devel gtk4-layer-shell-devel libadwaita-devel \ - gettext pkgconf curl tar xz - else - info "Install deps manually: git, gtk4, gtk4-layer-shell, libadwaita, gettext" + gettext pkgconf curl tar xz g++ blueprint-compiler harfbuzz-devel fi } -# === Clone repo and checkout version === +# === Clone Ghostty repo and checkout version === fetch_source_git() { if [ ! -d "ghostty" ]; then git clone "$GHOSTTY_REPO" @@ -163,14 +199,14 @@ fetch_source_git() { fi } -# === Build & install === +# === Build and install Ghostty === build_install() { zig build -Doptimize="$OPTIMIZATION" zig build install -p "$PREFIX" -Doptimize="$OPTIMIZATION" info "Ghostty installed to $PREFIX/bin/ghostty" } -# === Cleanup build directory === +# === Clean build directory === cleanup_build() { if $CLEAN_BUILD; then info "Cleaning up build directory $BUILD_DIR" @@ -193,4 +229,4 @@ main() { cleanup_build } -main "$@" +main "$@" \ No newline at end of file