3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
inherit verify-sig
|
|
6 |
inherit verify-sig edo
|
7 |
7 |
|
8 |
8 |
DESCRIPTION="NCurses Disk Usage"
|
9 |
9 |
HOMEPAGE="https://dev.yorhel.nl/ncdu"
|
... | ... | |
14 |
14 |
|
15 |
15 |
LICENSE="MIT"
|
16 |
16 |
SLOT="0"
|
17 |
|
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos"
|
|
17 |
KEYWORDS="~amd64"
|
|
18 |
|
|
19 |
EZIG_MIN="0.10"
|
|
20 |
EZIG_MAX_EXCLUSIVE="0.11"
|
18 |
21 |
|
19 |
22 |
DEPEND="sys-libs/ncurses:=[unicode(+)]"
|
20 |
23 |
RDEPEND="${DEPEND}"
|
21 |
24 |
BDEPEND="
|
|
25 |
|| ( dev-lang/zig:${EZIG_MIN} dev-lang/zig-bin:${EZIG_MIN} )
|
22 |
26 |
virtual/pkgconfig
|
23 |
27 |
dev-lang/perl
|
24 |
28 |
verify-sig? ( sec-keys/openpgp-keys-yorhel )
|
25 |
29 |
"
|
26 |
30 |
|
27 |
31 |
VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/yoranheling.asc
|
|
32 |
|
|
33 |
PATCHES=(
|
|
34 |
"${FILESDIR}/${P}-makefile-add-zig-variable.patch"
|
|
35 |
)
|
|
36 |
|
|
37 |
# see https://github.com/ziglang/zig/issues/3382
|
|
38 |
# For now, Zig doesn't support CFLAGS/LDFLAGS/etc.
|
|
39 |
QA_FLAGS_IGNORED="usr/bin/ncdu"
|
|
40 |
|
|
41 |
# Many thanks to Florian Schmaus (Flowdalic)!
|
|
42 |
# Adapted from https://github.com/gentoo/gentoo/pull/28986
|
|
43 |
# Set the EZIG environment variable.
|
|
44 |
zig-set_EZIG() {
|
|
45 |
[[ -n ${EZIG} ]] && return
|
|
46 |
|
|
47 |
if [[ -n ${EZIG_OVERWRITE} ]]; then
|
|
48 |
export EZIG="${EZIG_OVERWRITE}"
|
|
49 |
return
|
|
50 |
fi
|
|
51 |
|
|
52 |
local candidate selected selected_ver ver
|
|
53 |
|
|
54 |
for candidate in "${BROOT}"/usr/bin/zig-*; do
|
|
55 |
if [[ ! -L ${candidate} || ${candidate} != */zig?(-bin)-+([0-9.]) ]]; then
|
|
56 |
continue
|
|
57 |
fi
|
|
58 |
|
|
59 |
ver=${candidate##*-}
|
|
60 |
|
|
61 |
if [[ -n ${EZIG_EXACT_VER} ]]; then
|
|
62 |
ver_test "${ver}" -ne "${EZIG_EXACT_VER}" && continue
|
|
63 |
|
|
64 |
selected="${candidate}"
|
|
65 |
selected_ver="${ver}"
|
|
66 |
break
|
|
67 |
fi
|
|
68 |
|
|
69 |
if [[ -n ${EZIG_MIN} ]] \
|
|
70 |
&& ver_test "${ver}" -lt "${EZIG_MIN}"; then
|
|
71 |
# Candidate does not satisfy EZIG_MIN condition.
|
|
72 |
continue
|
|
73 |
fi
|
|
74 |
|
|
75 |
if [[ -n ${EZIG_MAX_EXCLUSIVE} ]] \
|
|
76 |
&& ver_test "${ver}" -ge "${EZIG_MAX_EXCLUSIVE}"; then
|
|
77 |
# Candidate does not satisfy EZIG_MAX_EXCLUSIVE condition.
|
|
78 |
continue
|
|
79 |
fi
|
|
80 |
|
|
81 |
if [[ -n ${selected_ver} ]] \
|
|
82 |
&& ver_test "${selected_ver}" -gt "${ver}"; then
|
|
83 |
# Candidate is older than the currently selected candidate.
|
|
84 |
continue
|
|
85 |
fi
|
|
86 |
|
|
87 |
selected="${candidate}"
|
|
88 |
selected_ver="${ver}"
|
|
89 |
done
|
|
90 |
|
|
91 |
if [[ -z ${selected} ]]; then
|
|
92 |
die "Could not find (suitable) zig installation in ${BROOT}/usr/bin"
|
|
93 |
fi
|
|
94 |
|
|
95 |
export EZIG="${selected}"
|
|
96 |
export EZIG_VER="${selected_ver}"
|
|
97 |
}
|
|
98 |
|
|
99 |
# Invoke zig with the optionally provided arguments.
|
|
100 |
ezig() {
|
|
101 |
zig-set_EZIG
|
|
102 |
|
|
103 |
# Unfortunately, we cannot add more args here, since syntax is different
|
|
104 |
# for every subcommands. Yes, even target/cpu :( f.i. :
|
|
105 |
# -target/-mcpu for zig build-exe vs -Dtarget/-Dcpu for zig build-
|
|
106 |
# -OReleaseSafe for zig build-exe vs -DReleaseSafe for zig build
|
|
107 |
# (or even none, if hardcoded by upstream so choice is -Drelease=true/false)
|
|
108 |
# Ofc we can patch this, but still...
|
|
109 |
|
|
110 |
edo "${EZIG}" "${@}"
|
|
111 |
}
|
|
112 |
|
|
113 |
src_unpack() {
|
|
114 |
if use verify-sig; then
|
|
115 |
verify-sig_verify_detached "${DISTDIR}"/${P}.tar.gz{,.asc}
|
|
116 |
fi
|
|
117 |
default
|
|
118 |
}
|
|
119 |
|
|
120 |
src_configure() {
|
|
121 |
zig-set_EZIG
|
|
122 |
export ZIG=${EZIG}
|
|
123 |
}
|
|
124 |
|
|
125 |
src_test() {
|
|
126 |
ezig build test -Drelease-fast
|
|
127 |
}
|
|
128 |
|
|
129 |
src_install() {
|
|
130 |
emake PREFIX="${ED}"/usr install
|
|
131 |
|
|
132 |
dodoc README.md ChangeLog
|
|
133 |
}
|