diff mbox

gutenprint: fix host build when libusb found

Message ID 20160402184733.GA8155@waldemar-brodkorb.de
State Superseded
Headers show

Commit Message

Waldemar Brodkorb April 2, 2016, 6:47 p.m. UTC
Allow to disable USB support, otherwise host build breaks when
libusb is found as installation tries to install to /usr.
Fixes following autobuild error:
http://autobuild.buildroot.net/results/081b3be918ac1eaa8cfbc5919e00bc1ea267c1df/

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
 .../0004-build-usb-backends-conditional.patch      | 23 ++++++++++++++++++++++
 package/gutenprint/gutenprint.mk                   |  1 +
 2 files changed, 24 insertions(+)
 create mode 100644 package/gutenprint/0004-build-usb-backends-conditional.patch

Comments

Baruch Siach April 15, 2016, 4:49 a.m. UTC | #1
Hi Waldemar,

On Sat, Apr 02, 2016 at 08:47:33PM +0200, Waldemar Brodkorb wrote:
> Allow to disable USB support, otherwise host build breaks when
> libusb is found as installation tries to install to /usr.
> Fixes following autobuild error:
> http://autobuild.buildroot.net/results/081b3be918ac1eaa8cfbc5919e00bc1ea267c1df/
> 
> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>

Tested-by: Baruch Siach <baruch@tkos.co.il>

> ---
>  .../0004-build-usb-backends-conditional.patch      | 23 ++++++++++++++++++++++
>  package/gutenprint/gutenprint.mk                   |  1 +
>  2 files changed, 24 insertions(+)
>  create mode 100644 package/gutenprint/0004-build-usb-backends-conditional.patch
> 
> diff --git a/package/gutenprint/0004-build-usb-backends-conditional.patch b/package/gutenprint/0004-build-usb-backends-conditional.patch
> new file mode 100644
> index 0000000..db44a12
> --- /dev/null
> +++ b/package/gutenprint/0004-build-usb-backends-conditional.patch
> @@ -0,0 +1,23 @@
> +Allow to disable USB backend
> +
> +Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>

Have you tried to upstream this patch?

Since we would now be patching also configure.ac, please updated the 
AUTORECONF comment in gutenprint.mk.

baruch
Peter Korsgaard April 15, 2016, 9:31 a.m. UTC | #2
>>>>> "Waldemar" == Waldemar Brodkorb <wbx@openadk.org> writes:

 > Allow to disable USB support, otherwise host build breaks when
 > libusb is found as installation tries to install to /usr.
 > Fixes following autobuild error:
 > http://autobuild.buildroot.net/results/081b3be918ac1eaa8cfbc5919e00bc1ea267c1df/

Hmm, but why does that end up with /usr and not $(HOST_DIR)/usr? Is it
picking up a libusb.pc from your host or is our host-libusb .pc file
wrong?
Waldemar Brodkorb April 15, 2016, 5:50 p.m. UTC | #3
Hi Peter,
Peter Korsgaard wrote,

> >>>>> "Waldemar" == Waldemar Brodkorb <wbx@openadk.org> writes:
> 
>  > Allow to disable USB support, otherwise host build breaks when
>  > libusb is found as installation tries to install to /usr.
>  > Fixes following autobuild error:
>  > http://autobuild.buildroot.net/results/081b3be918ac1eaa8cfbc5919e00bc1ea267c1df/
> 
> Hmm, but why does that end up with /usr and not $(HOST_DIR)/usr? Is it
> picking up a libusb.pc from your host or is our host-libusb .pc file
> wrong?

It is picking up libusb.pc from the host and I don't think
gutenprint-print will build host libusb at all. As cups support
is disabled anyway for the host, I don't think installing any USB
backends for the hosttools is strictly necessary and might be better
avoided.

best regards
 Waldemar
Peter Korsgaard April 15, 2016, 10:07 p.m. UTC | #4
>>>>> "Waldemar" == Waldemar Brodkorb <wbx@openadk.org> writes:

 > Hi Peter,
 > Peter Korsgaard wrote,

 >> >>>>> "Waldemar" == Waldemar Brodkorb <wbx@openadk.org> writes:
 >> 
 >> > Allow to disable USB support, otherwise host build breaks when
 >> > libusb is found as installation tries to install to /usr.
 >> > Fixes following autobuild error:
 >> > http://autobuild.buildroot.net/results/081b3be918ac1eaa8cfbc5919e00bc1ea267c1df/
 >> 
 >> Hmm, but why does that end up with /usr and not $(HOST_DIR)/usr? Is it
 >> picking up a libusb.pc from your host or is our host-libusb .pc file
 >> wrong?

 > It is picking up libusb.pc from the host and I don't think
 > gutenprint-print will build host libusb at all. As cups support
 > is disabled anyway for the host, I don't think installing any USB
 > backends for the hosttools is strictly necessary and might be better
 > avoided.

I had a closer look, and it actually isn't libusb.pc from the build host
(or directly anything to do with libusb).

The problem is really that the --without-cups option doesn't really
work. We already have a related workaround for this where we
ac_cv_path_CUPS_CONFIG='', but more is needed. When we pass
--without-cups the configure script hardcodes cups_prefix to "/usr".

host-gutenprint itself doesn't depend on host-libusb, but other packages
do so it might be built before host-gutenprint. If the configure script
detects libusb support (using pkg-config), then it will build a cups
backend using libusb (even though cups support is disabled) and intall
it into $cups_prefix/share/cups/usb, breaking the build :/

So either we fix the configure script to really disable the cups support
when configured with --without-cups, we add your patch as a workaround
or we simply add PKG_CONFIG=false to HOST_GUTENPRINT_CONF_ENV to make
sure the configure script doesn't find libusb. We can do that as
pkg-config is only used to check for libusb and gtk2, neither of which
we need for host-gutenprint.
diff mbox

Patch

diff --git a/package/gutenprint/0004-build-usb-backends-conditional.patch b/package/gutenprint/0004-build-usb-backends-conditional.patch
new file mode 100644
index 0000000..db44a12
--- /dev/null
+++ b/package/gutenprint/0004-build-usb-backends-conditional.patch
@@ -0,0 +1,23 @@ 
+Allow to disable USB backend
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur gutenprint-5.2.11.orig/configure.ac gutenprint-5.2.11/configure.ac
+--- gutenprint-5.2.11.orig/configure.ac	2016-01-14 04:02:49.000000000 +0100
++++ gutenprint-5.2.11/configure.ac	2016-04-02 20:07:54.649589473 +0200
+@@ -442,12 +442,15 @@
+ dnl   [EXTRA_LIBREADLINE_DEPS]=""
+ dnl fi
+ 
++AC_ARG_WITH([libusb], AS_HELP_STRING([--with-libusb], [Build with USB backend support]))
+ # libusb-1.0 (For CUPS backends)
++AS_IF([test "x$with_libusb" = "xyes"], [
+ PKG_CHECK_MODULES([LIBUSB], [libusb-1.0],
+                   [HAVE_LIBUSB=yes
+                    BUILD_LIBUSB_BACKENDS=yes],
+                   [HAVE_LIBUSB=no
+ 	           BUILD_LIBUSB_BACKENDS=no])
++])
+ 
+ AC_PATH_PROGS([GIMPTOOL2_CHECK], [gimptool-2.0 gimptool])
+ if test -z "${GIMPTOOL2_CHECK}" ; then
diff --git a/package/gutenprint/gutenprint.mk b/package/gutenprint/gutenprint.mk
index 7e3024d..2a5fc95 100644
--- a/package/gutenprint/gutenprint.mk
+++ b/package/gutenprint/gutenprint.mk
@@ -67,6 +67,7 @@  HOST_GUTENPRINT_CONF_OPTS = \
 	--disable-escputil \
 	--disable-test \
 	--disable-testpattern \
+	--without-libusb \
 	--without-cups
 
 # Needed by autoreconf