SUMMARY = "bpftrace" HOMEPAGE = "https://github.com/iovisor/bpftrace" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" DEPENDS += "gzip-native \ elfutils \ bpftool-native \ bcc \ libcereal \ libbpf \ xxd-native \ " DEPENDS += "${@bb.utils.contains('PTEST_ENABLED', '1', 'pahole-native llvm-native zip-native', '', d)}" SRC_URI = "git://github.com/iovisor/bpftrace;branch=release/0.26.x;protocol=https;tag=v${PV} \ file://run-ptest \ file://0001-cmake-BuildBPF.cmake-introduce-DEBUG_PREFIX_MAP.patch \ file://0003-cmake-BuildBPF.cmake-link-data-source-binary-without.patch \ file://0004-IRBuilderBPF-Fix-HasTerminator-on-LLVM-23.patch \ file://0005-CMakeLists-Add-support-for-LLVM-23.patch \ file://0001-tests-pass-C-linker-flags-and-sysroot-to-raw-compile.patch \ file://0006-tests-do-not-embed-build-paths-in-split-DWARF-test-pr.patch \ file://0007-tests-testprogs-define-_GNU_SOURCE-for-pthread_setn.patch \ " SRCREV = "1bac8a8daad6e0aa579980e877d0c9d5fc296593" inherit bash-completion cmake ptest pkgconfig export DEBUG_PREFIX_MAP # cmake/BuildBPF.cmake compiles the BPF data source with the plain gcc it finds # in PATH, i.e. the build host's compiler (see its own commentary for why it has # to be gcc), and 0001-cmake-BuildBPF.cmake-introduce-DEBUG_PREFIX_MAP.patch # hands it DEBUG_PREFIX_MAP so the embedded objects do not leak build paths. # -fcanon-prefix-map, which DEBUG_PREFIX_MAP_EXTRA adds for the gcc toolchain, # only exists in GCC >= 13: the target compiler always has it, the build host's # gcc may not, and then the build dies with # gcc: error: unrecognized command-line option '-fcanon-prefix-map' # The -ffile-prefix-map= rewrites are all this needs, so drop the extra. DEBUG_PREFIX_MAP:remove = "-fcanon-prefix-map" PACKAGECONFIG ?= " \ ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)} \ ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "systemd", "", d)} \ " PACKAGECONFIG[tests] = "-DBUILD_TESTING=ON,-DBUILD_TESTING=OFF,gtest" PACKAGECONFIG[systemd] = "-DENABLE_SYSTEMD=ON,-DENABLE_SYSTEMD=OFF,systemd" do_install_ptest() { if [ -e ${B}/tests/bpftrace_test ]; then install -Dm 755 ${B}/tests/bpftrace_test ${D}${PTEST_PATH}/tests/bpftrace_test cp -rf ${B}/tests/runtime ${D}${PTEST_PATH}/tests cp -rf ${B}/tests/test* ${D}${PTEST_PATH}/tests fi for f in testlibs/cmake_install.cmake \ testprogs/cmake_install.cmake \ testlibs/CTestTestfile.cmake \ testprogs/CTestTestfile.cmake do sed -i -e 's|${STAGING_BINDIR_TOOLCHAIN}/||' ${D}${libdir}/bpftrace/ptest/tests/$f sed -i -e 's|${S}/||' ${D}${libdir}/bpftrace/ptest/tests/$f sed -i -e 's|${B}/||' ${D}${libdir}/bpftrace/ptest/tests/$f done } do_install_ptest:powerpc64() { } do_install_ptest:powerpc64le() { } EXTRA_OECMAKE = " \ -DCMAKE_ENABLE_EXPORTS=1 \ -DCMAKE_BUILD_TYPE=Release \ -DUSE_SYSTEM_BPF_BCC=ON \ -DUSE_SYSTEM_LIBBPF=ON \ -DENABLE_MAN=OFF \ " PACKAGES:remove:powerpc64 = "${PN}-ptest" PACKAGES:remove:powerpc64le = "${PN}-ptest" RDEPENDS:${PN}-ptest += "bash bpftool python3" COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*|riscv64.*)-linux" INHIBIT_PACKAGE_STRIP_FILES += "\ ${PKGD}${PTEST_PATH}/tests/testprogs/uprobe_test \ " WARN_QA:append = "${@bb.utils.contains('PTEST_ENABLED', '1', ' buildpaths', '', d)}" ERROR_QA:remove = "${@bb.utils.contains('PTEST_ENABLED', '1', 'buildpaths', '', d)}"