dnsmasq: update to 2.73 (23.06.2015)
[tomato.git] / release / src / router / dnsmasq / debian / rules
blob74012ddf49a0f2d2588b6325a9f217c2653c4f1f
1 #!/usr/bin/make -f
2 # debian/rules file - for dnsmasq.
3 # Copyright 2001-2011 by Simon Kelley
4 # Based on the sample in the debian hello package which carries the following:
5 # Copyright 1994,1995 by Ian Jackson.
6 # I hereby give you perpetual unlimited permission to copy,
7 # modify and relicense this file, provided that you do not remove
8 # my name from the file itself. (I assert my moral right of
9 # paternity under the Copyright, Designs and Patents Act 1988.)
10 # This file may have to be extensively modified
12 package=dnsmasq-base
14 dpkg_buildflags := DEB_BUILD_MAINT_OPTIONS="hardening=+all" dpkg-buildflags
16 CFLAGS = $(shell $(dpkg_buildflags) --get CFLAGS)
17 CFLAGS += $(shell $(dpkg_buildflags) --get CPPFLAGS)
18 CFLAGS += -Wall -W
20 LDFLAGS = $(shell $(dpkg_buildflags) --get LDFLAGS)
22 DEB_COPTS = $(COPTS)
24 TARGET = install-i18n
26 DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
27 BUILD_DATE := $(shell dpkg-parsechangelog --show-field Date)
29 # Force package version based on git tags.
30 ifneq (,$(filter gitversion,$(DEB_BUILD_OPTIONS)))
31 PACKAGE_VERSION = $(shell bld/get-version `pwd` | sed 's/test/~&/; s/[a-z]/~&/; s/-/./g; s/$$/-1/; s/^/-v/';)
32 endif
34 ifeq (,$(filter nodbus,$(DEB_BUILD_OPTIONS)))
35 DEB_COPTS += -DHAVE_DBUS
36 endif
38 ifeq (,$(filter noconntrack,$(DEB_BUILD_OPTIONS)))
39 ifeq ($(DEB_HOST_ARCH_OS),linux)
40 DEB_COPTS += -DHAVE_CONNTRACK
41 endif
42 endif
44 ifneq (,$(filter noipset,$(DEB_BUILD_OPTIONS)))
45 DEB_COPTS += -DNO_IPSET
46 endif
48 ifneq (,$(filter nodhcp6,$(DEB_BUILD_OPTIONS)))
49 DEB_COPTS += -DNO_DHCP6
50 endif
52 ifneq (,$(filter noipv6,$(DEB_BUILD_OPTIONS)))
53 DEB_COPTS += -DNO_IPV6
54 endif
56 ifneq (,$(filter notftp,$(DEB_BUILD_OPTIONS)))
57 DEB_COPTS += -DNO_TFTP
58 endif
60 ifneq (,$(filter nodhcp,$(DEB_BUILD_OPTIONS)))
61 DEB_COPTS += -DNO_DHCP
62 endif
64 ifneq (,$(filter noscript,$(DEB_BUILD_OPTIONS)))
65 DEB_COPTS += -DNO_SCRIPT
66 endif
68 ifneq (,$(filter nortc,$(DEB_BUILD_OPTIONS)))
69 DEB_COPTS += -DHAVE_BROKEN_RTC
70 endif
72 ifneq (,$(filter noi18n,$(DEB_BUILD_OPTIONS)))
73 TARGET = install
74 ifeq (,$(filter noidn, $(DEB_BUILD_OPTIONS)))
75 DEB_COPTS += -DHAVE_IDN
76 endif
77 endif
79 ifneq (,$(filter uselua,$(DEB_BUILD_OPTIONS)))
80 DEB_COPTS += -DHAVE_LUASCRIPT
81 endif
83 ifeq (,$(filter nodnssec,$(DEB_BUILD_OPTIONS)))
84 DEB_COPTS += -DHAVE_DNSSEC
85 endif
87 ifneq ($(DEB_HOST_ARCH_OS),linux)
88 # For strlcpy in FreeBSD
89 LDFLAGS += -lbsd
90 endif
92 clean:
93 $(checkdir)
94 rm -rf debian/daemon debian/base debian/utils debian/*~ debian/files debian/substvars debian/utils-substvars
95 make clean
96 make -C contrib/wrt clean
98 binary-indep: checkroot
99 $(checkdir)
100 rm -rf debian/daemon
101 install -m 755 \
102 -d debian/daemon/DEBIAN \
103 -d debian/daemon/usr/share/doc \
104 -d debian/daemon/etc/init.d \
105 -d debian/daemon/etc/dnsmasq.d \
106 -d debian/daemon/etc/resolvconf/update.d \
107 -d debian/daemon/usr/lib/resolvconf/dpkg-event.d \
108 -d debian/daemon/etc/default \
109 -d debian/daemon/lib/systemd/system \
110 -d debian/daemon/etc/insserv.conf.d
111 install -m 644 debian/conffiles debian/daemon/DEBIAN
112 install -m 755 debian/postinst debian/postrm debian/prerm debian/daemon/DEBIAN
113 install -m 755 debian/init debian/daemon/etc/init.d/dnsmasq
114 install -m 755 debian/resolvconf debian/daemon/etc/resolvconf/update.d/dnsmasq
115 install -m 755 debian/resolvconf-package debian/daemon/usr/lib/resolvconf/dpkg-event.d/dnsmasq
116 install -m 644 debian/default debian/daemon/etc/default/dnsmasq
117 install -m 644 dnsmasq.conf.example debian/daemon/etc/dnsmasq.conf
118 install -m 644 debian/readme.dnsmasq.d debian/daemon/etc/dnsmasq.d/README
119 install -m 644 debian/systemd.service debian/daemon/lib/systemd/system/dnsmasq.service
120 install -m 644 debian/insserv debian/daemon/etc/insserv.conf.d/dnsmasq
121 ln -s $(package) debian/daemon/usr/share/doc/dnsmasq
122 cd debian/daemon && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | LC_ALL=C sort -z | xargs -r0 md5sum > DEBIAN/md5sums
123 dpkg-gencontrol $(PACKAGE_VERSION) -T -pdnsmasq -Pdebian/daemon
124 find debian/daemon -depth -newermt '$(BUILD_DATE)' -print0 | xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
125 chown -R root.root debian/daemon
126 chmod -R g-ws debian/daemon
127 dpkg --build debian/daemon ..
129 binary-arch: checkroot
130 $(checkdir)
131 rm -rf debian/base
132 install -m 755 \
133 -d debian/base/DEBIAN \
134 -d debian/base/etc/dbus-1/system.d \
135 -d debian/base/usr/share/doc/$(package) \
136 -d debian/base/usr/share/doc/$(package)/examples \
137 -d debian/base/var/run \
138 -d debian/base/usr/share/$(package) \
139 -d debian/base/var/lib/misc
140 make $(TARGET) PREFIX=/usr DESTDIR=`pwd`/debian/base CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" COPTS="$(DEB_COPTS)" CC=gcc
141 ifeq (,$(findstring nodocs,$(DEB_BUILD_OPTIONS)))
142 # Need to remove paypal links in Debian Package for policy reasons.
143 sed -e /\<H2\>Donations/Q -e /icon.png/d doc.html -e /favicon.ico/d >debian/base/usr/share/doc/$(package)/doc.html
144 echo "</BODY>" >>debian/base/usr/share/doc/$(package)/doc.html
145 install -m 644 setup.html debian/base/usr/share/doc/$(package)/.
146 install -m 644 dnsmasq.conf.example debian/base/usr/share/doc/$(package)/examples/.
147 install -m 644 trust-anchors.conf debian/base/usr/share/$(package)/.
148 install -m 644 FAQ debian/base/usr/share/doc/$(package)/.
149 gzip -9n debian/base/usr/share/doc/$(package)/FAQ
150 install -m 644 CHANGELOG debian/base/usr/share/doc/$(package)/changelog
151 gzip -9n debian/base/usr/share/doc/$(package)/changelog
152 install -m 644 CHANGELOG.archive debian/base/usr/share/doc/$(package)/changelog.archive
153 gzip -9n debian/base/usr/share/doc/$(package)/changelog.archive
154 install -m 644 dbus/DBus-interface debian/base/usr/share/doc/$(package)/.
155 gzip -9n debian/base/usr/share/doc/$(package)/DBus-interface
156 endif
157 install -m 644 debian/dnsmasq-base.conffiles debian/base/DEBIAN/conffiles
158 install -m 755 debian/dnsmasq-base.postinst debian/base/DEBIAN/postinst
159 install -m 755 debian/dnsmasq-base.postrm debian/base/DEBIAN/postrm
160 install -m 644 debian/changelog debian/base/usr/share/doc/$(package)/changelog.Debian
161 gzip -9n debian/base/usr/share/doc/$(package)/changelog.Debian
162 install -m 644 debian/readme debian/base/usr/share/doc/$(package)/README.Debian
163 install -m 644 debian/copyright debian/base/usr/share/doc/$(package)/copyright
164 install -m 644 debian/dbus.conf debian/base/etc/dbus-1/system.d/dnsmasq.conf
165 gzip -9n debian/base/usr/share/man/man8/dnsmasq.8
166 for f in debian/base/usr/share/man/*; do \
167 if [ -f $$f/man8/dnsmasq.8 ]; then \
168 gzip -9n $$f/man8/dnsmasq.8 ; \
169 fi \
170 done
171 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
172 strip -R .note -R .comment debian/base/usr/sbin/dnsmasq
173 endif
174 cd debian/base && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | LC_ALL=C sort -z | xargs -r0 md5sum > DEBIAN/md5sums
175 dpkg-shlibdeps --warnings=1 debian/base/usr/sbin/dnsmasq
176 dpkg-gencontrol $(PACKAGE_VERSION) -pdnsmasq-base -Pdebian/base
177 find debian/base -depth -newermt '$(BUILD_DATE)' -print0 | xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
178 chown -R root.root debian/base
179 chmod -R g-ws debian/base
180 dpkg --build debian/base ..
182 ifeq ($(DEB_HOST_ARCH_OS),linux)
183 rm -rf debian/utils
184 install -m 755 -d debian/utils/DEBIAN \
185 -d debian/utils/usr/share/man/man1 \
186 -d debian/utils/usr/bin \
187 -d debian/utils/usr/share/doc/dnsmasq-utils
188 make -C contrib/wrt PREFIX=/usr DESTDIR=`pwd`/debian/utils CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" COPTS="$(DEB_COPTS)" CC=gcc
189 install -m 755 contrib/wrt/dhcp_release debian/utils/usr/bin/dhcp_release
190 install -m 644 contrib/wrt/dhcp_release.1 debian/utils/usr/share/man/man1/dhcp_release.1
191 gzip -9n debian/utils/usr/share/man/man1/dhcp_release.1
192 install -m 755 contrib/wrt/dhcp_lease_time debian/utils/usr/bin/dhcp_lease_time
193 install -m 644 contrib/wrt/dhcp_lease_time.1 debian/utils/usr/share/man/man1/dhcp_lease_time.1
194 install -m 644 debian/copyright debian/utils/usr/share/doc/dnsmasq-utils/copyright
195 install -m 644 debian/changelog debian/utils/usr/share/doc/dnsmasq-utils/changelog.Debian
196 gzip -9n debian/utils/usr/share/doc/dnsmasq-utils/changelog.Debian
197 gzip -9n debian/utils/usr/share/man/man1/dhcp_lease_time.1
198 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
199 strip -R .note -R .comment debian/utils/usr/bin/dhcp_release
200 strip -R .note -R .comment debian/utils/usr/bin/dhcp_lease_time
201 endif
202 cd debian/utils && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | LC_ALL=C sort -z | xargs -r0 md5sum > DEBIAN/md5sums
203 dpkg-shlibdeps -Tdebian/utils-substvars debian/utils/usr/bin/dhcp_release debian/utils/usr/bin/dhcp_lease_time
204 dpkg-gencontrol $(PACKAGE_VERSION) -Tdebian/utils-substvars -pdnsmasq-utils -Pdebian/utils
205 find debian/utils -depth -newermt '$(BUILD_DATE)' -print0 | xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
206 chown -R root.root debian/utils
207 chmod -R g-ws debian/utils
208 dpkg --build debian/utils ..
209 endif
211 define checkdir
212 test -f Makefile -a -f debian/rules
213 endef
215 # Below here is fairly generic really
217 binary: binary-arch binary-indep
219 build:
220 build-arch:
221 build-indep:
223 checkroot:
224 test root = "`whoami`"
226 .PHONY: binary binary-arch binary-indep clean checkroot