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 <mr.zoltan.gyarmati@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Zoltan Gyarmati
2026-10-09 09:49:36 +02:00
committed by Thomas Petazzoni
parent a19c9e6c44
commit 7396b459ad
2 changed files with 25 additions and 0 deletions

View File

@@ -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

View File

@@ -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))