2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
|
PYTHON_COMPAT=( python3_{9..11} )
|
|
5 |
|
6 |
6 |
DISTUTILS_OPTIONAL=1
|
|
7 |
PYTHON_COMPAT=( python3_{10..11} )
|
7 |
8 |
|
8 |
|
inherit linux-info bash-completion-r1 python-r1 toolchain-funcs
|
|
9 |
inherit linux-info meson python-single-r1
|
9 |
10 |
|
10 |
11 |
DESCRIPTION="User-space front-end for Ftrace"
|
11 |
12 |
HOMEPAGE="https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git"
|
... | ... | |
21 |
22 |
|
22 |
23 |
LICENSE="GPL-2+ LGPL-2.1+"
|
23 |
24 |
SLOT="0/${PV}"
|
24 |
|
IUSE="+audit doc python test udis86 +zstd"
|
|
25 |
IUSE="python test"
|
25 |
26 |
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
|
26 |
|
RESTRICT="!test? ( test )"
|
|
27 |
# Tests segfault for now?
|
|
28 |
RESTRICT="!test? ( test ) test"
|
27 |
29 |
|
28 |
|
# XXX trace-cmd autodetects this without configurability. This might cause
|
29 |
|
# issues if the libraries are picked up with the useflag disabled and later
|
30 |
|
# uninstalled
|
31 |
30 |
RDEPEND="
|
32 |
|
audit? ( sys-process/audit )
|
33 |
|
python? ( ${PYTHON_DEPS} )
|
34 |
|
udis86? ( dev-libs/udis86 )
|
35 |
|
zstd? ( >=app-arch/zstd-1.4 )
|
|
31 |
>=app-arch/zstd-1.4
|
36 |
32 |
!<dev-libs/libtracefs-1.6.1
|
37 |
33 |
>=dev-libs/libtracefs-1.6.1-r1
|
38 |
34 |
>=dev-libs/libtraceevent-1.6.3
|
|
35 |
sys-libs/zlib
|
|
36 |
sys-process/audit
|
|
37 |
python? ( ${PYTHON_DEPS} )
|
39 |
38 |
"
|
40 |
|
DEPEND="${RDEPEND}
|
|
39 |
DEPEND="
|
|
40 |
${RDEPEND}
|
41 |
41 |
sys-kernel/linux-headers
|
42 |
42 |
test? ( dev-util/cunit )
|
43 |
43 |
"
|
44 |
44 |
BDEPEND="
|
|
45 |
app-text/asciidoc
|
|
46 |
dev-util/source-highlight
|
45 |
47 |
virtual/pkgconfig
|
46 |
48 |
python? ( dev-lang/swig )
|
47 |
|
doc? (
|
48 |
|
app-text/asciidoc
|
49 |
|
dev-util/source-highlight
|
50 |
|
)
|
51 |
49 |
"
|
52 |
50 |
|
53 |
|
# having trouble getting tests to compile
|
54 |
|
RESTRICT+=" test"
|
55 |
|
|
56 |
51 |
pkg_setup() {
|
57 |
52 |
local CONFIG_CHECK="
|
58 |
53 |
~TRACING
|
... | ... | |
60 |
55 |
~BLK_DEV_IO_TRACE"
|
61 |
56 |
|
62 |
57 |
linux-info_pkg_setup
|
63 |
|
}
|
64 |
58 |
|
65 |
|
src_prepare() {
|
66 |
|
default
|
67 |
|
sed -r -e 's:([[:space:]]+)install_bash_completion($|[[:space:]]+):\1:' \
|
68 |
|
-e '/^prefix/s:/usr/local:/usr:g' \
|
69 |
|
-i Makefile || die "sed failed"
|
70 |
|
|
71 |
|
sed -i -e "s|^htmldir.*|&-${PVR}|g" \
|
72 |
|
-e "s|^pdfdir.*|&-${PVR}|g" \
|
73 |
|
Documentation/libtracecmd/Makefile \
|
74 |
|
Documentation/trace-cmd/Makefile || die
|
|
59 |
# TODO: Once we have options for doc+tests, we can revisit Python being
|
|
60 |
# single-impl.
|
|
61 |
use python && python-single-r1_pkg_setup
|
75 |
62 |
}
|
76 |
63 |
|
77 |
64 |
src_configure() {
|
78 |
|
EMAKE_FLAGS=(
|
79 |
|
BUILD_OUTPUT="${WORKDIR}/${P}_build"
|
80 |
|
"prefix=${EPREFIX}/usr"
|
81 |
|
"libdir=${EPREFIX}/usr/$(get_libdir)"
|
82 |
|
"CC=$(tc-getCC)"
|
83 |
|
"AR=$(tc-getAR)"
|
84 |
|
"BASH_COMPLETE_DIR=$(get_bashcompdir)"
|
85 |
|
"etcdir=/etc"
|
86 |
|
$(usex audit '' 'NO_AUDIT=' '' '1')
|
87 |
|
$(usex test 'CUNIT_INSTALLED=' '' '1' '')
|
88 |
|
$(usex udis86 '' 'NO_UDIS86=' '' '1')
|
89 |
|
VERBOSE=1
|
|
65 |
local emesonargs=(
|
|
66 |
-Dasciidoctor=false
|
|
67 |
$(meson_use python)
|
90 |
68 |
)
|
91 |
|
}
|
92 |
|
|
93 |
|
src_compile() {
|
94 |
|
emake "${EMAKE_FLAGS[@]}" NO_PYTHON=1 \
|
95 |
|
trace-cmd
|
96 |
|
|
97 |
|
if use python; then
|
98 |
|
python_copy_sources
|
99 |
|
python_foreach_impl python_compile
|
100 |
|
fi
|
101 |
|
|
102 |
|
use doc && emake doc
|
103 |
|
}
|
104 |
|
|
105 |
|
python_compile() {
|
106 |
|
pushd "${BUILD_DIR}" > /dev/null || die
|
107 |
|
|
108 |
|
emake "${EMAKE_FLAGS[@]}" \
|
109 |
|
PYTHON_VERS="${EPYTHON}" \
|
110 |
|
PYTHON_PKGCONFIG_VERS="${EPYTHON//python/python-}" \
|
111 |
|
python_dir=$(python_get_sitedir)/${PN} \
|
112 |
|
python ctracecmd.so
|
113 |
|
|
114 |
|
popd > /dev/null || die
|
115 |
|
}
|
116 |
|
|
117 |
|
src_test() {
|
118 |
|
emake "${EMAKE_FLAGS[@]}" test
|
119 |
|
}
|
120 |
|
|
121 |
|
src_install() {
|
122 |
|
emake "${EMAKE_FLAGS[@]}" NO_PYTHON=1 \
|
123 |
|
DESTDIR="${D}" \
|
124 |
|
install install_libs
|
125 |
|
|
126 |
|
newbashcomp tracecmd/trace-cmd.bash "${PN}"
|
127 |
|
|
128 |
|
use doc && emake DESTDIR="${D}" install_doc
|
129 |
|
use python && python_foreach_impl python_install
|
130 |
|
}
|
131 |
|
|
132 |
|
python_install() {
|
133 |
|
pushd "${BUILD_DIR}" > /dev/null || die
|
134 |
|
|
135 |
|
emake "${EMAKE_FLAGS[@]}" DESTDIR="${D}" \
|
136 |
|
PYTHON_VERS="${EPYTHON}" \
|
137 |
|
PYTHON_PKGCONFIG_VERS="${EPYTHON//python/python-}" \
|
138 |
|
python_dir=$(python_get_sitedir)/${PN} \
|
139 |
|
install_python
|
140 |
|
|
141 |
|
popd > /dev/null || die
|
142 |
69 |
|
143 |
|
python_optimize
|
|
70 |
# TODO: udis86 isn't wired up to meson at all
|
|
71 |
# TODO: get docs & tests optional upstream
|
|
72 |
# TODO: audit/zstd/zlib lack meson options for now. Previously, the situation
|
|
73 |
# was somewhat automagic, so this isn't a huge loss for now, but we should
|
|
74 |
# upstream some build options for these.
|
|
75 |
meson_src_configure
|
144 |
76 |
}
|