Code sync
[external/cups.git] / debian / rules
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3 # Sample debian/rules that uses debhelper.
4 # GNU copyright 1997 to 1999 by Joey Hess.
5 #
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
8
9 # Uncomment this to turn on verbose mode.
10 export DH_VERBOSE=1
11
12 # work around libpng crash on our test PNGs with 8 bit colormaps (LP #710881)
13 export NO_PNG_PKG_MANGLE=1
14
15 #export DEB_BUILD_MAINT_OPTIONS=hardening
16 #DPKG_EXPORT_BUILDFLAGS=1
17 #include /usr/share/dpkg/buildflags.mk
18 LDFLAGS+= -Wl,--as-needed
19
20 include /usr/share/cdbs/1/rules/debhelper.mk
21 include /usr/share/cdbs/1/class/autotools.mk
22
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 \
29     --disable-mallinfo \
30     --disable-libpaper \
31     --disable-libusb \
32     --disable-tcp-wrappers \
33     --disable-acl \
34     --disable-dbus \
35     --disable-unit-tests \
36     --disable-relro \
37     --enable-image \
38     --enable-jpeg \
39     --enable-png \
40     --disable-tiff \
41     --disable-slp \
42     --disable-ldap \
43     --enable-gssapi \
44     --enable-threads \
45     --enable-debug \
46     --disable-cdsassl \
47     --enable-gnutls \
48     --disable-openssl \
49     --enable-ssl \
50     --enable-avahi \
51     --disable-pam \
52     --enable-largefile \
53     --disable-launchd \
54     --enable-raw-printing \
55     --enable-bannertops \
56     --enable-texttops \
57     --disable-pap \
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'
62
63 #ifeq ($(DEB_HOST_ARCH_OS),hurd)
64 #DEB_CONFIGURE_EXTRA_FLAGS += --disable-libusb
65 #else
66 #DEB_CONFIGURE_EXTRA_FLAGS += --enable-libusb
67 #endif
68
69 DEB_MAKE_INSTALL_TARGET := install BUILDROOT=$(DEB_DESTDIR)
70 DEB_INSTALL_CHANGELOGS_ALL := CHANGES.txt
71
72 ifeq ($(shell dpkg-vendor --query vendor), Ubuntu)
73 DEB_DH_INSTALLINIT_ARGS := --upstart-only
74 else
75 DEB_DH_INSTALLINIT_ARGS := -u'start 50 2 3 4 5 . stop 80 1 .'
76 endif
77
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
84 else
85 DEB_MAKE_CHECK_TARGET := check
86 endif
87 DPKG_GENSYMBOLS_CHECK_LEVEL=4
88 export DPKG_GENSYMBOLS_CHECK_LEVEL
89
90 post-patches::
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; \
95             done; \
96             touch debian/patches/ubuntu/stamp-applied; \
97         fi
98         # Rebuild ./configure to get build system patches working
99         aclocal
100         autoconf
101
102 clean::
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; \
107             done; \
108             rm debian/patches/ubuntu/stamp-applied; \
109         fi
110
111 cleanbuilddir::
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
116
117 common-install-prehook-impl::
118         (cd fonts && $(MAKE) install BUILDROOT=$(DEB_DESTDIR))
119
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; \
124         fi
125
126 binary-post-install/cups::
127         (cd $(DEB_DESTDIR)/../cups/usr/share/doc/cups && ln -sf ../../cups/doc-root online-docs)
128
129         # Remove all files which get replaced by the ones in the cups-filters
130         # package
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/*
146
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
149
150         # Ensure that we don't ship anything in /var/run
151         rm -rf $(DEB_DESTDIR)/../cups/var/run
152
153         # PPD directories
154         #mkdir -p "$(DEB_DESTDIR)/../cups/usr/share/ppd/cups-included/"
155
156         # PPD-updating triggers directory
157         mkdir -p "$(DEB_DESTDIR)/../cups/usr/share/cups/ppd-updaters/"
158
159         #dh_usrlocal
160
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; \
166         fi
167
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; \
173
174 binary-post-install/cups-common::
175         rm debian/$(cdbs_curpkg)/usr/share/cups/charsets/utf-8
176
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