1SUMMARY = "BPF Compiler Collection (BCC)"
2HOMEPAGE = "https://github.com/iovisor/bcc"
3LICENSE = "Apache-2.0"
4LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=e3fc50a88d0a364313df4b21ef20c29e"
5
6inherit cmake python3native manpages ptest
7
8DEPENDS += "bison-native \
9            flex-native \
10            flex \
11            elfutils \
12            ${LUAJIT} \
13            clang \
14            libbpf \
15            "
16
17LUAJIT ?= "luajit"
18LUAJIT:powerpc64le = ""
19LUAJIT:powerpc64 = ""
20LUAJIT:riscv64 = ""
21
22RDEPENDS:${PN} += "bash python3 python3-core python3-setuptools xz"
23RDEPENDS:${PN}-ptest = "cmake python3 python3-distutils python3-netaddr python3-pyroute2"
24
25SRC_URI = "gitsm://github.com/iovisor/bcc;branch=master;protocol=https \
26           file://0001-python-CMakeLists.txt-Remove-check-for-host-etc-debi.patch \
27           file://0001-tools-trace.py-Fix-failing-to-exit.patch \
28           file://0001-CMakeLists.txt-override-the-PY_CMD_ESCAPED.patch \
29           file://0001-Vendor-just-enough-extra-headers-to-allow-libbpf-to-.patch \
30           file://run-ptest \
31           file://ptest_wrapper.sh \
32           "
33
34SRCREV = "8f40d6f57a8d94e7aee74ce358572d34d31b4ed4"
35
36PV .= "+git${SRCPV}"
37
38S = "${WORKDIR}/git"
39
40PACKAGECONFIG ??= "examples"
41PACKAGECONFIG:remove:libc-musl = "examples"
42
43PACKAGECONFIG[manpages] = "-DENABLE_MAN=ON,-DENABLE_MAN=OFF,"
44PACKAGECONFIG[examples] = "-DENABLE_EXAMPLES=ON,-DENABLE_EXAMPLES=OFF,"
45
46EXTRA_OECMAKE = " \
47    -DCMAKE_USE_LIBBPF_PACKAGE=ON \
48    -DENABLE_LLVM_SHARED=ON \
49    -DENABLE_CLANG_JIT=ON \
50    -DLLVM_PACKAGE_VERSION=${LLVMVERSION} \
51    -DPYTHON_CMD=${PYTHON} \
52    -DPYTHON_FLAGS=--install-lib=${PYTHON_SITEPACKAGES_DIR} \
53"
54
55do_install:append() {
56        sed -e 's@#!/usr/bin/python@#!/usr/bin/env python3@g' \
57            -i $(find ${D}${datadir}/${PN} -type f)
58}
59
60do_install_ptest() {
61    install -d ${D}${PTEST_PATH}/tests/cc
62    install ${B}/tests/cc/test_libbcc_no_libbpf ${B}/tests/cc/libusdt_test_lib.so ${D}${PTEST_PATH}/tests/cc
63    cp -rf ${S}/tests/python ${D}${PTEST_PATH}/tests/python
64    install ${WORKDIR}/ptest_wrapper.sh ${D}${PTEST_PATH}/tests
65    install ${S}/examples/networking/simulation.py ${D}${PTEST_PATH}/tests/python
66}
67
68FILES:${PN} += "${PYTHON_SITEPACKAGES_DIR}"
69FILES:${PN}-doc += "${datadir}/${PN}/man"
70
71COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*|riscv64.*)-linux"
72