similarity index 100%
rename from meta-oe/recipes-support/libgpiod/files/run-ptest
rename to meta-oe/recipes-support/libgpiod/libgpiod-1.6.4/run-ptest
new file mode 100644
@@ -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
new file mode 100644
@@ -0,0 +1 @@
+SRC_URI += "https://www.kernel.org/pub/software/libs/libgpiod/libgpiod-${PV}.tar.xz"
new file mode 100644
@@ -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
+}
+
@@ -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
new file mode 100644
@@ -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"