cups.inc 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. SUMMARY = "An Internet printing system for Unix"
  2. DESCRIPTION = "The Common UNIX Printing System is a printing system and \
  3. general replacement for lpd and the like. It supports the Internet Printing \
  4. Protocol (IPP), and has its own filtering driver model for handling various \
  5. document types."
  6. HOMEPAGE = "https://www.cups.org/"
  7. SECTION = "console/utils"
  8. LICENSE = "Apache-2.0"
  9. DEPENDS = "libpng jpeg dbus zlib libusb1"
  10. SRC_URI = "https://github.com/OpenPrinting/cups/releases/download/v${PV}/cups-${PV}-source.tar.gz \
  11. file://0001-use-echo-only-in-init.patch \
  12. file://0002-don-t-try-to-run-generated-binaries.patch \
  13. file://libexecdir.patch \
  14. file://0004-cups-fix-multilib-install-file-conflicts.patch \
  15. file://volatiles.99_cups \
  16. file://cups-volatiles.conf \
  17. "
  18. UPSTREAM_CHECK_URI = "https://github.com/OpenPrinting/cups/releases"
  19. UPSTREAM_CHECK_REGEX = "cups-(?P<pver>.+)-source.tar"
  20. # Issue only applies to MacOS
  21. CVE_CHECK_WHITELIST += "CVE-2008-1033"
  22. # Issue affects pdfdistiller plugin used with but not part of cups
  23. CVE_CHECK_WHITELIST += "CVE-2009-0032"
  24. # This is an Ubuntu only issue.
  25. CVE_CHECK_WHITELIST += "CVE-2018-6553"
  26. LEAD_SONAME = "libcupsdriver.so"
  27. CLEANBROKEN = "1"
  28. inherit autotools-brokensep binconfig useradd systemd pkgconfig multilib_script
  29. USERADD_PACKAGES = "${PN}"
  30. GROUPADD_PARAM_${PN} = "--system lpadmin"
  31. SYSTEMD_SERVICE_${PN} = "cups.socket cups.path cups.service cups-lpd.socket"
  32. PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'avahi', '', d)} \
  33. ${@bb.utils.filter('DISTRO_FEATURES', 'pam systemd', d)}"
  34. PACKAGECONFIG[avahi] = "--enable-avahi,--disable-avahi,avahi"
  35. PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl"
  36. PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls"
  37. PACKAGECONFIG[pam] = "--enable-pam --with-pam-module=unix, --disable-pam, libpam"
  38. PACKAGECONFIG[systemd] = "--with-systemd=${systemd_system_unitdir},--without-systemd,systemd"
  39. PACKAGECONFIG[xinetd] = "--with-xinetd=${sysconfdir}/xinetd.d,--without-xinetd,xinetd"
  40. EXTRA_OECONF = " \
  41. --enable-dbus \
  42. --enable-browsing \
  43. --disable-gssapi \
  44. --enable-debug \
  45. --disable-relro \
  46. --enable-libusb \
  47. --with-system-groups=lpadmin \
  48. --with-cups-group=lp \
  49. --with-domainsocket=/run/cups/cups.sock \
  50. DSOFLAGS='${LDFLAGS}' \
  51. "
  52. EXTRA_AUTORECONF += "--exclude=autoheader"
  53. do_install () {
  54. oe_runmake "DESTDIR=${D}" install
  55. # Remove /var/run from package as cupsd will populate it on startup
  56. rm -fr ${D}/${localstatedir}/run
  57. rm -fr ${D}/${localstatedir}/log
  58. rmdir ${D}/${libexecdir}/${BPN}/driver
  59. # Fix the pam configuration file permissions
  60. if ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'true', 'false', d)}; then
  61. chmod 0644 ${D}${sysconfdir}/pam.d/cups
  62. fi
  63. # Remove sysinit script and symlinks if sysvinit is not in DISTRO_FEATURES
  64. if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','false','true',d)}; then
  65. rm -rf ${D}${sysconfdir}/init.d/
  66. rm -rf ${D}${sysconfdir}/rc*
  67. install -d ${D}${sysconfdir}/tmpfiles.d
  68. install -m 0644 ${WORKDIR}/cups-volatiles.conf \
  69. ${D}${sysconfdir}/tmpfiles.d/cups.conf
  70. else
  71. install -d ${D}${sysconfdir}/default/volatiles
  72. install -m 0644 ${WORKDIR}/volatiles.99_cups \
  73. ${D}${sysconfdir}/default/volatiles/99_cups
  74. fi
  75. }
  76. PACKAGES =+ "${PN}-lib ${PN}-libimage"
  77. RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'procps', '', d)}"
  78. FILES_${PN} += "${libexecdir}/cups/"
  79. FILES_${PN}-lib = "${libdir}/libcups.so.*"
  80. FILES_${PN}-libimage = "${libdir}/libcupsimage.so.*"
  81. #package the html for the webgui inside the main packages (~1MB uncompressed)
  82. FILES_${PN} += "${datadir}/doc/cups/images \
  83. ${datadir}/doc/cups/*html \
  84. ${datadir}/doc/cups/*.css \
  85. ${datadir}/icons/ \
  86. "
  87. CONFFILES_${PN} += "${sysconfdir}/cups/cupsd.conf"
  88. MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/cups-config"
  89. SYSROOT_PREPROCESS_FUNCS += "cups_sysroot_preprocess"
  90. cups_sysroot_preprocess () {
  91. sed -i ${SYSROOT_DESTDIR}${bindir_crossscripts}/cups-config -e 's:cups_datadir=.*:cups_datadir=${datadir}/cups:' -e 's:cups_serverbin=.*:cups_serverbin=${libexecdir}/cups:'
  92. }
  93. # -25317 concerns /var/log/cups having lp ownership. Our /var/log/cups is
  94. # root:root, so this doesn't apply.
  95. CVE_CHECK_WHITELIST += "CVE-2021-25317"