Update ghostty live ebuild to add useflags and match upstreams build-options
This commit is contained in:
@@ -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"));
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user