diff options
Diffstat (limited to 'meta-egvirt/recipes-support')
-rw-r--r-- | meta-egvirt/recipes-support/libgpiod/files/run-ptest | 19 | ||||
-rw-r--r-- | meta-egvirt/recipes-support/libgpiod/libgpiod.inc | 59 | ||||
-rw-r--r-- | meta-egvirt/recipes-support/libgpiod/libgpiod_2.1.bb | 35 |
3 files changed, 113 insertions, 0 deletions
diff --git a/meta-egvirt/recipes-support/libgpiod/files/run-ptest b/meta-egvirt/recipes-support/libgpiod/files/run-ptest new file mode 100644 index 00000000..61b9b69f --- /dev/null +++ b/meta-egvirt/recipes-support/libgpiod/files/run-ptest @@ -0,0 +1,19 @@ +#!/bin/sh + +testbins="gpiod-test gpio-tools-test gpiod-cxx-test gpiod_py_test.py" + +ptestdir=$(dirname "$(readlink -f "$0")") +cd $ptestdir/tests + +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-egvirt/recipes-support/libgpiod/libgpiod.inc b/meta-egvirt/recipes-support/libgpiod/libgpiod.inc new file mode 100644 index 00000000..0edb429f --- /dev/null +++ b/meta-egvirt/recipes-support/libgpiod/libgpiod.inc @@ -0,0 +1,59 @@ +SUMMARY = "C library and tools for interacting with the linux GPIO character device" +RECIPE_MAINTAINER = "Bartosz Golaszewski <brgl@bgdev.pl>" + +inherit autotools pkgconfig ptest + +SRC_URI += " \ + https://www.kernel.org/pub/software/libs/libgpiod/libgpiod-${PV}.tar.xz \ + 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:libgpiodcxx = "${libdir}/libgpiodcxx.so.*" + +RRECOMMENDS:${PN}-ptest += "coreutils" + +do_install:append() { + rm -f ${D}${bindir}/gpiod-test + rm -f ${D}${bindir}/gpio-tools-test + rm -f ${D}${bindir}/gpio-tools-test.bats + rm -f ${D}${bindir}/gpiod-cxx-test +} + +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. + 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-egvirt/recipes-support/libgpiod/libgpiod_2.1.bb b/meta-egvirt/recipes-support/libgpiod/libgpiod_2.1.bb new file mode 100644 index 00000000..6de445ed --- /dev/null +++ b/meta-egvirt/recipes-support/libgpiod/libgpiod_2.1.bb @@ -0,0 +1,35 @@ +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 \ +" + +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}-2.x:" + +SRC_URI[sha256sum] = "fa4024a080121c958502f9a46a5bda44bea85e7a4dd7fcb3dead463b6fc4261c" + +# Enable all project features for ptest +PACKAGECONFIG[tests] = "--enable-tests --enable-tools --enable-bindings-cxx --enable-gpioset-interactive,--disable-tests,kmod util-linux glib-2.0 catch2 libedit" +PACKAGECONFIG[gpioset-interactive] = "--enable-gpioset-interactive,--disable-gpioset-interactive,libedit" + +PACKAGES =+ "${PN}-ptest-dev" +FILES:${PN}-tools += "${bindir}/gpionotify" +FILES:${PN}-ptest += "${libdir}/libgpiosim.so.*" +FILES:${PN}-ptest-dev += "${includedir}/gpiosim.h" + +RDEPENDS:${PN}-ptest += " \ + bash \ + ${@bb.utils.contains('PTEST_ENABLED', '1', 'shunit2', '', d)} \ +" +RRECOMMENDS:${PN}-ptest += "kernel-module-gpio-sim" + +do_install_ptest:append() { + install -m 0755 ${S}/tools/gpio-tools-test.bash ${D}${PTEST_PATH}/tests/ + install -m 0644 ${S}/tests/gpiosim/gpiosim.h ${D}${includedir}/gpiosim.h +} + + + |