Message ID | 20230208152541.136848-3-brgl@bgdev.pl |
---|---|
State | Under Review |
Headers | show |
Series | libgpiod: add support for libgpiod v2 | expand |
fails to build with clang https://errors.yoctoproject.org/Errors/Details/689563/ On Wed, Feb 8, 2023 at 7:25 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> > > 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> > --- > .../{files => libgpiod-1.6.4}/run-ptest | 0 > .../libgpiod/libgpiod-2.0-rc1/run-ptest | 24 ++++++++ > .../recipes-support/libgpiod/libgpiod-src.inc | 1 + > meta-oe/recipes-support/libgpiod/libgpiod.inc | 61 +++++++++++++++++++ > .../libgpiod/libgpiod_1.6.4.bb | 56 ++--------------- > .../libgpiod/libgpiod_2.0-rc1.bb | 21 +++++++ > 6 files changed, 113 insertions(+), 50 deletions(-) > rename meta-oe/recipes-support/libgpiod/{files => libgpiod-1.6.4}/run-ptest (100%) > create mode 100644 meta-oe/recipes-support/libgpiod/libgpiod-2.0-rc1/run-ptest > create mode 100644 meta-oe/recipes-support/libgpiod/libgpiod-src.inc > create mode 100644 meta-oe/recipes-support/libgpiod/libgpiod.inc > create mode 100644 meta-oe/recipes-support/libgpiod/libgpiod_2.0-rc1.bb > > diff --git a/meta-oe/recipes-support/libgpiod/files/run-ptest b/meta-oe/recipes-support/libgpiod/libgpiod-1.6.4/run-ptest > 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 > diff --git a/meta-oe/recipes-support/libgpiod/libgpiod-2.0-rc1/run-ptest b/meta-oe/recipes-support/libgpiod/libgpiod-2.0-rc1/run-ptest > new file mode 100644 > index 000000000..9475f0253 > --- /dev/null > +++ b/meta-oe/recipes-support/libgpiod/libgpiod-2.0-rc1/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 000000000..6bab4c1f4 > --- /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 000000000..abb6544ec > --- /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 70a77c883..df0e3f104 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-rc1.bb b/meta-oe/recipes-support/libgpiod/libgpiod_2.0-rc1.bb > new file mode 100644 > index 000000000..6894932ee > --- /dev/null > +++ b/meta-oe/recipes-support/libgpiod/libgpiod_2.0-rc1.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] = "64a718e8f8e022afc1880bae0b6ddc874fca1ce1bf8a2ac88bab4ccca6b66a1e" > + > +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" > -- > 2.37.2 >
On Thu, Feb 9, 2023 at 4:50 PM Khem Raj <raj.khem@gmail.com> wrote: > > fails to build with clang > > https://errors.yoctoproject.org/Errors/Details/689563/ > Thanks for the report. I fixed this one but it seems like there are more issues with clang and musl. For instance musl doesn't have twalk_r() which libgpiod uses in tests. I need to spend some time on it. Bart
diff --git a/meta-oe/recipes-support/libgpiod/files/run-ptest b/meta-oe/recipes-support/libgpiod/libgpiod-1.6.4/run-ptest 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 diff --git a/meta-oe/recipes-support/libgpiod/libgpiod-2.0-rc1/run-ptest b/meta-oe/recipes-support/libgpiod/libgpiod-2.0-rc1/run-ptest new file mode 100644 index 000000000..9475f0253 --- /dev/null +++ b/meta-oe/recipes-support/libgpiod/libgpiod-2.0-rc1/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 000000000..6bab4c1f4 --- /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 000000000..abb6544ec --- /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 70a77c883..df0e3f104 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-rc1.bb b/meta-oe/recipes-support/libgpiod/libgpiod_2.0-rc1.bb new file mode 100644 index 000000000..6894932ee --- /dev/null +++ b/meta-oe/recipes-support/libgpiod/libgpiod_2.0-rc1.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] = "64a718e8f8e022afc1880bae0b6ddc874fca1ce1bf8a2ac88bab4ccca6b66a1e" + +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"