From b218acac6257da8c393bf2ea35de38ce791a9497 Mon Sep 17 00:00:00 2001 From: Luiz Angelo Daros de Luca Date: Wed, 31 May 2017 02:13:40 -0300 Subject: [PATCH 1/2] libcups: import cups from old-packages (for hplip) This package is needed only to provide libcups.so and libcups-image.so for hplip. No ipk is generated as hplip-cups is currently disabled until full cups is provided. cups was bumped to version 2.2.8 Signed-off-by: Luiz Angelo Daros de Luca --- libs/libcups/Makefile | 93 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 libs/libcups/Makefile diff --git a/libs/libcups/Makefile b/libs/libcups/Makefile new file mode 100644 index 000000000..892182f50 --- /dev/null +++ b/libs/libcups/Makefile @@ -0,0 +1,93 @@ +# +# Copyright (C) 2006-2012 OpenWrt.org +# Copyright (C) 2017-2018 Luiz Angelo Daros de Luca +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=cups +PKG_VERSION:=2.2.8 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-source.tar.gz +PKG_SOURCE_URL:=https://github.com/apple/cups/releases/download/v$(PKG_VERSION)/ +PKG_HASH:=3968fc1d26fc48727508db1c1380e36c6694ab90177fd6920aec5f6cc73af9e4 +PKG_MAINTAINER:=Luiz Angelo Daros de Luca +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=LICENSE.txt + +include $(INCLUDE_DIR)/package.mk + +define Package/libcups/Default + URL:=http://www.cups.org/ + SUBMENU:=Printing +endef + +define Package/libcups +$(call Package/cups/Default) + SECTION:=libs + CATEGORY:=Libraries + DEPENDS:=+zlib +libpthread +libpng +libjpeg +libusb-1.0 + TITLE:=Common UNIX Printing System - Core library +endef + +define Package/libcups/description + Common UNIX Printing System - Core library +endef + +TARGET_LDFLAGS+=-Wl,-rpath-link=$(STAGING_DIR)/usr/lib + +CONFIGURE_ARGS+=--with-cups-user="nobody" \ + --with-cups-group="nogroup" \ + --with-components="core" \ + --with-pdftops="none" \ + --without-perl \ + --without-python \ + --without-php \ + --enable-shared \ + --enable-image \ + --enable-libusb \ + --disable-acl \ + --disable-dbus \ + --disable-dnssd \ + --disable-launchd \ + --disable-ldap \ + --disable-pam \ + --disable-slp \ + --disable-gnutls \ + --disable-openssl \ + --disable-cdsassl \ + --disable-ssl \ + --disable-gssapi \ + --disable-tiff \ + UNAME="Linux" \ + LIBS="$(TARGET_LDFLAGS) -lz -lpng -ljpeg" + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR)/cups \ + $(TARGET_CONFIGURE_OPTS) \ + DSTROOT="$(PKG_INSTALL_DIR)" \ + STRIP="/bin/true" \ + libcups.so.2 install-libs install-headers + $(MAKE) -C $(PKG_BUILD_DIR)/filter \ + $(TARGET_CONFIGURE_OPTS) \ + DSTROOT="$(PKG_INSTALL_DIR)" \ + STRIP="/bin/true" \ + libcupsimage.so.2 install-libs install-headers + $(INSTALL_DIR) $(PKG_INSTALL_DIR)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/cups-config $(PKG_INSTALL_DIR)/usr/bin +endef + +define Build/InstallDev + $(INSTALL_DIR) $(2)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cups-config $(2)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/cups $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcups*.so* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,libcups)) From e5d3422df7e0058dfc26695ba7b1e02a6ea2b84a Mon Sep 17 00:00:00 2001 From: Luiz Angelo Daros de Luca Date: Fri, 21 Aug 2015 15:59:21 -0300 Subject: [PATCH 2/2] hplip: import from oldpackage and update to 3.18.6 hplip was split into subpackages: * hplip-common: generic files * hplip-sane: sane backend - patched to remove cups deps used only for network scanners * hplip-cups: cups driver (currently disabled) Signed-off-by: Luiz Angelo Daros de Luca --- utils/hplip/Makefile | 103 +++++++++++ utils/hplip/files/20-hplip | 20 +++ utils/hplip/files/hplib.conf | 2 + utils/hplip/patches/010-libusb_fix.patch | 13 ++ .../patches/020-remove_cups_dep_on_scan.patch | 163 ++++++++++++++++++ ...0-replace_unsafe_memcpy_with_memmove.patch | 15 ++ utils/hplip/patches/040-fix_bool.patch | 31 ++++ 7 files changed, 347 insertions(+) create mode 100644 utils/hplip/Makefile create mode 100644 utils/hplip/files/20-hplip create mode 100644 utils/hplip/files/hplib.conf create mode 100644 utils/hplip/patches/010-libusb_fix.patch create mode 100644 utils/hplip/patches/020-remove_cups_dep_on_scan.patch create mode 100644 utils/hplip/patches/030-replace_unsafe_memcpy_with_memmove.patch create mode 100644 utils/hplip/patches/040-fix_bool.patch diff --git a/utils/hplip/Makefile b/utils/hplip/Makefile new file mode 100644 index 000000000..6c1c85311 --- /dev/null +++ b/utils/hplip/Makefile @@ -0,0 +1,103 @@ +# +# Copyright (C) 2006-2011 OpenWrt.org +# Copyright (C) 2017-2018 Luiz Angelo Daros de Luca +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=hplip +PKG_VERSION:=3.18.6 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/hplip +PKG_HASH:=0ecf3e68b09480f602de81798ac00774cf8ffe754692e784bbbe0f9b2e337b7d +PKG_MAINTAINER:=Luiz Angelo Daros de Luca +PKG_LICENSE:=GPL-2.0 GPL-2.0+ +PKG_LICENSE_FILES:=COPYING LICENSE + +PKG_BUILD_DEPENDS := python libcups +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/hplip/Default + SECTION:=utils + CATEGORY:=Utilities + TITLE:=HP Linux Imaging and Printing + URL:=http://sourceforge.net/projects/hplip/ +endef + +define Package/hplip/Default/description + HPLIP is an HP developed solution for printing, scanning, and faxing with HP inkjet and laser based printers in Linux. +endef + +define Package/hplip-common +$(call Package/hplip/Default) + TITLE+= (common files) + DEPENDS+=+libusb-1.0 +endef + +define Package/hplip-common/description +$(call Package/hplip/Default/description) + +These are common files shared between subpackages +endef + +define Package/hplip-sane +$(call Package/hplip/Default) + TITLE+= (scanner drivers) + DEPENDS+=+libsane +hplip-common +endef + +define Package/hplip-sane/description +$(call Package/hplip/Default/description) + +S.A.N.E backend for HP Scanners +endef + +CONFIGURE_ARGS += \ + --disable-gui-build \ + --disable-network-build \ + --disable-fax-build \ + --disable-pp-build \ + --disable-doc-build \ + --disable-dbus-build \ + --enable-lite-build + +define Package/hplip-common/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/.libs/libhpip.so* $(1)/usr/lib/ + $(CP) $(PKG_BUILD_DIR)/.libs/libhpmud.so* $(1)/usr/lib/ + + $(INSTALL_DIR) $(1)/etc/hp + $(CP) $(PKG_BUILD_DIR)/hplip.conf $(1)/etc/hp/hplip.conf + + $(INSTALL_DIR) $(1)/usr/share/hplip/data/models/ + $(CP) $(PKG_BUILD_DIR)/data/models/models.dat $(1)/usr/share/hplip/data/models/ + + $(INSTALL_DIR) $(1)/etc/hotplug.d/usb/ + $(INSTALL_BIN) ./files/20-hplip $(1)/etc/hotplug.d/usb/ +endef + +define Package/hplip-sane/install + $(INSTALL_DIR) $(1)/usr/lib/sane + $(CP) $(PKG_BUILD_DIR)/.libs/libsane-hpaio.so* $(1)/usr/lib/sane + + $(INSTALL_DIR) $(1)/etc/sane.d/dll.d/ + $(INSTALL_DATA) ./files/hplib.conf $(1)/etc/sane.d/dll.d/hplib +endef + +define Package/hplip-common/conffiles +/etc/hp/hplip.conf +endef + +define Package/hplip-sane/conffiles +/etc/sane.d/dll.d/hplib +endef + +$(eval $(call BuildPackage,hplip-common)) +$(eval $(call BuildPackage,hplip-sane)) diff --git a/utils/hplip/files/20-hplip b/utils/hplip/files/20-hplip new file mode 100644 index 000000000..6066cc540 --- /dev/null +++ b/utils/hplip/files/20-hplip @@ -0,0 +1,20 @@ +#!/bin/sh + +# Copyright (C) 2009 OpenWrt.org + + +case "$ACTION" in + add) + # You have to figure out your PRODUCT id. Uncomment the line below, + # attach and detach your HP USB printer to find your id in /tmp/hplip.test. + # It will look like "Found 3f0/1717/100 on /proc/bus/usb/002/009" + # Replace 3f0/1717/100 below with your id. + # + # echo "Found $PRODUCT on $DEVICE" > /tmp/hplip.test + + [ "$PRODUCT" = "3f0/1717/100" ] && chown nobody $DEVICE && chmod 666 $DEVICE + ;; + remove) + # device is gone + ;; +esac diff --git a/utils/hplip/files/hplib.conf b/utils/hplip/files/hplib.conf new file mode 100644 index 000000000..d67d37053 --- /dev/null +++ b/utils/hplip/files/hplib.conf @@ -0,0 +1,2 @@ +# Load the hplib driver +hpaio diff --git a/utils/hplip/patches/010-libusb_fix.patch b/utils/hplip/patches/010-libusb_fix.patch new file mode 100644 index 000000000..004513935 --- /dev/null +++ b/utils/hplip/patches/010-libusb_fix.patch @@ -0,0 +1,13 @@ +--- a/configure.in ++++ b/configure.in +@@ -595,6 +595,10 @@ if test "$class_driver" = "no" && test " + 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_1_0, [ libusb-1.0 >= 1.0.0 ], have_libusb_1_0=yes, have_libusb_1_0=no) ++ if test "$have_libusb_1_0" = "yes"; then ++ CFLAGS="$CFLAGS $LIBUSB_1_0_CFLAGS" ++ fi + fi + fi + diff --git a/utils/hplip/patches/020-remove_cups_dep_on_scan.patch b/utils/hplip/patches/020-remove_cups_dep_on_scan.patch new file mode 100644 index 000000000..bbeb0dc63 --- /dev/null +++ b/utils/hplip/patches/020-remove_cups_dep_on_scan.patch @@ -0,0 +1,163 @@ +--- a/scan/sane/hpaio.c ++++ b/scan/sane/hpaio.c +@@ -34,7 +34,6 @@ + #include + #include + #include +-#include + #include "hpmud.h" + #include "hpip.h" + #include "hp_ipp.h" +@@ -144,98 +143,6 @@ static int GetUriLine(char *buf, char *u + return i; + } + +-static int AddCupsList(char *uri, char ***printer) +-{ +- int i, stat=1; +- +- /* Look for hp network URIs only. */ +- if (strncasecmp(uri, "hp:/net/", 8) !=0) +- goto bugout; +- +- if (*printer == NULL) +- { +- /* Allocate array of string pointers. */ +- *printer = malloc(sizeof(char *) * MAX_DEVICE); +- memset(*printer, 0, sizeof(char *) * MAX_DEVICE); +- } +- +- /* Ignor duplicates (ie: printer queues using the same device). */ +- for (i=0; (*printer)[i] != NULL && i 2) + len -= 2; +- memcpy(buffer, buffer+2, len); /* remove length */ ++ memmove(buffer, buffer+2, len); /* remove length */ + buffer[len]=0; + DBG("read actual device_id successfully fd=%d len=%d\n", fd, len); + diff --git a/utils/hplip/patches/040-fix_bool.patch b/utils/hplip/patches/040-fix_bool.patch new file mode 100644 index 000000000..2f43429f3 --- /dev/null +++ b/utils/hplip/patches/040-fix_bool.patch @@ -0,0 +1,31 @@ +https://bugs.launchpad.net/hplip/+bug/1778626 + +--- a/prnt/hpcups/genPCLm.cpp ++++ b/prnt/hpcups/genPCLm.cpp +@@ -171,7 +171,7 @@ Defines + #define rgb_2_gray(r,g,b) (ubyte)(0.299*(double)r+0.587*(double)g+0.114*(double)b) + + // Note: this is required for debugging +-boolean writeOutputFile(int numBytes, ubyte *ptr, char *user_name); ++bool writeOutputFile(int numBytes, ubyte *ptr, char *user_name); + + /* + ********************************************* Helper Routines ************************** +@@ -343,7 +343,7 @@ bool PCLmGenerator::addKids(sint32 kidOb + return(true); + } + +-boolean writeOutputFile(int numBytes, ubyte *ptr, char *user_name) ++bool writeOutputFile(int numBytes, ubyte *ptr, char *user_name) + { + FILE *outputFile; + char outFileName[MAX_FILE_PATH_LEN]; +@@ -1074,7 +1074,7 @@ void PCLmGenerator::writePDFGrammarPage( + * Limitations: + * - + *****************************************************************************************/ +-boolean prepImageForBacksideDuplex(ubyte *imagePtr, sint32 imageHeight, sint32 imageWidth, sint32 numComponents) ++bool prepImageForBacksideDuplex(ubyte *imagePtr, sint32 imageHeight, sint32 imageWidth, sint32 numComponents) + { + sint32 numBytes=imageHeight*imageWidth*numComponents; + ubyte *head, *tail, t0, t1, t2;