summaryrefslogtreecommitdiff
blob: 7e83bab0bd2746c135bbea73a0f5b973b0d7d548 (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
# Copyright 2019-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit toolchain-funcs

DESCRIPTION="Linux kernel trace event library"
HOMEPAGE="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/"

if [[ ${PV} =~ [9]{4,} ]]; then
	EGIT_REPO_URI="git://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/"
	inherit git-r3
else
	SRC_URI="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/snapshot/${P}.tar.gz"
	KEYWORDS="~amd64 ~arm64 ~riscv ~x86"
fi

LICENSE="LGPL-2.1"
SLOT="0"
IUSE="doc test"
RESTRICT="!test? ( test )"

RDEPEND="
	!<dev-util/trace-cmd-3.0
"
BDEPEND="
	doc? (
		app-text/asciidoc
		app-text/xmlto
	)
	test? ( dev-util/cunit )
"

src_configure() {
	EMAKE_FLAGS=(
		"prefix=${EPREFIX}/usr"
		"libdir=${EPREFIX}/usr/$(get_libdir)"
		"CC=$(tc-getCC)"
		"AR=$(tc-getAR)"
		VERBOSE=1
	)
}

src_compile() {
	emake "${EMAKE_FLAGS[@]}"
	use doc && emake "${EMAKE_FLAGS[@]}" doc
}

src_test() {
	emake "${EMAKE_FLAGS[@]}" test
}

src_install() {
	emake "${EMAKE_FLAGS[@]}" DESTDIR="${ED}" install
	# can't prevent installation of the static lib with parameters
	rm "${ED}/usr/$(get_libdir)/libtraceevent.a" || die
	use doc && emake "${EMAKE_FLAGS[@]}" DESTDIR="${ED}" install-doc
}