summaryrefslogtreecommitdiff
path: root/sys-apps/earlyoom/earlyoom-1.7-r1.ebuild
blob: 9c0f8e1059dc28c66b2231dd1b105450688fb2cd (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
# Copyright 2020-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

GO_OPTIONAL=1
inherit go-module systemd toolchain-funcs

DESCRIPTION="Early OOM Daemon for Linux"
HOMEPAGE="https://github.com/rfjakob/earlyoom"

if [[ ${PV} == 9999 ]] ; then
	EGIT_REPO_URI="https://github.com/rfjakob/earlyoom.git"
	inherit git-r3
else
	SRC_URI="https://github.com/rfjakob/earlyoom/archive/v${PV}.tar.gz -> ${P}.tar.gz"
	SRC_URI+=" test? ( https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-deps.tar.xz )"

	KEYWORDS="amd64 x86"
fi

LICENSE="MIT"
SLOT="0"
IUSE="man test"
RESTRICT="!test? ( test )"

BDEPEND="
	man? ( virtual/pandoc )
	test? (
		dev-lang/go
		dev-util/cppcheck
	)
"

src_unpack() {
	default

	use test && go-module_src_unpack
}

src_compile() {
	tc-export CC

	emake \
		PREFIX="${EPREFIX}"/usr \
		VERSION="v${PV}" \
		SYSTEMDUNITDIR="$(systemd_get_systemunitdir)" \
		earlyoom earlyoom.service $(usev man 'earlyoom.1')
}

src_install() {
	dobin earlyoom

	use man && doman earlyoom.1

	insinto /etc/default
	newins earlyoom.default earlyoom

	dodir /etc/conf.d
	dosym -r /etc/default/earlyoom /etc/conf.d/earlyoom

	newinitd "${FILESDIR}"/${PN}-r1 ${PN}
	systemd_dounit earlyoom.service
}