diff --git a/fix-printer-attributes-parsing.patch b/fix-printer-attributes-parsing.patch new file mode 100644 index 0000000000000000000000000000000000000000..8b314e1caf83fc3aa189c9d4a6d088986b4a0322 --- /dev/null +++ b/fix-printer-attributes-parsing.patch @@ -0,0 +1,59 @@ +diff -Nrup a/protocol/hp_ipp.c b/protocol/hp_ipp.c +--- a/protocol/hp_ipp.c 2023-06-02 10:02:35.000000000 +0200 ++++ b/protocol/hp_ipp.c 2023-09-17 07:54:14.227565173 +0200 +@@ -39,6 +39,12 @@ Boston, MA 02110-1301, USA. + #define _STRINGIZE(x) #x + #define STRINGIZE(x) _STRINGIZE(x) + ++#define hplip_strlcpy(dst, src, size) \ ++ do { \ ++ if (!memccpy(dst, src, '\0', size)) \ ++ dst[size - 1] = '\0'; \ ++ } while (0) ++ + http_t *acquireCupsInstance() + { + if (http == NULL) +@@ -109,7 +115,7 @@ int addCupsPrinter(char *name, char *dev + } + + if ( info == NULL ) +- snprintf( info,sizeof(info), name ); ++ hplip_strlcpy( info, name, sizeof(info)); + + sprintf(printer_uri, "ipp://localhost/printers/%s", name); + +@@ -514,27 +520,27 @@ int __parsePrinterAttributes(ipp_t *resp + + if ( strcmp(attr_name, "printer-name") == 0 && + val_tag == IPP_TAG_NAME ) { +- snprintf(t_printer->name, sizeof(t_printer->name),ippGetString(attr, 0, NULL) ); ++ hplip_strlcpy(t_printer->name, ippGetString(attr, 0, NULL), sizeof(t_printer->name) ); + } + else if ( strcmp(attr_name, "device-uri") == 0 && + val_tag == IPP_TAG_URI ) { +- snprintf(t_printer->device_uri,sizeof(t_printer->device_uri), ippGetString(attr, 0, NULL) ); ++ hplip_strlcpy(t_printer->device_uri, ippGetString(attr, 0, NULL), sizeof(t_printer->device_uri) ); + } + else if ( strcmp(attr_name, "printer-uri-supported") == 0 && + val_tag == IPP_TAG_URI ) { +- snprintf(t_printer->printer_uri,sizeof(t_printer->printer_uri), ippGetString(attr, 0, NULL) ); ++ hplip_strlcpy(t_printer->printer_uri, ippGetString(attr, 0, NULL), sizeof(t_printer->printer_uri) ); + } + else if ( strcmp(attr_name, "printer-info") == 0 && + val_tag == IPP_TAG_TEXT ) { +- snprintf(t_printer->info,sizeof(t_printer->info), ippGetString(attr, 0, NULL) ); ++ hplip_strlcpy(t_printer->info, ippGetString(attr, 0, NULL), sizeof(t_printer->info) ); + } + else if ( strcmp(attr_name, "printer-location") == 0 && + val_tag == IPP_TAG_TEXT ) { +- snprintf(t_printer->location,sizeof(t_printer->location),ippGetString(attr, 0, NULL) ); ++ hplip_strlcpy(t_printer->location, ippGetString(attr, 0, NULL), sizeof(t_printer->location) ); + } + else if ( strcmp(attr_name, "printer-make-and-model") == 0 && + val_tag == IPP_TAG_TEXT ) { +- snprintf(t_printer->make_model,sizeof(t_printer->make_model),ippGetString(attr, 0, NULL) ); ++ hplip_strlcpy(t_printer->make_model, ippGetString(attr, 0, NULL), sizeof(t_printer->make_model)); + } + else if ( strcmp(attr_name, "printer-state") == 0 && + val_tag == IPP_TAG_ENUM ) { diff --git a/hplip-automake-fix-subdir-objects.patch b/hplip-automake-fix-subdir-objects.patch new file mode 100644 index 0000000000000000000000000000000000000000..b671dacc60253a9228233f6b16f20ea4750c2c6c --- /dev/null +++ b/hplip-automake-fix-subdir-objects.patch @@ -0,0 +1,12 @@ +diff --git a/Makefile.am b/Makefile.am +index 605744a..bb274d4 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -4,6 +4,7 @@ + # (c) 2004-2015 Copyright HP Development Company, LP + # Author: David Suffield, Naga Samrat Chowdary Narla, Sarbeswar Meher + INCLUDES = -Iip -Iio/hpmud -Iscan/sane -Iprnt/hpijs -Icommon/ ++AUTOMAKE_OPTIONS = subdir-objects + CFLAGS+= -DCONFDIR=\"$(hplip_confdir)\" + CXXFLAGS+= -DCONFDIR=\"$(hplip_confdir)\" + diff --git a/hplip-configure-python.patch b/hplip-configure-python.patch new file mode 100644 index 0000000000000000000000000000000000000000..c06ac49b815defe17bca08fbcb6175e16a0f3c72 --- /dev/null +++ b/hplip-configure-python.patch @@ -0,0 +1,56 @@ +diff --git a/configure.in b/configure.in +index 9e330e3..e4a254e 100755 +--- a/configure.in ++++ b/configure.in +@@ -604,20 +604,31 @@ if test "$class_driver" = "no" && test " + fi + fi + +-SAVE_CPPFLAGS="$CPPFLAGS" +-CFLAGS=`python-config --includes` +-if [ $? -eq 0 ] +-then +- echo $FLAGS +-else +-CFLAGS=`python3-config --includes` +- if [ $? -eq 0 ] +- then +- echo $FLAGS +- fi ++AC_PATH_PROG(python3_config_path, python3-config, [AC_MSG_ERROR([python3-config not installed], 6)]) ++ ++PYTHON_INCLUDES=`$python3_config_path --includes` ++if test "X$PYTHON_INCLUDES" == "X" ; then ++ AC_MSG_ERROR([Cannot get Python includes via python3-config], 6) ++fi ++ ++PYTHON_LIBS=`$python3_config_path --libs` ++if test "X$PYTHON_LIBS" == "X" ; then ++ AC_MSG_ERROR([Cannot get Python libs via python3-config], 6) ++fi ++ ++SAVE_CFLAGS=$CFLAGS ++SAVE_LIBS=$LIBS ++ ++CFLAGS="$CFLAGS $PYTHON_INCLUDES" ++LIBS="$LIBS $PYTHON_LIBS" ++ ++AC_TRY_LINK(,[ ], AC_MSG_RESULT(yes); python_includes="ok", AC_MSG_ERROR([no: PYTHON DISABLED], 6)) ++ ++if test "X$python_includes" != "Xok" ; then ++ CFLAGS="$SAVE_CFLAGS" ++ LIBS="$SAVE_LIBS" + fi + +-#CFLAGS=`(python-config --includes)` + if test "$class_driver" = "no" && test "$hpijs_only_build" = "no" && test "$lite_build" = "no" && test "$hpcups_only_build" = "no"; then + AC_ARG_VAR([PYTHON], [Python interpreter/compiler command]) + AC_CHECK_PROGS(PYTHON,[python python3 python2]) +@@ -631,7 +642,6 @@ if test "$class_driver" = "no" && test " + AS_IF([test "x$FOUND_HEADER" != "xyes"], + [AC_MSG_ERROR([cannot find python-devel support], 6)]) + fi +-CFLAGS="$save_CFLAGS" + + if test "$hpijs_only_build" = "no" && test "$scan_build" = "yes" && test "$hpcups_only_build" = "no"; then + AC_CHECK_LIB([sane], [sane_open], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find sane-backends-devel support (or --disable-scan-build)], 12)]) diff --git a/hplip-fix-linkage.patch b/hplip-fix-linkage.patch new file mode 100644 index 0000000000000000000000000000000000000000..0cd95ec4b68b6b01df4db320b04e43431032e53b --- /dev/null +++ b/hplip-fix-linkage.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.am b/Makefile.am +index 605744a..58bd60b 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -325,7 +325,7 @@ lib_LTLIBRARIES += libhpipp.la + libhpipp_la_SOURCES = protocol/hp_ipp.c protocol/hp_ipp.h protocol/hp_ipp_i.h + libhpipp_la_CFLAGS = -DCONFDIR=\"$(hplip_confdir)\" + libhpipp_la_LDFLAGS = -version-info 0:1:0 +-libhpipp_la_LIBADD = libhpmud.la ++libhpipp_la_LIBADD = libhpmud.la -lcups + + # cupsext + cupsextdir = $(pyexecdir) diff --git a/hplip.spec b/hplip.spec index 53debe8ba5fe032715b72d5325b7dc97cca78e02..74c3266b717ad5eecdac61f835b32fc9a9df714a 100644 --- a/hplip.spec +++ b/hplip.spec @@ -1,7 +1,7 @@ Name: hplip Summary: HP Linux Imaging and Printing Project Version: 3.23.8 -Release: 2 +Release: 3 License: GPLv2+ and MIT and BSD and IJG and Public Domain and GPLv2+ with exceptions and ISC Url: https://developers.hp.com/hp-linux-imaging-and-printing Source0: http://downloads.sourceforge.net/sourceforge/hplip/hplip-%%{version}.tar.gz @@ -40,6 +40,10 @@ Patch34: hplip-hpfax-importerror-print.patch Patch35: 0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch Patch36: 0026-Call-QMessageBox-constructors-of-PyQT5-with-the-corr.patch Patch37: 0027-Fixed-incomplete-removal-of-hp-toolbox-features-whic.patch +Patch38: hplip-automake-fix-subdir-objects.patch +Patch39: hplip-configure-python.patch +Patch40: hplip-fix-linkage.patch +Patch41: fix-printer-attributes-parsing.patch Requires: python3-pillow python3-gobject cups python3-dbus systemd %{_bindir}/gpg Requires: python3-qt5 wget python3-gobject python3-reportlab sane-backends python3 @@ -75,29 +79,29 @@ drivers for HP printers and multi-function peripherals. %prep %setup -q -%patch1 -p1 -b .pstotiff-is-rubbish -%patch3 -p1 -b .ui-optional -%patch5 -p1 -b .deviceIDs-drv +%patch -P1 -p1 -b .pstotiff-is-rubbish +%patch -P3 -p1 -b .ui-optional +%patch -P5 -p1 -b .deviceIDs-drv chmod +x %{SOURCE2} mv prnt/drv/hpijs.drv.in{,.deviceIDs-drv-hpijs} %{SOURCE2} prnt/drv/hpcups.drv.in \ prnt/drv/hpijs.drv.in.deviceIDs-drv-hpijs \ > prnt/drv/hpijs.drv.in -%patch6 -p1 -b .udev-rules -%patch7 -p1 -b .retry-open -%patch8 -p1 -b .snmp-quirks -%patch9 -p1 -b .hpijs-marker-supply -%patch10 -p1 -b .clear-old-state-reasons -%patch11 -p1 -b .hpcups-sigpipe -%patch12 -p1 -b .logdir -%patch13 -p1 -b .bad-low-ink-warning +%patch -P6 -p1 -b .udev-rules +%patch -P7 -p1 -b .retry-open +%patch -P8 -p1 -b .snmp-quirks +%patch -P9 -p1 -b .hpijs-marker-supply +%patch -P10 -p1 -b .clear-old-state-reasons +%patch -P11 -p1 -b .hpcups-sigpipe +%patch -P12 -p1 -b .logdir +%patch -P13 -p1 -b .bad-low-ink-warning for ppd_file in $(grep '^diff' %{PATCH14} | cut -d " " -f 4); do gunzip ${ppd_file#*/}.gz done -%patch14 -p1 -b .deviceIDs-ppd +%patch -P14 -p1 -b .deviceIDs-ppd for ppd_file in $(grep '^diff' %{PATCH14} | cut -d " " -f 4); do gzip -n ${ppd_file#*/} @@ -107,37 +111,41 @@ for ppd_file in $(grep '^diff' %{PATCH15} | cut -d " " -f 4); do gunzip ${ppd_file#*/}.gz done -%patch15 -p1 -b .ImageableArea +%patch -P15 -p1 -b .ImageableArea for ppd_file in $(grep '^diff' %{PATCH15} | cut -d " " -f 4); do gzip -n ${ppd_file#*/} done -%patch16 -p1 -b .scan-tmp -%patch17 -p1 -b .log-stderr -%patch18 -p1 -b .parsing -%patch20 -p1 -b .dj990c-margin -%patch21 -p1 -b .strncpy -%patch22 -p1 -b .no-write-bytecode -%patch23 -p1 -b .silence-ioerror -%patch24 -p1 -b .sourceoption -%patch25 -p1 -b .no-ernie +%patch -P16 -p1 -b .scan-tmp +%patch -P17 -p1 -b .log-stderr +%patch -P18 -p1 -b .parsing +%patch -P20 -p1 -b .dj990c-margin +%patch -P21 -p1 -b .strncpy +%patch -P22 -p1 -b .no-write-bytecode +%patch -P23 -p1 -b .silence-ioerror +%patch -P24 -p1 -b .sourceoption +%patch -P25 -p1 -b .no-ernie rm prnt/hpcups/ErnieFilter.{cpp,h} prnt/hpijs/ernieplatform.h -%patch27 -p1 -b .check-cups -%patch30 -p1 -b .typo +%patch -P27 -p1 -b .check-cups +%patch -P30 -p1 -b .typo -%patch31 -p1 -b .use-binary-str -%patch32 -p1 -b .colorlaserjet-mfp-m278-m281 -%patch33 -p1 -b .error-print-fix -%patch34 -p1 -b .hpfax-import-error-print +%patch -P31 -p1 -b .use-binary-str +%patch -P32 -p1 -b .colorlaserjet-mfp-m278-m281 +%patch -P33 -p1 -b .error-print-fix +%patch -P34 -p1 -b .hpfax-import-error-print -%patch35 -p1 -b .libimageprocessor-removal +%patch -P35 -p1 -b .libimageprocessor-removal %{_bindir}/rm prnt/hpcups/libImageProcessor-x86* -%patch36 -p1 -b .qmsgbox-typos-fix -%patch37 -p1 -b .toolbox-crash +%patch -P36 -p1 -b .qmsgbox-typos-fix +%patch -P37 -p1 -b .toolbox-crash +%patch -P38 -p1 -b .subdir +%patch -P39 -p1 -b .python +%patch -P40 -p1 -b .linkage +%patch -P41 -p1 -b .parsing sed -i.duplex-constraints \ -e 's,\(UIConstraints.* \*Duplex\),//\1,' \ @@ -157,9 +165,7 @@ sed -i 's|^AM_INIT_AUTOMAKE|AM_INIT_AUTOMAKE([foreign])|g' configure.in autoreconf --verbose --force --install -export CFLAGS="%{optflags} $(python3-config --includes)" -export CXXFLAGS="%{optflags} $(python3-config --includes)" -export LDFLAGS="${LDFLAGS} -fPIC" +export LDFLAGS="%{build_ldflags} -fPIC" %configure \ --enable-scan-build --enable-gui-build --enable-fax-build \ @@ -214,29 +220,23 @@ popd install -d ${RPM_BUILD_ROOT}%{_datadir}/applications sed -i -e '/^Categories=/d' hplip.desktop sed -i -e '/^Encoding=/d' hplip.desktop -desktop-file-validate hplip.desktop desktop-file-install --vendor HP --dir ${RPM_BUILD_ROOT}/%{_datadir}/applications --add-category System \ --add-category Settings --add-category HardwareSettings hplip.desktop -appstream-util validate-relax --nonet ${RPM_BUILD_ROOT}%{_datadir}/appdata/*.appdata.xml install -p -m755 %{SOURCE1} ${RPM_BUILD_ROOT}%{_bindir}/hpcups-update-ppds install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/sane.d/dll.d echo hpaio > ${RPM_BUILD_ROOT}%{_sysconfdir}/sane.d/dll.d/hpaio find doc/images -type f -exec chmod 644 {} \; install -d ${RPM_BUILD_ROOT}%{_datadir}/hplip/prnt/plugins -%pre -%{_bindir}/systemctl start cups &>/dev/null ||: -%{_bindir}/systemctl enable cups &>/dev/null ||: +%check +desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop +appstream-util validate-relax --nonet ${RPM_BUILD_ROOT}%{_datadir}/appdata/*.appdata.xml %post %{_bindir}/hpcups-update-ppds &>/dev/null ||: -/sbin/ldconfig - -%postun -/sbin/ldconfig %files -%doc COPYING doc/* +%doc doc/* %license COPYING %{_bindir}/* %dir %{_datadir}/%{name} @@ -280,6 +280,10 @@ install -d ${RPM_BUILD_ROOT}%{_datadir}/hplip/prnt/plugins %exclude %{python3_sitearch}/*.la %changelog +* Wed Oct 08 2025 Funda Wang - 3.23.8-3 +- fix linkage of libhpipp +- drop redundant code on cups + * Thu Nov 21 2024 xu_ping <707078654@qq.com> - 3.23.8-2 - fix self build failed.