1. Fixed that cups daemon is not launched
[external/cups.git] / packaging / cups.spec
1 #
2 # "$Id: cups.spec.in 10558 2012-07-27 20:33:27Z mike $"
3 #
4 #   RPM "spec" file for CUPS.
5 #
6 #   Original version by Jason McMullan <jmcc@ontv.com>.
7 #
8 #   Copyright 2007-2012 by Apple Inc.
9 #   Copyright 1999-2007 by Easy Software Products, all rights reserved.
10 #
11 #   These coded instructions, statements, and computer programs are the
12 #   property of Apple Inc. and are protected by Federal copyright
13 #   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
14 #   which should have been included with this file.  If this file is
15 #   file is missing or damaged, see the license at "http://www.cups.org/".
16 #
17
18 # Conditional build options (--with name/--without name):
19 #
20 #   dbus     - Enable/disable DBUS support (default = enable)
21 #   dnssd    - Enable/disable DNS-SD support (default = enable)
22 #   static   - Enable/disable static libraries (default = enable)
23
24 %{!?_with_dbus: %{!?_without_dbus: %define _with_dbus --with-dbus}}
25 %{?_with_dbus: %define _dbus --enable-dbus}
26 %{!?_with_dbus: %define _dbus --disable-dbus}
27
28 %{!?_with_dnssd: %{!?_without_dnssd: %define _with_dnssd --with-dnssd}}
29 %{?_with_dnssd: %define _dnssd --enable-dnssd}
30 %{!?_with_dnssd: %define _dnssd --disable-dnssd}
31
32 %{!?_with_static: %{!?_without_static: %define _without_static --without-static}}
33 %{?_with_static: %define _static --enable-static}
34 %{!?_with_static: %define _static --disable-static}
35
36 %define _unpackaged_files_terminate_build 0
37
38 Summary: CUPS
39 Name: cups
40 Version: 1.6.1
41 Release: 9
42 License: GPLv2, LGPLv2
43 Group: System Environment/Daemons
44 Source: %{name}-%{version}.tar.gz
45
46 Patch01: network-backends-snmp-queries-optional.patch
47 Patch02: get-ppd-file-for-statically-configured-bonjour-shared-queues.patch
48 Patch03: usb-backend-reset-after-job-only-for-specific-devices.patch
49 Patch04: usb-backend-more-quirk-rules.patch
50 Patch05: printers-c-recognize-remote-cups-queue-via-dnssd-uri.patch
51 Patch06: avahi-not-considered-at-some-dnssd-conditionals.patch
52 Patch07: cupsd-conf-remove-obsolete-browse-directives.patch
53 Patch08: filter-out-all-control-characters-from-the-1284-device-id.patch
54 Patch09: ipp-backend-did-not-specify-the-compression-used.patch
55 Patch10: work-around-some-broken-ipp-printers.patch
56 Patch11: prevent-crash-due-to-null-host-name-or-fqdn-from-avahi.patch
57 Patch12: fix-crash-on-shutdown-caused-by-broken-avahi-config.patch
58 Patch13: fix-another-spot-where-avahi-crashes-cupsd-because-it-does-not-handle-null-values-from-its-own-apis.patch
59 Patch14: ipp-backend-abort-the-outer-loop-if-we-get-a-failure-from-send-document.patch
60 Patch15: ipp-backend-could-get-stuck-in-an-endless-loop-on-certain-network-errors.patch
61 Patch16: ipp-backend-did-not-send-cancel-request-to-printers-when-a-job-was-canceled-and-printer-did-not-support-create-job.patch
62 Patch17: get-ppd-file-for-statically-configured-ipp-shared-queues.patch
63 Patch18: pidfile.patch
64 Patch19: ppd-poll-with-client-conf.patch
65 Patch20: manpage-translations.patch
66 Patch21: rootbackends-worldreadable.patch
67 Patch22: airprint-support.patch
68 Patch23: removecvstag.patch
69 Patch24: no-conffile-timestamp.patch
70 Patch25: drop_unnecessary_dependencies.patch
71 Patch26: reactivate_recommended_driver.patch
72 Patch27: read-embedded-options-from-incoming-postscript-and-add-to-ipp-attrs.patch
73 Patch28: do-not-broadcast-with-hostnames.patch
74 Patch29: cups-deviced-allow-device-ids-with-newline.patch
75 Patch30: cups-snmp-oids-device-id-hp-ricoh.patch
76 Patch31: configure-default-browse-protocols.patch
77 Patch32: add-ipp-backend-of-cups-1.4.patch
78 Patch33: logfiles_adm_readable.patch
79 Patch34: default_log_settings.patch
80 Patch35: confdirperms.patch
81 Patch36: printer-filtering.patch
82 Patch37: show-compile-command-lines.patch
83 Patch38: ppdc-dynamic-linking.patch
84 Patch39: log-debug-history-nearly-unlimited.patch
85 Patch40: pstops-based-workflow-only-for-printing-ps-on-a-ps-printer.patch
86 Patch41: tests-ignore-warnings.patch
87 Patch42: tests-ignore-usb-crash.patch
88 Patch43: test-i18n-nonlinux.patch
89 Patch44: tests-slow-lpstat.patch
90 Patch45: forward-port-cups-1-5-x-cups-browsing.patch
91 Patch46: cupsd-no-crash-on-avahi-threaded-poll-shutdown.patch
92 Patch47: CVE-2012-5519.patch
93
94 # Tizen Patch
95 Patch48: tizen_fix_build_error.patch
96 Patch49: tizen_fix_temp_path.patch
97 Patch50: tizen_set_configuration.patch
98 Patch51: tizen_fix_unable_to_locate_printer.patch
99 Patch52: tizen_fix_ps_progress.patch
100 Patch53: tizen_fix_unable_to_find_ipp_printer_temporarily.patch
101 Patch54: tizen_work_around_samsung_ipp_printer.patch
102 Patch55: tizen_fix_ignore_sigpipe.patch
103 Patch56: tizen_add_job_media_progress.patch
104
105 # Use buildroot so as not to disturb the version already installed
106 BuildRoot: /tmp/%{name}-root
107
108 # Dependencies...
109 Requires: %{name}-libs
110 Requires: avahi-libs
111 Requires(post): eglibc
112 BuildRequires:  pkgconfig(gnutls)
113 #BuildRequires:  pkgconfig(libusb)
114 BuildRequires:  libgcrypt-devel
115 BuildRequires:  avahi-libs
116 BuildRequires:  avahi-devel
117 #BuildRequires:  pkgconfig(po4a)
118 Obsoletes: lpd, lpr, LPRng
119 Provides: lpd, lpr, LPRng
120 Obsoletes: cups-da, cups-de, cups-es, cups-et, cups-fi, cups-fr, cups-he
121 Obsoletes: cups-id, cups-it, cups-ja, cups-ko, cups-nl, cups-no, cups-pl
122 Obsoletes: cups-pt, cups-ru, cups-sv, cups-zh
123
124 %package devel
125 Summary: CUPS - development environment
126 Group: Development/Libraries
127 Requires: %{name}-libs
128
129 %package libs
130 Summary: CUPS - shared libraries
131 Group: System Environment/Libraries
132 Provides: libcups1
133
134 %package -n cups-data
135 Summary: CUPS - shared libraries
136 Group: System Environment/Libraries
137 Requires: %{name}
138 Requires: %{name}-libs
139
140 #%package lpd
141 #Summary: CUPS - LPD support
142 #Group: System Environment/Daemons
143 #Requires: %{name} = %{epoch}:%{version} xinetd
144
145 %description
146 CUPS is the standards-based, open source printing system developed by
147 Apple Inc. for OS X and other UNIX®-like operating systems.
148
149 %description devel
150 This package provides the CUPS headers and development environment.
151
152 %description libs
153 This package provides the CUPS shared libraries.
154
155 %description -n cups-data
156 This package provides CUPS configuration files
157
158 #%description lpd
159 #This package provides LPD client support.
160
161 %prep
162 %setup -q
163
164 %patch01 -p1
165 %patch02 -p1
166 %patch03 -p1
167 %patch04 -p1
168 %patch05 -p1
169 %patch06 -p1
170 %patch07 -p1
171 %patch08 -p1
172 %patch09 -p1
173 %patch10 -p1
174 %patch11 -p1
175 %patch12 -p1
176 %patch13 -p1
177 %patch14 -p1
178 %patch15 -p1
179 %patch16 -p1
180 %patch17 -p1
181 %patch18 -p1
182 %patch19 -p1
183 #%patch20 -p1
184 %patch21 -p1
185 %patch22 -p1
186 %patch23 -p1
187 %patch24 -p1
188 %patch25 -p1
189 %patch26 -p1
190 %patch27 -p1
191 %patch28 -p1
192 %patch29 -p1
193 %patch30 -p1
194 %patch31 -p1
195 %patch32 -p1
196 %patch33 -p1
197 %patch34 -p1
198 %patch35 -p1
199 %patch36 -p1
200 %patch37 -p1
201 #%patch38 -p1
202 %patch39 -p1
203 %patch40 -p1
204 %patch41 -p1
205 %patch42 -p1
206 %patch43 -p1
207 %patch44 -p1
208 %patch45 -p1
209 %patch46 -p1
210 %patch47 -p1
211 %patch48 -p1
212 %patch49 -p1
213 %patch50 -p1
214 %patch51 -p1
215 %patch52 -p1
216 %patch53 -p1
217 %patch54 -p1
218 %patch55 -p1
219 %patch56 -p1
220
221 %build
222 %configure \
223     --without-mandir \
224     --without-docdir \
225     --localedir=/usr/share/cups/locale \
226     --sysconfdir=/usr/etc \
227     --localstatedir=/opt/var \
228     --disable-mallinfo \
229     --disable-libpaper \
230     --disable-libusb \
231     --disable-tcp-wrappers \
232     --disable-acl \
233     --disable-dbus \
234     --without-dbusdir \
235     --disable-unit-tests \
236     --disable-relro \
237     --enable-gssapi \
238     --enable-threads \
239     --enable-debug \
240     --enable-debug-printfs \
241     --disable-cdsassl \
242     --enable-gnutls \
243     --disable-openssl \
244     --enable-ssl \
245     --enable-avahi \
246     --disable-dnssd \
247     --disable-pam \
248     --enable-largefile \
249     --disable-launchd \
250     --enable-raw-printing \
251     --without-java --without-php --without-python --without-perl --disable-webif \
252     --with-languages=en --without-smfmanifestdir \
253     --with-local_protocols='dnssd' --without-printcap \
254     --with-remote_protocols='dnssd' --with-log-level=debug --with-system-groups=system,root
255
256 # If we got this far, all prerequisite libraries must be here.
257 make %{?_smp_mflags}
258
259 %install
260 # Make sure the RPM_BUILD_ROOT directory exists.
261 rm -rf $RPM_BUILD_ROOT
262
263 make BUILDROOT=$RPM_BUILD_ROOT install
264
265 mkdir -p %{buildroot}/usr/share/license
266 cp %{_builddir}/%{buildsubdir}/LICENSE.txt %{buildroot}/usr/share/license/cups-libs
267 cp %{_builddir}/%{buildsubdir}/LICENSE.txt %{buildroot}/usr/share/license/cups-data
268 cp %{_builddir}/%{buildsubdir}/LICENSE.txt %{buildroot}/usr/share/license/cups
269
270 %post
271 #if [ ! -z "`getent group app`" ]; then
272     chown -R 5000:5000 /usr/lib/cups/backend/*
273 #fi
274
275 %post -n cups-data
276 mkdir -p /opt/var/run/cups
277 if [ -f /usr/lib/rpm-plugins/msm.so ]
278 then
279         chsmack -a _ /opt/var/run
280         chsmack -a mobileprint /opt/var/run/cups
281 fi
282
283 mkdir -p /opt/etc/cups/ssl
284 mkdir -p /opt/var/spool/
285 mkdir -p /opt/var/spool/cups/
286 mkdir -p /opt/var/spool/cups/tmp
287 mkdir -p /opt/var/cache/cups
288 mkdir -p /opt/var/log/cups
289
290 if [ -f /usr/lib/rpm-plugins/msm.so ]
291 then
292 chsmack -a mobileprint /opt/etc/cups/ssl
293 chsmack -a mobileprint /opt/var/spool/
294 chsmack -a mobileprint /opt/var/spool/cups/
295 chsmack -a mobileprint /opt/var/spool/cups/tmp
296 chsmack -a mobileprint /opt/var/cache/cups
297 chsmack -a mobileprint /opt/var/log/cups
298 fi
299
300 #if [ ! -z "`getent group app`" ]; then
301     chown -R 5000:5000 /opt/etc/cups/
302     chown -R 5000:5000 /opt/var/run/cups/
303     chown -R 5000:5000 /opt/var/spool/cups/
304     chown -R 5000:5000 /opt/var/cache/cups/
305     chown -R 5000:5000 /opt/var/log/cups/
306     chown -R 5000:5000 /usr/lib/cups/backend/*
307 #fi
308
309 if [ -f /usr/lib/rpm-plugins/msm.so ]
310 then
311         chsmack -a mobileprint /opt/etc/cups/
312         chsmack -t /opt/etc/cups/
313         chsmack -a mobileprint /opt/etc/cups/ssl
314 fi
315
316 # Deal with config migration due to CVE-2012-5519 (STR #4223)
317 IN=/usr/etc/cups/cupsd.conf
318 OUT=/usr/etc/cups/cups-files.conf
319 copiedany=no
320 for keyword in AccessLog CacheDir ConfigFilePerm        \
321     DataDir DocumentRoot ErrorLog FatalErrors           \
322     FileDevice FontPath Group LogFilePerm               \
323     LPDConfigFile PageLog Printcap PrintcapFormat       \
324     RemoteRoot RequestRoot ServerBin ServerCertificate  \
325     ServerKey ServerRoot SMBConfigFile StateDir         \
326     SystemGroup SystemGroupAuthKey TempDir User; do
327     if ! /bin/grep -iq ^$keyword "$IN"; then continue; fi
328     copy=yes
329     if /bin/grep -iq ^$keyword "$OUT"; then
330         if [ "`/bin/grep -i ^$keyword "$IN"`" ==        \
331              "`/bin/grep -i ^$keyword "$OUT"`" ]; then
332             copy=no
333         else
334             /bin/sed -i -e "s,^$keyword,#$keyword,i" "$OUT" || :
335         fi
336     fi
337     if [ "$copy" == "yes" ]; then
338         if [ "$copiedany" == "no" ]; then
339             (cat >> "$OUT" <<EOF
340
341 # Settings automatically moved from cupsd.conf by RPM package:
342 EOF
343             ) || :
344         fi
345
346         (/bin/grep -i ^$keyword "$IN" >> "$OUT") || :
347         copiedany=yes
348     fi
349
350     /bin/sed -i -e "s,^$keyword,#$keyword,i" "$IN" || :
351 done
352 exit 0
353
354 %post libs
355 /sbin/ldconfig
356
357 %postun libs
358 /sbin/ldconfig
359
360 %clean
361 rm -rf $RPM_BUILD_ROOT
362
363 %files
364 %manifest cups.manifest
365 #%docdir /usr/share/doc/cups
366 %defattr(-,root,root)
367 /usr/share/license/%{name}
368
369 #%if %{?_with_dbus:1}%{!?_with_dbus:0}
370 # DBUS
371 #/etc/dbus-1/system.d/*
372 #%endif
373
374 # PAM
375 #%dir /etc/pam.d
376 #/etc/pam.d/*
377
378 # RC dirs are a pain under Linux...  Uncomment the appropriate ones if you
379 # don't use Red Hat or Mandrake...
380
381 #/etc/init.d/*
382 #/etc/rc0.d/*
383 #/etc/rc2.d/*
384 #/etc/rc3.d/*
385 #/etc/rc5.d/*
386
387 # OLD RedHat/Mandrake
388 #/etc/rc.d/init.d/*
389 #/etc/rc.d/rc0.d/*
390 #/etc/rc.d/rc2.d/*
391 #/etc/rc.d/rc3.d/*
392 #/etc/rc.d/rc5.d/*
393
394 #/sbin/rc.d/*
395 #/sbin/rc.d/rc0.d/*
396 #/sbin/rc.d/rc2.d/*
397 #/sbin/rc.d/rc3.d/*
398 #/sbin/rc.d/rc5.d/*
399 /usr/bin/ppdc
400 /usr/bin/cancel
401 /usr/bin/cupstestdsc
402 /usr/bin/cupstestppd
403 /usr/bin/ipptool
404 /usr/bin/lp
405 /usr/bin/lpoptions
406 /usr/bin/lppasswd
407 /usr/bin/lpstat
408 %attr(0755,root,root) %dir /usr/lib/cups
409 %attr(0755,root,root) %dir /usr/lib/cups/backend
410 /usr/lib/cups/backend/dnssd
411 /usr/lib/cups/backend/http
412 /usr/lib/cups/backend/https
413 /usr/lib/cups/backend/ipp
414 /usr/lib/cups/backend/ipp14
415 /usr/lib/cups/backend/ipps
416 /usr/lib/cups/backend/lpd
417
418 /usr/lib/cups/backend/snmp
419 /usr/lib/cups/backend/socket
420 /usr/lib/cups/backend/usb
421 %exclude %attr(0755,root,root) %dir /usr/lib/cups/cgi-bin
422 %exclude /usr/lib/cups/cgi-bin/*
423 %attr(0755,root,root) %dir /usr/lib/cups/daemon
424 /usr/lib/cups/daemon/cups-deviced
425 /usr/lib/cups/daemon/cups-driverd
426 /usr/lib/cups/daemon/cups-exec
427 /usr/lib/cups/daemon/cups-polld
428 %dir /usr/lib/cups/driver
429 %attr(0755,root,root) %dir /usr/lib/cups/filter
430 /usr/lib/cups/filter/*
431 %exclude /usr/lib/cups/filter/rastertodymo
432 %exclude /usr/lib/cups/filter/rastertoepson
433 %exclude /usr/lib/cups/filter/rastertohp
434 %exclude /usr/lib/cups/filter/rastertolabel
435 %attr(0755,root,root) %dir /usr/lib/cups/monitor
436 /usr/lib/cups/monitor/*
437 %attr(0755,root,root) %dir /usr/lib/cups/notifier
438 %exclude /usr/lib/cups/notifier/*
439 %attr(0755, root, root) /usr/sbin/cupsaccept
440 %attr(0755, root, root) /usr/sbin/cupsaddsmb
441 %attr(0755, root, root) /usr/sbin/cupsctl
442 %attr(0755, root, root) /usr/sbin/cupsd
443 %attr(0755, root, root) /usr/sbin/cupsfilter
444 %attr(0755, root, root) /usr/sbin/lpadmin
445 %attr(0755, root, root) /usr/sbin/lpc
446 %attr(0755, root, root) /usr/sbin/lpinfo
447 %attr(0755, root, root) /usr/sbin/lpmove
448 %attr(-,root,root) %dir /usr/share/cups
449 #%dir /usr/share/cups/charsets
450 #/usr/share/cups/charsets/*
451 %dir /usr/share/cups/mime
452 /usr/share/cups/mime/*
453 %dir /usr/share/cups/model
454 %dir /usr/share/cups/ppdc
455 /usr/share/cups/ppdc/*
456
457 %files libs
458 %manifest cups-libs.manifest
459 %defattr(-,root,root)
460 /usr/share/license/cups-libs
461 /usr/lib/*.so.*
462
463 %files devel
464 %defattr(-,root,root)
465 %{_bindir}/cups-config
466 %{_libdir}/*.so
467 %{_includedir}/cups
468 /usr/share/cups/ipptool/*
469 /usr/lib/cups/backend/pseudo
470
471 %files -n cups-data
472 %manifest cups-data.manifest
473 %defattr(-,root,root)
474 /usr/share/license/cups-data
475 /usr/etc/cups/*.conf
476 %dir /usr/etc/cups/interfaces
477 %attr(0755,app,app) %dir /opt/var/cache/cups
478 %attr(0775,app,app) %dir /opt/var/cache/cups/rss
479 %attr(0755,app,app) %dir /opt/var/log/cups
480 %attr(0755,app,app) %dir /opt/var/run/cups
481 %attr(0711,app,app) %dir /opt/var/run/cups/certs
482 %attr(0755,app,app) %dir /opt/var/spool/cups
483 %attr(1777,app,app) %dir /opt/var/spool/cups/tmp
484
485 #%files lpd
486 #%defattr(-,app,app)
487 #/opt/etc/xinetd.d/cups-lpd
488 #%dir /usr/lib/cups
489 #%dir /usr/lib/cups/daemon
490 #/usr/lib/cups/daemon/cups-lpd
491 #%dir /usr/share/man/man8
492 #/usr/share/man/man8/cups-lpd.8.gz
493
494
495 #
496 # End of "$Id: cups.spec.in 10558 2012-07-27 20:33:27Z mike $".
497 #