blob: a2d1f57a8b4ba646133802f5a5a72df77308eb10 [file] [log] [blame]
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06001SUMMARY = "C library and tools for interacting with the linux GPIO character device"
2AUTHOR = "Bartosz Golaszewski <brgl@bgdev.pl>"
Patrick Williamsb542dec2023-06-09 01:26:37 -05003RECIPE_MAINTAINER = "Bartosz Golaszewski <brgl@bgdev.pl>"
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06004
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06005inherit autotools pkgconfig ptest
6
Patrick Williams8e7b46e2023-05-01 14:19:06 -05007SRC_URI += " \
8 https://www.kernel.org/pub/software/libs/libgpiod/libgpiod-${PV}.tar.xz \
9 file://run-ptest \
10"
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060011
12PACKAGECONFIG[cxx] = "--enable-bindings-cxx,--disable-bindings-cxx"
13
14# Enable cxx bindings by default.
15PACKAGECONFIG ?= " \
16 cxx \
17 ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)} \
18"
19
20# Always build tools - they don't have any additional
21# requirements over the library.
22EXTRA_OECONF = "--enable-tools"
23
24DEPENDS += "autoconf-archive-native"
25
26PACKAGES =+ "${PN}-tools libgpiodcxx"
27FILES:${PN}-tools += " \
28 ${bindir}/gpiodetect \
29 ${bindir}/gpioinfo \
30 ${bindir}/gpioget \
31 ${bindir}/gpioset \
32 ${bindir}/gpiomon \
33"
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060034FILES:libgpiodcxx = "${libdir}/libgpiodcxx.so.*"
35
36RRECOMMENDS:${PN}-ptest += "coreutils"
37RDEPENDS:${PN}-ptest += "bats"
38
Patrick Williams8e7b46e2023-05-01 14:19:06 -050039do_install:append() {
40 rm -f ${D}${bindir}/gpiod-test
41 rm -f ${D}${bindir}/gpio-tools-test
42 rm -f ${D}${bindir}/gpio-tools-test.bats
43 rm -f ${D}${bindir}/gpiod-cxx-test
44}
45
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060046do_install_ptest() {
47 install -d ${D}${PTEST_PATH}/tests/
48
49 # These are the core C library tests
50 install -m 0755 ${B}/tests/.libs/gpiod-test ${D}${PTEST_PATH}/tests/
51
52 # Tools are always built so let's always install them for ptest even if
53 # we're not selecting libgpiod-tools.
54 install -m 0755 ${S}/tools/gpio-tools-test ${D}${PTEST_PATH}/tests/
55 install -m 0755 ${S}/tools/gpio-tools-test.bats ${D}${PTEST_PATH}/tests/
56 for tool in ${FILES:${PN}-tools}; do
57 install ${B}/tools/.libs/$(basename $tool) ${D}${PTEST_PATH}/tests/
58 done
59
60 if ${@bb.utils.contains('PACKAGECONFIG', 'cxx', 'true', 'false', d)}; then
61 install -m 0755 ${B}/bindings/cxx/tests/.libs/gpiod-cxx-test ${D}${PTEST_PATH}/tests/
62 fi
63}
64