summaryrefslogtreecommitdiff
path: root/dev-util/0xtools/0xtools-1.2.4.ebuild
blob: 3b7026647b97e8d0f6216ebe3e69edb5a65ad020 (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
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{10..12} )

inherit python-single-r1 systemd toolchain-funcs

DESCRIPTION="Always-on profiling for production systems"
HOMEPAGE="https://0x.tools/
	https://github.com/tanelpoder/0xtools/"

if [[ ${PV} == *9999* ]] ; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/tanelpoder/${PN}.git"
else
	SRC_URI="https://github.com/tanelpoder/${PN}/archive/v${PV}.tar.gz
		-> ${P}.tar.gz"
	KEYWORDS="~amd64 ~x86"
fi

LICENSE="GPL-2+"
SLOT="0"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"

RDEPEND="${PYTHON_DEPS}"
BDEPEND="${RDEPEND}"

DOCS=( CHANGELOG.md README.md )

src_compile() {
	emake CC="$(tc-getCC)" CFLAGS="${CFLAGS} ${LDFLAGS}"

	sed -e "/^sys.path.append/s|(.*)|('$(python_get_sitedir)/${PN}')|"	\
		-i bin/psn -i bin/schedlat || die
}

src_install() {
	# C executables and scripts
	exeinto /usr/bin
	doexe bin/{run_xcapture.sh,run_xcpu.sh,vmtop,xcapture}

	# Python executables
	python_domodule lib/${PN}
	python_doscript bin/psn
	python_doscript bin/schedlat

	# Service
	systemd_dounit xcapture.service
	systemd_dounit xcapture-restart.service
	systemd_dounit xcapture-restart.timer

	# Service config
	insinto /etc/default
	newins xcapture.default xcapture

	# Service logs
	keepdir /var/log/xcapture

	einstalldocs
}