blob: a814eb79f95c35b96d8ba82bc14030cda42ff2f4 [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}"
18RDEPENDS:${PN}-ptest += "make perl bash gawk babeltrace procps perl-module-overloading coreutils util-linux kmod ${LTTNGMODULES} sed python3-core grep"
19RDEPENDS:${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 \
38 file://determinism.patch \
39 file://disable-tests.patch \
40 "
41
42SRC_URI[sha256sum] = "b1e959579b260790930b20f3c7aa7cefb8a40e0de80d4a777c2bf78c6b353dc1"
43
44inherit autotools ptest pkgconfig useradd python3-dir manpages systemd
45
46CACHED_CONFIGUREVARS = "PGREP=/usr/bin/pgrep"
47
48SYSTEMD_SERVICE:${PN} = "lttng-sessiond.service"
49SYSTEMD_AUTO_ENABLE = "disable"
50
51USERADD_PACKAGES = "${PN}"
52GROUPADD_PARAM:${PN} = "tracing"
53
54FILES:${PN} += "${libdir}/lttng/libexec/* ${datadir}/xml/lttng \
55 ${PYTHON_SITEPACKAGES_DIR}/*"
56FILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
57FILES:${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/*.la"
58
59# Since files are installed into ${libdir}/lttng/libexec we match
60# the libexec insane test so skip it.
61# Python module needs to keep _lttng.so
62INSANE_SKIP:${PN} = "libexec dev-so"
63INSANE_SKIP:${PN}-dbg = "libexec"
64
65PRIVATE_LIBS:${PN}-ptest = "libfoo.so"
66
67do_install:append () {
68 # install systemd unit file
69 install -d ${D}${systemd_system_unitdir}
70 install -m 0644 ${WORKDIR}/lttng-sessiond.service ${D}${systemd_system_unitdir}
71}
72
73do_install_ptest () {
74 for f in Makefile tests/Makefile tests/utils/utils.sh tests/regression/tools/save-load/*.lttng \
75 tests/regression/tools/save-load/configuration/load-42*.lttng tests/regression/tools/health/test_health.sh \
76 tests/regression/tools/metadata/utils.sh tests/regression/tools/rotation/rotate_utils.sh \
77 tests/regression/tools/notification/util_event_generator.sh \
78 tests/regression/tools/base-path/*.lttng; do
79 install -D "${B}/$f" "${D}${PTEST_PATH}/$f"
80 done
81
82 for f in tests/utils/tap-driver.sh config/test-driver src/common/config/session.xsd src/common/mi-lttng-4.1.xsd; do
83 install -D "${S}/$f" "${D}${PTEST_PATH}/$f"
84 done
85
86 # Patch in the correct path for the custom libraries a helper executable needs
87 sed -i -e 's!FIXMEPTESTPATH!${PTEST_PATH}!' "${D}${PTEST_PATH}/run-ptest"
88
89 # Prevent 'make check' from recursing into non-test subdirectories.
90 sed -i -e 's!^SUBDIRS = .*!SUBDIRS = tests!' "${D}${PTEST_PATH}/Makefile"
91
92 # We don't need these
93 sed -i -e '/dist_noinst_SCRIPTS = /,/^$/d' "${D}${PTEST_PATH}/tests/Makefile"
94
95 # We shouldn't need to build anything in tests/utils
96 sed -i -e 's!am__append_1 = . utils!am__append_1 = . !' \
97 "${D}${PTEST_PATH}/tests/Makefile"
98
99 # Copy the tests directory tree and the executables and
100 # Makefiles found within.
101 for d in $(find "${B}/tests" -type d -not -name .libs -printf '%P ') ; do
102 install -d "${D}${PTEST_PATH}/tests/$d"
103 find "${B}/tests/$d" -maxdepth 1 -executable -type f \
104 -exec install -t "${D}${PTEST_PATH}/tests/$d" {} +
105 # Take all .py scripts for tests using the python bindings.
106 find "${B}/tests/$d" -maxdepth 1 -type f -name "*.py" \
107 -exec install -t "${D}${PTEST_PATH}/tests/$d" {} +
108 test -r "${B}/tests/$d/Makefile" && \
109 install -t "${D}${PTEST_PATH}/tests/$d" "${B}/tests/$d/Makefile"
110 done
111
112 for d in $(find "${B}/tests" -type d -name .libs -printf '%P ') ; do
113 for f in $(find "${B}/tests/$d" -maxdepth 1 -executable -type f -printf '%P ') ; do
114 cp ${B}/tests/$d/$f ${D}${PTEST_PATH}/tests/`dirname $d`/$f
115 case $f in
116 *.so|userspace-probe-elf-*)
117 install -d ${D}${PTEST_PATH}/tests/$d/
118 ln -s ../$f ${D}${PTEST_PATH}/tests/$d/$f
119 # Remove any rpath/runpath to pass QA check.
120 chrpath --delete ${D}${PTEST_PATH}/tests/$d/$f
121 ;;
122 esac
123 done
124 done
125
126 chrpath --delete ${D}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary
127 chrpath --delete ${D}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-cxx-binary/userspace-probe-elf-cxx-binary
128 chrpath --delete ${D}${PTEST_PATH}/tests/regression/ust/ust-dl/libbar.so
129 chrpath --delete ${D}${PTEST_PATH}/tests/regression/ust/ust-dl/libfoo.so
130
131 #
132 # Use the versioned libs of liblttng-ust-dl.
133 #
134 ustdl="${D}${PTEST_PATH}/tests/regression/ust/ust-dl/test_ust-dl.py"
135 if [ -e $ustdl ]; then
136 sed -i -e 's!:liblttng-ust-dl.so!:liblttng-ust-dl.so.0!' $ustdl
137 fi
138
139 install ${B}/tests/unit/ini_config/sample.ini ${D}${PTEST_PATH}/tests/unit/ini_config/
140
141 # We shouldn't need to build anything in tests/regression/tools
142 sed -i -e 's!^SUBDIRS = tools !SUBDIRS = !' \
143 "${D}${PTEST_PATH}/tests/regression/Makefile"
144
145 # Prevent attempts to update Makefiles during test runs, and
146 # silence "Making check in $SUBDIR" messages.
147 find "${D}${PTEST_PATH}" -name Makefile -type f -exec \
148 sed -i -e '/Makefile:/,/^$/d' -e '/%: %.in/,/^$/d' \
149 -e '/echo "Making $$target in $$subdir"; \\/d' \
150 -e 's/^srcdir = \(.*\)/srcdir = ./' \
151 -e 's/^builddir = \(.*\)/builddir = ./' \
152 -e 's/^all-am:.*/all-am:/' \
153 {} +
154
155 find "${D}${PTEST_PATH}" -name Makefile -type f -exec \
156 touch -r "${B}/Makefile" {} +
157
158 #
159 # Need to stop generated binaries from rebuilding by removing their source dependencies
160 #
161 sed -e 's#\(^test.*OBJECTS.=\)#disable\1#g' \
162 -e 's#\(^test.*DEPENDENCIES.=\)#disable\1#g' \
163 -e 's#\(^test.*SOURCES.=\)#disable\1#g' \
164 -e 's#\(^test.*LDADD.=\)#disable\1#g' \
165 -i ${D}${PTEST_PATH}/tests/unit/Makefile
166
167 # Fix hardcoded build path
168 sed -e 's#TESTAPP_PATH=.*/tests/regression/#TESTAPP_PATH="${PTEST_PATH}/tests/regression/#' \
169 -i ${D}${PTEST_PATH}/tests/regression/ust/python-logging/test_python_logging
170
171 # Substitute links to installed binaries.
172 for prog in lttng lttng-relayd lttng-sessiond lttng-consumerd lttng-crash; do
173 exedir="${D}${PTEST_PATH}/src/bin/${prog}"
174 install -d "$exedir"
175 case "$prog" in
176 lttng-consumerd)
177 ln -s "${libdir}/lttng/libexec/$prog" "$exedir"
178 ;;
179 *)
180 ln -s "${bindir}/$prog" "$exedir"
181 ;;
182 esac
183 done
184}
185
186INHIBIT_PACKAGE_STRIP_FILES = "\
187 ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary \
188 ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/.libs/userspace-probe-elf-binary \
189 ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-cxx-binary/userspace-probe-elf-cxx-binary \
190 ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-cxx-binary/.libs/userspace-probe-elf-cxx-binary \
191 ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events/gen-syscall-events \
192 ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events/.libs/gen-syscall-events \
193 ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack \
194 ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events-callstack/.libs/gen-syscall-events-callstack \
195 "