From 2487f059cf1671bc79fcb61ca046e085f0d81ad5 Mon Sep 17 00:00:00 2001 From: fabolous005 Date: Mon, 6 Jan 2025 04:23:05 +0100 Subject: [PATCH] Update ghostty live ebuild to add useflags and match upstreams build-options --- metadata/md5-cache/dev-libs/hyprgraphics-9999 | 3 +- metadata/md5-cache/x11-terms/ghostty-9999 | 13 +- .../ghostty-1.0.0-bzip2-dependency.patch | 13 ++ ...1.0.1-copy-terminfo-using-installdir.patch | 44 +++++ x11-terms/ghostty/ghostty-9999.ebuild | 166 ++++++++---------- 5 files changed, 139 insertions(+), 100 deletions(-) create mode 100644 x11-terms/ghostty/files/ghostty-1.0.0-bzip2-dependency.patch create mode 100644 x11-terms/ghostty/files/ghostty-1.0.1-copy-terminfo-using-installdir.patch diff --git a/metadata/md5-cache/dev-libs/hyprgraphics-9999 b/metadata/md5-cache/dev-libs/hyprgraphics-9999 index e862c6a..9f4bd26 100644 --- a/metadata/md5-cache/dev-libs/hyprgraphics-9999 +++ b/metadata/md5-cache/dev-libs/hyprgraphics-9999 @@ -5,11 +5,10 @@ DESCRIPTION=Aquamarine is a very light linux rendering backend library EAPI=8 HOMEPAGE=https://github.com/hyprwm/aquamarine INHERIT=cmake git-r3 -KEYWORDS=~amd64 LICENSE=BSD PROPERTIES=live RDEPEND=media-libs/libjxl RESTRICT=test SLOT=0 _eclasses_=toolchain-funcs 14648d8795f7779e11e1bc7cf08b7536 multilib b2a329026f2e404e9e371097dda47f96 flag-o-matic f14aba975c94ccaa9f357a27e3b17ffe multiprocessing 1e32df7deee68372153dca65f4a7c21f ninja-utils 2df4e452cea39a9ec8fb543ce059f8d6 xdg-utils 42869b3c8d86a70ef3cf75165a395e09 cmake 10a50dfaf728b802fcfd37f8d0da9056 git-r3 875eb471682d3e1f18da124be97dcc81 -_md5_=b540517aac6da9238b92ac640ca6e66a +_md5_=c9d3a5d4e012e6ccc390d9ad79eb49b1 diff --git a/metadata/md5-cache/x11-terms/ghostty-9999 b/metadata/md5-cache/x11-terms/ghostty-9999 index 58e9327..5cbe504 100644 --- a/metadata/md5-cache/x11-terms/ghostty-9999 +++ b/metadata/md5-cache/x11-terms/ghostty-9999 @@ -1,11 +1,14 @@ -BDEPEND=gui-libs/gtk[X] >=dev-vcs/git-1.8.2.1[curl] -DEFINED_PHASES=compile configure install test unpack +BDEPEND=adwaita? ( gui-libs/libadwaita:1= ) gtk? ( gui-libs/gtk:4=[X] system-libxml2? ( >=dev-libs/libxml2-2.11.5:= ) ) system-fontconfig? ( >=media-libs/fontconfig-2.14.2:= ) system-freetype? ( >=media-libs/freetype-2.13.2:=[bzip2] ) system-glslang? ( >=dev-util/glslang-1.3.296.0:= ) system-harfbuzz? ( >=media-libs/harfbuzz-8.4.0:= ) system-libpng? ( >=media-libs/libpng-1.6.43:= ) system-oniguruma? ( >=dev-libs/oniguruma-6.9.9:= ) system-zlib? ( >=sys-libs/zlib-1.3.1:= ) system-simdutf? ( >=dev-cpp/simdutf-5.7.2:= ) >=dev-vcs/git-1.8.2.1[curl] || ( dev-lang/zig: dev-lang/zig-bin: ) virtual/pkgconfig +DEFINED_PHASES=compile configure install prepare setup test unpack DESCRIPTION=Ghostty is a fast, feature-rich, and cross-platform terminal emulator that uses platform-native UI and GPU acceleration. EAPI=8 HOMEPAGE=ghostty.org -INHERIT=edo git-r3 +INHERIT=edo git-r3 zig +IUSE=adwaita man gtk +glfw +system-fontconfig +system-freetype +system-glslang +system-harfbuzz +system-libpng +system-libxml2 +system-oniguruma +system-zlib +system-simdutf LICENSE=MIT PROPERTIES=live +RDEPEND=adwaita? ( gui-libs/libadwaita:1= ) gtk? ( gui-libs/gtk:4=[X] system-libxml2? ( >=dev-libs/libxml2-2.11.5:= ) ) system-fontconfig? ( >=media-libs/fontconfig-2.14.2:= ) system-freetype? ( >=media-libs/freetype-2.13.2:=[bzip2] ) system-glslang? ( >=dev-util/glslang-1.3.296.0:= ) system-harfbuzz? ( >=media-libs/harfbuzz-8.4.0:= ) system-libpng? ( >=media-libs/libpng-1.6.43:= ) system-oniguruma? ( >=dev-libs/oniguruma-6.9.9:= ) system-zlib? ( >=sys-libs/zlib-1.3.1:= ) system-simdutf? ( >=dev-cpp/simdutf-5.7.2:= ) +REQUIRED_USE=adwaita? ( gtk ) ^^ ( gtk glfw ) SLOT=0 -_eclasses_=edo 367e103a74bf77e6a8da7894d999fa3c git-r3 875eb471682d3e1f18da124be97dcc81 -_md5_=5d5d028d531f17d3e4f565dc70d96279 +_eclasses_=edo 367e103a74bf77e6a8da7894d999fa3c git-r3 875eb471682d3e1f18da124be97dcc81 multiprocessing 1e32df7deee68372153dca65f4a7c21f toolchain-funcs 14648d8795f7779e11e1bc7cf08b7536 multilib b2a329026f2e404e9e371097dda47f96 flag-o-matic f14aba975c94ccaa9f357a27e3b17ffe linux-info ea4122ba1d8791a12b78e53f9510a2e3 zig-utils 52d461a2abcfdeb90344b40e902c0f6e zig 1dedc2f01be682d4a76e3f24b00c9252 +_md5_=7b45e9c26fee443ee70c0992ef0a8096 diff --git a/x11-terms/ghostty/files/ghostty-1.0.0-bzip2-dependency.patch b/x11-terms/ghostty/files/ghostty-1.0.0-bzip2-dependency.patch new file mode 100644 index 0000000..cb9dec4 --- /dev/null +++ b/x11-terms/ghostty/files/ghostty-1.0.0-bzip2-dependency.patch @@ -0,0 +1,13 @@ +diff --git a/build.zig b/build.zig +index c3f73026..09965025 100644 +--- a/build.zig ++++ b/build.zig +@@ -1064,7 +1064,7 @@ fn addDeps( + step.root_module.addImport("freetype", freetype_dep.module("freetype")); + + if (b.systemIntegrationOption("freetype", .{})) { +- step.linkSystemLibrary2("bzip2", dynamic_link_opts); ++ step.linkSystemLibrary2("bz2", dynamic_link_opts); + step.linkSystemLibrary2("freetype2", dynamic_link_opts); + } else { + step.linkLibrary(freetype_dep.artifact("freetype")); diff --git a/x11-terms/ghostty/files/ghostty-1.0.1-copy-terminfo-using-installdir.patch b/x11-terms/ghostty/files/ghostty-1.0.1-copy-terminfo-using-installdir.patch new file mode 100644 index 0000000..184ddec --- /dev/null +++ b/x11-terms/ghostty/files/ghostty-1.0.1-copy-terminfo-using-installdir.patch @@ -0,0 +1,44 @@ +diff --git a/build.zig b/build.zig +index 6b92a095..ca2bd330 100644 +--- a/build.zig ++++ b/build.zig +@@ -528,27 +528,21 @@ pub fn build(b: *std.Build) !void { + run_step.step.dependOn(&src_install.step); + + { +- // Use cp -R instead of Step.InstallDir because we need to preserve +- // symlinks in the terminfo database. Zig's InstallDir step doesn't +- // handle symlinks correctly yet. +- const copy_step = RunStep.create(b, "copy terminfo db"); +- copy_step.addArgs(&.{ "cp", "-R" }); +- copy_step.addFileArg(path); +- copy_step.addArg(b.fmt("{s}/share", .{b.install_path})); +- b.getInstallStep().dependOn(©_step.step); ++ const install_dir_step = b.addInstallDirectory(.{ ++ .source_dir = path, ++ .install_dir = .prefix, ++ .install_subdir = "share/terminfo", ++ }); ++ b.getInstallStep().dependOn(&install_dir_step.step); + } + + if (target.result.os.tag == .macos and exe_ != null) { +- // Use cp -R instead of Step.InstallDir because we need to preserve +- // symlinks in the terminfo database. Zig's InstallDir step doesn't +- // handle symlinks correctly yet. +- const copy_step = RunStep.create(b, "copy terminfo db"); +- copy_step.addArgs(&.{ "cp", "-R" }); +- copy_step.addFileArg(path); +- copy_step.addArg( +- b.fmt("{s}/Ghostty.app/Contents/Resources", .{b.install_path}), +- ); +- b.getInstallStep().dependOn(©_step.step); ++ const install_dir_step = b.addInstallDirectory(.{ ++ .source_dir = path, ++ .install_dir = .prefix, ++ .install_subdir = "Ghostty.app/Contents/Resources/terminfo", ++ }); ++ b.getInstallStep().dependOn(&install_dir_step.step); + } + } + } diff --git a/x11-terms/ghostty/ghostty-9999.ebuild b/x11-terms/ghostty/ghostty-9999.ebuild index 4585edd..895b1fd 100644 --- a/x11-terms/ghostty/ghostty-9999.ebuild +++ b/x11-terms/ghostty/ghostty-9999.ebuild @@ -3,7 +3,8 @@ EAPI=8 -inherit edo git-r3 +ZIG_SLOT="0.13" +inherit edo git-r3 zig DESCRIPTION="Ghostty is a fast, feature-rich, and cross-platform terminal emulator that uses platform-native UI and GPU acceleration." HOMEPAGE="ghostty.org" @@ -12,112 +13,91 @@ EGIT_REPO_URI="https://github.com/ghostty-org/ghostty.git" LICENSE="MIT" SLOT="0" -EZIG_MIN="0.13" -EZIG_MAX_EXCLUSIVE="0.14" - -# RDEPEND="${DEPEND}" -BDEPEND=" - gui-libs/gtk[X] +IUSE="adwaita man gtk +glfw" +IUSE+=" +system-fontconfig +system-freetype +system-glslang +system-harfbuzz +system-libpng system-libxml2 +system-oniguruma +system-zlib +system-simdutf" +REQUIRED_USE=" + adwaita? ( gtk ) + ^^ ( gtk glfw ) " + +RDEPEND=" + adwaita? ( gui-libs/libadwaita:1= ) + gtk? ( + gui-libs/gtk:4=[X] + system-libxml2? ( >=dev-libs/libxml2-2.11.5:= ) + ) + + system-fontconfig? ( >=media-libs/fontconfig-2.14.2:= ) + system-freetype? ( >=media-libs/freetype-2.13.2:=[bzip2] ) + system-glslang? ( >=dev-util/glslang-1.3.296.0:= ) + system-harfbuzz? ( >=media-libs/harfbuzz-8.4.0:= ) + system-libpng? ( >=media-libs/libpng-1.6.43:= ) + system-oniguruma? ( >=dev-libs/oniguruma-6.9.9:= ) + system-zlib? ( >=sys-libs/zlib-1.3.1:= ) + system-simdutf? ( >=dev-cpp/simdutf-5.7.2:= ) +" +DEPEND="${RDEPEND}" + QA_FLAGS_IGNORED="usr/bin/ghostty" +QA_PRESTRIPPED="usr/bin/ghostty" -# S="${WORKDIR}/${PN}" - -# Many thanks to Florian Schmaus (Flowdalic)! -# Adapted from https://github.com/gentoo/gentoo/pull/28986 -# Set the EZIG environment variable. -zig-set_EZIG() { - [[ -n ${EZIG} ]] && return - - if [[ -n ${EZIG_OVERWRITE} ]]; then - export EZIG="${EZIG_OVERWRITE}" - return - fi - - local candidate selected selected_ver ver - - for candidate in "${BROOT}"/usr/bin/zig-*; do - if [[ ! -L ${candidate} || ${candidate} != */zig?(-bin)-+([0-9.]) ]]; then - continue - fi - - ver=${candidate##*-} - - if [[ -n ${EZIG_EXACT_VER} ]]; then - ver_test "${ver}" -ne "${EZIG_EXACT_VER}" && continue - - selected="${candidate}" - selected_ver="${ver}" - break - fi - - if [[ -n ${EZIG_MIN} ]] \ - && ver_test "${ver}" -lt "${EZIG_MIN}"; then - # Candidate does not satisfy EZIG_MIN condition. - continue - fi - - if [[ -n ${EZIG_MAX_EXCLUSIVE} ]] \ - && ver_test "${ver}" -ge "${EZIG_MAX_EXCLUSIVE}"; then - # Candidate does not satisfy EZIG_MAX_EXCLUSIVE condition. - continue - fi - - if [[ -n ${selected_ver} ]] \ - && ver_test "${selected_ver}" -gt "${ver}"; then - # Candidate is older than the currently selected candidate. - continue - fi - - selected="${candidate}" - selected_ver="${ver}" - done - - if [[ -z ${selected} ]]; then - die "Could not find (suitable) zig installation in ${BROOT}/usr/bin" - fi - - export EZIG="${selected}" - export EZIG_VER="${selected_ver}" -} - -# Invoke zig with the optionally provided arguments. -ezig() { - zig-set_EZIG - - # Unfortunately, we cannot add more args here, since syntax is different - # for every subcommands. Yes, even target/cpu :( f.i. : - # -target/-mcpu for zig build-exe vs -Dtarget/-Dcpu for zig build- - # -OReleaseSafe for zig build-exe vs -DReleaseSafe for zig build - # (or even none, if hardcoded by upstream so choice is -Drelease=true/false) - # Ofc we can patch this, but still... - - edo "${EZIG}" "${@}" -} +PATCHES=( + "${FILESDIR}"/${PN}-1.0.0-bzip2-dependency.patch +) src_unpack() { git-r3_fetch git-r3_checkout - cd ${S} || return - zig build --fetch 2>/dev/null - zig build --fetch 2>/dev/null - zig build --fetch 2>/dev/null + cd ${S}/ || die + zig build --help -Dapp-runtime=glfw 2&>/dev/null + zig build --help -Dapp-runtime=glfw 2&>/dev/null + zig build --help -Dapp-runtime=glfw 2&>/dev/null + zig build --help -Dapp-runtime=gtk } -src_configure() { - zig-set_EZIG - export ZIG=${EZIG} +src_prepare() { + default + my_zbs_args=( + -Doptimize=ReleaseFast + -Dfont-backend=fontconfig_freetype + -Drenderer=opengl + -Dgtk-adwaita=$(usex adwaita true false) + -Demit-docs=$(usex man true false) + + -f$(usex system-fontconfig sys no-sys)=fontconfig + -f$(usex system-freetype sys no-sys)=freetype + -f$(usex system-glslang sys no-sys)=glslang + -f$(usex system-harfbuzz sys no-sys)=harfbuzz + -f$(usex system-libpng sys no-sys)=libpng + -f$(usex system-oniguruma sys no-sys)=oniguruma + -f$(usex system-zlib sys no-sys)=zlib + -f$(usex system-simdutf sys no-sys)=simdutf + ) + if use gtk; then + my_zbs_args+=( + -Dapp-runtime=gtk + ) + if use system-libxml2; then + my_zbs_args+=( + -Dsys=libxml2 + ) + fi + elif use glfw; then + my_zbs_args+=( + -Dapp-runtime=glfw + ) + fi + + zig_src_configure } src_compile() { - ezig build -Doptimize=ReleaseFast -} - -src_test() { - ezig build test -Doptimize=ReleaseFast + BUILD_DIR=${S} + zig_src_compile } src_install() { - ezig build -p "${ED}"/usr -Doptimize=ReleaseFast + zig_src_install + dosym -r /usr/share/terminfo/x/xterm-ghostty /usr/share/terminfo/g/ghostty }