From 7396b459ad58cd62405b0b2e114e203c86e4c58b Mon Sep 17 00:00:00 2001 From: Zoltan Gyarmati Date: Fri, 9 Oct 2026 09:49:36 +0200 Subject: [PATCH] package/libusb-compat: add option to build/install examples The examples are not installed by upstream, and their names conflict with other packages (lsusb from busybox/usbutils, testlibusb from the libusb examples), so install them in /usr/libexec/libusb-compat/examples. Signed-off-by: Zoltan Gyarmati Signed-off-by: Thomas Petazzoni --- package/libusb-compat/Config.in | 11 +++++++++++ package/libusb-compat/libusb-compat.mk | 14 ++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/package/libusb-compat/Config.in b/package/libusb-compat/Config.in index 076d7b8d77..5efa9bbe3d 100644 --- a/package/libusb-compat/Config.in +++ b/package/libusb-compat/Config.in @@ -5,3 +5,14 @@ config BR2_PACKAGE_LIBUSB_COMPAT libusb-0.1 compatibility layer for libusb-1.0. http://libusb.info/ + +if BR2_PACKAGE_LIBUSB_COMPAT + +config BR2_PACKAGE_LIBUSB_COMPAT_EXAMPLES + bool "build libusb-compat examples" + help + Build and install the libusb-compat example programs (lsusb, + testlibusb and hotplug_monitor) in + /usr/libexec/libusb-compat/examples. + +endif diff --git a/package/libusb-compat/libusb-compat.mk b/package/libusb-compat/libusb-compat.mk index 4e78a213b7..c8dabe2068 100644 --- a/package/libusb-compat/libusb-compat.mk +++ b/package/libusb-compat/libusb-compat.mk @@ -20,5 +20,19 @@ LIBUSB_COMPAT_CONF_ENV += \ |sed -r -e '/\(SONAME\)/!d; s/.*\[(.+)\]$$/\1/'` endif +ifeq ($(BR2_PACKAGE_LIBUSB_COMPAT_EXAMPLES),y) +LIBUSB_COMPAT_CONF_OPTS += --enable-examples-build +# Examples are not installed by upstream, and their names conflict +# with other packages (e.g. lsusb, testlibusb), so install them in a +# package-specific directory. +define LIBUSB_COMPAT_INSTALL_TARGET_EXAMPLES + $(foreach example,lsusb testlibusb hotplug_monitor, + $(INSTALL) -D -m0755 $(@D)/examples/$(example) \ + $(TARGET_DIR)/usr/libexec/libusb-compat/examples/$(example) + ) +endef +LIBUSB_COMPAT_POST_INSTALL_TARGET_HOOKS += LIBUSB_COMPAT_INSTALL_TARGET_EXAMPLES +endif + $(eval $(autotools-package)) $(eval $(host-autotools-package))