1SUMMARY = "interface to seccomp filtering mechanism"
2DESCRIPTION = "The libseccomp library provides an easy to use, platform independent, interface to the Linux Kernel's syscall filtering mechanism: seccomp."
3HOMEPAGE = "https://github.com/seccomp/libseccomp"
4SECTION = "security"
5LICENSE = "LGPL-2.1-only"
6LIC_FILES_CHKSUM = "file://LICENSE;md5=7c13b3376cea0ce68d2d2da0a1b3a72c"
7
8DEPENDS += "gperf-native"
9
10SRCREV = "f0b04ab0b4fc0bc2cde6da1f407b4a487fe6d78f"
11
12SRC_URI = "git://github.com/seccomp/libseccomp.git;branch=release-2.5;protocol=https \
13           file://run-ptest \
14           "
15
16S = "${WORKDIR}/git"
17
18inherit autotools-brokensep pkgconfig ptest features_check
19
20inherit_defer ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3native', '', d)}
21
22REQUIRED_DISTRO_FEATURES = "seccomp"
23
24PACKAGECONFIG ??= ""
25PACKAGECONFIG[python] = "--enable-python, --disable-python, python3-cython-native"
26
27DISABLE_STATIC = ""
28
29do_compile_ptest() {
30    oe_runmake -C tests check-build
31}
32
33do_install_ptest() {
34    install -d ${D}${PTEST_PATH}/tests
35    install -d ${D}${PTEST_PATH}/tools
36    for file in $(find tests/* -executable -type f); do
37        install -m 744 ${S}/${file} ${D}/${PTEST_PATH}/tests
38    done
39    for file in $(find tests/*.tests -type f); do
40        install -m 744 ${S}/${file} ${D}/${PTEST_PATH}/tests
41    done
42        for file in $(find tests/*.pfc -type f); do
43        install -m 644 ${S}/${file} ${D}/${PTEST_PATH}/tests
44    done
45    install -m 644 ${S}/tests/valgrind_test.supp ${D}/${PTEST_PATH}/tests
46    for file in $(find tools/* -executable -type f); do
47        install -m 744 ${S}/${file} ${D}/${PTEST_PATH}/tools
48    done
49    # Overwrite libtool wrappers with real executables
50    for file in $(find tools/.libs/* -executable -type f); do
51        install -m 744 ${S}/${file} ${D}/${PTEST_PATH}/tools
52    done
53     # fix python shebang
54     sed -i -e 's@cmd /usr/bin/env python @cmd /usr/bin/env python3 @' ${D}/${PTEST_PATH}/tests/regression
55     sed -i -e 's@^#!/usr/bin/env python$@#!/usr/bin/env python3@' ${D}/${PTEST_PATH}/tests/*.py
56}
57
58FILES:${PN} = "${bindir} ${libdir}/${BPN}.so* ${PYTHON_SITEPACKAGES_DIR}/"
59FILES:${PN}-dbg += "${libdir}/${PN}/tests/.debug/* ${libdir}/${PN}/tools/.debug"
60
61RDEPENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3', '', d)}"
62RDEPENDS:${PN}-ptest = "coreutils bash"
63