1 |
1 |
# Copyright 2020-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
inherit systemd
|
|
6 |
GO_OPTIONAL=1
|
|
7 |
inherit go-module systemd toolchain-funcs
|
7 |
8 |
|
8 |
9 |
DESCRIPTION="Early OOM Daemon for Linux"
|
9 |
10 |
HOMEPAGE="https://github.com/rfjakob/earlyoom"
|
10 |
11 |
|
11 |
|
LICENSE="MIT-with-advertising"
|
12 |
|
SLOT="0"
|
13 |
|
if [ "${PV}" = "9999" ]; then
|
|
12 |
if [[ ${PV} == 9999 ]] ; then
|
14 |
13 |
EGIT_REPO_URI="https://github.com/rfjakob/earlyoom.git"
|
15 |
14 |
inherit git-r3
|
16 |
15 |
else
|
17 |
16 |
SRC_URI="https://github.com/rfjakob/earlyoom/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
|
17 |
SRC_URI+=" test? ( https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-deps.tar.xz )"
|
|
18 |
|
18 |
19 |
KEYWORDS="amd64 x86"
|
19 |
20 |
fi
|
20 |
|
IUSE="docs systemd test"
|
21 |
21 |
|
22 |
|
RDEPEND=""
|
23 |
|
DEPEND=""
|
|
22 |
LICENSE="MIT-with-advertising"
|
|
23 |
SLOT="0"
|
|
24 |
IUSE="man test"
|
|
25 |
RESTRICT="!test? ( test )"
|
|
26 |
|
24 |
27 |
BDEPEND="
|
25 |
|
docs? ( virtual/pandoc )
|
26 |
|
test? ( dev-lang/go )
|
|
28 |
man? ( virtual/pandoc )
|
|
29 |
test? (
|
|
30 |
dev-lang/go
|
|
31 |
dev-util/cppcheck
|
|
32 |
)
|
27 |
33 |
"
|
28 |
34 |
|
29 |
|
#tests don't work
|
30 |
|
RESTRICT=test
|
|
35 |
src_unpack() {
|
|
36 |
default
|
|
37 |
|
|
38 |
use test && go-module_src_unpack
|
|
39 |
}
|
31 |
40 |
|
32 |
41 |
src_compile() {
|
33 |
|
VERSION="v${PV}" emake earlyoom
|
34 |
|
use docs && VERSION="v${PV}" emake earlyoom.1
|
35 |
|
use systemd && emake PREFIX=/usr earlyoom.service
|
|
42 |
tc-export CC
|
|
43 |
|
|
44 |
emake \
|
|
45 |
PREFIX="${EPREFIX}"/usr \
|
|
46 |
VERSION="v${PV}" \
|
|
47 |
SYSTEMDUNITDIR="$(systemd_get_systemunitdir)" \
|
|
48 |
earlyoom earlyoom.service $(usev man 'earlyoom.1')
|
36 |
49 |
}
|
37 |
50 |
|
38 |
51 |
src_install() {
|
39 |
52 |
dobin earlyoom
|
40 |
|
use docs && doman earlyoom.1
|
|
53 |
|
|
54 |
use man && doman earlyoom.1
|
41 |
55 |
|
42 |
56 |
insinto /etc/default
|
43 |
57 |
newins earlyoom.default earlyoom
|
|
58 |
|
44 |
59 |
dodir /etc/conf.d
|
45 |
|
ln -s ../default/earlyoom "${ED}/etc/conf.d/earlyoom"
|
|
60 |
dosym -r /etc/default/earlyoom /etc/conf.d/earlyoom
|
46 |
61 |
|
47 |
|
newinitd "${FILESDIR}/${PN}-r1" "${PN}"
|
48 |
|
use systemd && systemd_dounit earlyoom.service
|
|
62 |
newinitd "${FILESDIR}"/${PN}-r1 ${PN}
|
|
63 |
systemd_dounit earlyoom.service
|
49 |
64 |
}
|