aboutsummaryrefslogtreecommitdiff
blob: 86665f2ccb18e8a1ae4be142a4646464abb6fbf2 (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
89
90
91
92
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit edo

DESCRIPTION="A dynamic tiling Wayland compositor"
HOMEPAGE="https://isaacfreund.com/software/river/"

SRC_URI="
	https://codeberg.org/river/river/archive/v${PV}.tar.gz -> ${P}.tar.gz
	https://codeberg.org/ifreund/zig-pixman/archive/v0.2.0.tar.gz -> zig-pixman-0.2.0.tar.gz
	https://codeberg.org/ifreund/zig-wayland/archive/v0.2.0.tar.gz -> zig-wayland-0.2.0.tar.gz
	https://codeberg.org/ifreund/zig-wlroots/archive/v0.18.0.tar.gz -> zig-wlroots-0.18.0.tar.gz
	https://codeberg.org/ifreund/zig-xkbcommon/archive/v0.2.0.tar.gz -> zig-xkbcommon-0.2.0.tar.gz
"
S="${WORKDIR}/${PN}"

PATCHES=(
	"${FILESDIR}/${P}-build-zig-zon.patch"
	"${FILESDIR}/${P}-zig-0.12.0.patch"
)

LICENSE="GPL-3+"
SLOT="0"
KEYWORDS="~amd64"
IUSE="+llvm +man pie xwayland bash-completion zsh-completion fish-completion"

EZIG_MIN="0.12"

DEPEND="
	|| ( dev-lang/zig-bin:${EZIG_MIN} dev-lang/zig:${EZIG_MIN} )
	dev-libs/wayland
	gui-libs/wlroots:0.18
	xwayland? ( x11-base/xwayland )
	x11-libs/libxkbcommon
	x11-libs/pixman
"
RDEPEND="${DEPEND}"

# https://github.com/ziglang/zig/issues/3382
QA_FLAGS_IGNORED="usr/bin/*"

ezig_build() {
	EZIG=zig
	edo "${EZIG}" build "${ZIG_BUILD_ARGS[@]}" "${@}"
}

src_unpack() {
	default

	mkdir "${S}/deps" || die
	mv zig-pixman "${S}/deps" || die
	mv zig-wayland "${S}/deps" || die
	mv zig-wlroots "${S}/deps" || die
	mv zig-xkbcommon "${S}/deps" || die
}

src_configure() {
	export ZIG_BUILD_ARGS=(
		-Doptimize=ReleaseSafe

		-Dpie=$(usex pie true false)
		-Dno-llvm=$(usex llvm false true)
		-Dman-pages=$(usex man true false)
		-Dbash-completion=$(usex bash-completion true false)
		-Dzsh-completion=$(usex zsh-completion true false)
		-Dfish-completion=$(usex fish-completion true false)
		-Dxwayland=$(usex xwayland true false)
	)
}

src_compile() {
	ezig_build
}

src_test() {
	ezig_build test
}

src_install() {
	ezig_build install --prefix "${ED}/usr"

	dodoc README.md

	insinto /usr/share/wayland-sessions
	doins contrib/river.desktop

	insinto /usr/share/${PN}
	doins -r example
}