diff options
author | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2023-02-16 09:49:36 +0100 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2023-02-18 13:19:36 -0800 |
commit | cd26db61af27a9f822492b1d67b0e39e6828e7cb (patch) | |
tree | 57fd7496f2bbbc5139d0ca3c620cdd607704a437 /meta-oe/recipes-support/libgpiod | |
parent | be25139b3a22014d954363e64d98f84eef5dba3c (diff) | |
download | meta-openembedded-contrib-cd26db61af27a9f822492b1d67b0e39e6828e7cb.tar.gz |
libgpiod: add a recipe for libgpiod v2.0-rc2
This is a recipe for libgpiod v2 release candidate. Let's put common
bits and pieces into an .inc file and the source fetching into a
separate include that will be later reused by the python bindings that
for v2 will be moved into a separate recipe in meta-python.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-support/libgpiod')
-rw-r--r-- | meta-oe/recipes-support/libgpiod/libgpiod-1.6.4/run-ptest (renamed from meta-oe/recipes-support/libgpiod/files/run-ptest) | 0 | ||||
-rw-r--r-- | meta-oe/recipes-support/libgpiod/libgpiod-2.0-rc2/run-ptest | 24 | ||||
-rw-r--r-- | meta-oe/recipes-support/libgpiod/libgpiod-src.inc | 1 | ||||
-rw-r--r-- | meta-oe/recipes-support/libgpiod/libgpiod.inc | 61 | ||||
-rw-r--r-- | meta-oe/recipes-support/libgpiod/libgpiod_1.6.4.bb | 56 | ||||
-rw-r--r-- | meta-oe/recipes-support/libgpiod/libgpiod_2.0-rc2.bb | 21 |
6 files changed, 113 insertions, 50 deletions
diff --git a/meta-oe/recipes-support/libgpiod/files/run-ptest b/meta-oe/recipes-support/libgpiod/libgpiod-1.6.4/run-ptest index 61b9b69fc6..61b9b69fc6 100644 --- a/meta-oe/recipes-support/libgpiod/files/run-ptest +++ b/meta-oe/recipes-support/libgpiod/libgpiod-1.6.4/run-ptest diff --git a/meta-oe/recipes-support/libgpiod/libgpiod-2.0-rc2/run-ptest b/meta-oe/recipes-support/libgpiod/libgpiod-2.0-rc2/run-ptest new file mode 100644 index 0000000000..9475f02535 --- /dev/null +++ b/meta-oe/recipes-support/libgpiod/libgpiod-2.0-rc2/run-ptest @@ -0,0 +1,24 @@ +#!/bin/sh + +testbins="gpiod-test gpio-tools-test gpiod-cxx-test" + +ptestdir=$(dirname "$(readlink -f "$0")") +cd $ptestdir/tests + +# libgpiod v2 uses gpio-sim - a configfs-based testing module. We need to +# make sure configfs is mounted before running any tests. +modprobe configfs +mountpoint /sys/kernel/config > /dev/null || mount -t configfs configfs /sys/kernel/config + +for testbin in $testbins; do + if test -e ./$testbin; then + ./$testbin > ./$testbin.out 2>&1 + if [ $? -ne 0 ]; then + echo "FAIL: $testbin" + else + echo "PASS: $testbin" + fi + else + echo "SKIP: $testbin" + fi +done diff --git a/meta-oe/recipes-support/libgpiod/libgpiod-src.inc b/meta-oe/recipes-support/libgpiod/libgpiod-src.inc new file mode 100644 index 0000000000..6bab4c1f42 --- /dev/null +++ b/meta-oe/recipes-support/libgpiod/libgpiod-src.inc @@ -0,0 +1 @@ +SRC_URI += "https://www.kernel.org/pub/software/libs/libgpiod/libgpiod-${PV}.tar.xz" diff --git a/meta-oe/recipes-support/libgpiod/libgpiod.inc b/meta-oe/recipes-support/libgpiod/libgpiod.inc new file mode 100644 index 0000000000..abb6544ec2 --- /dev/null +++ b/meta-oe/recipes-support/libgpiod/libgpiod.inc @@ -0,0 +1,61 @@ +SUMMARY = "C library and tools for interacting with the linux GPIO character device" +AUTHOR = "Bartosz Golaszewski <brgl@bgdev.pl>" + +require libgpiod-src.inc + +inherit autotools pkgconfig ptest + +SRC_URI += "file://run-ptest" + +PACKAGECONFIG[cxx] = "--enable-bindings-cxx,--disable-bindings-cxx" + +# Enable cxx bindings by default. +PACKAGECONFIG ?= " \ + cxx \ + ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)} \ +" + +# Always build tools - they don't have any additional +# requirements over the library. +EXTRA_OECONF = "--enable-tools" + +DEPENDS += "autoconf-archive-native" + +PACKAGES =+ "${PN}-tools libgpiodcxx" +FILES:${PN}-tools += " \ + ${bindir}/gpiodetect \ + ${bindir}/gpioinfo \ + ${bindir}/gpioget \ + ${bindir}/gpioset \ + ${bindir}/gpiomon \ +" +FILES:${PN}-ptest += " \ + ${bindir}/gpiod-test \ + ${bindir}/gpio-tools-test \ + ${bindir}/gpio-tools-test.bats \ + ${bindir}/gpiod-cxx-test \ +" +FILES:libgpiodcxx = "${libdir}/libgpiodcxx.so.*" + +RRECOMMENDS:${PN}-ptest += "coreutils" +RDEPENDS:${PN}-ptest += "bats" + +do_install_ptest() { + install -d ${D}${PTEST_PATH}/tests/ + + # These are the core C library tests + install -m 0755 ${B}/tests/.libs/gpiod-test ${D}${PTEST_PATH}/tests/ + + # Tools are always built so let's always install them for ptest even if + # we're not selecting libgpiod-tools. + install -m 0755 ${S}/tools/gpio-tools-test ${D}${PTEST_PATH}/tests/ + install -m 0755 ${S}/tools/gpio-tools-test.bats ${D}${PTEST_PATH}/tests/ + for tool in ${FILES:${PN}-tools}; do + install ${B}/tools/.libs/$(basename $tool) ${D}${PTEST_PATH}/tests/ + done + + if ${@bb.utils.contains('PACKAGECONFIG', 'cxx', 'true', 'false', d)}; then + install -m 0755 ${B}/bindings/cxx/tests/.libs/gpiod-cxx-test ${D}${PTEST_PATH}/tests/ + fi +} + diff --git a/meta-oe/recipes-support/libgpiod/libgpiod_1.6.4.bb b/meta-oe/recipes-support/libgpiod/libgpiod_1.6.4.bb index 70a77c8834..df0e3f104a 100644 --- a/meta-oe/recipes-support/libgpiod/libgpiod_1.6.4.bb +++ b/meta-oe/recipes-support/libgpiod/libgpiod_1.6.4.bb @@ -1,80 +1,36 @@ -SUMMARY = "C library and tools for interacting with the linux GPIO character device" -AUTHOR = "Bartosz Golaszewski <brgl@bgdev.pl>" +require libgpiod.inc LICENSE = "LGPL-2.1-or-later" LIC_FILES_CHKSUM = "file://COPYING;md5=2caced0b25dfefd4c601d92bd15116de" -SRC_URI = " \ - https://www.kernel.org/pub/software/libs/${BPN}/${BP}.tar.xz \ - file://run-ptest \ -" - -SRC_URI[md5sum] = "7a2cca6ead9296c27e877070dd8853bc" SRC_URI[sha256sum] = "7b146e12f28fbca3df7557f176eb778c5ccf952ca464698dba8a61b2e1e3f9b5" -inherit autotools pkgconfig python3native ptest +inherit python3native PACKAGECONFIG[tests] = "--enable-tests,--disable-tests,kmod udev glib-2.0 catch2" -PACKAGECONFIG[cxx] = "--enable-bindings-cxx,--disable-bindings-cxx" PACKAGECONFIG[python3] = "--enable-bindings-python,--disable-bindings-python,python3" -# Enable cxx bindings by default. -PACKAGECONFIG ?= "cxx \ - ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" - # Always build tools - they don't have any additional # requirements over the library. EXTRA_OECONF = "--enable-tools" -DEPENDS += "autoconf-archive-native" - -PACKAGES =+ "${PN}-tools libgpiodcxx ${PN}-python" -FILES:${PN}-tools = " \ - ${bindir}/gpiodetect \ - ${bindir}/gpioinfo \ - ${bindir}/gpioget \ - ${bindir}/gpioset \ - ${bindir}/gpiofind \ - ${bindir}/gpiomon \ -" +PACKAGES =+ "${PN}-python" +FILES:${PN}-tools += "${bindir}/gpiofind" FILES:${PN}-ptest += " \ - ${bindir}/gpiod-test \ - ${bindir}/gpio-tools-test \ - ${bindir}/gpio-tools-test.bats \ - ${bindir}/gpiod-cxx-test \ ${bindir}/gpiod_py_test.py \ ${libdir}/libgpiomockup.so.* \ " -FILES:libgpiodcxx = "${libdir}/libgpiodcxx.so.*" FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR}/*.so" FILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a" RRECOMMENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-python', '', d)}" RRECOMMENDS:${PN}-ptest += " \ kernel-module-gpio-mockup \ - coreutils \ ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3-unittest', '', d)} \ " -RDEPENDS:${PN}-ptest += "bats python3-packaging" - -do_install_ptest() { - install -d ${D}${PTEST_PATH}/tests - - # These are the core C library tests - install -m 0755 ${B}/tests/.libs/gpiod-test ${D}${PTEST_PATH}/tests/ - - # Tools are always built so let's always install them for ptest even if - # we're not selecting libgpiod-tools. - install -m 0755 ${S}/tools/gpio-tools-test ${D}${PTEST_PATH}/tests/ - install -m 0755 ${S}/tools/gpio-tools-test.bats ${D}${PTEST_PATH}/tests/ - for tool in ${FILES:${PN}-tools}; do - install ${B}/tools/.libs/$(basename $tool) ${D}${PTEST_PATH}/tests/ - done - - if ${@bb.utils.contains('PACKAGECONFIG', 'cxx', 'true', 'false', d)}; then - install -m 0755 ${B}/bindings/cxx/tests/.libs/gpiod-cxx-test ${D}${PTEST_PATH}/tests/ - fi +RDEPENDS:${PN}-ptest += "python3-packaging" +do_install_ptest:append() { if ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'true', 'false', d)}; then install -m 0755 ${S}/bindings/python/tests/gpiod_py_test.py ${D}${PTEST_PATH}/tests/ fi diff --git a/meta-oe/recipes-support/libgpiod/libgpiod_2.0-rc2.bb b/meta-oe/recipes-support/libgpiod/libgpiod_2.0-rc2.bb new file mode 100644 index 0000000000..158175cdbb --- /dev/null +++ b/meta-oe/recipes-support/libgpiod/libgpiod_2.0-rc2.bb @@ -0,0 +1,21 @@ +require libgpiod.inc + +LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later & CC-BY-SA-4.0" +LIC_FILES_CHKSUM = " \ + file://LICENSES/GPL-2.0-or-later.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://LICENSES/LGPL-2.1-or-later.txt;md5=4b54a1fd55a448865a0b32d41598759d \ + file://LICENSES/CC-BY-SA-4.0.txt;md5=fba3b94d88bfb9b81369b869a1e9a20f \ +" + +SRC_URI[sha256sum] = "1b931bfabef897911e59d45c80b8930c43fa72f08aab9c03e8dfd4005881c09e" + +S = "${WORKDIR}/libgpiod-2.0" + +# We must enable gpioset-interactive for all gpio-tools tests to pass +PACKAGECONFIG[tests] = "--enable-tests --enable-gpioset-interactive,--disable-tests,kmod util-linux glib-2.0 catch2 libedit" +PACKAGECONFIG[gpioset-interactive] = "--enable-gpioset-interactive,--disable-gpioset-interactive,libedit" + +FILES:${PN}-tools += "${bindir}/gpionotify" +FILES:${PN}-ptest += "${libdir}/libgpiosim.so.*" + +RRECOMMENDS:${PN}-ptest += "kernel-module-gpio-sim" |