| 1 |
|
# Copyright 1999-2026 Gentoo Authors
|
|
1 |
# Copyright 2023-2026 Gentoo Authors
|
| 2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
3 |
|
| 4 |
4 |
EAPI=8
|
| 5 |
5 |
|
| 6 |
|
GENTOO_DEPEND_ON_PERL=no
|
| 7 |
|
inherit perl-module systemd flag-o-matic
|
|
6 |
inherit flag-o-matic
|
| 8 |
7 |
|
| 9 |
8 |
DESCRIPTION="Cups filters"
|
| 10 |
9 |
HOMEPAGE="https://wiki.linuxfoundation.org/openprinting/cups-filters"
|
| 11 |
|
SRC_URI="
|
| 12 |
|
https://github.com/OpenPrinting/cups-filters/releases/download/${PV}/${P}.tar.xz
|
| 13 |
|
https://www.openprinting.org/download/${PN}/${P}.tar.xz
|
| 14 |
|
"
|
|
10 |
SRC_URI="https://github.com/OpenPrinting/cups-filters/releases/download/${PV}/${P}.tar.xz"
|
| 15 |
11 |
|
| 16 |
|
LICENSE="MIT GPL-2"
|
|
12 |
LICENSE="Apache-2.0"
|
| 17 |
13 |
SLOT="0"
|
| 18 |
|
IUSE="dbus exif +foomatic jpeg ldap pclm pdf perl png +postscript test tiff zeroconf"
|
| 19 |
14 |
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
|
| 20 |
|
|
| 21 |
|
RESTRICT="!test? ( test )"
|
|
15 |
IUSE="+foomatic"
|
| 22 |
16 |
|
| 23 |
17 |
RDEPEND="
|
| 24 |
|
>=app-text/poppler-0.32[cxx,jpeg?,lcms,tiff?,utils]
|
| 25 |
|
>=app-text/qpdf-8.3.0:=
|
| 26 |
|
dev-libs/glib:2
|
| 27 |
|
media-libs/fontconfig
|
| 28 |
|
media-libs/freetype:2
|
| 29 |
|
media-libs/lcms:2
|
|
18 |
net-print/libcupsfilters
|
|
19 |
net-print/libppd
|
| 30 |
20 |
>=net-print/cups-1.7.3
|
| 31 |
|
!<=net-print/cups-1.5.9999
|
| 32 |
|
app-alternatives/bc
|
| 33 |
|
virtual/zlib:=
|
| 34 |
|
exif? ( media-libs/libexif )
|
| 35 |
|
dbus? ( sys-apps/dbus )
|
| 36 |
|
foomatic? ( !net-print/foomatic-filters )
|
| 37 |
|
jpeg? ( media-libs/libjpeg-turbo:= )
|
| 38 |
|
ldap? ( net-nds/openldap:= )
|
| 39 |
|
pdf? ( app-text/mupdf:= )
|
| 40 |
|
perl? ( dev-lang/perl:= )
|
| 41 |
|
png? ( media-libs/libpng:= )
|
| 42 |
|
postscript? ( >=app-text/ghostscript-gpl-9.09[cups] )
|
| 43 |
|
tiff? ( media-libs/tiff:= )
|
| 44 |
|
zeroconf? ( net-dns/avahi[dbus] )
|
| 45 |
21 |
"
|
| 46 |
22 |
DEPEND="${RDEPEND}"
|
| 47 |
23 |
BDEPEND="
|
| 48 |
|
>=dev-util/gdbus-codegen-2.80.5-r1
|
| 49 |
24 |
>=sys-devel/gettext-0.18.3
|
| 50 |
25 |
virtual/pkgconfig
|
| 51 |
|
test? ( media-fonts/dejavu )
|
| 52 |
26 |
"
|
| 53 |
27 |
|
|
28 |
# The tests are composed of:
|
|
29 |
# - built program
|
|
30 |
# - test case itself: filter/test.sh
|
|
31 |
#
|
|
32 |
# The latter is not wired up, and it becomes immediately evident why.
|
|
33 |
# Bow to this reality and don't claim we can run anything. As a side
|
|
34 |
# effect, don't compile in src_test, that which we never use.
|
|
35 |
RESTRICT="test"
|
|
36 |
|
| 54 |
37 |
PATCHES=(
|
| 55 |
|
"${FILESDIR}"/${PN}-1.28.17-c++17.patch
|
| 56 |
|
"${FILESDIR}"/${PN}-1.28.17-CVE-2023-24805.patch
|
| 57 |
|
"${FILESDIR}"/${PN}-1.28.17-qpdf-12.patch
|
|
38 |
"${FILESDIR}"/${PN}-2.0.1-CVE-2025-64524.patch
|
| 58 |
39 |
)
|
| 59 |
40 |
|
| 60 |
41 |
src_configure() {
|
| 61 |
|
# Bug #898156
|
| 62 |
|
append-cxxflags -std=c++17
|
|
42 |
# https://github.com/OpenPrinting/cups-filters/issues/605 (bug #944074)
|
|
43 |
append-cflags -std=gnu17
|
| 63 |
44 |
|
| 64 |
45 |
local myeconfargs=(
|
| 65 |
46 |
--enable-imagefilters
|
|
47 |
--enable-driverless
|
|
48 |
--enable-poppler
|
| 66 |
49 |
--localstatedir="${EPREFIX}"/var
|
| 67 |
|
--with-browseremoteprotocols=DNSSD,CUPS
|
| 68 |
|
--with-cups-rundir="${EPREFIX}"/run/cups
|
| 69 |
50 |
--with-fontdir="fonts/conf.avail"
|
| 70 |
|
--with-pdftops=pdftops
|
| 71 |
|
--with-rcdir=no
|
| 72 |
|
--without-php
|
|
51 |
# These are just probed for the path. Always enable them.
|
|
52 |
--with-gs-path="${EPREFIX}"/usr/bin/gs
|
|
53 |
--with-mutool-path="${EPREFIX}"/usr/bin/mutool
|
| 73 |
54 |
|
| 74 |
|
$(use_enable exif)
|
| 75 |
|
$(use_enable dbus)
|
| 76 |
55 |
$(use_enable foomatic)
|
| 77 |
|
$(use_enable ldap)
|
| 78 |
|
$(use_enable pclm)
|
| 79 |
|
$(use_enable pdf mutool)
|
| 80 |
|
$(use_enable postscript ghostscript)
|
| 81 |
|
$(use_enable zeroconf avahi)
|
| 82 |
|
$(use_with jpeg)
|
| 83 |
|
$(use_with png)
|
| 84 |
|
$(use_with tiff)
|
| 85 |
56 |
)
|
| 86 |
57 |
|
| 87 |
58 |
econf "${myeconfargs[@]}"
|
| 88 |
|
|
| 89 |
|
if use perl; then
|
| 90 |
|
pushd "${S}"/scripting/perl > /dev/null || die
|
| 91 |
|
perl-module_src_configure
|
| 92 |
|
popd > /dev/null || die
|
| 93 |
|
fi
|
| 94 |
|
}
|
| 95 |
|
|
| 96 |
|
src_compile() {
|
| 97 |
|
default
|
| 98 |
|
|
| 99 |
|
if use perl; then
|
| 100 |
|
pushd "${S}"/scripting/perl > /dev/null || die
|
| 101 |
|
perl-module_src_compile
|
| 102 |
|
popd > /dev/null || die
|
| 103 |
|
fi
|
| 104 |
|
}
|
| 105 |
|
|
| 106 |
|
src_test() {
|
| 107 |
|
# Avoid perl-module_src_test
|
| 108 |
|
default
|
| 109 |
|
|
| 110 |
|
if use perl; then
|
| 111 |
|
pushd "${S}/scripting/perl" > /dev/null || die
|
| 112 |
|
perl-module_src_test
|
| 113 |
|
popd > /dev/null || die
|
| 114 |
|
fi
|
| 115 |
|
}
|
| 116 |
|
|
| 117 |
|
src_install() {
|
| 118 |
|
default
|
| 119 |
|
|
| 120 |
|
if use perl; then
|
| 121 |
|
pushd "${S}"/scripting/perl > /dev/null || die
|
| 122 |
|
perl-module_src_install
|
| 123 |
|
perl_delete_localpod
|
| 124 |
|
popd > /dev/null || die
|
| 125 |
|
fi
|
| 126 |
|
|
| 127 |
|
if use postscript; then
|
| 128 |
|
# workaround: some printer drivers still require pstoraster and pstopxl, bug #383831
|
| 129 |
|
dosym gstoraster /usr/libexec/cups/filter/pstoraster
|
| 130 |
|
dosym gstopxl /usr/libexec/cups/filter/pstopxl
|
| 131 |
|
fi
|
| 132 |
|
|
| 133 |
|
find "${ED}" \( -name "*.a" -o -name "*.la" \) -delete || die
|
| 134 |
|
|
| 135 |
|
cp "${FILESDIR}"/cups-browsed.init.d-r2 "${T}"/cups-browsed || die
|
| 136 |
|
|
| 137 |
|
if ! use zeroconf ; then
|
| 138 |
|
sed -i -e 's:need cupsd avahi-daemon:need cupsd:g' "${T}"/cups-browsed || die
|
| 139 |
|
sed -i -e 's:cups\.service avahi-daemon\.service:cups.service:g' "${S}"/utils/cups-browsed.service || die
|
| 140 |
|
fi
|
| 141 |
|
|
| 142 |
|
doinitd "${T}"/cups-browsed
|
| 143 |
|
systemd_dounit "${S}"/utils/cups-browsed.service
|
| 144 |
|
}
|
| 145 |
|
|
| 146 |
|
pkg_postinst() {
|
| 147 |
|
if ! use foomatic ; then
|
| 148 |
|
ewarn "You are disabling the foomatic code in cups-filters. Please do that ONLY if absolutely"
|
| 149 |
|
ewarn "necessary. net-print/foomatic-filters as a replacement is deprecated and unmaintained."
|
| 150 |
|
fi
|
| 151 |
59 |
}
|