diff mbox series

[22/49,v2] package/dahdi-tools: add USB support

Message ID 4fc439b83d4974f15558cf6963b500862d0a85bc.1504993178.git.yann.morin.1998@free.fr
State Changes Requested
Headers show
Series [01/49,v2] package/asterisk: new package | expand

Commit Message

Yann E. MORIN Sept. 9, 2017, 9:39 p.m. UTC
dahdi-tools can use either libusb-1.0.x or libusb-0.1.x, and Buildroot
packages both, respectively as libusb and as libusb-compat.

However, the terminology used by dahdi-tools is a little bit confusing.
dahdi-tools references libusb-1.0.x as libusbx, while it knows
libusb-0.1.x as just plain libusb.

So, here's a samll summary table;

    Those tools   |       libusb version        |
    know it as... | 0.1.x         | 1.0.x       |
    --------------+---------------+-------------+
    Buildroot     | libusb-compat | libusb      |
    dahdi-tools   | libusb        | libusbx     |

However, in Buildroot, libusb-compat (0.1.x) depends on libusb (1.0.x).
So, whenever libusb-compat is enabled, we can be sure that libusb is
enabled too.

So, from the perspective of dahdi-tools, we need not care about libusb
(0.1.x) since we will always have libusbx (1.0.x).

Ergo, we only care about Buildroot libusb (1.0.x) to decide whether or
not to enable USB support in dahdi-tools with libusbx, while libusb is
always disabled.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 package/dahdi-tools/dahdi-tools.mk | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

Comments

Arnout Vandecappelle Sept. 23, 2017, 4:28 p.m. UTC | #1
Hi Yann,

 I'm in the process of applying this series. Small problem here.

On 09-09-17 23:39, Yann E. MORIN wrote:
> dahdi-tools can use either libusb-1.0.x or libusb-0.1.x, and Buildroot
> packages both, respectively as libusb and as libusb-compat.

[snip]
> +# Note: libsubx was a fork of libusb, which was merged back into
> +# libusb for the 1.0.18 release in early 2014, but it looks like
> +# dahdi-tools uses the libusbx vs. libusb to differentiate whether
> +# to use the 1.0.x vs. 0.9.x libusb. Since in Buildroot, libusb-compat
> +# anyway depends on libusb, presence of libusb-compat means that
> +# libusb is enabled, so we only support libusb for dahdi-tools.
> +#
> +# Yet, we must ensure build-ordering in case libusb-compat id enabled.

 That bit doesn't make sense to me. Since we always pass --without-libusb, why
would this be needed?

> +#
> +# Yes, this is very confusing.
> +#
> +ifeq ($(BR2_PACKAGE_LIBUSB),y)
> +DAHDI_TOOLS_DEPENDENCIES += libusb
> +DAHDI_TOOLS_CONF_OPTS += --with-usb --with-libusbx
> +ifeq ($(BR2_PACKAGE_LIBUSB_COMPAT),y)
> +DAHDI_TOOLS_DEPENDENCIES += libusb-comapt

 This will surely give a build error :-)

 Regards,
 Arnout

> +endif
> +else
> +DAHDI_TOOLS_CONF_OPTS += --without-usb --without-libusbx
> +endif
> +
>  $(eval $(autotools-package))
>
Yann E. MORIN Sept. 24, 2017, 2:57 p.m. UTC | #2
On 2017-09-23 18:28 +0200, Arnout Vandecappelle spake thusly:
>  Hi Yann,
> 
>  I'm in the process of applying this series. Small problem here.
> 
> On 09-09-17 23:39, Yann E. MORIN wrote:
> > dahdi-tools can use either libusb-1.0.x or libusb-0.1.x, and Buildroot
> > packages both, respectively as libusb and as libusb-compat.
> 
> [snip]
> > +# Note: libsubx was a fork of libusb, which was merged back into
> > +# libusb for the 1.0.18 release in early 2014, but it looks like
> > +# dahdi-tools uses the libusbx vs. libusb to differentiate whether
> > +# to use the 1.0.x vs. 0.9.x libusb. Since in Buildroot, libusb-compat
> > +# anyway depends on libusb, presence of libusb-compat means that
> > +# libusb is enabled, so we only support libusb for dahdi-tools.
> > +#
> > +# Yet, we must ensure build-ordering in case libusb-compat id enabled.
> 
>  That bit doesn't make sense to me. Since we always pass --without-libusb, why
> would this be needed?

Hmm.. Lemme get my mind back together...

Well, even since we do not enforce ordering at all in fact, this is
probasbly a leftover from a previous tentative...

> > +#
> > +# Yes, this is very confusing.
> > +#
> > +ifeq ($(BR2_PACKAGE_LIBUSB),y)
> > +DAHDI_TOOLS_DEPENDENCIES += libusb
> > +DAHDI_TOOLS_CONF_OPTS += --with-usb --with-libusbx
> > +ifeq ($(BR2_PACKAGE_LIBUSB_COMPAT),y)
> > +DAHDI_TOOLS_DEPENDENCIES += libusb-comapt
> 
>  This will surely give a build error :-)

Meh... It means I did not try-build with libusb enabled... :-/

Regards,
Yann E. MORIN.

>  Regards,
>  Arnout
> 
> > +endif
> > +else
> > +DAHDI_TOOLS_CONF_OPTS += --without-usb --without-libusbx
> > +endif
> > +
> >  $(eval $(autotools-package))
> > 
> 
> -- 
> Arnout Vandecappelle                          arnout at mind be
> Senior Embedded Software Architect            +32-16-286500
> Essensium/Mind                                http://www.mind.be
> G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
> LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
> GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
diff mbox series

Patch

diff --git a/package/dahdi-tools/dahdi-tools.mk b/package/dahdi-tools/dahdi-tools.mk
index e97d944c52..3930968042 100644
--- a/package/dahdi-tools/dahdi-tools.mk
+++ b/package/dahdi-tools/dahdi-tools.mk
@@ -21,12 +21,37 @@  DAHDI_TOOLS_CONF_ENV = PERL=/usr/bin/perl
 
 DAHDI_TOOLS_CONF_OPTS = \
 	--without-newt \
-	--without-usb \
 	--without-pcap \
-	--without-libusbx \
 	--without-libusb \
 	--without-selinux \
 	--without-ppp \
 	--with-perllib=/usr/lib/perl5/$(PERL_VERSION)
 
+# dahdi-tools can use either libusb-1.0.x (libusb in Buildroot)
+# or libusb-0.9.x (libusb-compat in Buildroot). The former is
+# enabled using --with-libusbx, while the latter is enabled using
+# --with-libusb. Both require --with-usb for USB support to be
+# effectively enabled.
+#
+# Note: libsubx was a fork of libusb, which was merged back into
+# libusb for the 1.0.18 release in early 2014, but it looks like
+# dahdi-tools uses the libusbx vs. libusb to differentiate whether
+# to use the 1.0.x vs. 0.9.x libusb. Since in Buildroot, libusb-compat
+# anyway depends on libusb, presence of libusb-compat means that
+# libusb is enabled, so we only support libusb for dahdi-tools.
+#
+# Yet, we must ensure build-ordering in case libusb-compat id enabled.
+#
+# Yes, this is very confusing.
+#
+ifeq ($(BR2_PACKAGE_LIBUSB),y)
+DAHDI_TOOLS_DEPENDENCIES += libusb
+DAHDI_TOOLS_CONF_OPTS += --with-usb --with-libusbx
+ifeq ($(BR2_PACKAGE_LIBUSB_COMPAT),y)
+DAHDI_TOOLS_DEPENDENCIES += libusb-comapt
+endif
+else
+DAHDI_TOOLS_CONF_OPTS += --without-usb --without-libusbx
+endif
+
 $(eval $(autotools-package))