Signed-off-by: Remy Bohmer <li...@bohme
---
 rules/libusb.in   |   38 ++++++++++++++++++++++++++++++++++++++
 rules/libusb.make |   20 ++++++++++++++++++--
 2 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/rules/libusb.in b/rules/libusb.in
index 0156af1..32329b1 100644
--- a/rules/libusb.in
+++ b/rules/libusb.in
@@ -8,6 +8,42 @@ menuconfig LIBUSB
 
 if LIBUSB
 
+config LIBUSB_COMPAT_LAYER
+       bool
+       prompt "libusb-0.x compatibility layer"
+       select LIBUSB1
+       help
+         Activate to build the libusb-compat instead of libusb.
+         libusb-compat-0.1 is a replacement for libusb-0.1.
+         However, instead of being an actual implementation, libusb-0.1 is
+         more of a compatibility layer (or wrapper) which just converts
+         libusb-0.1 calls into their libusb-1.0 equivalents.
+         It aims to look, feel and behave exactly like libusb-0.1. As the
+         compatibility layer implements the exact same ABI and API, no
+         modifications to existing libusb-0.1-based applications are needed.
+         You do not even have to recompile them. This compatibility layer is
+         a drop-in replacement.
+
+if LIBUSB_COMPAT_LAYER
+
+config LIBUSB_VERSION_COMPAT
+       string
+       prompt "Version number of libusb-compat"
+       default "0.1.0"
+       help
+         Version number of the libusb compatibility layer
+         First version released is 0.1.0
+
+endif
+if !LIBUSB_COMPAT_LAYER
+
+config LIBUSB_VERSION
+       string
+       prompt "Version number of libusb"
+       default "0.1.12"
+       help
+         libusb 0.1.12 is the latest of the 0.1 releases
+
 config LIBUSB_DOCS
        bool
        prompt "Documentation"
@@ -15,3 +51,5 @@ config LIBUSB_DOCS
          Activate to build the libusb-documentation
 
 endif
+
+endif
diff --git a/rules/libusb.make b/rules/libusb.make
index 0da1086..ede9bcc 100644
--- a/rules/libusb.make
+++ b/rules/libusb.make
@@ -3,6 +3,8 @@
 #
 # Copyright (C) 2007 by Sascha Hauer
 #
+# Added support for libusb-compat by Remy Bohmer
+#
 # See CREDITS for details about who has contributed to this project.
 #
 # For further information about the PTXdist project and license conditions
@@ -17,9 +19,17 @@ PACKAGES-$(PTXCONF_LIBUSB) += libusb
 #
 # Paths and names
 #
-LIBUSB_VERSION := 0.1.12
+ifdef PTXCONF_LIBUSB_COMPAT_LAYER
+LIBUSB_VERSION := $(call remove_quotes,$(PTXCONF_LIBUSB_VERSION_COMPAT))
+LIBUSB         := libusb-compat-$(LIBUSB_VERSION)
+LIBUSB_SUFFIX  := tar.bz2
+LIBUSB_RESULTS  := $(BUILDDIR)/$(LIBUSB)/libusb
+else
+LIBUSB_VERSION := $(call remove_quotes,$(PTXCONF_LIBUSB_VERSION))
 LIBUSB         := libusb-$(LIBUSB_VERSION)
 LIBUSB_SUFFIX  := tar.gz
+LIBUSB_RESULTS  := $(BUILDDIR)/$(LIBUSB)
+endif
 LIBUSB_URL     := $(PTXCONF_SETUP_SFMIRROR)/libusb/$(LIBUSB).$(LIBUSB_SUFFIX)
 LIBUSB_SOURCE  := $(SRCDIR)/$(LIBUSB).$(LIBUSB_SUFFIX)
 LIBUSB_DIR     := $(BUILDDIR)/$(LIBUSB)
@@ -44,11 +54,17 @@ LIBUSB_ENV  := $(CROSS_ENV)
 #
 LIBUSB_AUTOCONF := $(CROSS_AUTOCONF_USR)
 
+ifdef !PTXCONF_LIBUSB_COMPAT_LAYER
 ifdef PTXCONF_LIBUSB_DOCS
 LIBUSB_AUTOCONF += --enable-build-docs
 else
 LIBUSB_AUTOCONF += --disable-build-docs
 endif
+endif
+
+ifdef PTXCONF_LIBUSB_COMPAT_LAYER
+$(STATEDIR)/libusb.prepare: $(STATEDIR)/libusb1.install
+endif
 
 # ----------------------------------------------------------------------------
 # Target-Install
@@ -66,7 +82,7 @@ $(STATEDIR)/libusb.targetinstall:
        @$(call install_fixup, libusb,DEPENDS,)
        @$(call install_fixup, libusb,DESCRIPTION,missing)
 
-       @$(call install_copy, libusb, 0, 0, 0644, 
$(LIBUSB_DIR)/.libs/libusb-0.1.so.4.4.4, /usr/lib/libusb-0.1.so.4.4.4 )
+       @$(call install_copy, libusb, 0, 0, 0644, 
$(LIBUSB_RESULTS)/.libs/libusb-0.1.so.4.4.4, /usr/lib/libusb-0.1.so.4.4.4 )
        @$(call install_link, libusb, libusb-0.1.so.4.4.4, 
/usr/lib/libusb-0.1.so.4)
        @$(call install_link, libusb, libusb-0.1.so.4.4.4, /usr/lib/libusb.so)
 
-- 
1.5.6.3


--
ptxdist mailing list
ptxdist@pengutronix.de

Reply via email to