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