From c25f2174707dd9a03940d16b63a64d92f9732b96 Mon Sep 17 00:00:00 2001 From: Max Rees Date: Tue, 22 Dec 2020 10:59:28 -0500 Subject: [PATCH] nonfree/hplip: bump to 3.20.11, adopt Debian patchset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since this adheres to DFSG and is present in their main/ repository we might be able to put this into Adélie, though it's quite an irritating thing to package. I adopted their patchset in order to fix the millions of things wrong that upstream seems unwilling to tend to. These patches will be especially useful in the future if we ever want to build the UI components. For now, they just fixup some of the PPD definitions amongst other things. --- nonfree/hplip/APKBUILD | 64 +++++++++++--- nonfree/hplip/createPPD.patch | 56 +++++++++++++ nonfree/hplip/fix-includes.patch | 35 -------- nonfree/hplip/hpps-shebang.patch | 8 ++ nonfree/hplip/remove-binary-blob.patch | 110 ------------------------- nonfree/hplip/sane-types.patch | 15 ++++ 6 files changed, 133 insertions(+), 155 deletions(-) create mode 100644 nonfree/hplip/createPPD.patch delete mode 100644 nonfree/hplip/fix-includes.patch create mode 100644 nonfree/hplip/hpps-shebang.patch delete mode 100644 nonfree/hplip/remove-binary-blob.patch create mode 100644 nonfree/hplip/sane-types.patch diff --git a/nonfree/hplip/APKBUILD b/nonfree/hplip/APKBUILD index 9e30190..d745f99 100644 --- a/nonfree/hplip/APKBUILD +++ b/nonfree/hplip/APKBUILD @@ -4,27 +4,66 @@ # Contributor: Leonardo Arena # Maintainer: Max Rees pkgname=hplip -pkgver=3.19.11 +pkgver=3.20.11 pkgrel=0 +_debver=dfsg0-1 +_debdate=20201204T160016Z pkgdesc="Drivers for HP printers and scanners" url="https://developers.hp.com/hp-linux-imaging-and-printing" arch="all" options="!check" # No test suite. license="GPL-2.0+ AND MIT AND BSD-3-Clause AND GPL-2.0+ WITH sane-exception AND Public-Domain AND GPL-2.0+ WITH HP-OpenSSL-exception AND Python-2.0 AND BSD-2-Clause AND ISC AND GPL-2.0-only AND Custom AND IJG" depends="" -makedepends="libjpeg-turbo-dev net-snmp-dev cups-dev libusb-dev sane-dev" +makedepends="autoconf automake avahi-dev cups-dev dbus-dev + libjpeg-turbo-dev libtool libusb-dev net-snmp-dev python3-dev + sane-dev + " subpackages="$pkgname-doc $pkgname-libs sane-backend-hpaio:sane" source="https://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz - fix-includes.patch - remove-binary-blob.patch" + https://snapshot.debian.org/archive/debian/$_debdate/pool/main/h/hplip/hplip_$pkgver+$_debver.debian.tar.xz + createPPD.patch + hpps-shebang.patch + sane-types.patch + " prepare() { - default_prepare + cd "$builddir" update_config_sub update_config_guess + + find \( \ + -name '*.ppd.gz' \ + -o -path './data/*.ldl.gz' \ + -o -path './data/*.pcl.gz' \ + -o -path './data/*.pdf.gz' \ + -o -path './data/*.ps.gz' \ + \) -exec gunzip -f '{}' + + + while read -r _i; do + msg "$_i" + patch -p1 -i ../debian/patches/"$_i" + done < ../debian/patches/series + + default_prepare + + touch AUTHORS ChangeLog NEWS README + autoreconf -vif + + find \( \ + -name '*.ppd' \ + -o -path './data/*.ldl' \ + -o -path './data/*.pcl' \ + -o -path './data/*.pdf' \ + -o -path './data/*.ps' \ + \) -exec gzip -fn '{}' + } build() { + _dbus_cflags="$(pkg-config --cflags-only-I dbus-1)" + export CFLAGS="$CFLAGS $_dbus_cflags" + + python3 ./dat2drv.py + ./configure \ --build=$CBUILD \ --host=$CHOST \ @@ -40,6 +79,7 @@ build() { --disable-dbus-build \ --enable-cups-drv-install \ --enable-cups-ppd-install + make } @@ -50,8 +90,10 @@ package() { "$pkgdir"/etc/sane.d \ "$pkgdir"/usr/share/hal \ "$pkgdir"/usr/lib/systemd \ - "$pkgdir"/usr/lib/cups/filter/pstotiff - install -Dm755 prnt/filters/hpps "$pkgdir"/usr/lib/cups/filter/hpps + "$pkgdir"/usr/lib/cups/filter/pstotiff \ + "$pkgdir"/usr/share/doc/hplip/README_LIBJPG + install -Dm755 prnt/filters/hpps \ + "$pkgdir"/usr/lib/cups/filter/hpps } sane() { @@ -63,6 +105,8 @@ sane() { echo "hpaio" > "$subpkgdir"/etc/sane.d/dll.d/hpaio } -sha512sums="f419de0e18937c93c2727f4d8b4f7bf1fcc24961a6b7a0d043ce8341c65d0c0332cd354c0cd907b85bc6ccc7735d23ba5f2c918dba5bf965540291cfcbe032d5 hplip-3.19.11.tar.gz -3a7d93d5c52c5988314029e85a72cab4a76c38fab8e36e5c9d4affd31b4ab968423c3af4bac78fac69ad41f4fcade1766dcd0537c3878c8df5ded789878ab3ec fix-includes.patch -d1b843ee3a725df8c66979fc40748db8f824d6c3d92fbaf7ec35dd2aac0845f41e4af7f1ba0a69e30e452c5621c56736e967993b84831edce04e6449ff5b63db remove-binary-blob.patch" +sha512sums="f583fb4140a29c5e21956c3e51fe3620baa65d33b40447af419d7fc61473a1148a1873216a84e89be785b155ee8e9aebd5e3eb19d2ded82b8415b1a35de1b55d hplip-3.20.11.tar.gz +2199672dedac0f8693e8fbc619156f574568658f713389f2d651bf5934275bf29adefa2e6f1977e2beb4fdd1b027ccc3160892f27ebf21e808fedeb2d2cec3c0 hplip_3.20.11+dfsg0-1.debian.tar.xz +125051933b84e5bc09e0df6f2fe837283a2c005c886ea7922d18e5cebc65b1f491feb0649592aec217b8ac1fb08bd299573430436459c6baa78b3f69ed8794a3 createPPD.patch +ccbb5e9ba7e91593064425c516553e455df83fbed77437f2c916ac6c14d5c420c351ab88faafe175ad838de397fd460066a14d47abc5a8157b7aad8552ede9aa hpps-shebang.patch +52d3795cbcd98807a9d19697fcc3fcfea2377c1ba43af4e17b4fa7a71ff10ff0f9a063365b206ac6abdb3a1a1bdd7f2b4194f3618853a0d4c8adc25a3cb9b5a9 sane-types.patch" diff --git a/nonfree/hplip/createPPD.patch b/nonfree/hplip/createPPD.patch new file mode 100644 index 0000000..05d4f3f --- /dev/null +++ b/nonfree/hplip/createPPD.patch @@ -0,0 +1,56 @@ +Ensure each file exists before trying to gzip or record it. This +prevents files literally named '*.ppd.gz' etc. from spontaneously being +generated, which will break the 'install' Makefile target later + +--- hplip-3.20.11/createPPD.sh 2020-11-29 19:03:51.000000000 -0500 ++++ hplip-3.20.11/createPPD.sh 2020-12-21 21:13:58.469771205 -0500 +@@ -54,11 +54,13 @@ then + else + cp prnt/ps/hp-postscript*.ppd ppd/classppd/ps + for i in ppd/classppd/ps/*.ppd; do ++ [ -e "$i" ] || continue + gzip -c "$i" > "$i.gz" + done + fi + #cp prnt/ps/hp-postscript*.ppd.gz ppd/classppd/ps + for i in ppd/classppd/hpcups/*.ppd; do ++ [ -e "$i" ] || continue + gzip -c "$i" > "$i.gz" + done + #for i in ppd/classppd/ps/*.ppd; do +@@ -69,9 +71,11 @@ then + class_cups_ppd_printers = \\ + EOF + for i in ppd/classppd/hpcups/*.ppd.gz; do ++ [ -e "$i" ] || continue + echo " $i \\" >>class_cups_drv.inc + done + for i in ppd/classppd/ps/*.ppd.gz; do ++ [ -e "$i" ] || continue + echo " $i \\" >>class_cups_drv.inc + done + sed -i -e "s|$i .$|$i|" class_cups_drv.inc +@@ -81,6 +85,7 @@ else # discrete drivers + install -d ppd/hpcups + ppdc -d ppd/hpcups prnt/drv/hpcups.drv + for i in ppd/hpcups/*.ppd; do ++ [ -e "$i" ] || continue + gzip -c "$i" > "$i.gz" + done + +@@ -88,6 +93,7 @@ install -d ppd/hpijs + ppdc -d ppd/hpijs prnt/drv/hpijs.drv + echo "gzip ppd files..." + for i in ppd/hpijs/*.ppd; do ++ [ -e "$i" ] || continue + gzip -c "$i" > "$i.gz" + done + echo "building foomatic_drv.inc..." +@@ -98,6 +104,7 @@ cat > cups_drv.inc <>cups_drv.inc + done + sed -i -e "s|$i .$|$i|" cups_drv.inc diff --git a/nonfree/hplip/fix-includes.patch b/nonfree/hplip/fix-includes.patch deleted file mode 100644 index 05bdf2d..0000000 --- a/nonfree/hplip/fix-includes.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff -ru hplip-3.16.10.orig/protocol/discovery/mdns.c hplip-3.16.10/protocol/discovery/mdns.c ---- hplip-3.16.10.orig/protocol/discovery/mdns.c 2016-10-21 13:48:34.000000000 +0300 -+++ hplip-3.16.10/protocol/discovery/mdns.c 2016-11-03 14:41:38.828298853 +0200 -@@ -24,10 +24,15 @@ - Author: Sanjay Kumar - \*****************************************************************************/ - --//#include -+#include -+#include -+#include -+#include - #include - #include -+#include - #include -+#include - #include - #include - #include ---- hplip-3.18.9/scan/sane/OrbliteScan/LinuxCommon.h 2018-09-20 23:56:44.000000000 -0400 -+++ hplip-3.18.9/scan/sane/OrbliteScan/LinuxCommon.h 2018-10-30 01:34:11.970019105 -0400 -@@ -18,10 +18,8 @@ typedef u_int32_t UInt32; - typedef int32_t SInt32; - //typedef unsigned long UInt32; - //typedef signed long SInt32; --typedef __S64_TYPE SInt64; --typedef __U64_TYPE UInt64; --typedef __S64_TYPE int64_t; --typedef __U64_TYPE uint64_t; -+typedef int64_t SInt64; -+typedef uint64_t UInt64; - - //typedef unsigned long ULONG; - //typedef void* LPVOID; diff --git a/nonfree/hplip/hpps-shebang.patch b/nonfree/hplip/hpps-shebang.patch new file mode 100644 index 0000000..1b5e60d --- /dev/null +++ b/nonfree/hplip/hpps-shebang.patch @@ -0,0 +1,8 @@ +--- hplip-3.20.11/prnt/filters/hpps 2020-11-29 19:03:52.000000000 -0500 ++++ hplip-3.20.11/prnt/filters/hpps 2020-12-22 10:55:46.099947650 -0500 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # -*- coding: utf-8 -*- + # + # (c) Copyright 2003-2015 HP Development Company, L.P. diff --git a/nonfree/hplip/remove-binary-blob.patch b/nonfree/hplip/remove-binary-blob.patch deleted file mode 100644 index 37c1a85..0000000 --- a/nonfree/hplip/remove-binary-blob.patch +++ /dev/null @@ -1,110 +0,0 @@ -Taken from http://slackware.cs.utah.edu/pub/slackware/slackware-current/source/ap/hplip/hplip.remove-ImageProcessor.diff.gz - ---- hplip-3.18.9/Makefile.in 2018-09-20 23:59:34.000000000 -0400 -+++ hplip-3.18.9/Makefile.in 2018-10-30 01:23:08.120007229 -0400 -@@ -103,7 +103,7 @@ DIST_COMMON = $(am__configure_deps) \ - - # ip library - @HPLIP_BUILD_TRUE@am__append_12 = libhpip.la --@FULL_BUILD_TRUE@@HPLIP_BUILD_TRUE@am__append_13 = prnt/drv/hpijs.drv.in.template prnt/drv/hpcups.drv.in.template prnt/hpcups/libImageProcessor-x86_64.so prnt/hpcups/libImageProcessor-x86_32.so -+@FULL_BUILD_TRUE@@HPLIP_BUILD_TRUE@am__append_13 = prnt/drv/hpijs.drv.in.template prnt/drv/hpcups.drv.in.template - @FULL_BUILD_TRUE@@HPLIP_BUILD_TRUE@am__append_14 = dat2drv.py install.py hplip-install init-suse-firewall init-iptables-firewall class_rpm_build.sh hplipclassdriver.spec createPPD.sh Makefile_dat2drv hpijs-drv - @FULL_BUILD_TRUE@@HPLIP_BUILD_TRUE@@HPLIP_CLASS_DRIVER_FALSE@am__append_15 = scan/sane/hpaio.desc \ - @FULL_BUILD_TRUE@@HPLIP_BUILD_TRUE@@HPLIP_CLASS_DRIVER_FALSE@ installer/text_install.py \ -@@ -723,8 +723,7 @@ am__dist_locatedriver_DATA_DIST = locate - am__dist_models_DATA_DIST = data/models/models.dat - am__dist_noinst_DATA_DIST = prnt/drv/hpijs.drv.in.template \ - prnt/drv/hpcups.drv.in.template \ -- prnt/hpcups/libImageProcessor-x86_64.so \ -- prnt/hpcups/libImageProcessor-x86_32.so scan/sane/hpaio.desc \ -+ scan/sane/hpaio.desc \ - installer/text_install.py data/localization/hplip_de.ts \ - data/localization/hplip_es.ts data/localization/hplip_fr.ts \ - data/localization/hplip_it.ts data/localization/hplip_pt.ts \ -@@ -4669,7 +4668,7 @@ libapdk_la_CFLAGS = $(libapdk_la_CXXFLAG - @HPCUPS_INSTALL_TRUE@ prnt/hpcups/ImageProcessor.h - - @HPCUPS_INSTALL_TRUE@hpcups_CXXFLAGS = $(APDK_ENDIAN_FLAG) $(DBUS_CFLAGS) --@HPCUPS_INSTALL_TRUE@hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lImageProcessor -lcups -lcupsimage -lz $(DBUS_LIBS) -+@HPCUPS_INSTALL_TRUE@hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lcups -lcupsimage -lz $(DBUS_LIBS) - #else - #hpcupsdir = $(cupsfilterdir) - #hpcups_PROGRAMS = hpcups -@@ -9380,16 +9379,6 @@ uninstall-am: uninstall-apparmor_abstrac - - - install-data-hook: --@HPLIP_BUILD_TRUE@ if [ \( "$(UNAME)" = "x86_64" -a -d "$(libdir)/" \) ]; then \ --@HPLIP_BUILD_TRUE@ cp prnt/hpcups/libImageProcessor-x86_64.so $(libdir)/ ; \ --@HPLIP_BUILD_TRUE@ chmod 775 $(libdir)/libImageProcessor-x86_64.so ; \ --@HPLIP_BUILD_TRUE@ ln -sf $(libdir)/libImageProcessor-x86_64.so $(libdir)/libImageProcessor.so ; \ --@HPLIP_BUILD_TRUE@ fi; \ --@HPLIP_BUILD_TRUE@ if [ \( \( "$(UNAME)" = "i686" -o "$(UNAME)" = "i386" \) -a -d "$(libdir)/" \) ]; then \ --@HPLIP_BUILD_TRUE@ cp prnt/hpcups/libImageProcessor-x86_32.so $(libdir)/ ; \ --@HPLIP_BUILD_TRUE@ chmod 775 $(libdir)/libImageProcessor-x86_32.so ; \ --@HPLIP_BUILD_TRUE@ ln -sf $(libdir)/libImageProcessor-x86_32.so $(libdir)/libImageProcessor.so ; \ --@HPLIP_BUILD_TRUE@ fi - # If scanner build, add hpaio entry to sane dll.conf. - @HPLIP_BUILD_TRUE@@HPLIP_CLASS_DRIVER_FALSE@ if [ "$(scan_build)" = "yes" ]; then \ - @HPLIP_BUILD_TRUE@@HPLIP_CLASS_DRIVER_FALSE@ $(mkinstalldirs) $(DESTDIR)/etc/sane.d; \ ---- hplip-3.18.9/prnt/hpcups/HPCupsFilter.cpp 2018-09-20 23:56:25.000000000 -0400 -+++ hplip-3.18.9/prnt/hpcups/HPCupsFilter.cpp 2018-10-30 01:24:05.730008260 -0400 -@@ -31,7 +31,6 @@ - \*****************************************************************************/ - - #include "HPCupsFilter.h" --#include "ImageProcessor.h" - - #include - #include -@@ -637,15 +636,10 @@ int HPCupsFilter::processRasterData(cups - - - sprintf(hpPreProcessedRasterFile, "%s/hp_%s_cups_SwapedPagesXXXXXX",CUPS_TMP_DIR, m_JA.user_name); -- image_processor_t* imageProcessor = imageProcessorCreate(); - - while (cupsRasterReadHeader2(cups_raster, &cups_header)) - { - -- IMAGE_PROCESSOR_ERROR result = imageProcessorStartPage(imageProcessor, &cups_header); -- if (result != IPE_SUCCESS){ -- dbglog("DEBUG: imageProcessorStartPage failed result = %d\n", result); -- } - - current_page_number++; - -@@ -745,12 +739,6 @@ int HPCupsFilter::processRasterData(cups - color_raster = rgbRaster; - black_raster = kRaster; - -- result = imageProcessorProcessLine(imageProcessor, m_pPrinterBuffer, cups_header.cupsBytesPerLine); -- if (result != IPE_SUCCESS){ -- dbglog("DEBUG: imageProcessorProcessLine failed result = %d\n", result); -- } -- -- - if ((y == 0) && !is_ljmono) { - //For ljmono, make sure that first line is not a blankRaster line.Otherwise printer - //may not skip blank lines before actual data -@@ -780,12 +768,6 @@ int HPCupsFilter::processRasterData(cups - } - } // for() loop end - -- result = imageProcessorEndPage(imageProcessor); -- if (result != IPE_SUCCESS){ -- dbglog("DEBUG: imageProcessorEndPage failed result = %d\n", result); -- } -- -- - m_Job.NewPage(); - if (err != NO_ERROR) { - break; -@@ -800,8 +782,6 @@ int HPCupsFilter::processRasterData(cups - rgbRaster = NULL; - } - -- imageProcessorDestroy(imageProcessor); -- - unlink(hpPreProcessedRasterFile); - return ret_status; - } diff --git a/nonfree/hplip/sane-types.patch b/nonfree/hplip/sane-types.patch new file mode 100644 index 0000000..9c892c9 --- /dev/null +++ b/nonfree/hplip/sane-types.patch @@ -0,0 +1,15 @@ +--- hplip-3.20.11/scan/sane/OrbliteScan/LinuxCommon.h 2020-11-29 19:03:52.000000000 -0500 ++++ hplip-3.20.11/scan/sane/OrbliteScan/LinuxCommon.h 2020-12-21 18:03:50.599938201 -0500 +@@ -18,10 +18,8 @@ typedef u_int32_t UInt32; + typedef int32_t SInt32; + //typedef unsigned long UInt32; + //typedef signed long SInt32; +-typedef __S64_TYPE SInt64; +-typedef __U64_TYPE UInt64; +-typedef __S64_TYPE int64_t; +-typedef __U64_TYPE uint64_t; ++typedef int64_t SInt64; ++typedef uint64_t UInt64; + + //typedef unsigned long ULONG; + //typedef void* LPVOID; -- GitLab