blob: be5be2f8db673af01e19734bae663ae2bdfa6a62 [file] [log] [blame]
Andrew Geisslera2681d92020-10-16 10:17:07 -05001SUMMARY = "C library and tools for interacting with the linux GPIO character device"
Andrew Geissler69721092021-07-23 12:57:00 -04002AUTHOR = "Bartosz Golaszewski <brgl@bgdev.pl>"
Andrew Geissler82c905d2020-04-13 13:39:40 -05003
Andrew Geisslera2681d92020-10-16 10:17:07 -05004LICENSE = "LGPLv2.1+"
5LIC_FILES_CHKSUM = "file://COPYING;md5=2caced0b25dfefd4c601d92bd15116de"
Andrew Geissler82c905d2020-04-13 13:39:40 -05006
Andrew Geissler69721092021-07-23 12:57:00 -04007SRC_URI = " \
8 https://www.kernel.org/pub/software/libs/${BPN}/${BP}.tar.xz \
9 file://run-ptest \
Andrew Geisslerac970dd2021-02-12 15:32:45 -060010"
11
Andrew Geissler32b11992021-03-31 13:37:05 -050012SRC_URI[md5sum] = "28e79f6f70fee1da9079558d8b7b3736"
13SRC_URI[sha256sum] = "841be9d788f00bab08ef22c4be5c39866f0e46cb100a3ae49ed816ac9c5dddc7"
Andrew Geissler82c905d2020-04-13 13:39:40 -050014
Andrew Geisslerac970dd2021-02-12 15:32:45 -060015inherit autotools pkgconfig python3native ptest
Andrew Geissler82c905d2020-04-13 13:39:40 -050016
Andrew Geissler69721092021-07-23 12:57:00 -040017PACKAGECONFIG[tests] = "--enable-tests,--disable-tests,kmod udev glib-2.0 catch2,bats python3-packaging"
Andrew Geisslera2681d92020-10-16 10:17:07 -050018PACKAGECONFIG[cxx] = "--enable-bindings-cxx,--disable-bindings-cxx"
Andrew Geissler82c905d2020-04-13 13:39:40 -050019PACKAGECONFIG[python3] = "--enable-bindings-python,--disable-bindings-python,python3"
20
Andrew Geisslera2681d92020-10-16 10:17:07 -050021# 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
Andrew Geissler69721092021-07-23 12:57:00 -040030PACKAGES =+ "${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"
Andrew Geisslera2681d92020-10-16 10:17:07 -050047FILES_libgpiodcxx = "${libdir}/libgpiodcxx.so.*"
Andrew Geissler97771a32021-03-05 15:23:11 -060048FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}/*.so"
49FILES_${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
Andrew Geissler69721092021-07-23 12:57:00 -040050
51RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-python', '', d)}"
52RRECOMMENDS_${PN}-ptest += "kernel-module-gpio-mockup"
Andrew Geisslerac970dd2021-02-12 15:32:45 -060053
54PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'tests', '', d)}"
55
56do_install_ptest() {
Andrew Geissler69721092021-07-23 12:57:00 -040057 install -d ${D}${PTEST_PATH}/tests
58
59 # These are the core C library tests
60 install -m 0755 ${B}/tests/.libs/gpiod-test ${D}${PTEST_PATH}/tests/
61
62 # Tools are always built so let's always install them for ptest even if
63 # we're not selecting libgpiod-tools.
64 install -m 0755 ${S}/tools/gpio-tools-test ${D}${PTEST_PATH}/tests/
65 install -m 0755 ${S}/tools/gpio-tools-test.bats ${D}${PTEST_PATH}/tests/
66 for tool in ${FILES_${PN}-tools}; do
67 install ${B}/tools/.libs/$(basename $tool) ${D}${PTEST_PATH}/tests/
68 done
69
70 if ${@bb.utils.contains('PACKAGECONFIG', 'cxx', 'true', 'false', d)}; then
71 install -m 0755 ${B}/bindings/cxx/tests/.libs/gpiod-cxx-test ${D}${PTEST_PATH}/tests/
72 fi
73
74 if ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'true', 'false', d)}; then
75 install -m 0755 ${S}/bindings/python/tests/gpiod_py_test.py ${D}${PTEST_PATH}/tests/
76 fi
Andrew Geisslerac970dd2021-02-12 15:32:45 -060077}