xref: /OK3568_Linux_fs/yocto/meta-openembedded/meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1SUMMARY = "C library and tools for interacting with the linux GPIO character device"
2AUTHOR = "Bartosz Golaszewski <brgl@bgdev.pl>"
3
4LICENSE = "LGPL-2.1-or-later"
5LIC_FILES_CHKSUM = "file://COPYING;md5=2caced0b25dfefd4c601d92bd15116de"
6
7SRC_URI = " \
8    https://www.kernel.org/pub/software/libs/${BPN}/${BP}.tar.xz \
9    file://run-ptest \
10"
11
12SRC_URI[md5sum] = "28e79f6f70fee1da9079558d8b7b3736"
13SRC_URI[sha256sum] = "841be9d788f00bab08ef22c4be5c39866f0e46cb100a3ae49ed816ac9c5dddc7"
14
15inherit autotools pkgconfig python3native ptest
16
17PACKAGECONFIG[tests] = "--enable-tests,--disable-tests,kmod udev glib-2.0 catch2"
18PACKAGECONFIG[cxx] = "--enable-bindings-cxx,--disable-bindings-cxx"
19PACKAGECONFIG[python3] = "--enable-bindings-python,--disable-bindings-python,python3"
20
21# Enable cxx bindings by default.
22PACKAGECONFIG ?= "cxx"
23
24# Always build tools - they don't have any additional
25# requirements over the library.
26EXTRA_OECONF = "--enable-tools"
27
28DEPENDS += "autoconf-archive-native"
29
30PACKAGES =+ "${PN}-tools libgpiodcxx ${PN}-python"
31FILES:${PN}-tools = " \
32    ${bindir}/gpiodetect \
33    ${bindir}/gpioinfo \
34    ${bindir}/gpioget \
35    ${bindir}/gpioset \
36    ${bindir}/gpiofind \
37    ${bindir}/gpiomon \
38"
39FILES:${PN}-ptest += " \
40    ${bindir}/gpiod-test \
41    ${bindir}/gpio-tools-test \
42    ${bindir}/gpio-tools-test.bats \
43    ${bindir}/gpiod-cxx-test \
44    ${bindir}/gpiod_py_test.py \
45    ${libdir}/libgpiomockup.so.* \
46"
47FILES:libgpiodcxx = "${libdir}/libgpiodcxx.so.*"
48FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR}/*.so"
49FILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
50
51RRECOMMENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-python', '', d)}"
52RRECOMMENDS:${PN}-ptest += " \
53    kernel-module-gpio-mockup \
54    coreutils \
55    ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3-unittest', '', d)} \
56"
57RDEPENDS:${PN}-ptest += "bats python3-packaging"
58
59PACKAGECONFIG:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'tests', '', d)}"
60
61do_install_ptest() {
62    install -d ${D}${PTEST_PATH}/tests
63
64    # These are the core C library tests
65    install -m 0755 ${B}/tests/.libs/gpiod-test ${D}${PTEST_PATH}/tests/
66
67    # Tools are always built so let's always install them for ptest even if
68    # we're not selecting libgpiod-tools.
69    install -m 0755 ${S}/tools/gpio-tools-test ${D}${PTEST_PATH}/tests/
70    install -m 0755 ${S}/tools/gpio-tools-test.bats ${D}${PTEST_PATH}/tests/
71    for tool in ${FILES:${PN}-tools}; do
72        install ${B}/tools/.libs/$(basename $tool) ${D}${PTEST_PATH}/tests/
73    done
74
75    if ${@bb.utils.contains('PACKAGECONFIG', 'cxx', 'true', 'false', d)}; then
76        install -m 0755 ${B}/bindings/cxx/tests/.libs/gpiod-cxx-test ${D}${PTEST_PATH}/tests/
77    fi
78
79    if ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'true', 'false', d)}; then
80        install -m 0755 ${S}/bindings/python/tests/gpiod_py_test.py ${D}${PTEST_PATH}/tests/
81    fi
82}
83