Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From 9dcdfa716e3c3831d9b70472b39dab2fd370f503 Mon Sep 17 00:00:00 2001
From: Yoann Congal <[email protected]>
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
14 changes: 14 additions & 0 deletions meta-oe/recipes-support/libusb/libusb-compat/run-ptest
Original file line number Diff line number Diff line change
@@ -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
22 changes: 14 additions & 8 deletions meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -21,21 +24,24 @@ 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 = "88740f0fe497b473c8ef40093ab7daeebfb40eb6"
SRCREV = "c497eff1ae8c4cfd4fdff370f04c78fa0584f4f3"
S = "${WORKDIR}/git"

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

EXTRA_OECONF = "--libdir=${base_libdir}"
# examples are used as ptest so enable them at configuration if needed
EXTRA_OECONF += "${@bb.utils.contains('PTEST_ENABLED', '1', '--enable-examples-build', '', d)}"

do_install:append() {
install -d ${D}${libdir}
if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then
mv ${D}${base_libdir}/pkgconfig ${D}${libdir}
fi
# 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
}