xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-extended/cups/cups.inc (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunSUMMARY = "An Internet printing system for Unix"
2*4882a593SmuzhiyunDESCRIPTION = "The Common UNIX Printing System is a printing system and \
3*4882a593Smuzhiyungeneral replacement for lpd and the like. It supports the Internet Printing \
4*4882a593SmuzhiyunProtocol (IPP), and has its own filtering driver model for handling various \
5*4882a593Smuzhiyundocument types."
6*4882a593SmuzhiyunHOMEPAGE = "https://www.cups.org/"
7*4882a593SmuzhiyunSECTION = "console/utils"
8*4882a593SmuzhiyunLICENSE = "Apache-2.0"
9*4882a593SmuzhiyunDEPENDS = "libpng jpeg dbus zlib libusb1"
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunSRC_URI = "https://github.com/OpenPrinting/cups/releases/download/v${PV}/cups-${PV}-source.tar.gz \
12*4882a593Smuzhiyun           file://0001-use-echo-only-in-init.patch \
13*4882a593Smuzhiyun           file://0002-don-t-try-to-run-generated-binaries.patch \
14*4882a593Smuzhiyun           file://libexecdir.patch \
15*4882a593Smuzhiyun           file://0004-cups-fix-multilib-install-file-conflicts.patch \
16*4882a593Smuzhiyun           file://volatiles.99_cups \
17*4882a593Smuzhiyun           file://cups-volatiles.conf \
18*4882a593Smuzhiyun           "
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunUPSTREAM_CHECK_URI = "https://github.com/OpenPrinting/cups/releases"
21*4882a593SmuzhiyunUPSTREAM_CHECK_REGEX = "cups-(?P<pver>(?!.+\d(b|rc)\d.+).+)-source.tar"
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun# Issue only applies to MacOS
24*4882a593SmuzhiyunCVE_CHECK_IGNORE += "CVE-2008-1033"
25*4882a593Smuzhiyun# Issue affects pdfdistiller plugin used with but not part of cups
26*4882a593SmuzhiyunCVE_CHECK_IGNORE += "CVE-2009-0032"
27*4882a593Smuzhiyun# This is an Ubuntu only issue.
28*4882a593SmuzhiyunCVE_CHECK_IGNORE += "CVE-2018-6553"
29*4882a593Smuzhiyun# This is fixed in 2.4.2 but the cve-check class still reports it
30*4882a593SmuzhiyunCVE_CHECK_IGNORE += "CVE-2022-26691"
31*4882a593Smuzhiyun
32*4882a593SmuzhiyunLEAD_SONAME = "libcupsdriver.so"
33*4882a593Smuzhiyun
34*4882a593SmuzhiyunCLEANBROKEN = "1"
35*4882a593Smuzhiyun
36*4882a593Smuzhiyuninherit autotools-brokensep binconfig useradd systemd pkgconfig multilib_script
37*4882a593Smuzhiyun
38*4882a593SmuzhiyunUSERADD_PACKAGES = "${PN}"
39*4882a593SmuzhiyunGROUPADD_PARAM:${PN} = "--system lpadmin"
40*4882a593Smuzhiyun
41*4882a593SmuzhiyunSYSTEMD_SERVICE:${PN} = "cups.socket cups.path cups.service cups-lpd.socket"
42*4882a593Smuzhiyun
43*4882a593SmuzhiyunPACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'avahi', '', d)} \
44*4882a593Smuzhiyun                   ${@bb.utils.filter('DISTRO_FEATURES', 'pam systemd', d)}"
45*4882a593SmuzhiyunPACKAGECONFIG[avahi] = "--with-dnssd=avahi,--with-dnssd=no,avahi"
46*4882a593SmuzhiyunPACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl"
47*4882a593SmuzhiyunPACKAGECONFIG[gnutls] = "--with-tls=gnutls,--with-tls=no,gnutls"
48*4882a593SmuzhiyunPACKAGECONFIG[pam] = "--enable-pam --with-pam-module=unix, --disable-pam, libpam"
49*4882a593SmuzhiyunPACKAGECONFIG[systemd] = "--with-systemd=${systemd_system_unitdir},--without-systemd,systemd"
50*4882a593SmuzhiyunPACKAGECONFIG[xinetd] = "--with-xinetd=${sysconfdir}/xinetd.d,--without-xinetd,xinetd"
51*4882a593SmuzhiyunPACKAGECONFIG[webif] = "--enable-webif,--disable-webif"
52*4882a593Smuzhiyun
53*4882a593SmuzhiyunEXTRA_OECONF = " \
54*4882a593Smuzhiyun               --enable-dbus \
55*4882a593Smuzhiyun               --with-dbusdir=${sysconfdir}/dbus-1 \
56*4882a593Smuzhiyun               --enable-browsing \
57*4882a593Smuzhiyun               --disable-gssapi \
58*4882a593Smuzhiyun               --enable-debug \
59*4882a593Smuzhiyun               --disable-relro \
60*4882a593Smuzhiyun               --enable-libusb \
61*4882a593Smuzhiyun               --with-system-groups=lpadmin \
62*4882a593Smuzhiyun               --with-cups-group=lp \
63*4882a593Smuzhiyun               --with-domainsocket=/run/cups/cups.sock \
64*4882a593Smuzhiyun               --with-pkgconfpath=${libdir}/pkgconfig \
65*4882a593Smuzhiyun               DSOFLAGS='${LDFLAGS}' \
66*4882a593Smuzhiyun               "
67*4882a593Smuzhiyun
68*4882a593SmuzhiyunEXTRA_AUTORECONF += "--exclude=autoheader"
69*4882a593Smuzhiyun
70*4882a593Smuzhiyundo_install () {
71*4882a593Smuzhiyun	oe_runmake "BUILDROOT=${D}" install
72*4882a593Smuzhiyun
73*4882a593Smuzhiyun	# Remove /var/run from package as cupsd will populate it on startup
74*4882a593Smuzhiyun	rm -fr ${D}/${localstatedir}/run
75*4882a593Smuzhiyun	rm -fr ${D}/${localstatedir}/log
76*4882a593Smuzhiyun	rmdir ${D}/${libexecdir}/${BPN}/driver
77*4882a593Smuzhiyun
78*4882a593Smuzhiyun	# Fix the pam configuration file permissions
79*4882a593Smuzhiyun	if ${@bb.utils.contains('PACKAGECONFIG', 'pam', 'true', 'false', d)}; then
80*4882a593Smuzhiyun	    chmod 0644 ${D}${sysconfdir}/pam.d/cups
81*4882a593Smuzhiyun	fi
82*4882a593Smuzhiyun
83*4882a593Smuzhiyun	# Remove sysinit script and symlinks if sysvinit is not in DISTRO_FEATURES
84*4882a593Smuzhiyun	if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','false','true',d)}; then
85*4882a593Smuzhiyun	    rm -rf ${D}${sysconfdir}/init.d/
86*4882a593Smuzhiyun	    rm -rf ${D}${sysconfdir}/rc*
87*4882a593Smuzhiyun	    install -d ${D}${sysconfdir}/tmpfiles.d
88*4882a593Smuzhiyun	    install -m 0644 ${WORKDIR}/cups-volatiles.conf \
89*4882a593Smuzhiyun		    ${D}${sysconfdir}/tmpfiles.d/cups.conf
90*4882a593Smuzhiyun	else
91*4882a593Smuzhiyun	    install -d ${D}${sysconfdir}/default/volatiles
92*4882a593Smuzhiyun	    install -m 0644 ${WORKDIR}/volatiles.99_cups \
93*4882a593Smuzhiyun		    ${D}${sysconfdir}/default/volatiles/99_cups
94*4882a593Smuzhiyun	fi
95*4882a593Smuzhiyun}
96*4882a593Smuzhiyun
97*4882a593SmuzhiyunPACKAGES =+ "${PN}-lib ${PN}-libimage ${PN}-webif"
98*4882a593Smuzhiyun
99*4882a593SmuzhiyunRDEPENDS:${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'procps', '', d)}"
100*4882a593SmuzhiyunFILES:${PN} += "${libexecdir}/cups/"
101*4882a593Smuzhiyun
102*4882a593SmuzhiyunFILES:${PN}-lib = "${libdir}/libcups.so.*"
103*4882a593Smuzhiyun
104*4882a593SmuzhiyunFILES:${PN}-libimage = "${libdir}/libcupsimage.so.*"
105*4882a593Smuzhiyun
106*4882a593Smuzhiyun# put the html for the web interface into its own PACKAGE
107*4882a593SmuzhiyunFILES:${PN}-webif += "${datadir}/doc/cups/ ${datadir}/icons/"
108*4882a593SmuzhiyunRRECOMMENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'webif', '${PN}-webif', '', d)}"
109*4882a593Smuzhiyun
110*4882a593SmuzhiyunCONFFILES:${PN} += "${sysconfdir}/cups/cupsd.conf"
111*4882a593Smuzhiyun
112*4882a593SmuzhiyunMULTILIB_SCRIPTS = "${PN}-dev:${bindir}/cups-config"
113*4882a593Smuzhiyun
114*4882a593SmuzhiyunSYSROOT_PREPROCESS_FUNCS += "cups_sysroot_preprocess"
115*4882a593Smuzhiyuncups_sysroot_preprocess () {
116*4882a593Smuzhiyun	sed -i ${SYSROOT_DESTDIR}${bindir_crossscripts}/cups-config -e 's:cups_datadir=.*:cups_datadir=${datadir}/cups:' -e 's:cups_serverbin=.*:cups_serverbin=${libexecdir}/cups:'
117*4882a593Smuzhiyun}
118*4882a593Smuzhiyun
119*4882a593Smuzhiyun# -25317 concerns /var/log/cups having lp ownership.  Our /var/log/cups is
120*4882a593Smuzhiyun# root:root, so this doesn't apply.
121*4882a593SmuzhiyunCVE_CHECK_IGNORE += "CVE-2021-25317"
122