Andrew Geissler | a2681d9 | 2020-10-16 10:17:07 -0500 | [diff] [blame] | 1 | SUMMARY = "C library and tools for interacting with the linux GPIO character device" |
Andrew Geissler | 6972109 | 2021-07-23 12:57:00 -0400 | [diff] [blame] | 2 | AUTHOR = "Bartosz Golaszewski <brgl@bgdev.pl>" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 3 | |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 4 | LICENSE = "LGPL-2.1-or-later" |
Andrew Geissler | a2681d9 | 2020-10-16 10:17:07 -0500 | [diff] [blame] | 5 | LIC_FILES_CHKSUM = "file://COPYING;md5=2caced0b25dfefd4c601d92bd15116de" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 6 | |
Andrew Geissler | 6972109 | 2021-07-23 12:57:00 -0400 | [diff] [blame] | 7 | SRC_URI = " \ |
| 8 | https://www.kernel.org/pub/software/libs/${BPN}/${BP}.tar.xz \ |
| 9 | file://run-ptest \ |
Andrew Geissler | ac970dd | 2021-02-12 15:32:45 -0600 | [diff] [blame] | 10 | " |
| 11 | |
Andrew Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame] | 12 | SRC_URI[md5sum] = "28e79f6f70fee1da9079558d8b7b3736" |
| 13 | SRC_URI[sha256sum] = "841be9d788f00bab08ef22c4be5c39866f0e46cb100a3ae49ed816ac9c5dddc7" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 14 | |
Andrew Geissler | ac970dd | 2021-02-12 15:32:45 -0600 | [diff] [blame] | 15 | inherit autotools pkgconfig python3native ptest |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 16 | |
Andrew Geissler | 78b7279 | 2022-06-14 06:47:25 -0500 | [diff] [blame] | 17 | PACKAGECONFIG[tests] = "--enable-tests,--disable-tests,kmod udev glib-2.0 catch2" |
Andrew Geissler | a2681d9 | 2020-10-16 10:17:07 -0500 | [diff] [blame] | 18 | PACKAGECONFIG[cxx] = "--enable-bindings-cxx,--disable-bindings-cxx" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 19 | PACKAGECONFIG[python3] = "--enable-bindings-python,--disable-bindings-python,python3" |
| 20 | |
Andrew Geissler | a2681d9 | 2020-10-16 10:17:07 -0500 | [diff] [blame] | 21 | # Enable cxx bindings by default. |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 22 | PACKAGECONFIG ?= "cxx \ |
| 23 | ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" |
Andrew Geissler | a2681d9 | 2020-10-16 10:17:07 -0500 | [diff] [blame] | 24 | |
| 25 | # Always build tools - they don't have any additional |
| 26 | # requirements over the library. |
| 27 | EXTRA_OECONF = "--enable-tools" |
| 28 | |
| 29 | DEPENDS += "autoconf-archive-native" |
| 30 | |
Andrew Geissler | 6972109 | 2021-07-23 12:57:00 -0400 | [diff] [blame] | 31 | PACKAGES =+ "${PN}-tools libgpiodcxx ${PN}-python" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 32 | FILES:${PN}-tools = " \ |
Andrew Geissler | 6972109 | 2021-07-23 12:57:00 -0400 | [diff] [blame] | 33 | ${bindir}/gpiodetect \ |
| 34 | ${bindir}/gpioinfo \ |
| 35 | ${bindir}/gpioget \ |
| 36 | ${bindir}/gpioset \ |
| 37 | ${bindir}/gpiofind \ |
| 38 | ${bindir}/gpiomon \ |
| 39 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 40 | FILES:${PN}-ptest += " \ |
Andrew Geissler | 6972109 | 2021-07-23 12:57:00 -0400 | [diff] [blame] | 41 | ${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 Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 48 | FILES:libgpiodcxx = "${libdir}/libgpiodcxx.so.*" |
| 49 | FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR}/*.so" |
| 50 | FILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a" |
Andrew Geissler | 6972109 | 2021-07-23 12:57:00 -0400 | [diff] [blame] | 51 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 52 | RRECOMMENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-python', '', d)}" |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 53 | RRECOMMENDS:${PN}-ptest += " \ |
| 54 | kernel-module-gpio-mockup \ |
| 55 | coreutils \ |
| 56 | ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3-unittest', '', d)} \ |
| 57 | " |
Andrew Geissler | 78b7279 | 2022-06-14 06:47:25 -0500 | [diff] [blame] | 58 | RDEPENDS:${PN}-ptest += "bats python3-packaging" |
Andrew Geissler | ac970dd | 2021-02-12 15:32:45 -0600 | [diff] [blame] | 59 | |
Andrew Geissler | ac970dd | 2021-02-12 15:32:45 -0600 | [diff] [blame] | 60 | do_install_ptest() { |
Andrew Geissler | 6972109 | 2021-07-23 12:57:00 -0400 | [diff] [blame] | 61 | 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 Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 70 | for tool in ${FILES:${PN}-tools}; do |
Andrew Geissler | 6972109 | 2021-07-23 12:57:00 -0400 | [diff] [blame] | 71 | 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 Geissler | ac970dd | 2021-02-12 15:32:45 -0600 | [diff] [blame] | 81 | } |