1SUMMARY = "Script-directed dynamic tracing and performance analysis tool for Linux"
2DESCRIPTION = "It provides free software infrastructure to simplify the \
3gathering of information about the running Linux system. This assists \
4diagnosis of a performance or functional problem."
5HOMEPAGE = "https://sourceware.org/systemtap/"
6
7require systemtap_git.inc
8
9SRC_URI += " \
10           file://0001-improve-reproducibility-for-c-compiling.patch \
11           file://0001-staprun-address-ncurses-6.3-failures.patch \
12           "
13
14DEPENDS = "elfutils"
15
16EXTRA_OECONF += "--with-libelf=${STAGING_DIR_TARGET} --without-rpm \
17            --without-nss --without-avahi --without-dyninst \
18            --disable-server --disable-grapher --enable-prologues \
19            --with-python3 --without-python2-probes \
20            ac_cv_prog_have_javac=no \
21            ac_cv_prog_have_jar=no "
22
23STAP_DOCS ?= "--disable-docs --disable-publican --disable-refdocs"
24
25EXTRA_OECONF += "${STAP_DOCS} "
26
27PACKAGECONFIG ??= "translator sqlite monitor python3-probes ${@bb.utils.filter('DISTRO_FEATURES', 'debuginfod', d)}"
28PACKAGECONFIG[translator] = "--enable-translator,--disable-translator,boost,bash"
29PACKAGECONFIG[libvirt] = "--enable-libvirt,--disable-libvirt,libvirt"
30PACKAGECONFIG[sqlite] = "--enable-sqlite,--disable-sqlite,sqlite3"
31PACKAGECONFIG[monitor] = "--enable-monitor,--disable-monitor,ncurses json-c"
32PACKAGECONFIG[python3-probes] = "--with-python3-probes,--without-python3-probes,python3-setuptools-native"
33PACKAGECONFIG[debuginfod] = "--with-debuginfod, --without-debuginfod"
34
35inherit autotools gettext pkgconfig systemd
36inherit_defer ${@bb.utils.contains('PACKAGECONFIG', 'python3-probes', 'setuptools3-base', '', d)}
37
38# | ../git/elaborate.cxx:2601:21: error: storing the address of local variable 'sym' in '*s.systemtap_session::symbol_resolver' [-Werror=dangling-pointer=]
39CXXFLAGS += "-Wno-dangling-pointer"
40
41# exporter comes with python3-probes
42PACKAGES =+ "${PN}-exporter"
43FILES:${PN}-exporter = "${sysconfdir}/stap-exporter/* \
44                        ${sysconfdir}/sysconfig/stap-exporter \
45                        ${systemd_system_unitdir}/stap-exporter.service \
46                        ${sbindir}/stap-exporter"
47RDEPENDS:${PN}-exporter = "${PN} python3-core python3-netclient"
48SYSTEMD_SERVICE:${PN}-exporter = "stap-exporter.service"
49
50PACKAGES =+ "${PN}-runtime"
51FILES:${PN}-runtime = "\
52 ${bindir}/staprun \
53 ${bindir}/stap-merge \
54 ${bindir}/stapsh \
55 ${libexecdir}/${BPN}/stapio \
56"
57RDEPENDS:${PN}:class-target += "${PN}-runtime"
58
59PACKAGES =+ "${PN}-examples"
60FILES:${PN}-examples = "${datadir}/${BPN}/examples/"
61RDEPENDS:${PN}-examples += "${PN}"
62
63# don't complain that some examples involve bash, perl, php...
64INSANE_SKIP:${PN}-examples += "file-rdeps"
65
66PACKAGES =+ "${PN}-python"
67FILES:${PN}-python += "\
68 ${bindir}/dtrace \
69 ${libdir}/python*/ \
70 ${libexecdir}/${BPN}/python/ \
71"
72# python material requires sdt headers
73RDEPENDS:${PN}-python += "${PN}-dev python3-core"
74INSANE_SKIP:${PN}-python += "dev-deps"
75
76do_configure:prepend () {
77    # Improve reproducibility for c++ object files
78    reltivepath="${@os.path.relpath(d.getVar('STAGING_INCDIR'), d.getVar('S'))}"
79    sed -i "s:@RELATIVE_STAGING_INCDIR@:$reltivepath:g" ${S}/stringtable.h
80}
81
82do_install:append () {
83   if [ ! -f ${D}${bindir}/stap ]; then
84      # translator disabled case, need to leave only minimal runtime
85      rm -rf ${D}${datadir}/${PN}
86      rm ${D}${libexecdir}/${PN}/stap-env
87   fi
88
89   if [ -d ${D}${prefix}/lib/systemd -a ${D}${prefix}/lib != `dirname ${D}${systemd_unitdir}` ]; then
90      # Fix makefile hardcoded path assumptions for systemd (assumes $prefix)
91      # without usrmerge distro feature enabled
92      install -d `dirname ${D}${systemd_unitdir}`
93      mv ${D}${prefix}/lib/systemd `dirname ${D}${systemd_unitdir}`
94      rmdir ${D}${prefix}/lib --ignore-fail-on-non-empty
95   fi
96
97   # Ensure correct ownership for files copied in
98   if [ -d ${D}${sysconfdir}/stap-exporter ]; then
99       chown root:root ${D}${sysconfdir}/stap-exporter/* -R
100   fi
101}
102
103BBCLASSEXTEND = "nativesdk"
104