blob: 3e6e5d567d03ea397e5db09ccc1cfe9f19e03472 [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 Geissler9aee5002022-03-30 16:27:02 +00004LICENSE = "LGPL-2.1-or-later"
Andrew Geisslera2681d92020-10-16 10:17:07 -05005LIC_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 Geissler78b72792022-06-14 06:47:25 -050017PACKAGECONFIG[tests] = "--enable-tests,--disable-tests,kmod udev glib-2.0 catch2"
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.
Patrick Williams92b42cb2022-09-03 06:53:57 -050022PACKAGECONFIG ?= "cxx \
23 ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}"
Andrew Geisslera2681d92020-10-16 10:17:07 -050024
25# Always build tools - they don't have any additional
26# requirements over the library.
27EXTRA_OECONF = "--enable-tools"
28
29DEPENDS += "autoconf-archive-native"
30
Andrew Geissler69721092021-07-23 12:57:00 -040031PACKAGES =+ "${PN}-tools libgpiodcxx ${PN}-python"
Patrick Williams213cb262021-08-07 19:21:33 -050032FILES:${PN}-tools = " \
Andrew Geissler69721092021-07-23 12:57:00 -040033 ${bindir}/gpiodetect \
34 ${bindir}/gpioinfo \
35 ${bindir}/gpioget \
36 ${bindir}/gpioset \
37 ${bindir}/gpiofind \
38 ${bindir}/gpiomon \
39"
Patrick Williams213cb262021-08-07 19:21:33 -050040FILES:${PN}-ptest += " \
Andrew Geissler69721092021-07-23 12:57:00 -040041 ${bindir}/gpiod-test \
42 ${bindir}/gpio-tools-test \
43 ${bindir}/gpio-tools-test.bats \
44 ${bindir}/gpiod-cxx-test \
45 ${bindir}/gpiod_py_test.py \
46 ${libdir}/libgpiomockup.so.* \
47"
Patrick Williams213cb262021-08-07 19:21:33 -050048FILES:libgpiodcxx = "${libdir}/libgpiodcxx.so.*"
49FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR}/*.so"
50FILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
Andrew Geissler69721092021-07-23 12:57:00 -040051
Patrick Williams213cb262021-08-07 19:21:33 -050052RRECOMMENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-python', '', d)}"
Andrew Geissler595f6302022-01-24 19:11:47 +000053RRECOMMENDS:${PN}-ptest += " \
54 kernel-module-gpio-mockup \
55 coreutils \
56 ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3-unittest', '', d)} \
57"
Andrew Geissler78b72792022-06-14 06:47:25 -050058RDEPENDS:${PN}-ptest += "bats python3-packaging"
Andrew Geisslerac970dd2021-02-12 15:32:45 -060059
Andrew Geisslerac970dd2021-02-12 15:32:45 -060060do_install_ptest() {
Andrew Geissler69721092021-07-23 12:57:00 -040061 install -d ${D}${PTEST_PATH}/tests
62
63 # These are the core C library tests
64 install -m 0755 ${B}/tests/.libs/gpiod-test ${D}${PTEST_PATH}/tests/
65
66 # Tools are always built so let's always install them for ptest even if
67 # we're not selecting libgpiod-tools.
68 install -m 0755 ${S}/tools/gpio-tools-test ${D}${PTEST_PATH}/tests/
69 install -m 0755 ${S}/tools/gpio-tools-test.bats ${D}${PTEST_PATH}/tests/
Patrick Williams213cb262021-08-07 19:21:33 -050070 for tool in ${FILES:${PN}-tools}; do
Andrew Geissler69721092021-07-23 12:57:00 -040071 install ${B}/tools/.libs/$(basename $tool) ${D}${PTEST_PATH}/tests/
72 done
73
74 if ${@bb.utils.contains('PACKAGECONFIG', 'cxx', 'true', 'false', d)}; then
75 install -m 0755 ${B}/bindings/cxx/tests/.libs/gpiod-cxx-test ${D}${PTEST_PATH}/tests/
76 fi
77
78 if ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'true', 'false', d)}; then
79 install -m 0755 ${S}/bindings/python/tests/gpiod_py_test.py ${D}${PTEST_PATH}/tests/
80 fi
Andrew Geisslerac970dd2021-02-12 15:32:45 -060081}