blob: 174dec036e06d5f92cbea4e2c9e3f4a31fbc0652 [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001SECTION = "devel"
2SUMMARY = "Linux Trace Toolkit Control"
3DESCRIPTION = "The Linux trace toolkit is a suite of tools designed \
4to extract program execution details from the Linux operating system \
5and interpret them."
6HOMEPAGE = "https://github.com/lttng/lttng-tools"
7
8LICENSE = "GPL-2.0-only & LGPL-2.1-only"
9LIC_FILES_CHKSUM = "file://LICENSE;md5=40ef17463fbd6f377db3c47b1cbaded8 \
10 file://LICENSES/GPL-2.0;md5=e68f69a54b44ba526ad7cb963e18fbce \
11 file://LICENSES/LGPL-2.1;md5=9920968d0f2ff585ce61fae30344dd95"
12
13include lttng-platforms.inc
14
15DEPENDS = "liburcu popt libxml2 util-linux bison-native"
16RDEPENDS:${PN} = "libgcc"
17RRECOMMENDS:${PN} += "${LTTNGMODULES}"
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050018RDEPENDS:${PN}-ptest += "make perl bash gawk babeltrace procps perl-module-overloading coreutils util-linux kmod ${LTTNGMODULES} sed python3-core grep binutils"
Patrick Williams92b42cb2022-09-03 06:53:57 -050019RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-utils"
20RDEPENDS:${PN}-ptest:append:libc-musl = " musl-utils"
21# babelstats.pl wants getopt-long
22RDEPENDS:${PN}-ptest += "perl-module-getopt-long"
23
24PYTHON_OPTION = "am_cv_python_pyexecdir='${PYTHON_SITEPACKAGES_DIR}' \
25 am_cv_python_pythondir='${PYTHON_SITEPACKAGES_DIR}' \
26 PYTHON_INCLUDE='-I${STAGING_INCDIR}/python${PYTHON_BASEVERSION}${PYTHON_ABI}' \
27"
28PACKAGECONFIG ??= "${LTTNGUST} kmod"
29PACKAGECONFIG[python] = "--enable-python-bindings ${PYTHON_OPTION},,python3 swig-native"
30PACKAGECONFIG[lttng-ust] = "--with-lttng-ust, --without-lttng-ust, lttng-ust"
31PACKAGECONFIG[kmod] = "--with-kmod, --without-kmod, kmod"
32PACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-pages, asciidoc-native xmlto-native libxslt-native"
33
34SRC_URI = "https://lttng.org/files/lttng-tools/lttng-tools-${PV}.tar.bz2 \
35 file://0001-tests-do-not-strip-a-helper-library.patch \
36 file://run-ptest \
37 file://lttng-sessiond.service \
Patrick Williams92b42cb2022-09-03 06:53:57 -050038 file://disable-tests.patch \
Andrew Geissler517393d2023-01-13 08:55:19 -060039 file://0001-compat-Define-off64_t-as-off_t-on-linux.patch \
Patrick Williams03514f12024-04-05 07:04:11 -050040 file://0001-tests-add-check_skip_kernel_test-to-check-root-user-.patch \
41 file://0001-Fix-rotation-destroy-flush-fix-session-daemon-abort-.patch \
Patrick Williams92b42cb2022-09-03 06:53:57 -050042 "
43
Patrick Williams44b3caf2024-04-12 16:51:14 -050044SRC_URI[sha256sum] = "ff5f4f00b081dac66092afe8e72b7c790670931cf1c1ee0deaa7f80fbc53883e"
Patrick Williams92b42cb2022-09-03 06:53:57 -050045
46inherit autotools ptest pkgconfig useradd python3-dir manpages systemd
47
48CACHED_CONFIGUREVARS = "PGREP=/usr/bin/pgrep"
49
50SYSTEMD_SERVICE:${PN} = "lttng-sessiond.service"
51SYSTEMD_AUTO_ENABLE = "disable"
52
53USERADD_PACKAGES = "${PN}"
54GROUPADD_PARAM:${PN} = "tracing"
55
56FILES:${PN} += "${libdir}/lttng/libexec/* ${datadir}/xml/lttng \
57 ${PYTHON_SITEPACKAGES_DIR}/*"
58FILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
59FILES:${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/*.la"
60
61# Since files are installed into ${libdir}/lttng/libexec we match
62# the libexec insane test so skip it.
63# Python module needs to keep _lttng.so
64INSANE_SKIP:${PN} = "libexec dev-so"
65INSANE_SKIP:${PN}-dbg = "libexec"
66
67PRIVATE_LIBS:${PN}-ptest = "libfoo.so"
68
69do_install:append () {
70 # install systemd unit file
71 install -d ${D}${systemd_system_unitdir}
72 install -m 0644 ${WORKDIR}/lttng-sessiond.service ${D}${systemd_system_unitdir}
73}
74
75do_install_ptest () {
76 for f in Makefile tests/Makefile tests/utils/utils.sh tests/regression/tools/save-load/*.lttng \
77 tests/regression/tools/save-load/configuration/load-42*.lttng tests/regression/tools/health/test_health.sh \
78 tests/regression/tools/metadata/utils.sh tests/regression/tools/rotation/rotate_utils.sh \
79 tests/regression/tools/notification/util_event_generator.sh \
80 tests/regression/tools/base-path/*.lttng; do
81 install -D "${B}/$f" "${D}${PTEST_PATH}/$f"
82 done
83
84 for f in tests/utils/tap-driver.sh config/test-driver src/common/config/session.xsd src/common/mi-lttng-4.1.xsd; do
85 install -D "${S}/$f" "${D}${PTEST_PATH}/$f"
86 done
87
88 # Patch in the correct path for the custom libraries a helper executable needs
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050089 sed -i -e 's!FIXMEPTESTPATH!${PTEST_PATH}!g' "${D}${PTEST_PATH}/run-ptest"
Patrick Williams92b42cb2022-09-03 06:53:57 -050090
91 # Prevent 'make check' from recursing into non-test subdirectories.
92 sed -i -e 's!^SUBDIRS = .*!SUBDIRS = tests!' "${D}${PTEST_PATH}/Makefile"
93
94 # We don't need these
95 sed -i -e '/dist_noinst_SCRIPTS = /,/^$/d' "${D}${PTEST_PATH}/tests/Makefile"
96
97 # We shouldn't need to build anything in tests/utils
98 sed -i -e 's!am__append_1 = . utils!am__append_1 = . !' \
99 "${D}${PTEST_PATH}/tests/Makefile"
100
101 # Copy the tests directory tree and the executables and
102 # Makefiles found within.
103 for d in $(find "${B}/tests" -type d -not -name .libs -printf '%P ') ; do
104 install -d "${D}${PTEST_PATH}/tests/$d"
105 find "${B}/tests/$d" -maxdepth 1 -executable -type f \
106 -exec install -t "${D}${PTEST_PATH}/tests/$d" {} +
107 # Take all .py scripts for tests using the python bindings.
108 find "${B}/tests/$d" -maxdepth 1 -type f -name "*.py" \
109 -exec install -t "${D}${PTEST_PATH}/tests/$d" {} +
110 test -r "${B}/tests/$d/Makefile" && \
111 install -t "${D}${PTEST_PATH}/tests/$d" "${B}/tests/$d/Makefile"
112 done
113
114 for d in $(find "${B}/tests" -type d -name .libs -printf '%P ') ; do
115 for f in $(find "${B}/tests/$d" -maxdepth 1 -executable -type f -printf '%P ') ; do
116 cp ${B}/tests/$d/$f ${D}${PTEST_PATH}/tests/`dirname $d`/$f
117 case $f in
118 *.so|userspace-probe-elf-*)
119 install -d ${D}${PTEST_PATH}/tests/$d/
120 ln -s ../$f ${D}${PTEST_PATH}/tests/$d/$f
121 # Remove any rpath/runpath to pass QA check.
122 chrpath --delete ${D}${PTEST_PATH}/tests/$d/$f
123 ;;
124 esac
125 done
126 done
127
128 chrpath --delete ${D}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary
129 chrpath --delete ${D}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-cxx-binary/userspace-probe-elf-cxx-binary
130 chrpath --delete ${D}${PTEST_PATH}/tests/regression/ust/ust-dl/libbar.so
131 chrpath --delete ${D}${PTEST_PATH}/tests/regression/ust/ust-dl/libfoo.so
132
133 #
134 # Use the versioned libs of liblttng-ust-dl.
135 #
136 ustdl="${D}${PTEST_PATH}/tests/regression/ust/ust-dl/test_ust-dl.py"
137 if [ -e $ustdl ]; then
138 sed -i -e 's!:liblttng-ust-dl.so!:liblttng-ust-dl.so.0!' $ustdl
139 fi
140
141 install ${B}/tests/unit/ini_config/sample.ini ${D}${PTEST_PATH}/tests/unit/ini_config/
142
143 # We shouldn't need to build anything in tests/regression/tools
144 sed -i -e 's!^SUBDIRS = tools !SUBDIRS = !' \
145 "${D}${PTEST_PATH}/tests/regression/Makefile"
146
147 # Prevent attempts to update Makefiles during test runs, and
148 # silence "Making check in $SUBDIR" messages.
149 find "${D}${PTEST_PATH}" -name Makefile -type f -exec \
150 sed -i -e '/Makefile:/,/^$/d' -e '/%: %.in/,/^$/d' \
151 -e '/echo "Making $$target in $$subdir"; \\/d' \
152 -e 's/^srcdir = \(.*\)/srcdir = ./' \
153 -e 's/^builddir = \(.*\)/builddir = ./' \
154 -e 's/^all-am:.*/all-am:/' \
155 {} +
156
157 find "${D}${PTEST_PATH}" -name Makefile -type f -exec \
158 touch -r "${B}/Makefile" {} +
159
160 #
161 # Need to stop generated binaries from rebuilding by removing their source dependencies
162 #
163 sed -e 's#\(^test.*OBJECTS.=\)#disable\1#g' \
164 -e 's#\(^test.*DEPENDENCIES.=\)#disable\1#g' \
165 -e 's#\(^test.*SOURCES.=\)#disable\1#g' \
166 -e 's#\(^test.*LDADD.=\)#disable\1#g' \
167 -i ${D}${PTEST_PATH}/tests/unit/Makefile
168
169 # Fix hardcoded build path
170 sed -e 's#TESTAPP_PATH=.*/tests/regression/#TESTAPP_PATH="${PTEST_PATH}/tests/regression/#' \
171 -i ${D}${PTEST_PATH}/tests/regression/ust/python-logging/test_python_logging
172
173 # Substitute links to installed binaries.
174 for prog in lttng lttng-relayd lttng-sessiond lttng-consumerd lttng-crash; do
175 exedir="${D}${PTEST_PATH}/src/bin/${prog}"
176 install -d "$exedir"
177 case "$prog" in
178 lttng-consumerd)
179 ln -s "${libdir}/lttng/libexec/$prog" "$exedir"
180 ;;
181 *)
182 ln -s "${bindir}/$prog" "$exedir"
183 ;;
184 esac
185 done
186}
187
188INHIBIT_PACKAGE_STRIP_FILES = "\
189 ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary \
190 ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/.libs/userspace-probe-elf-binary \
191 ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-cxx-binary/userspace-probe-elf-cxx-binary \
192 ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-cxx-binary/.libs/userspace-probe-elf-cxx-binary \
193 ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events/gen-syscall-events \
194 ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events/.libs/gen-syscall-events \
195 ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack \
196 ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events-callstack/.libs/gen-syscall-events-callstack \
197 "