# Fedora only: EPEL zig is 0.15, upstream main needs 0.16. EL chroots are excluded by the COPR chroot denylist. %global commit 765ea37ad64f7e3a48f6ac27a70ad7fb6f31b9bb %global commits 18269 %global snapdate 20261019 %global tag 1.3.1 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global zig_minimum_version 0.16.0 %global _missing_build_ids_terminate_build 0 %global debug_package %{nil} %global ghostty_systemd_user_unitdir %{_prefix}/lib/systemd/user %global ghostty_libdir %{_prefix}/lib %global ghostty_pkgconfig_dir %{_prefix}/share/pkgconfig %if 0%{?rhel} %global ghostty_vendored_deps -fno-sys=harfbuzz -fno-sys=freetype -fno-sys=fontconfig -fno-sys=libpng -fno-sys=zlib -fno-sys=oniguruma %endif Name: ghostty-git Version: %{tag}^%{commits}.git%{shortcommit} Release: 1%{?dist} Summary: Fast, feature-rich, and cross-platform terminal emulator that uses platform-native UI and GPU acceleration License: MIT URL: https://github.com/ghostty-org/ghostty Source0: %{url}/archive/%{commit}/ghostty-%{commit}.tar.gz ExclusiveArch: x86_64 aarch64 Conflicts: ghostty BuildRequires: zig >= %{zig_minimum_version} # main needs >= 0.20 when built from a snapshot tarball; fedora-43 ships 0.18, dux carries a dist-git rebuild of the f44 package for that chroot BuildRequires: blueprint-compiler >= 0.20.0 BuildRequires: fontconfig-devel BuildRequires: freetype-devel BuildRequires: glib2-devel BuildRequires: gtk4-devel BuildRequires: gtk4-layer-shell-devel BuildRequires: pkgconfig(egl) BuildRequires: harfbuzz-devel BuildRequires: libadwaita-devel BuildRequires: libpng-devel BuildRequires: oniguruma-devel BuildRequires: pixman-devel BuildRequires: pkg-config BuildRequires: wayland-protocols-devel BuildRequires: zlib-ng-devel BuildRequires: curl Requires: fontconfig Requires: freetype Requires: glib2 Requires: gtk4 Requires: harfbuzz Requires: libadwaita Requires: libpng Requires: oniguruma Requires: pixman Requires: zlib-ng %package devel Summary: Development files for Ghostty Requires: %{name}%{?_isa} = %{version}-%{release} Conflicts: ghostty-devel %description devel Development files for Ghostty. Includes headers and pkg-config metadata for the libghostty-vt API. %description %{summary}. Development snapshot built from the main branch. %prep %setup -q -n ghostty-%{commit} # Fetch remote dependencies to a local Zig cache so build is reproducible and offline-safe ZIG_GLOBAL_CACHE_DIR=$PWD/zig-deps if [ -x ./nix/build-support/fetch-zig-cache.sh ]; then ZIG_GLOBAL_CACHE_DIR=$ZIG_GLOBAL_CACHE_DIR ./nix/build-support/fetch-zig-cache.sh else echo "WARNING: fetch-zig-cache.sh not found; proceeding with direct network access." fi # zig 0.16 caches packages as p/.tar.gz, but --system only finds extracted p// dirs for pkg in "$ZIG_GLOBAL_CACHE_DIR"/p/*.tar.gz; do [ -e "$pkg" ] || continue tar -C "$ZIG_GLOBAL_CACHE_DIR/p" -xzf "$pkg" done %build ZIG_BIN=%{_bindir}/zig ZIG_GLOBAL_CACHE_DIR=$PWD/zig-deps if [ ! -d "$ZIG_GLOBAL_CACHE_DIR/p" ]; then echo "ERROR: Zig cache directory not found at $ZIG_GLOBAL_CACHE_DIR/p; expected pre-fetched deps." exit 1 fi # -Dversion-string must be semver (no RPM ^), so use upstream's dev version plus the commit GHOSTTY_SEMVER="$(sed -nE 's/^[[:space:]]*\.version = "([^"]+)",/\1/p' build.zig.zon | head -n 1)" if [ -z "$GHOSTTY_SEMVER" ]; then echo "ERROR: Could not read .version from build.zig.zon." exit 1 fi export ZIG_GLOBAL_CACHE_DIR mkdir -p %{_builddir}/ghostty-buildroot DESTDIR=%{_builddir}/ghostty-buildroot "$ZIG_BIN" build install \ --system "$ZIG_GLOBAL_CACHE_DIR/p" \ --summary all \ --prefix "%{_prefix}" \ -Dversion-string="$GHOSTTY_SEMVER+%{shortcommit}" \ -Doptimize=ReleaseFast \ -Dcpu=baseline \ -Dpie=true \ -Demit-docs=false%{?ghostty_vendored_deps: %{ghostty_vendored_deps}} %install cp -a %{_builddir}/ghostty-buildroot/* %{buildroot}/ if [ ! -f "%{buildroot}%{ghostty_systemd_user_unitdir}/app-com.mitchellh.ghostty.service" ]; then echo "ERROR: Ghostty systemd user service file was not generated by zig build." exit 1 fi PKGCONFIG_SOURCE_FILE="$(find %{_builddir}/ghostty-buildroot -type f \ -path '*/pkgconfig/libghostty-vt.pc' | head -n 1)" if [ -z "$PKGCONFIG_SOURCE_FILE" ]; then echo "ERROR: Ghostty pkg-config metadata libghostty-vt.pc was not generated by zig build." echo "Searched in: */pkgconfig/libghostty-vt.pc" find %{_builddir}/ghostty-buildroot -type f -path '*/pkgconfig/*ghostty*' | head -n 20 || true exit 1 fi mkdir -p "%{buildroot}%{ghostty_pkgconfig_dir}" cp -a "$PKGCONFIG_SOURCE_FILE" "%{buildroot}%{ghostty_pkgconfig_dir}/libghostty-vt.pc" # main also installs a static libghostty-vt; ship only the shared library like stable rm -f "%{buildroot}%{ghostty_libdir}/libghostty-vt.a" \ "%{buildroot}%{ghostty_pkgconfig_dir}/libghostty-vt-static.pc" %if 0%{?fedora} >= 42 rm -f "%{buildroot}%{_prefix}/share/terminfo/g/ghostty" %endif %files %license LICENSE %{_bindir}/ghostty %{_prefix}/share/applications/com.mitchellh.ghostty.desktop %{_prefix}/share/bash-completion/completions/ghostty.bash %{_prefix}/share/bat/syntaxes/ghostty.sublime-syntax %{_prefix}/share/fish/vendor_completions.d/ghostty.fish %{_prefix}/share/ghostty %{_prefix}/share/icons/hicolor/1024x1024/apps/com.mitchellh.ghostty.png %{_prefix}/share/icons/hicolor/128x128/apps/com.mitchellh.ghostty.png %{_prefix}/share/icons/hicolor/128x128@2/apps/com.mitchellh.ghostty.png %{_prefix}/share/icons/hicolor/16x16/apps/com.mitchellh.ghostty.png %{_prefix}/share/icons/hicolor/16x16@2/apps/com.mitchellh.ghostty.png %{_prefix}/share/icons/hicolor/256x256/apps/com.mitchellh.ghostty.png %{_prefix}/share/icons/hicolor/256x256@2/apps/com.mitchellh.ghostty.png %{_prefix}/share/icons/hicolor/32x32/apps/com.mitchellh.ghostty.png %{_prefix}/share/icons/hicolor/32x32@2/apps/com.mitchellh.ghostty.png %{_prefix}/share/icons/hicolor/512x512/apps/com.mitchellh.ghostty.png %{_prefix}/share/kio/servicemenus/com.mitchellh.ghostty.desktop %{_prefix}/share/nautilus-python/extensions/ghostty.py %{_prefix}/share/nvim/site/compiler/ghostty.vim %{_prefix}/share/nvim/site/ftdetect/ghostty.vim %{_prefix}/share/nvim/site/ftplugin/ghostty.vim %{_prefix}/share/nvim/site/syntax/ghostty.vim %{_prefix}/share/vim/vimfiles/compiler/ghostty.vim %{_prefix}/share/vim/vimfiles/ftdetect/ghostty.vim %{_prefix}/share/vim/vimfiles/ftplugin/ghostty.vim %{_prefix}/share/vim/vimfiles/syntax/ghostty.vim %{_prefix}/share/zsh/site-functions/_ghostty %{_prefix}/share/dbus-1/services/com.mitchellh.ghostty.service %{_prefix}/share/locale/*/LC_MESSAGES/com.mitchellh.ghostty.mo %{_prefix}/share/metainfo/com.mitchellh.ghostty.metainfo.xml %{ghostty_systemd_user_unitdir}/app-com.mitchellh.ghostty.service %{ghostty_libdir}/libghostty-vt.so.0* %{_prefix}/share/terminfo/x/xterm-ghostty %if 0%{?fedora} < 42 %{_prefix}/share/terminfo/g/ghostty %endif %files devel # main adds headers often, so own the whole tree instead of listing them like stable %{_includedir}/ghostty/ %{ghostty_libdir}/libghostty-vt.so %{ghostty_pkgconfig_dir}/libghostty-vt.pc %changelog %autochangelog