summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/libgpiod
diff options
context:
space:
mode:
Diffstat (limited to 'meta-oe/recipes-support/libgpiod')
-rw-r--r--meta-oe/recipes-support/libgpiod/libgpiod-1.x/0001-bindings-cxx-disable-tests.patch33
-rw-r--r--meta-oe/recipes-support/libgpiod/libgpiod-1.x/run-ptest2
-rw-r--r--meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-manager.init76
-rw-r--r--meta-oe/recipes-support/libgpiod/libgpiod-2.x/run-ptest43
-rw-r--r--meta-oe/recipes-support/libgpiod/libgpiod.inc5
-rw-r--r--meta-oe/recipes-support/libgpiod/libgpiod_1.6.5.bb (renamed from meta-oe/recipes-support/libgpiod/libgpiod_1.6.4.bb)10
-rw-r--r--meta-oe/recipes-support/libgpiod/libgpiod_2.1.1.bb31
-rw-r--r--meta-oe/recipes-support/libgpiod/libgpiod_2.2.1.bb104
8 files changed, 249 insertions, 55 deletions
diff --git a/meta-oe/recipes-support/libgpiod/libgpiod-1.x/0001-bindings-cxx-disable-tests.patch b/meta-oe/recipes-support/libgpiod/libgpiod-1.x/0001-bindings-cxx-disable-tests.patch
new file mode 100644
index 0000000000..0b850ba138
--- /dev/null
+++ b/meta-oe/recipes-support/libgpiod/libgpiod-1.x/0001-bindings-cxx-disable-tests.patch
@@ -0,0 +1,33 @@
1From 8293f0b8a329beed542f5c8a2efa4641759fccf4 Mon Sep 17 00:00:00 2001
2From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
3Date: Tue, 11 Jun 2024 10:34:14 +0200
4Subject: [PATCH] bindings: cxx: disable tests
5
6Meta-openembedded is moving to catch2 v3 which will make the C++ tests
7incompatible with the testing library. As this is an older version of
8the project, just disable C++ tests entirely.
9
10Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
11---
12Upstream-Status: Inappropriate [upstream continues to use Catch2 v2]
13
14 bindings/cxx/Makefile.am | 6 ------
15 1 file changed, 6 deletions(-)
16
17diff --git a/bindings/cxx/Makefile.am b/bindings/cxx/Makefile.am
18index 5c40ceb..d901836 100644
19--- a/bindings/cxx/Makefile.am
20+++ b/bindings/cxx/Makefile.am
21@@ -19,9 +19,3 @@ pkgconfigdir = $(libdir)/pkgconfig
22 pkgconfig_DATA = libgpiodcxx.pc
23
24 SUBDIRS = . examples
25-
26-if WITH_TESTS
27-
28-SUBDIRS += tests
29-
30-endif
31--
322.40.1
33
diff --git a/meta-oe/recipes-support/libgpiod/libgpiod-1.x/run-ptest b/meta-oe/recipes-support/libgpiod/libgpiod-1.x/run-ptest
index 61b9b69fc6..a56c2bb685 100644
--- a/meta-oe/recipes-support/libgpiod/libgpiod-1.x/run-ptest
+++ b/meta-oe/recipes-support/libgpiod/libgpiod-1.x/run-ptest
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2 2
3testbins="gpiod-test gpio-tools-test gpiod-cxx-test gpiod_py_test.py" 3testbins="gpiod-test gpio-tools-test gpiod_py_test.py"
4 4
5ptestdir=$(dirname "$(readlink -f "$0")") 5ptestdir=$(dirname "$(readlink -f "$0")")
6cd $ptestdir/tests 6cd $ptestdir/tests
diff --git a/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-manager.init b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-manager.init
new file mode 100644
index 0000000000..e36755eea2
--- /dev/null
+++ b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-manager.init
@@ -0,0 +1,76 @@
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides: gpio-manager
4# Required-Start: $remote_fs $syslog
5# Required-Stop: $remote_fs $syslog
6# Default-Start: 2 3 4 5
7# Default-Stop: 1
8# Short-Description: Centralized GPIO manager daemon
9### END INIT INFO
10#
11# -*- coding: utf-8 -*-
12# Debian init.d script for gpio-manager
13# Copyright (c) 2024 Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
14
15# set -e
16
17# Source function library.
18. /etc/init.d/functions
19
20DAEMON=/usr/bin/gpio-manager
21NAME=gpio-manager
22PIDFILE=/var/run/gpio-manager/pid
23DESC="GPIO manager daemon"
24
25test -x $DAEMON || exit 0
26test "$ENABLED" != "0" || exit 0
27
28do_start()
29{
30 mkdir -p "`dirname $PIDFILE`"
31 if [ -e $PIDFILE ]; then
32 PIDDIR=/proc/$(cat $PIDFILE)
33 if [ -d ${PIDDIR} -a "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then
34 echo "$DESC already started; not starting."
35 else
36 echo "Removing stale PID file $PIDFILE."
37 rm -f $PIDFILE
38 fi
39 fi
40
41 echo -n "Starting $DESC: "
42 start-stop-daemon --user gpio-manager --background --start --quiet --make-pidfile --pidfile $PIDFILE --exec $DAEMON
43 echo "$NAME."
44}
45
46do_stop()
47{
48 echo -n "Stopping $DESC: "
49 start-stop-daemon --stop --quiet --pidfile $PIDFILE
50 echo "$NAME."
51 rm -f $PIDFILE
52}
53
54case "$1" in
55 start)
56 do_start
57 ;;
58 stop)
59 do_stop
60 ;;
61 status)
62 status $DAEMON
63 exit $?
64 ;;
65 restart)
66 do_stop
67 sleep 1
68 do_start
69 ;;
70 *)
71 echo "Usage: /etc/init.d/$NAME {start|stop|status|restart}" >&2
72 exit 1
73 ;;
74esac
75
76exit 0
diff --git a/meta-oe/recipes-support/libgpiod/libgpiod-2.x/run-ptest b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/run-ptest
index 29ec0d1027..eae172116f 100644
--- a/meta-oe/recipes-support/libgpiod/libgpiod-2.x/run-ptest
+++ b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/run-ptest
@@ -1,24 +1,43 @@
1#!/bin/sh 1#!/bin/sh
2 2
3testbins="gpiod-test gpio-tools-test.bash gpiod-cxx-test"
4
5ptestdir=$(dirname "$(readlink -f "$0")") 3ptestdir=$(dirname "$(readlink -f "$0")")
6cd $ptestdir/tests 4cd $ptestdir/tests
7 5
6export GPIODBUS_TEST_DAEMON_PATH="$ptestdir/tests/gpio-manager"
7export PATH="$ptestdir/tests/:$PATH"
8
8# libgpiod v2 uses gpio-sim - a configfs-based testing module. We need to 9# libgpiod v2 uses gpio-sim - a configfs-based testing module. We need to
9# make sure configfs is mounted before running any tests. 10# make sure configfs is mounted before running any tests.
10modprobe configfs 11modprobe configfs
11mountpoint /sys/kernel/config > /dev/null || mount -t configfs configfs /sys/kernel/config 12mountpoint /sys/kernel/config > /dev/null || mount -t configfs configfs /sys/kernel/config
12 13
13for testbin in $testbins; do 14# Make sure the daemon is not running during tests.
14 if test -e ./$testbin; then 15systemctl stop gpio-manager 2> /dev/null > /dev/null
15 ./$testbin > ./$testbin.out 2>&1 16service gpio-manager stop 2> /dev/null > /dev/null
16 if [ $? -ne 0 ]; then 17
17 echo "FAIL: $testbin" 18run_one_test() {
18 else 19 testbin="$1"
19 echo "PASS: $testbin" 20
20 fi 21 ./$testbin > ./$testbin.out 2>&1
22 if [ $? -ne 0 ]; then
23 echo "FAIL: $testbin"
21 else 24 else
22 echo "SKIP: $testbin" 25 echo "PASS: $testbin"
23 fi 26 fi
24done 27}
28
29run_one_test gpiod-test
30run_one_test gpio-tools-test.bash
31run_one_test gpiod-cxx-test
32run_one_test gpiod-glib-test
33
34# Wait for the leftover uevents to be emitted before running DBus tests.
35udevadm settle
36run_one_test gpiodbus-test
37
38udevadm settle
39gpio-manager 2> /dev/null > /dev/null &
40GPIO_MANAGER_PID=$!
41run_one_test gpiocli-test.bash
42kill $GPIO_MANAGER_PID
43wait $GPIO_MANAGER_PID
diff --git a/meta-oe/recipes-support/libgpiod/libgpiod.inc b/meta-oe/recipes-support/libgpiod/libgpiod.inc
index dc1fb4fe92..fb309c5644 100644
--- a/meta-oe/recipes-support/libgpiod/libgpiod.inc
+++ b/meta-oe/recipes-support/libgpiod/libgpiod.inc
@@ -52,9 +52,4 @@ do_install_ptest() {
52 for tool in ${FILES:${PN}-tools}; do 52 for tool in ${FILES:${PN}-tools}; do
53 install ${B}/tools/.libs/$(basename $tool) ${D}${PTEST_PATH}/tests/ 53 install ${B}/tools/.libs/$(basename $tool) ${D}${PTEST_PATH}/tests/
54 done 54 done
55
56 if ${@bb.utils.contains('PACKAGECONFIG', 'cxx', 'true', 'false', d)}; then
57 install -m 0755 ${B}/bindings/cxx/tests/.libs/gpiod-cxx-test ${D}${PTEST_PATH}/tests/
58 fi
59} 55}
60
diff --git a/meta-oe/recipes-support/libgpiod/libgpiod_1.6.4.bb b/meta-oe/recipes-support/libgpiod/libgpiod_1.6.5.bb
index 111a5727ba..009cf9897a 100644
--- a/meta-oe/recipes-support/libgpiod/libgpiod_1.6.4.bb
+++ b/meta-oe/recipes-support/libgpiod/libgpiod_1.6.5.bb
@@ -3,19 +3,17 @@ require libgpiod.inc
3LICENSE = "LGPL-2.1-or-later" 3LICENSE = "LGPL-2.1-or-later"
4LIC_FILES_CHKSUM = "file://COPYING;md5=2caced0b25dfefd4c601d92bd15116de" 4LIC_FILES_CHKSUM = "file://COPYING;md5=2caced0b25dfefd4c601d92bd15116de"
5 5
6SRC_URI[sha256sum] = "7b146e12f28fbca3df7557f176eb778c5ccf952ca464698dba8a61b2e1e3f9b5" 6SRC_URI += "file://0001-bindings-cxx-disable-tests.patch"
7 7
8FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}-1.x:" 8SRC_URI[sha256sum] = "ae280f697bf035a1fb780c9972e5c81d0d2712b7ab6124fb3fba24619daa72bc"
9
10FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}-1.x:"
9 11
10inherit python3native 12inherit python3native
11 13
12PACKAGECONFIG[tests] = "--enable-tests,--disable-tests,kmod udev glib-2.0 catch2" 14PACKAGECONFIG[tests] = "--enable-tests,--disable-tests,kmod udev glib-2.0 catch2"
13PACKAGECONFIG[python3] = "--enable-bindings-python,--disable-bindings-python,python3" 15PACKAGECONFIG[python3] = "--enable-bindings-python,--disable-bindings-python,python3"
14 16
15# Always build tools - they don't have any additional
16# requirements over the library.
17EXTRA_OECONF = "--enable-tools"
18
19PACKAGES =+ "${PN}-python" 17PACKAGES =+ "${PN}-python"
20FILES:${PN}-tools += "${bindir}/gpiofind" 18FILES:${PN}-tools += "${bindir}/gpiofind"
21FILES:${PN}-ptest += " \ 19FILES:${PN}-ptest += " \
diff --git a/meta-oe/recipes-support/libgpiod/libgpiod_2.1.1.bb b/meta-oe/recipes-support/libgpiod/libgpiod_2.1.1.bb
deleted file mode 100644
index 4c13d67eba..0000000000
--- a/meta-oe/recipes-support/libgpiod/libgpiod_2.1.1.bb
+++ /dev/null
@@ -1,31 +0,0 @@
1require libgpiod.inc
2
3LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later & CC-BY-SA-4.0"
4LIC_FILES_CHKSUM = " \
5 file://LICENSES/GPL-2.0-or-later.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
6 file://LICENSES/LGPL-2.1-or-later.txt;md5=4b54a1fd55a448865a0b32d41598759d \
7 file://LICENSES/CC-BY-SA-4.0.txt;md5=fba3b94d88bfb9b81369b869a1e9a20f \
8"
9
10FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}-2.x:"
11
12SRC_URI[sha256sum] = "b21913f469d3135680d5516f00fdf9f81d5e564e19ffb690927ea7f1d7e312cb"
13
14# Enable all project features for ptest
15PACKAGECONFIG[tests] = "--enable-tests --enable-tools --enable-bindings-cxx --enable-gpioset-interactive,--disable-tests,kmod util-linux glib-2.0 catch2 libedit"
16PACKAGECONFIG[gpioset-interactive] = "--enable-gpioset-interactive,--disable-gpioset-interactive,libedit"
17
18PACKAGES =+ "${PN}-ptest-dev"
19FILES:${PN}-tools += "${bindir}/gpionotify"
20FILES:${PN}-ptest += "${libdir}/libgpiosim.so.*"
21FILES:${PN}-ptest-dev += "${includedir}/gpiosim.h"
22
23RDEPENDS:${PN}-ptest += " \
24 ${@bb.utils.contains('PTEST_ENABLED', '1', 'shunit2 bash', '', d)} \
25"
26RRECOMMENDS:${PN}-ptest += "kernel-module-gpio-sim kernel-module-configfs"
27
28do_install_ptest:append() {
29 install -m 0755 ${S}/tools/gpio-tools-test.bash ${D}${PTEST_PATH}/tests/
30 install -m 0644 ${S}/tests/gpiosim/gpiosim.h ${D}${includedir}/gpiosim.h
31}
diff --git a/meta-oe/recipes-support/libgpiod/libgpiod_2.2.1.bb b/meta-oe/recipes-support/libgpiod/libgpiod_2.2.1.bb
new file mode 100644
index 0000000000..93c3e3b92d
--- /dev/null
+++ b/meta-oe/recipes-support/libgpiod/libgpiod_2.2.1.bb
@@ -0,0 +1,104 @@
1require libgpiod.inc
2
3inherit systemd update-rc.d useradd gobject-introspection
4
5LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later & CC-BY-SA-4.0"
6LIC_FILES_CHKSUM = " \
7 file://LICENSES/GPL-2.0-or-later.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
8 file://LICENSES/LGPL-2.1-or-later.txt;md5=4b54a1fd55a448865a0b32d41598759d \
9 file://LICENSES/CC-BY-SA-4.0.txt;md5=fba3b94d88bfb9b81369b869a1e9a20f \
10"
11
12FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}-2.x:"
13
14SRC_URI += "file://gpio-manager.init"
15
16SRC_URI[sha256sum] = "0e948049c309b87c220fb24ee0d605d7cd5b72f22376e608470903fffa2d4b18"
17
18# Enable all project features for ptest
19PACKAGECONFIG[tests] = " \
20 --enable-tests --enable-tools --enable-bindings-cxx --enable-bindings-glib --enable-gpioset-interactive --enable-dbus, \
21 --disable-tests, \
22 kmod util-linux glib-2.0 catch2 libedit glib-2.0-native libgudev, \
23 bash ${VIRTUAL-RUNTIME_dbus} glib-2.0-utils libgpiod-manager-cfg shunit2 \
24"
25PACKAGECONFIG[gpioset-interactive] = "--enable-gpioset-interactive,--disable-gpioset-interactive,libedit"
26PACKAGECONFIG[glib] = "--enable-bindings-glib,--disable-bindings-glib,glib-2.0 glib-2.0-native"
27PACKAGECONFIG[dbus] = "--enable-dbus,--disable-dbus,glib-2.0 glib-2.0-native libgudev,${VIRTUAL-RUNTIME_dbus}"
28
29PACKAGES =+ "${PN}-gpiosim ${PN}-glib ${PN}-manager ${PN}-manager-cfg ${PN}-cli"
30FILES:${PN}-tools += "${bindir}/gpionotify"
31FILES:${PN}-gpiosim += "${libdir}/libgpiosim.so.*"
32FILES:${PN}-gpiosim-dev += "${includedir}/gpiosim.h"
33FILES:${PN}-glib += "${libdir}/libgpiod-glib.so.*"
34FILES:${PN}-manager += " \
35 ${bindir}/gpio-manager \
36 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_system_unitdir}/gpio-manager.service', '', d)} \
37 ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '${sysconfdir}/init.d/gpio-manager', '', d)} \
38"
39FILES:${PN}-manager-cfg += " \
40 ${sysconfdir}/dbus-1/system.d/io.gpiod1.conf \
41 ${datadir}/dbus-1/interfaces/io.gpiod1.xml \
42 ${nonarch_base_libdir}/udev/rules.d/90-gpio.rules \
43"
44FILES:${PN}-cli += "${bindir}/gpiocli"
45
46RDEPENDS:${PN}-manager += "${VIRTUAL-RUNTIME_dbus} ${PN}-manager-cfg"
47RDEPENDS:${PN}-cli += "${PN}-manager"
48
49SYSTEMD_PACKAGES = "${PN}-manager"
50
51python __anonymous() {
52 distro_features = d.getVar("DISTRO_FEATURES").split()
53 packageconfig = d.getVar("PACKAGECONFIG").split()
54 pn = d.getVar("PN")
55
56 if "systemd" in distro_features and "dbus" in packageconfig:
57 d.appendVar("EXTRA_OECONF", " --enable-systemd")
58 # We need to set it conditionally or else the systemd class will look
59 # for the file that we don't install with systemd support disabled.
60 d.setVar("SYSTEMD_SERVICE:{}-manager".format(pn), "gpio-manager.service")
61 else:
62 d.appendVar("EXTRA_OECONF", " --disable-systemd")
63
64 # Disable gobject introspection set by the bbclass if we don't want it.
65 if not any(cfg in ["glib", "dbus", "ptest"] for cfg in packageconfig):
66 d.setVar("GI_DATA_ENABLED", "False")
67}
68
69UPDATERCPN = "${PN}-manager"
70INITSCRIPT_NAME = "gpio-manager"
71INITSCRIPT_PARAMS = "start 20 2 3 4 5 . stop 20 0 1 6 ."
72
73USERADD_PACKAGES = "${PN}-manager"
74GROUPADD_PARAM:${PN}-manager = "--system gpio"
75USERADD_PARAM:${PN}-manager = "--system -M -s /bin/nologin -g gpio gpio-manager"
76
77RDEPENDS:${PN}-ptest += " \
78 ${@bb.utils.contains('PTEST_ENABLED', '1', 'shunit2 bash', '', d)} \
79"
80RRECOMMENDS:${PN}-gpiosim += "kernel-module-gpio-sim kernel-module-configfs"
81INSANE_SKIP:${PN}-ptest += "buildpaths"
82
83do_compile:prepend() {
84 export GIR_EXTRA_LIBS_PATH="${B}/lib/.libs"
85}
86
87do_install:append() {
88 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
89 install -d ${D}${sysconfdir}/init.d
90 install -m 0755 ${UNPACKDIR}/gpio-manager.init ${D}${sysconfdir}/init.d/gpio-manager
91 fi
92}
93
94do_install_ptest:append() {
95 install -m 0755 ${B}/bindings/cxx/tests/.libs/gpiod-cxx-test ${D}${PTEST_PATH}/tests/
96 install -m 0755 ${S}/tools/gpio-tools-test.bash ${D}${PTEST_PATH}/tests/
97 install -m 0644 ${S}/tests/scripts/gpiod-bash-test-helper.inc ${D}${PTEST_PATH}/tests/
98 install -m 0644 ${S}/tests/gpiosim/gpiosim.h ${D}${includedir}/gpiosim.h
99 install -m 0755 ${B}/bindings/glib/tests/.libs/gpiod-glib-test ${D}${PTEST_PATH}/tests/
100 install -m 0755 ${B}/dbus/tests/.libs/gpiodbus-test ${D}${PTEST_PATH}/tests/
101 install -m 0755 ${S}/dbus/client/gpiocli-test.bash ${D}${PTEST_PATH}/tests/
102 install -m 0755 ${B}/dbus/manager/.libs/gpio-manager ${D}${PTEST_PATH}/tests/
103 install -m 0755 ${B}/dbus/client/.libs/gpiocli ${D}${PTEST_PATH}/tests/
104}