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

EAPI=7

LUA_COMPAT=( luajit )
PYTHON_COMPAT=( python3_{8..10} )

inherit bash-completion-r1 lua-single python-single-r1 toolchain-funcs

DESCRIPTION="Function (graph) tracer for user-space"
HOMEPAGE="https://github.com/namhyung/uftrace"
SRC_URI="https://github.com/namhyung/uftrace/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 ~arm64"
IUSE="capstone lua python unwind"

REQUIRED_USE="
	lua? ( ${LUA_REQUIRED_USE} )
	python? ( ${PYTHON_REQUIRED_USE} )
"

RESTRICT="test"

RDEPEND="
	sys-libs/ncurses:=
	virtual/libelf:=
	capstone? ( dev-libs/capstone:0= )
	lua? ( ${LUA_DEPS} )
	python? ( ${PYTHON_DEPS} )
	unwind? ( sys-libs/libunwind:= )
"
DEPEND="${RDEPEND}"

src_prepare() {
	default
	sed -i -e "s/ARCH/MYARCH/g" -e "/ldconfig/d" -e "/bash.completion/d" Makefile || die
}

src_configure() {
	local myconf=(
		--libdir="${EPREFIX}/usr/$(get_libdir)/uftrace"
		$(use_with capstone)
		$(use_with unwind libunwind)
		$(use_with python libpython)
	)
	if use lua && use lua_single_target_luajit; then
		myconf+=(
			--with-libluajit
		)
	else
		myconf+=(
			--without-libluajit
		)
	fi
	CC="$(tc-getCC)" LD="$(tc-getLD)" econf "${myconf[@]}"
}

src_compile() {
	emake V=1
}

src_install() {
	default

	dodoc doc/*.{md,gif,png}
	newbashcomp misc/bash-completion.sh uftrace
}