3 # Sample debian/rules that uses debhelper.
4 # GNU copyright 1997 to 1999 by Joey Hess.
6 # Modified to make a template file for a multi-binary package with separated
7 # build-arch and build-indep targets by Bill Allombert 2001
9 # Uncomment this to turn on verbose mode.
12 # work around libpng crash on our test PNGs with 8 bit colormaps (LP #710881)
13 export NO_PNG_PKG_MANGLE=1
15 #export DEB_BUILD_MAINT_OPTIONS=hardening
16 #DPKG_EXPORT_BUILDFLAGS=1
17 #include /usr/share/dpkg/buildflags.mk
18 LDFLAGS+= -Wl,--as-needed
20 include /usr/share/cdbs/1/rules/debhelper.mk
21 include /usr/share/cdbs/1/class/autotools.mk
23 DEB_CONFIGURE_EXTRA_FLAGS := --with-optim=$(DEB_OPTFLAGS) --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
24 --mandir=/usr/share/man \
25 --with-docdir=/usr/share/cups/doc-root \
26 --localedir=/usr/share/cups/locale \
27 --sysconfdir=/opt/etc \
28 --localstatedir=/opt/var \
32 --disable-tcp-wrappers \
35 --disable-unit-tests \
54 --enable-raw-printing \
58 --without-java --without-php --without-python --without-perl --enable-webif \
59 --with-languages=en --without-smfmanifestdir --withou-printcap \
60 --with-local_protocols='CUPS dnssd' \
61 --with-remote_protocols='CUPS dnssd'
63 #ifeq ($(DEB_HOST_ARCH_OS),hurd)
64 #DEB_CONFIGURE_EXTRA_FLAGS += --disable-libusb
66 #DEB_CONFIGURE_EXTRA_FLAGS += --enable-libusb
69 DEB_MAKE_INSTALL_TARGET := install BUILDROOT=$(DEB_DESTDIR)
70 DEB_INSTALL_CHANGELOGS_ALL := CHANGES.txt
72 ifeq ($(shell dpkg-vendor --query vendor), Ubuntu)
73 DEB_DH_INSTALLINIT_ARGS := --upstart-only
75 DEB_DH_INSTALLINIT_ARGS := -u'start 50 2 3 4 5 . stop 80 1 .'
78 DEB_DH_STRIP_ARGS := --dbg-package=cups-dbg
79 DEB_DH_FIXPERMS_ARGS := -Xusr/lib/cups/backend-available
80 DEB_DH_COMPRESS_ARGS := -Xusr/share/doc/libcups2-dev/examples/scripting
81 DEB_DH_INSTALL_SOURCEDIR := debian/tmp
82 ifneq ($(findstring $(DEB_BUILD_ARCH), arm m68k),)
83 DEB_MAKE_CHECK_TARGET := check || true
85 DEB_MAKE_CHECK_TARGET := check
87 DPKG_GENSYMBOLS_CHECK_LEVEL=4
88 export DPKG_GENSYMBOLS_CHECK_LEVEL
91 set -e; if dpkg-vendor --is ubuntu && ! [ -e debian/patches/ubuntu/stamp-applied ]; then \
92 echo '---- Applying Ubuntu specific patches'; \
93 for p in debian/patches/ubuntu/*; do \
94 patch -p1 --no-backup-if-mismatch < $$p; \
96 touch debian/patches/ubuntu/stamp-applied; \
98 # Rebuild ./configure to get build system patches working
103 if [ -e debian/patches/ubuntu/stamp-applied ]; then \
104 echo '---- Unapplying Ubuntu specific patches'; \
105 for p in debian/patches/ubuntu/*; do \
106 patch -Rp1 --no-backup-if-mismatch < $$p; \
108 rm debian/patches/ubuntu/stamp-applied; \
112 rm -f man/client.conf.man packaging/cups.list
113 rm -f conf/mime.convs conf/snmp.conf init/org.cups.cups-lpd.plist
114 [ ! -f Makedefs ] || make distclean
115 rm -f debian/*.upstart # master copy is in debian/local
117 common-install-prehook-impl::
118 (cd fonts && $(MAKE) install BUILDROOT=$(DEB_DESTDIR))
120 # Use upstart script on Ubuntu; we need to hide it away for Debian
121 # builds, as dh_installinit does not have a --sysvinit-only
122 if dpkg-vendor --is ubuntu; then \
123 cp debian/local/*.upstart debian; \
126 binary-post-install/cups::
127 (cd $(DEB_DESTDIR)/../cups/usr/share/doc/cups && ln -sf ../../cups/doc-root online-docs)
129 # Remove all files which get replaced by the ones in the cups-filters
131 rm debian/$(cdbs_curpkg)/usr/lib/cups/backend*/serial
132 rm debian/$(cdbs_curpkg)/usr/lib/cups/backend*/parallel
133 rm debian/$(cdbs_curpkg)/usr/lib/cups/filter/bannertops
134 rm debian/$(cdbs_curpkg)/usr/lib/cups/filter/commandtoescpx
135 rm debian/$(cdbs_curpkg)/usr/lib/cups/filter/commandtopclx
136 rm debian/$(cdbs_curpkg)/usr/lib/cups/filter/imagetops
137 rm debian/$(cdbs_curpkg)/usr/lib/cups/filter/imagetoraster
138 rm debian/$(cdbs_curpkg)/usr/lib/cups/filter/pdftops
139 rm debian/$(cdbs_curpkg)/usr/lib/cups/filter/rastertoescpx
140 rm debian/$(cdbs_curpkg)/usr/lib/cups/filter/rastertopclx
141 rm debian/$(cdbs_curpkg)/usr/lib/cups/filter/texttops
142 rm -rf debian/$(cdbs_curpkg)/usr/share/cups/banners
143 rm debian/$(cdbs_curpkg)/usr/share/cups/data/testprint
144 rm debian/$(cdbs_curpkg)/usr/share/cups/data/psglyphs
145 rm debian/$(cdbs_curpkg)/usr/share/cups/fonts/*
147 # Comment out conversion rules for removed filters
148 perl -p -i -e 's:^(.*\s+(pdftops|texttops|imagetops|bannertops|imagetoraster)\s*)$$:#\1:' debian/$(cdbs_curpkg)/usr/share/cups/mime/mime.convs
150 # Ensure that we don't ship anything in /var/run
151 rm -rf $(DEB_DESTDIR)/../cups/var/run
154 #mkdir -p "$(DEB_DESTDIR)/../cups/usr/share/ppd/cups-included/"
156 # PPD-updating triggers directory
157 mkdir -p "$(DEB_DESTDIR)/../cups/usr/share/cups/ppd-updaters/"
161 # Install AppArmor, ufw profile, and Apport hook on Ubuntu
162 if dpkg-vendor --is ubuntu; then \
163 install -D -m 644 debian/local/apparmor-profile debian/$(cdbs_curpkg)/etc/apparmor.d/usr.sbin.cupsd; \
164 install -D -m 644 debian/local/cups.ufw.profile debian/$(cdbs_curpkg)/etc/ufw/applications.d/cups; \
165 install -D -m 644 debian/local/apport-hook.py debian/$(cdbs_curpkg)/usr/share/apport/package-hooks/source_cups.py; \
168 # Make the usb backend run as root, since /dev/bus/usb/* are
169 # root:root in udev < 147, and cups does not use the usblp kernel
170 # module any more; udev 147 makes most of those printers accessible to
171 # lp, but apparently not all of them
172 chmod go-x debian/$(cdbs_curpkg)/usr/lib/cups/backend-available/usb; \
174 binary-post-install/cups-common::
175 rm debian/$(cdbs_curpkg)/usr/share/cups/charsets/utf-8
177 binary-post-install/libcupsimage2-dev::
178 rm -r debian/libcupsimage2-dev/usr/share/doc/libcupsimage2-dev
179 ln -s libcupsimage2 debian/libcupsimage2-dev/usr/share/doc/libcupsimage2-dev
180 binary-post-install/cups-bsd::
181 rm -r debian/cups-bsd/usr/share/doc/cups-bsd
182 ln -s libcups2 debian/cups-bsd/usr/share/doc/cups-bsd
183 binary-post-install/libcups2-dev::
184 rm -f debian/$(cdbs_curpkg)/usr/share/doc/$(cdbs_curpkg)/examples/scripting/php/*.o
185 rm -f debian/$(cdbs_curpkg)/usr/share/doc/$(cdbs_curpkg)/examples/scripting/php/*.so
186 # debian/libcups2-dev.install entry cannot rename files on-the-fly
187 cp cups/language-private.h debian/$(cdbs_curpkg)/usr/include/cups/i18n.h
188 binary-post-install/cups-client::
189 rm -r debian/cups-client/usr/share/doc/cups-client
190 ln -s libcups2 debian/cups-client/usr/share/doc/cups-client