cups.inc 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. SUMMARY = "An Internet printing system for Unix"
  2. SECTION = "console/utils"
  3. LICENSE = "GPLv2 & LGPLv2"
  4. DEPENDS = "gnutls libpng jpeg dbus dbus-glib zlib libusb"
  5. SRC_URI = "https://github.com/apple/cups/releases/download/v${PV}/${BP}-source.tar.gz \
  6. file://use_echo_only_in_init.patch \
  7. file://0001-don-t-try-to-run-generated-binaries.patch \
  8. file://cups_serverbin.patch \
  9. "
  10. UPSTREAM_CHECK_URI = "https://github.com/apple/cups/releases"
  11. UPSTREAM_CHECK_REGEX = "cups-(?P<pver>\d+\.\d+(\.\d+)?)-source.tar"
  12. LEAD_SONAME = "libcupsdriver.so"
  13. CLEANBROKEN = "1"
  14. inherit autotools-brokensep binconfig useradd systemd pkgconfig
  15. USERADD_PACKAGES = "${PN}"
  16. GROUPADD_PARAM_${PN} = "--system lpadmin"
  17. SYSTEMD_SERVICE_${PN} = "org.cups.cupsd.socket org.cups.cupsd.path org.cups.cupsd.service org.cups.cups-lpd.socket org.cups.cups-lpd@.service"
  18. PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'avahi', '', d)} \
  19. ${@bb.utils.filter('DISTRO_FEATURES', 'pam systemd', d)}"
  20. PACKAGECONFIG[avahi] = "--enable-avahi,--disable-avahi,avahi"
  21. PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl"
  22. PACKAGECONFIG[pam] = "--enable-pam, --disable-pam, libpam"
  23. PACKAGECONFIG[systemd] = "--with-systemd=${systemd_system_unitdir},--without-systemd,systemd"
  24. PACKAGECONFIG[xinetd] = "--with-xinetd=${sysconfdir}/xinetd.d,--without-xinetd,xinetd"
  25. EXTRA_OECONF = " \
  26. --enable-gnutls \
  27. --enable-dbus \
  28. --enable-browsing \
  29. --disable-gssapi \
  30. --enable-debug \
  31. --disable-relro \
  32. --enable-libusb \
  33. --without-php \
  34. --without-perl \
  35. --without-python \
  36. --without-java \
  37. DSOFLAGS='${LDFLAGS}' \
  38. "
  39. EXTRA_AUTORECONF += "--exclude=autoheader"
  40. do_compile () {
  41. echo "all:" > man/Makefile
  42. echo "libs:" >> man/Makefile
  43. echo "install:" >> man/Makefile
  44. echo "install-data:" >> man/Makefile
  45. echo "install-exec:" >> man/Makefile
  46. echo "install-headers:" >> man/Makefile
  47. echo "install-libs:" >> man/Makefile
  48. oe_runmake
  49. }
  50. do_install () {
  51. oe_runmake "DSTROOT=${D}" install
  52. # Remove /var/run from package as cupsd will populate it on startup
  53. rm -fr ${D}/${localstatedir}/run
  54. rmdir ${D}/${libdir}/${BPN}/driver
  55. # Fix the pam configuration file permissions
  56. if ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'true', 'false', d)}; then
  57. chmod 0644 ${D}${sysconfdir}/pam.d/cups
  58. fi
  59. # Remove sysinit script and symlinks if sysvinit is not in DISTRO_FEATURES
  60. if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','false','true',d)}; then
  61. rm -rf ${D}${sysconfdir}/init.d/
  62. rm -rf ${D}${sysconfdir}/rc*
  63. fi
  64. }
  65. python do_package_append() {
  66. import subprocess
  67. # Change permissions back the way they were, they probably had a reason...
  68. workdir = d.getVar('WORKDIR')
  69. subprocess.call('chmod 0511 %s/install/cups/var/run/cups/certs' % workdir, shell=True)
  70. }
  71. PACKAGES =+ "${PN}-lib ${PN}-libimage"
  72. RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'procps', '', d)}"
  73. FILES_${PN} += "${libdir}/cups/backend \
  74. ${libdir}/cups/cgi-bin \
  75. ${libdir}/cups/filter \
  76. ${libdir}/cups/monitor \
  77. ${libdir}/cups/notifier \
  78. ${libdir}/cups/daemon \
  79. "
  80. FILES_${PN}-lib = "${libdir}/libcups.so.*"
  81. FILES_${PN}-libimage = "${libdir}/libcupsimage.so.*"
  82. #package the html for the webgui inside the main packages (~1MB uncompressed)
  83. FILES_${PN} += "${datadir}/doc/cups/images \
  84. ${datadir}/doc/cups/*html \
  85. ${datadir}/doc/cups/*.css \
  86. ${datadir}/icons/ \
  87. "
  88. CONFFILES_${PN} += "${sysconfdir}/cups/cupsd.conf"
  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=${libdir}/cups:'
  92. }