package/hplip: remove includedir hack

The 0001-fix-make.patch which was added to the hplip package to remove
hardcoded paths to the libusb header introduced a solution that isn't
correct. When cross-compiling, $(includedir) is ${prefix}/include (i.e
/usr/include), so it is not the location where headers can be
found. Due to this, hplip.mk was overriding the includedir value with
--includedir which is not correct.

To replace this mechanism, this commit changes the patch to instead
use pkg-config (which is already used in other places in hplip
configure.in) to detect libusb. This way, we can get rid of the hack
and get a proper detection of libusb.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
Thomas Petazzoni 2016-01-22 00:02:32 +01:00
parent 8e11c38bce
commit ffca78cbcd
3 changed files with 47 additions and 39 deletions

View File

@ -0,0 +1,45 @@
From 1eed2b65eff4c66b80eab0ec46c6705de19bdb9d Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Thu, 21 Jan 2016 23:54:03 +0100
Subject: [PATCH] build: use pkg-config to discover libusb
This allows to remove hardcoded paths to libusb headers.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile.am | 4 ++--
configure.in | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 73fed2e..3a4e899 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -92,8 +92,8 @@ libhpmud_la_SOURCES += io/hpmud/musb_libusb01.c
libhpmud_la_LDFLAGS += -lusb
else
libhpmud_la_SOURCES += io/hpmud/musb.c
-libhpmud_la_CFLAGS += -I/usr/include/libusb-1.0
-libhpmud_la_LDFLAGS += -lusb-1.0
+libhpmud_la_CFLAGS += $(LIBUSB_CFLAGS)
+libhpmud_la_LDFLAGS += $(LIBUSB_LIBS)
endif
if NETWORK_BUILD
diff --git a/configure.in b/configure.in
index 3706645..8b06428 100755
--- a/configure.in
+++ b/configure.in
@@ -542,8 +542,7 @@ if test "$hpijs_only_build" = "no" && test "$hpcups_only_build" = "no"; then
AC_CHECK_LIB([usb], [usb_init], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find libusb support], 2)])
AC_CHECK_HEADERS(usb.h, ,[AC_MSG_ERROR([cannot find libusb-devel support], 11)])
else
- AC_CHECK_LIB([usb-1.0], [libusb_init], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find libusb 1.0 support], 2)])
- AC_CHECK_HEADERS(libusb-1.0/libusb.h, ,[AC_MSG_ERROR([cannot find libusb-1.0-devel support], 11)])
+ PKG_CHECK_MODULES([LIBUSB], [libusb-1.0])
fi
fi
--
2.6.4

View File

@ -1,35 +0,0 @@
From c1822a19e75bae8e044cd46a257a234cd9649896 Mon Sep 17 00:00:00 2001
From: Olivier Schonken <olivier.schonken@gmail.com>
Date: Wed, 20 Jan 2016 23:46:50 +0200
Subject: [PATCH] Changed Makefile.am to allow cross-compilation of HPLIP
Signed-off-by: Olivier Schonken <olivier.schonken@gmail.com>
---
Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 73fed2e..23aa0ec 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -92,7 +92,7 @@ libhpmud_la_SOURCES += io/hpmud/musb_libusb01.c
libhpmud_la_LDFLAGS += -lusb
else
libhpmud_la_SOURCES += io/hpmud/musb.c
-libhpmud_la_CFLAGS += -I/usr/include/libusb-1.0
+libhpmud_la_CFLAGS += -I$(includedir)/libusb-1.0
libhpmud_la_LDFLAGS += -lusb-1.0
endif
@@ -314,7 +314,7 @@ hpmudext_la_LIBADD = libhpmud.la libhpdiscovery.la
hpmudext_la_CFLAGS = -I$(PYTHONINCLUDEDIR) -Iprotocol/discovery
if !LIBUSB01_BUILD
-hpmudext_la_CFLAGS +=-I/usr/include/libusb-1.0
+hpmudext_la_CFLAGS +=-I$(includedir)/libusb-1.0
endif
# ui (qt3)
--
2.5.0

View File

@ -7,7 +7,7 @@
HPLIP_VERSION = 3.15.11
HPLIP_SITE = http://downloads.sourceforge.net/hplip/hplip
HPLIP_AUTORECONF = YES
HPLIP_DEPENDENCIES = cups libusb jpeg
HPLIP_DEPENDENCIES = cups libusb jpeg host-pkgconf
HPLIP_LICENSE = GPLv2 BSD-3c MIT
HPLIP_LICENSE_FILES = COPYING
@ -25,9 +25,7 @@ HPLIP_CONF_OPTS = \
--disable-foomatic-drv-install \
--disable-foomatic-rip-hplip-install \
--enable-new-hpcups \
--enable-lite-build \
--with-sysroot=$(STAGING_DIR) \
--includedir=$(STAGING_DIR)/usr/include
--enable-lite-build
ifeq ($(BR2_PACKAGE_DBUS),y)
HPLIP_CONF_OPTS += --enable-dbus-build