diff options
Diffstat (limited to 'meta-oe/recipes-support/libusb')
4 files changed, 115 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/libusb/libusb-compat/0001-usb.h-Include-sys-types.h.patch b/meta-oe/recipes-support/libusb/libusb-compat/0001-usb.h-Include-sys-types.h.patch new file mode 100644 index 0000000000..7df44737ad --- /dev/null +++ b/meta-oe/recipes-support/libusb/libusb-compat/0001-usb.h-Include-sys-types.h.patch @@ -0,0 +1,30 @@ +From 840795dcb48214b74cfde75e7ce5e8a1a6c64a46 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Thu, 2 Apr 2015 19:18:45 -0700 +Subject: [PATCH] usb.h: Include sys/types.h + +We need the definitions for things like u_intX_t + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + libusb/usb.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libusb/usb.h b/libusb/usb.h +index ea62543..18b610a 100644 +--- a/libusb/usb.h ++++ b/libusb/usb.h +@@ -46,6 +46,8 @@ typedef unsigned __int32 uint32_t; + #include <stdint.h> + #endif + ++#include <sys/types.h> ++ + /* On linux PATH_MAX is defined in linux/limits.h. */ + #if defined(__linux__) + #include <linux/limits.h> +-- +2.34.1 + 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 0000000000..faf532cad2 --- /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 <yoann.congal@smile.fr> +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 0000000000..901662d696 --- /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 new file mode 100644 index 0000000000..57f1f54387 --- /dev/null +++ b/meta-oe/recipes-support/libusb/libusb-compat_0.1.8.bb @@ -0,0 +1,47 @@ +SUMMARY = "libusb-0.1 compatibility layer for libusb1" +DESCRIPTION = "libusb-0.1 compatible layer for libusb1, a drop-in replacement \ +that aims to look, feel and behave exactly like libusb-0.1" +HOMEPAGE = "http://www.libusb.org/" +BUGTRACKER = "http://www.libusb.org/report" +SECTION = "libs" + +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 +# consumption. +PROVIDES = "libusb virtual/libusb0" +BBCLASSEXTEND = "native nativesdk" + +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" + +UPSTREAM_CHECK_URI = "https://github.com/libusb/libusb-compat-0.1/releases" + +BINCONFIG = "${bindir}/libusb-config" + +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 +} |