summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3ac2431efcfe4b92bc9323ae16938ca635b13a3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Maintainer: Gregory Anders <greg at gpanders dot com>
# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: kaij <contact at kaij dot tech>

_pkgbase=ghostty
pkgname=($_pkgbase-git $_pkgbase-shell-integration-git $_pkgbase-terminfo-git)
pkgrel=1
pkgver=1.0.1.r399.ga244535
pkgdesc="Fast, native, feature-rich terminal emulator pushing modern features"
arch=(x86_64 aarch64 i686)
url="https://github.com/ghostty-org/$_pkgbase"
license=(MIT)
depends=(bzip2
         fontconfig libfontconfig.so
         freetype2 libfreetype.so
         gcc-libs # ld-linux-x86-64.so
         glibc # libc.so libm.so
         glib2 libglib-2.0.so libgio-2.0.so libgobject-2.0.so
         gtk4 libgtk-4.so
         libx11 # libX11.so
         harfbuzz libharfbuzz.so
         libadwaita libadwaita-1.so
         libpng
         oniguruma # libonig.so
         pixman
         wayland libwayland-client.so
         zlib)
makedepends=(git
             pandoc-cli
             zig)
source=("git+$url.git")
sha256sums=('SKIP')

prepare() {
	cd "$_pkgbase"
	ZIG_GLOBAL_CACHE_DIR="$srcdir/zig-global-cache/" ./nix/build-support/fetch-zig-cache.sh
}

pkgver() {
	cd "$_pkgbase"
	git describe --long --tags --abbrev=7 --match="v*" HEAD |
		sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
        cd "$_pkgbase"
	DESTDIR=build zig build \
		--summary all \
		--prefix "/usr" \
		--system "$srcdir/zig-global-cache/p" \
		-Doptimize=ReleaseFast \
		-Dgtk-wayland=true \
		-Dgtk-x11=true \
		-Dcpu=baseline \
		-Dpie=true \
		-Demit-docs \
		-Dversion-string="${pkgver%.r*}-r${pkgver#*.r}-$pkgrel-arch"
}

package_ghostty-git() {
	provides=("${pkgname%-git}=$pkgver")
	conflicts=(${pkgname%-git})
	cd "$_pkgbase"
	cp -a build/* "$pkgdir/"
	install -Dm0644 -t "${pkgdir}/usr/share/licenses/$pkgname/" LICENSE
	rm -r "$pkgdir"/usr/share/terminfo
	rm -r "$pkgdir"/usr/share/ghostty/shell-integration
}

package_ghostty-shell-integration-git() {
	pkgdesc='Shell integration scripts for ghostty'
	depends=()
	provides=("${pkgname%-git}=$pkgver")
	conflicts=(${pkgname%-git})
	cd "$_pkgbase"
	mkdir -p "$pkgdir/usr/share/ghostty/shell-integration"
	cp -r build/usr/share/ghostty/shell-integration/* "$pkgdir/usr/share/ghostty/shell-integration/"
}

package_ghostty-terminfo-git() {
	pkgdesc='Terminfo for ghostty'
	depends=()
	provides=("${pkgname%-git}=$pkgver")
	conflicts=(${pkgname%-git})
	cd "$_pkgbase"
	mkdir -p "$pkgdir/usr/share/terminfo"
	cp -r build/usr/share/terminfo/* "$pkgdir/usr/share/terminfo/"
}