commit:     75f35a8155a706cf370d89683c268d1b8246e425
Author:     Brian Norris <briannorris <AT> chromium <DOT> org>
AuthorDate: Mon Feb  8 21:54:52 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Feb 11 02:20:52 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=75f35a81

net-print/cups-filters: add --disable-{foomatic,ghostscript} support

Support a new USE flag to allow disabling ghostscript-based filters in a
CUPS installation. Requires patching in a new --disable-ghostscript
option to the configure script. Patch supplied in upstream bug:

https://bugs.linuxfoundation.org/show_bug.cgi?id=1342

Also support a proper configure flag for foomatic at the same time.

 .../cups-filters/cups-filters-1.8.1-r1.ebuild      |  22 ++-
 ...s-filters-1.8.1-allow-disable-ghostscript.patch | 187 +++++++++++++++++++++
 2 files changed, 197 insertions(+), 12 deletions(-)

diff --git a/net-print/cups-filters/cups-filters-1.8.1-r1.ebuild 
b/net-print/cups-filters/cups-filters-1.8.1-r1.ebuild
index a7a1a9a..d6f6ef2 100644
--- a/net-print/cups-filters/cups-filters-1.8.1-r1.ebuild
+++ b/net-print/cups-filters/cups-filters-1.8.1-r1.ebuild
@@ -21,10 +21,10 @@ 
HOMEPAGE="http://www.linuxfoundation.org/collaborate/workgroups/openprinting/pdf
 
 LICENSE="MIT GPL-2"
 SLOT="0"
-IUSE="dbus +foomatic jpeg perl png static-libs tiff zeroconf"
+IUSE="dbus +foomatic jpeg perl png +postscript static-libs tiff zeroconf"
 
 RDEPEND="
-       >=app-text/ghostscript-gpl-9.09[cups]
+       postscript? ( >=app-text/ghostscript-gpl-9.09[cups] )
        app-text/poppler:=[cxx,jpeg?,lcms,tiff?,utils,xpdf-headers(+)]
        >=app-text/qpdf-3.0.2:=
        media-libs/fontconfig
@@ -48,6 +48,7 @@ DEPEND="${RDEPEND}
 
 src_prepare() {
        base_src_prepare
+       epatch "${FILESDIR}/${P}-allow-disable-ghostscript.patch"
        sed -e "s/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/" -i configure.ac || die
        eautoreconf
 }
@@ -58,6 +59,8 @@ src_configure() {
                $(use_enable dbus) \
                $(use_enable zeroconf avahi) \
                $(use_enable static-libs static) \
+               $(use_enable foomatic) \
+               $(use_enable postscript ghostscript) \
                --with-fontdir="fonts/conf.avail" \
                --with-pdftops=pdftops \
                --enable-imagefilters \
@@ -90,9 +93,11 @@ src_install() {
                popd > /dev/null
        fi
 
-       # workaround: some printer drivers still require pstoraster and 
pstopxl, bug #383831
-       dosym gstoraster /usr/libexec/cups/filter/pstoraster
-       dosym gstopxl /usr/libexec/cups/filter/pstopxl
+       if use ghostscript; then
+               # workaround: some printer drivers still require pstoraster and 
pstopxl, bug #383831
+               dosym gstoraster /usr/libexec/cups/filter/pstoraster
+               dosym gstopxl /usr/libexec/cups/filter/pstopxl
+       fi
 
        prune_libtool_files --all
 
@@ -103,13 +108,6 @@ src_install() {
                sed -i -e 's:cups\.service 
avahi-daemon\.service:cups.service:g' "${S}"/utils/cups-browsed.service || die
        fi
 
-       if ! use foomatic ; then
-               # this needs an upstream solution / configure switch
-               rm -v "${ED}/usr/bin/foomatic-rip" || die
-               rm -v "${ED}/usr/libexec/cups/filter/foomatic-rip" || die
-               rm -v "${ED}/usr/share/man/man1/foomatic-rip.1" || die
-       fi
-
        doinitd "${T}"/cups-browsed
        systemd_dounit "${S}/utils/cups-browsed.service"
 }

diff --git 
a/net-print/cups-filters/files/cups-filters-1.8.1-allow-disable-ghostscript.patch
 
b/net-print/cups-filters/files/cups-filters-1.8.1-allow-disable-ghostscript.patch
new file mode 100644
index 0000000..a9c63da
--- /dev/null
+++ 
b/net-print/cups-filters/files/cups-filters-1.8.1-allow-disable-ghostscript.patch
@@ -0,0 +1,187 @@
+Allow disabling ghostscript and foomatic. Pulled from upstream bzr rev 7447:
+
+https://bugs.linuxfoundation.org/show_bug.cgi?id=1342
+
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -412,11 +412,14 @@ pdftopdf_LDADD = \
+ # Simple filter binaries
+ # ======================
+ pkgfilter_SCRIPTS = \
+-      filter/gstopxl \
+       filter/imagetops \
+       filter/pstopdf \
+       filter/textonly \
+       filter/texttops
++if ENABLE_GHOSTSCRIPT
++pkgfilter_SCRIPTS += \
++      filter/gstopxl
++endif
+ if ENABLE_BRAILLE
+ nodist_pkgfilter_SCRIPTS = \
+       filter/braille/drivers/generic/brftoembosser \
+@@ -420,8 +423,6 @@ pdftopdf_LDADD = \
+       bannertopdf \
+       commandtoescpx \
+       commandtopclx \
+-      foomatic-rip \
+-      gstoraster \
+       pdftoijs \
+       sys5ippprinter \
+       pdftops \
+@@ -432,6 +433,14 @@ pkgfilter_PROGRAMS += \
+       texttopdf \
+       urftopdf \
+       rastertopdf
++if ENABLE_GHOSTSCRIPT
++pkgfilter_PROGRAMS += \
++      gstoraster
++endif
++if ENABLE_FOOMATIC
++pkgfilter_PROGRAMS += \
++      foomatic-rip
++endif
+ if ENABLE_IMAGEFILTERS
+ pkgfilter_PROGRAMS += \
+       imagetopdf \
+@@ -737,8 +746,11 @@ initrcdir = $(INITDDIR)
+ initrc_SCRIPTS = utils/cups-browsed
+ man_MANS = \
+       utils/cups-browsed.8 \
+-      utils/cups-browsed.conf.5 \
++      utils/cups-browsed.conf.5
++if ENABLE_FOOMATIC
++man_MANS += \
+       filter/foomatic-rip/foomatic-rip.1
++endif
+ EXTRA_DIST += utils/cups-browsed.in \
+       $(man_MANS)
+       utils/org.cups.cupsd.Notifier.xml
+@@ -752,9 +764,12 @@ ppd_DATA = \
+       ppd/HP-Color_LaserJet_CM3530_MFP-PDF.ppd \
+       ppd/HP-PhotoSmart_Pro_B8300-hpijs-pdftoijs.ppd \
+       ppd/Ricoh-PDF_Printer-PDF.ppd \
+-      ppd/pxlcolor.ppd \
+-      ppd/pxlmono.ppd \
+       ppd/textonly.ppd
++if ENABLE_GHOSTSCRIPT
++ppd_DATA += \
++      ppd/pxlcolor.ppd \
++      ppd/pxlmono.ppd
++endif
+ 
+ EXTRA_DIST += $(ppd_DATA)
+ 
+@@ -782,7 +797,9 @@ distclean-local:
+ install-exec-hook:
+       $(INSTALL) -d -m 755 $(DESTDIR)$(bindir)
+       $(INSTALL) -d -m 755 $(DESTDIR)$(pkgfilterdir)
++if ENABLE_FOOMATIC
+       $(LN_S) -f $(pkgfilterdir)/foomatic-rip $(DESTDIR)$(bindir)
++endif
+ if ENABLE_BRAILLE
+       $(LN_S) -f imagetobrf $(DESTDIR)$(pkgfilterdir)/imagetoubrl
+       $(LN_S) -f textbrftoindexv3 $(DESTDIR)$(pkgfilterdir)/textbrftoindexv4
+@@ -806,7 +823,9 @@ if RCLINKS
+       fi
+ endif
+       $(RM) $(DESTDIR)$(pkgcharsetdir)/pdf.utf-8
++if ENABLE_FOOMATIC
+       $(RM) $(DESTDIR)$(bindir)/foomatic-rip
++endif
+ if ENABLE_BRAILLE
+       $(RM) $(DESTDIR)$(pkgfilterdir)/imagetoubrl
+       $(RM) $(DESTDIR)$(pkgfilterdir)/textbrftoindexv4
+--- a/configure.ac
++++ b/configure.ac
+@@ -431,6 +431,11 @@ AS_IF([test x"$long_long_found" = "xyes"], [
+ # ================
+ # Check for pdf2ps
+ # ================
++AC_ARG_ENABLE([ghostscript],
++      [AS_HELP_STRING([--disable-ghostscript], [Disable filters using 
Ghostscript.])],
++      [enable_ghostscript="$enableval"],
++      [enable_ghostscript=yes]
++)
+ AC_ARG_WITH([pdftops],
+       [AS_HELP_STRING([--with-pdftops=value], [Set which pdftops to use 
(gs,pdftops,pdftocairo,acroread,hybrid).])],
+       [with_pdftops="$withval"],
+@@ -471,25 +476,35 @@ AS_CASE([x$with_pdftops_maxres],
+       [AC_MSG_ERROR([Unknown value of with-pdftops-maxres provided: 
$with_pdftops])]
+ )
+ 
+-AS_IF([test "x$with_gs_path" != "xsystem"], [
+-      CUPS_GHOSTSCRIPT="$with_gs_path"
+-], [
+-      AC_PATH_PROG(CUPS_GHOSTSCRIPT, [gs], [AC_MSG_ERROR([Required gs binary 
is missing. Please install ghostscript-gpl package.])])
+-])
+-AS_IF([test "x$CUPS_GHOSTSCRIPT" != "x"], [
+-      AC_DEFINE([HAVE_GHOSTSCRIPT], [], [Define that we provide ghostscript 
binary])
+-      AS_IF([test x"$with_pdftops" = xgs], 
[AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [GS], [Define default renderer])])
+-
+-      AC_MSG_CHECKING(whether gs supports the ps2write device)
+-      AS_IF([`$CUPS_GHOSTSCRIPT -h 2>&1 | grep -q ps2write`], [
+-              AC_MSG_RESULT([yes])
+-              AC_DEFINE([HAVE_GHOSTSCRIPT_PS2WRITE], [], [gs supports 
ps2write])
++CUPS_GHOSTSCRIPT=""
++AS_IF([test "x$enable_ghostscript" != "xyes"], [
++      AS_IF([test "x$with_gs_path" != "xsystem"], [
++             AC_MSG_ERROR([Cannot supply both --disable-ghostscript and 
--gs-path=])
+       ], [
+-              AC_MSG_RESULT([no])
++              with_gs_path=""
+       ])
+ ], [
+-      CUPS_GHOSTSCRIPT="gs"
++      AS_IF([test "x$with_gs_path" != "xsystem"], [
++              CUPS_GHOSTSCRIPT="$with_gs_path"
++      ], [
++              AC_PATH_PROG(CUPS_GHOSTSCRIPT, [gs], [AC_MSG_ERROR([Required gs 
binary is missing. Please install ghostscript-gpl package.])])
++      ])
++      AS_IF([test "x$CUPS_GHOSTSCRIPT" != "x"], [
++              AC_DEFINE([HAVE_GHOSTSCRIPT], [], [Define that we provide 
ghostscript binary])
++              AS_IF([test x"$with_pdftops" = xgs], 
[AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [GS], [Define default renderer])])
++
++              AC_MSG_CHECKING(whether gs supports the ps2write device)
++              AS_IF([`$CUPS_GHOSTSCRIPT -h 2>&1 | grep -q ps2write`], [
++                      AC_MSG_RESULT([yes])
++                      AC_DEFINE([HAVE_GHOSTSCRIPT_PS2WRITE], [], [gs supports 
ps2write])
++              ], [
++                      AC_MSG_RESULT([no])
++              ])
++      ], [
++              CUPS_GHOSTSCRIPT="gs"
++      ])
+ ])
++AM_CONDITIONAL(ENABLE_GHOSTSCRIPT, test "x$enable_ghostscript" = xyes)
+ 
+ AS_IF([test "x$with_pdftops_path" != "xsystem"], [
+       CUPS_PDFTOPS="$with_pdftops_path"
+@@ -550,6 +565,16 @@ AC_DEFINE_UNQUOTED([CUPS_POPPLER_PDFTOCAIRO], 
"$CUPS_PDFTOCAIRO", [pdftocairo bi
+ AC_DEFINE_UNQUOTED([CUPS_ACROREAD], "$CUPS_ACROREAD", [acroread binary to 
use.])
+ AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_MAX_RESOLUTION], [$CUPS_PDFTOPS_MAXRES], 
[max resolution used for pdftops when converting images])
+ 
++# ==================
++# Check for foomatic
++# ==================
++AC_ARG_ENABLE([foomatic],
++      [AS_HELP_STRING([--disable-foomatic], [Disable Foomatic-based 
filters.])],
++      [enable_foomatic="$enableval"],
++      [enable_foomatic=yes]
++)
++AM_CONDITIONAL([ENABLE_FOOMATIC], [test "x$enable_foomatic" = "xyes"])
++
+ # =============
+ # Check for php
+ # =============
+@@ -658,8 +683,10 @@ Environment settings:
+ Build configuration:
+       cups-config:     ${with_cups_config}
+       font directory:  ${sysconfdir}/${FONTDIR}
++      foomatic:        ${enable_foomatic}
+       init directory:  ${INITDDIR}
+       cups dom socket: ${CUPS_DEFAULT_DOMAINSOCKET}
++      ghostscript:     ${enable_ghostscript}
+       gs-path:         ${with_gs_path}
+       imagefilters:    ${enable_imagefilters}
+       jpeg:            ${with_jpeg}

Reply via email to