CAN, GPIO, RNG vhost-devices for virtio-loopback [v6]
[AGL/meta-agl-devel.git] / meta-egvirt / recipes-support / libgpiod / libgpiod.inc
1 SUMMARY = "C library and tools for interacting with the linux GPIO character device"
2 RECIPE_MAINTAINER = "Bartosz Golaszewski <brgl@bgdev.pl>"
3
4 inherit autotools pkgconfig ptest
5
6 SRC_URI += " \
7     https://www.kernel.org/pub/software/libs/libgpiod/libgpiod-${PV}.tar.xz \
8     file://run-ptest \
9 "
10
11 PACKAGECONFIG[cxx] = "--enable-bindings-cxx,--disable-bindings-cxx"
12
13 # Enable cxx bindings by default.
14 PACKAGECONFIG ?= " \
15     cxx \
16     ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)} \
17 "
18
19 # Always build tools - they don't have any additional
20 # requirements over the library.
21 EXTRA_OECONF = "--enable-tools"
22
23 DEPENDS += "autoconf-archive-native"
24
25 PACKAGES =+ "${PN}-tools libgpiodcxx"
26 FILES:${PN}-tools += " \
27     ${bindir}/gpiodetect \
28     ${bindir}/gpioinfo \
29     ${bindir}/gpioget \
30     ${bindir}/gpioset \
31     ${bindir}/gpiomon \
32 "
33 FILES:libgpiodcxx = "${libdir}/libgpiodcxx.so.*"
34
35 RRECOMMENDS:${PN}-ptest += "coreutils"
36
37 do_install:append() {
38     rm -f ${D}${bindir}/gpiod-test
39     rm -f ${D}${bindir}/gpio-tools-test
40     rm -f ${D}${bindir}/gpio-tools-test.bats
41     rm -f ${D}${bindir}/gpiod-cxx-test
42 }
43
44 do_install_ptest() {
45     install -d ${D}${PTEST_PATH}/tests/
46
47     # These are the core C library tests
48     install -m 0755 ${B}/tests/.libs/gpiod-test ${D}${PTEST_PATH}/tests/
49
50     # Tools are always built so let's always install them for ptest even if
51     # we're not selecting libgpiod-tools.
52     for tool in ${FILES:${PN}-tools}; do
53         install ${B}/tools/.libs/$(basename $tool) ${D}${PTEST_PATH}/tests/
54     done
55
56     if ${@bb.utils.contains('PACKAGECONFIG', 'cxx', 'true', 'false', d)}; then
57         install -m 0755 ${B}/bindings/cxx/tests/.libs/gpiod-cxx-test ${D}${PTEST_PATH}/tests/
58     fi
59 }