blob: c3fa45941c2bfda537c989a7ee623baadcda5abf [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "An Internet printing system for Unix"
2SECTION = "console/utils"
3LICENSE = "GPLv2 & LGPLv2"
4DEPENDS = "gnutls libpng jpeg dbus dbus-glib zlib libusb"
5
Brad Bishop6e60e8b2018-02-01 10:27:11 -05006SRC_URI = "https://github.com/apple/cups/releases/download/v${PV}/${BP}-source.tar.gz \
Patrick Williamsc124f4f2015-09-15 14:41:29 -05007 file://use_echo_only_in_init.patch \
8 file://0001-don-t-try-to-run-generated-binaries.patch \
9 file://cups_serverbin.patch \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010 "
11
Patrick Williamsc0f7c042017-02-23 20:41:17 -060012UPSTREAM_CHECK_URI = "https://github.com/apple/cups/releases"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050013UPSTREAM_CHECK_REGEX = "cups-(?P<pver>\d+\.\d+(\.\d+)?)-source.tar"
14
Patrick Williamsc124f4f2015-09-15 14:41:29 -050015LEAD_SONAME = "libcupsdriver.so"
16
17CLEANBROKEN = "1"
18
Brad Bishop6e60e8b2018-02-01 10:27:11 -050019inherit autotools-brokensep binconfig useradd systemd pkgconfig
Patrick Williamsc124f4f2015-09-15 14:41:29 -050020
21USERADD_PACKAGES = "${PN}"
22GROUPADD_PARAM_${PN} = "--system lpadmin"
23
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050024SYSTEMD_SERVICE_${PN} = "org.cups.cupsd.socket org.cups.cupsd.path org.cups.cupsd.service org.cups.cups-lpd.socket org.cups.cups-lpd@.service"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050025
26PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'avahi', '', d)} \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050027 ${@bb.utils.filter('DISTRO_FEATURES', 'pam systemd', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028PACKAGECONFIG[avahi] = "--enable-avahi,--disable-avahi,avahi"
29PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl"
30PACKAGECONFIG[pam] = "--enable-pam, --disable-pam, libpam"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050031PACKAGECONFIG[systemd] = "--with-systemd=${systemd_system_unitdir},--without-systemd,systemd"
Patrick Williamsf1e5d692016-03-30 15:21:19 -050032PACKAGECONFIG[xinetd] = "--with-xinetd=${sysconfdir}/xinetd.d,--without-xinetd,xinetd"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050033
34EXTRA_OECONF = " \
35 --enable-gnutls \
36 --enable-dbus \
37 --enable-browsing \
38 --disable-gssapi \
39 --enable-debug \
40 --disable-relro \
41 --enable-libusb \
42 --without-php \
43 --without-perl \
44 --without-python \
45 --without-java \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060046 DSOFLAGS='${LDFLAGS}' \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050047 "
48
49EXTRA_AUTORECONF += "--exclude=autoheader"
50
51do_compile () {
52 echo "all:" > man/Makefile
53 echo "libs:" >> man/Makefile
54 echo "install:" >> man/Makefile
55 echo "install-data:" >> man/Makefile
56 echo "install-exec:" >> man/Makefile
57 echo "install-headers:" >> man/Makefile
58 echo "install-libs:" >> man/Makefile
59
60 oe_runmake
61}
62
63do_install () {
64 oe_runmake "DSTROOT=${D}" install
65
66 # Remove /var/run from package as cupsd will populate it on startup
67 rm -fr ${D}/${localstatedir}/run
68 rmdir ${D}/${libdir}/${BPN}/driver
69
Patrick Williamsf1e5d692016-03-30 15:21:19 -050070 # Fix the pam configuration file permissions
71 if ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'true', 'false', d)}; then
72 chmod 0644 ${D}${sysconfdir}/pam.d/cups
73 fi
74
Patrick Williamsc124f4f2015-09-15 14:41:29 -050075 # Remove sysinit script and symlinks if sysvinit is not in DISTRO_FEATURES
76 if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','false','true',d)}; then
77 rm -rf ${D}${sysconfdir}/init.d/
78 rm -rf ${D}${sysconfdir}/rc*
79 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -050080}
81
82python do_package_append() {
83 import subprocess
84 # Change permissions back the way they were, they probably had a reason...
Brad Bishop6e60e8b2018-02-01 10:27:11 -050085 workdir = d.getVar('WORKDIR')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050086 subprocess.call('chmod 0511 %s/install/cups/var/run/cups/certs' % workdir, shell=True)
87}
88
89PACKAGES =+ "${PN}-lib ${PN}-libimage"
90
91RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'procps', '', d)}"
92FILES_${PN} += "${libdir}/cups/backend \
93 ${libdir}/cups/cgi-bin \
94 ${libdir}/cups/filter \
95 ${libdir}/cups/monitor \
96 ${libdir}/cups/notifier \
97 ${libdir}/cups/daemon \
98 "
99
100FILES_${PN}-lib = "${libdir}/libcups.so.*"
101
102FILES_${PN}-libimage = "${libdir}/libcupsimage.so.*"
103
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500104#package the html for the webgui inside the main packages (~1MB uncompressed)
105
106FILES_${PN} += "${datadir}/doc/cups/images \
107 ${datadir}/doc/cups/*html \
108 ${datadir}/doc/cups/*.css \
109 ${datadir}/icons/ \
110 "
111CONFFILES_${PN} += "${sysconfdir}/cups/cupsd.conf"
112
113SYSROOT_PREPROCESS_FUNCS += "cups_sysroot_preprocess"
114cups_sysroot_preprocess () {
115 sed -i ${SYSROOT_DESTDIR}${bindir_crossscripts}/cups-config -e 's:cups_datadir=.*:cups_datadir=${datadir}/cups:' -e 's:cups_serverbin=.*:cups_serverbin=${libdir}/cups:'
116}