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
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
)
20 LDFLAGS
= $(shell $(dpkg_buildflags
) --get LDFLAGS
)
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/';)
34 ifeq (,$(filter nodbus
,$(DEB_BUILD_OPTIONS
)))
35 DEB_COPTS
+= -DHAVE_DBUS
38 ifeq (,$(filter noconntrack
,$(DEB_BUILD_OPTIONS
)))
39 ifeq ($(DEB_HOST_ARCH_OS
),linux
)
40 DEB_COPTS
+= -DHAVE_CONNTRACK
44 ifneq (,$(filter noipset
,$(DEB_BUILD_OPTIONS
)))
45 DEB_COPTS
+= -DNO_IPSET
48 ifneq (,$(filter nodhcp6
,$(DEB_BUILD_OPTIONS
)))
49 DEB_COPTS
+= -DNO_DHCP6
52 ifneq (,$(filter noipv6
,$(DEB_BUILD_OPTIONS
)))
53 DEB_COPTS
+= -DNO_IPV6
56 ifneq (,$(filter notftp
,$(DEB_BUILD_OPTIONS
)))
57 DEB_COPTS
+= -DNO_TFTP
60 ifneq (,$(filter nodhcp
,$(DEB_BUILD_OPTIONS
)))
61 DEB_COPTS
+= -DNO_DHCP
64 ifneq (,$(filter noscript
,$(DEB_BUILD_OPTIONS
)))
65 DEB_COPTS
+= -DNO_SCRIPT
68 ifneq (,$(filter nortc
,$(DEB_BUILD_OPTIONS
)))
69 DEB_COPTS
+= -DHAVE_BROKEN_RTC
72 ifneq (,$(filter noi18n
,$(DEB_BUILD_OPTIONS
)))
74 ifeq (,$(filter noidn
, $(DEB_BUILD_OPTIONS
)))
75 DEB_COPTS
+= -DHAVE_IDN
79 ifneq (,$(filter uselua
,$(DEB_BUILD_OPTIONS
)))
80 DEB_COPTS
+= -DHAVE_LUASCRIPT
83 ifeq (,$(filter nodnssec
,$(DEB_BUILD_OPTIONS
)))
84 DEB_COPTS
+= -DHAVE_DNSSEC
87 ifneq ($(DEB_HOST_ARCH_OS
),linux
)
88 # For strlcpy in FreeBSD
94 rm -rf debian
/daemon debian
/base debian
/utils debian
/*~ debian
/files debian
/substvars debian
/utils-substvars
96 make
-C contrib
/wrt
clean
98 binary-indep
: checkroot
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
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
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 ; \
171 ifeq (,$(findstring nostrip
,$(DEB_BUILD_OPTIONS
)))
172 strip -R .note
-R .comment debian
/base
/usr
/sbin
/dnsmasq
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
)
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
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 ..
212 test -f Makefile
-a
-f debian
/rules
215 # Below here is fairly generic really
217 binary
: binary-arch binary-indep
224 test root
= "`whoami`"
226 .PHONY
: binary binary-arch binary-indep
clean checkroot