From 5db40abf2232505f7990fca1828169903d44e2de Mon Sep 17 00:00:00 2001 From: Yoann Congal Date: Mon, 27 Feb 2023 08:12:56 +0100 Subject: [PATCH 1/4] libusb-compat: Revert "libusb-compat: move libraries to base_libdir" Revert commit ed937940f54d1a376b518fc276da78811c4ac50b from oe-core: libusb-compat: move libraries to base_libdir udev links to libusb-compat, and so this library needs to be in base_libdir (/lib) instead of libdir (/usr/lib). The libdir=base_libdir configuration was needed for udev but it's not the case anymore. Remove it to simplify the recipe. Signed-off-by: Yoann Congal Reviewed-by: Ever ATILANO --- meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb b/meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb index 869e98fe517..70befa62456 100644 --- a/meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb +++ b/meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb @@ -31,11 +31,3 @@ BINCONFIG = "${bindir}/libusb-config" inherit autotools pkgconfig binconfig-disabled lib_package -EXTRA_OECONF = "--libdir=${base_libdir}" - -do_install:append() { - install -d ${D}${libdir} - if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then - mv ${D}${base_libdir}/pkgconfig ${D}${libdir} - fi -} From d83be077bb1a8e1d8168899f9a74c0edee77b1bd Mon Sep 17 00:00:00 2001 From: Yoann Congal Date: Mon, 27 Feb 2023 08:13:28 +0100 Subject: [PATCH 2/4] libusb-compat: upgrade sources to fix -native build Fixes [YOCTO #15032] by upgrading the source to a commit including the fix : change SONAME detection source from ldd to objdump ldd detects used libraries by partially running the target binary. This is a problem for when the target binary is not runnable (e.g. cross-compilation). Switch to objdump which only reads info from the ELF file without running anything from it. Signed-off-by: Yoann Congal Reviewed-by: Ever ATILANO --- meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb b/meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb index 70befa62456..884b1bbb248 100644 --- a/meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb +++ b/meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb @@ -22,7 +22,7 @@ SRC_URI = " \ git://github.com/libusb/libusb-compat-0.1.git;protocol=https;branch=master \ file://0001-usb.h-Include-sys-types.h.patch \ " -SRCREV = "88740f0fe497b473c8ef40093ab7daeebfb40eb6" +SRCREV = "c497eff1ae8c4cfd4fdff370f04c78fa0584f4f3" S = "${WORKDIR}/git" UPSTREAM_CHECK_URI = "https://github.com/libusb/libusb-compat-0.1/releases" From e7f6bed47c25d6abd9ced88f05d47a91e51a9bbc Mon Sep 17 00:00:00 2001 From: Yoann Congal Date: Mon, 27 Feb 2023 08:13:31 +0100 Subject: [PATCH 3/4] libusb-compat: add simple ptest (example programs) Build and run example programs as test. This will only catch major errors (.so lib won't load etc.) because no output check is done, only return status is checked. Signed-off-by: Yoann Congal Reviewed-by: Ever ATILANO --- ...ke-make-example-programs-installable.patch | 24 +++++++++++++++++++ .../libusb/libusb-compat/run-ptest | 14 +++++++++++ .../libusb/libusb-compat_0.1.8.bb | 13 +++++++++- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-support/libusb/libusb-compat/0002-automake-make-example-programs-installable.patch create mode 100644 meta-oe/recipes-support/libusb/libusb-compat/run-ptest diff --git a/meta-oe/recipes-support/libusb/libusb-compat/0002-automake-make-example-programs-installable.patch b/meta-oe/recipes-support/libusb/libusb-compat/0002-automake-make-example-programs-installable.patch new file mode 100644 index 00000000000..faf532cad23 --- /dev/null +++ b/meta-oe/recipes-support/libusb/libusb-compat/0002-automake-make-example-programs-installable.patch @@ -0,0 +1,24 @@ +From 9dcdfa716e3c3831d9b70472b39dab2fd370f503 Mon Sep 17 00:00:00 2001 +From: Yoann Congal +Date: Sun, 26 Feb 2023 16:04:35 +0100 +Subject: [PATCH] automake: make example programs installable + +The example programs are used as tests for ptest, so we need a way to +install them on the rootfs. + +Upstream-Status: Inappropriate [oe-core specific] +--- + examples/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/examples/Makefile.am b/examples/Makefile.am +index 9bd3efc..f4324c2 100644 +--- a/examples/Makefile.am ++++ b/examples/Makefile.am +@@ -1,5 +1,5 @@ + AM_CPPFLAGS = -I$(top_srcdir)/libusb +-noinst_PROGRAMS = lsusb testlibusb ++bin_PROGRAMS = lsusb testlibusb + + lsusb_SOURCES = lsusb.c + lsusb_LDADD = ../libusb/libusb.la diff --git a/meta-oe/recipes-support/libusb/libusb-compat/run-ptest b/meta-oe/recipes-support/libusb/libusb-compat/run-ptest new file mode 100644 index 00000000000..901662d6967 --- /dev/null +++ b/meta-oe/recipes-support/libusb/libusb-compat/run-ptest @@ -0,0 +1,14 @@ +#!/bin/sh + +rc=0 +for TEST in lsusb testlibusb; do + if ! ./$TEST ; then + echo "FAIL: $TEST" + rc=$((rc + 1)) + else + echo "PASS: $TEST" + fi +done + +# return number of failed tests +exit $rc diff --git a/meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb b/meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb index 884b1bbb248..bfafdae7a41 100644 --- a/meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb +++ b/meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb @@ -21,6 +21,8 @@ PE = "1" SRC_URI = " \ git://github.com/libusb/libusb-compat-0.1.git;protocol=https;branch=master \ file://0001-usb.h-Include-sys-types.h.patch \ + file://0002-automake-make-example-programs-installable.patch \ + file://run-ptest \ " SRCREV = "c497eff1ae8c4cfd4fdff370f04c78fa0584f4f3" S = "${WORKDIR}/git" @@ -29,5 +31,14 @@ UPSTREAM_CHECK_URI = "https://github.com/libusb/libusb-compat-0.1/releases" BINCONFIG = "${bindir}/libusb-config" -inherit autotools pkgconfig binconfig-disabled lib_package +inherit autotools pkgconfig binconfig-disabled lib_package ptest +# examples are used as ptest so enable them at configuration if needed +EXTRA_OECONF += "${@bb.utils.contains('PTEST_ENABLED', '1', '--enable-examples-build', '', d)}" + +# Move test binaries out of bindir to avoid clashing with a "real" lsusb. +do_install_ptest() { + for bin in lsusb testlibusb; do + mv ${D}${bindir}/$bin ${D}${PTEST_PATH} + done +} From 0ac065ecc5407a0baa733114bb2223dbc200a96f Mon Sep 17 00:00:00 2001 From: Yoann Congal Date: Mon, 27 Feb 2023 08:13:32 +0100 Subject: [PATCH 4/4] libusb-compat: RDEPENDS on libusb1 libusb-compat dlopen() libusb1 so we need to explicitly RDEPENDS on it. Signed-off-by: Yoann Congal Reviewed-by: Ever ATILANO --- meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb b/meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb index bfafdae7a41..57f1f543870 100644 --- a/meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb +++ b/meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb @@ -9,6 +9,9 @@ LICENSE = "LGPL-2.1-or-later" LIC_FILES_CHKSUM = "file://LICENSE;md5=f2ac5f3ac4835e8f91324a26a590a423" DEPENDS = "libusb1" +# libusb-compat dlopen() libusb1 so we need to explicitly RDEPENDS on it +RDEPENDS:${PN} += "libusb1" + # Few packages are known not to work with libusb-compat (e.g. libmtp-1.0.0), # so here libusb-0.1 is removed completely instead of adding virtual/libusb0. # Besides, libusb-0.1 uses a per 1ms polling that hurts a lot to power