From 6234908d0c6161a90b9d0c581a877e7f934fbeb8 Mon Sep 17 00:00:00 2001 From: Duncaen Date: Fri, 27 Dec 2024 01:19:20 +0100 Subject: [PATCH] ghostty: fix cross build, use more system libraries Co-authored-by: tranzystorekk --- srcpkgs/ghostty-terminfo | 1 + srcpkgs/ghostty/patches/unigen-nolibc.patch | 26 +++++++++++++++++++++ srcpkgs/ghostty/template | 26 ++++++++++++++++----- 3 files changed, 47 insertions(+), 6 deletions(-) create mode 120000 srcpkgs/ghostty-terminfo create mode 100644 srcpkgs/ghostty/patches/unigen-nolibc.patch diff --git a/srcpkgs/ghostty-terminfo b/srcpkgs/ghostty-terminfo new file mode 120000 index 00000000000000..fdfcbe5d92f1cb --- /dev/null +++ b/srcpkgs/ghostty-terminfo @@ -0,0 +1 @@ +ghostty \ No newline at end of file diff --git a/srcpkgs/ghostty/patches/unigen-nolibc.patch b/srcpkgs/ghostty/patches/unigen-nolibc.patch new file mode 100644 index 00000000000000..b5a1276db16e68 --- /dev/null +++ b/srcpkgs/ghostty/patches/unigen-nolibc.patch @@ -0,0 +1,26 @@ +diff --git a/build.zig b/build.zig +index c3f7302..9fa73e9 100644 +--- a/build.zig ++++ b/build.zig +@@ -1494,7 +1494,7 @@ fn addUnicodeTables( + .root_source_file = b.path("src/unicode/props.zig"), + .target = b.host, + }); +- exe.linkLibC(); ++ // exe.linkLibC(); + if (step_ == null) b.installArtifact(exe); + + const ziglyph_dep = b.dependency("ziglyph", .{ +diff --git a/src/unicode/props.zig b/src/unicode/props.zig +index d77bf4c..994cf36 100644 +--- a/src/unicode/props.zig ++++ b/src/unicode/props.zig +@@ -131,7 +131,7 @@ pub fn get(cp: u21) Properties { + + /// Runnable binary to generate the lookup tables and output to stdout. + pub fn main() !void { +- const alloc = std.heap.c_allocator; ++ const alloc = std.heap.page_allocator; + + const gen: lut.Generator( + Properties, diff --git a/srcpkgs/ghostty/template b/srcpkgs/ghostty/template index 142aa043def4f0..dfc6aaabec9ed5 100644 --- a/srcpkgs/ghostty/template +++ b/srcpkgs/ghostty/template @@ -1,11 +1,18 @@ # Template file for 'ghostty' pkgname=ghostty version=1.0.0 -revision=1 +revision=2 build_style=zig-build -configure_args="-Doptimize=ReleaseFast -Dpie" -hostmakedepends="pkg-config" -makedepends="gtk4-devel libadwaita-devel" +configure_args=" + -Doptimize=ReleaseFast + -Dpie + -Dversion-string=${version} + -fsys=freetype + -fsys=fontconfig + -fsys=harfbuzz" +hostmakedepends="pkg-config glib-devel pandoc" +makedepends="fontconfig-devel freetype-devel harfbuzz-devel gtk4-devel libadwaita-devel" +depends="ghostty-terminfo-${version}_${revision}" short_desc="Fast and feature-rich terminal emulator that uses GPU acceleration" maintainer="Duncaen " license="MIT" @@ -15,6 +22,13 @@ checksum=bd12953c8bbe7149e2f94e7e578a88e981932a69aa483f5ce9a2cfba726e0015 post_install() { vlicense LICENSE - rm -f "${DESTDIR}/usr/share/man/.placeholder" - tic -o "${DESTDIR}/usr/share/terminfo" -x "${DESTDIR}/usr/share/terminfo/ghostty.terminfo" + tic -sx -o ${DESTDIR}/usr/share/terminfo ${DESTDIR}/usr/share/terminfo/ghostty.terminfo + rm -f ${DESTDIR}/usr/share/man/.placeholder ${DESTDIR}/usr/share/terminfo/ghostty.{terminfo,termcap} +} + +ghostty-terminfo_package() { + short_desc+=" - terminfo data" + pkg_install() { + vmove usr/share/terminfo + } }