]> git.ipfire.org Git - people/ms/dnsmasq.git/blame - debian/rules
Fix new poll() code for helper pipe. Removed CPU-spin.
[people/ms/dnsmasq.git] / debian / rules
CommitLineData
c72daea8
SK
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
11
12package=dnsmasq-base
13
91f4a5e4
SR
14dpkg_buildflags := DEB_BUILD_MAINT_OPTIONS="hardening=+all" dpkg-buildflags
15
16CFLAGS = $(shell $(dpkg_buildflags) --get CFLAGS)
17CFLAGS += $(shell $(dpkg_buildflags) --get CPPFLAGS)
97c83bb0
SK
18CFLAGS += -Wall -W
19
91f4a5e4 20LDFLAGS = $(shell $(dpkg_buildflags) --get LDFLAGS)
c72daea8 21
8f6213cc 22DEB_COPTS = $(COPTS)
97c83bb0 23
c72daea8
SK
24TARGET = install-i18n
25
6ac3bc04 26DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
24e9207e 27BUILD_DATE := $(shell dpkg-parsechangelog --show-field Date)
c72daea8 28
02ed24d3
SK
29# Force package version based on git tags.
30ifneq (,$(filter gitversion,$(DEB_BUILD_OPTIONS)))
1d1c7956 31 PACKAGE_VERSION = $(shell bld/get-version `pwd` | sed 's/test/~&/; s/[a-z]/~&/; s/-/./g; s/$$/-1/; s/^/-v/';)
02ed24d3
SK
32endif
33
62779780 34ifeq (,$(filter nodbus,$(DEB_BUILD_OPTIONS)))
8f6213cc 35 DEB_COPTS += -DHAVE_DBUS
c72daea8
SK
36endif
37
62779780 38ifeq (,$(filter noconntrack,$(DEB_BUILD_OPTIONS)))
6ac3bc04 39ifeq ($(DEB_HOST_ARCH_OS),linux)
8f6213cc 40 DEB_COPTS += -DHAVE_CONNTRACK
c72daea8
SK
41endif
42endif
43
3ddad246 44ifneq (,$(filter noipset,$(DEB_BUILD_OPTIONS)))
8f6213cc 45 DEB_COPTS += -DNO_IPSET
3b323bda
SK
46endif
47
96c3879b 48ifneq (,$(filter nodhcp6,$(DEB_BUILD_OPTIONS)))
8f6213cc 49 DEB_COPTS += -DNO_DHCP6
127ea40a
SK
50endif
51
62779780 52ifneq (,$(filter noipv6,$(DEB_BUILD_OPTIONS)))
8f6213cc 53 DEB_COPTS += -DNO_IPV6
c72daea8
SK
54endif
55
62779780 56ifneq (,$(filter notftp,$(DEB_BUILD_OPTIONS)))
8f6213cc 57 DEB_COPTS += -DNO_TFTP
c72daea8
SK
58endif
59
62779780 60ifneq (,$(filter nodhcp,$(DEB_BUILD_OPTIONS)))
8f6213cc 61 DEB_COPTS += -DNO_DHCP
c72daea8
SK
62endif
63
62779780 64ifneq (,$(filter noscript,$(DEB_BUILD_OPTIONS)))
8f6213cc 65 DEB_COPTS += -DNO_SCRIPT
c72daea8
SK
66endif
67
62779780 68ifneq (,$(filter nortc,$(DEB_BUILD_OPTIONS)))
8f6213cc 69 DEB_COPTS += -DHAVE_BROKEN_RTC
c72daea8
SK
70endif
71
62779780 72ifneq (,$(filter noi18n,$(DEB_BUILD_OPTIONS)))
c72daea8 73 TARGET = install
62779780 74 ifeq (,$(filter noidn, $(DEB_BUILD_OPTIONS)))
8f6213cc 75 DEB_COPTS += -DHAVE_IDN
c72daea8
SK
76 endif
77endif
78
62779780 79ifneq (,$(filter uselua,$(DEB_BUILD_OPTIONS)))
8f6213cc 80 DEB_COPTS += -DHAVE_LUASCRIPT
62779780
SK
81endif
82
160f6507 83ifeq (,$(filter nodnssec,$(DEB_BUILD_OPTIONS)))
8f6213cc 84 DEB_COPTS += -DHAVE_DNSSEC
00ec693d
SK
85endif
86
6ac3bc04
SK
87ifneq ($(DEB_HOST_ARCH_OS),linux)
88 # For strlcpy in FreeBSD
89 LDFLAGS += -lbsd
90endif
91
c72daea8
SK
92clean:
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
97
98binary-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 \
c72daea8
SK
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
c72daea8
SK
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
24e9207e 122 cd debian/daemon && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | LC_ALL=C sort -z | xargs -r0 md5sum > DEBIAN/md5sums
aa985bee 123 dpkg-gencontrol $(PACKAGE_VERSION) -T -pdnsmasq -Pdebian/daemon
24e9207e 124 find debian/daemon -depth -newermt '$(BUILD_DATE)' -print0 | xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
c72daea8
SK
125 chown -R root.root debian/daemon
126 chmod -R g-ws debian/daemon
127 dpkg --build debian/daemon ..
128
129binary-arch: checkroot
130 $(checkdir)
131 rm -rf debian/base
132 install -m 755 \
133 -d debian/base/DEBIAN \
4ba9b38c 134 -d debian/base/etc/dbus-1/system.d \
c72daea8
SK
135 -d debian/base/usr/share/doc/$(package) \
136 -d debian/base/usr/share/doc/$(package)/examples \
137 -d debian/base/var/run \
da4f3722 138 -d debian/base/usr/share/$(package) \
c72daea8 139 -d debian/base/var/lib/misc
8f6213cc 140 make $(TARGET) PREFIX=/usr DESTDIR=`pwd`/debian/base CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" COPTS="$(DEB_COPTS)" CC=gcc
c72daea8 141ifeq (,$(findstring nodocs,$(DEB_BUILD_OPTIONS)))
933878f2
SK
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
c72daea8
SK
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/.
da4f3722 147 install -m 644 trust-anchors.conf debian/base/usr/share/$(package)/.
c72daea8 148 install -m 644 FAQ debian/base/usr/share/doc/$(package)/.
b467a454 149 gzip -9n debian/base/usr/share/doc/$(package)/FAQ
c72daea8 150 install -m 644 CHANGELOG debian/base/usr/share/doc/$(package)/changelog
b467a454 151 gzip -9n debian/base/usr/share/doc/$(package)/changelog
c72daea8 152 install -m 644 CHANGELOG.archive debian/base/usr/share/doc/$(package)/changelog.archive
b467a454 153 gzip -9n debian/base/usr/share/doc/$(package)/changelog.archive
c72daea8 154 install -m 644 dbus/DBus-interface debian/base/usr/share/doc/$(package)/.
b467a454 155 gzip -9n debian/base/usr/share/doc/$(package)/DBus-interface
c72daea8 156endif
4ba9b38c 157 install -m 644 debian/dnsmasq-base.conffiles debian/base/DEBIAN/conffiles
bc54ae39
SK
158 install -m 755 debian/dnsmasq-base.postinst debian/base/DEBIAN/postinst
159 install -m 755 debian/dnsmasq-base.postrm debian/base/DEBIAN/postrm
c72daea8 160 install -m 644 debian/changelog debian/base/usr/share/doc/$(package)/changelog.Debian
b467a454 161 gzip -9n debian/base/usr/share/doc/$(package)/changelog.Debian
c72daea8
SK
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
4ba9b38c 164 install -m 644 debian/dbus.conf debian/base/etc/dbus-1/system.d/dnsmasq.conf
b467a454 165 gzip -9n debian/base/usr/share/man/man8/dnsmasq.8
c72daea8
SK
166 for f in debian/base/usr/share/man/*; do \
167 if [ -f $$f/man8/dnsmasq.8 ]; then \
b467a454 168 gzip -9n $$f/man8/dnsmasq.8 ; \
c72daea8
SK
169 fi \
170 done
171ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
172 strip -R .note -R .comment debian/base/usr/sbin/dnsmasq
173endif
24e9207e 174 cd debian/base && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | LC_ALL=C sort -z | xargs -r0 md5sum > DEBIAN/md5sums
aa985bee 175 dpkg-shlibdeps --warnings=1 debian/base/usr/sbin/dnsmasq
02ed24d3 176 dpkg-gencontrol $(PACKAGE_VERSION) -pdnsmasq-base -Pdebian/base
24e9207e 177 find debian/base -depth -newermt '$(BUILD_DATE)' -print0 | xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
c72daea8
SK
178 chown -R root.root debian/base
179 chmod -R g-ws debian/base
180 dpkg --build debian/base ..
181
6ac3bc04 182ifeq ($(DEB_HOST_ARCH_OS),linux)
c72daea8
SK
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
8f6213cc 188 make -C contrib/wrt PREFIX=/usr DESTDIR=`pwd`/debian/utils CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" COPTS="$(DEB_COPTS)" CC=gcc
c72daea8
SK
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
b467a454 191 gzip -9n debian/utils/usr/share/man/man1/dhcp_release.1
c72daea8
SK
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
b467a454
CL
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
c72daea8
SK
198ifeq (,$(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
201endif
24e9207e 202 cd debian/utils && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | LC_ALL=C sort -z | xargs -r0 md5sum > DEBIAN/md5sums
c72daea8 203 dpkg-shlibdeps -Tdebian/utils-substvars debian/utils/usr/bin/dhcp_release debian/utils/usr/bin/dhcp_lease_time
02ed24d3 204 dpkg-gencontrol $(PACKAGE_VERSION) -Tdebian/utils-substvars -pdnsmasq-utils -Pdebian/utils
24e9207e 205 find debian/utils -depth -newermt '$(BUILD_DATE)' -print0 | xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
c72daea8
SK
206 chown -R root.root debian/utils
207 chmod -R g-ws debian/utils
208 dpkg --build debian/utils ..
209endif
210
211define checkdir
212 test -f Makefile -a -f debian/rules
213endef
214
215# Below here is fairly generic really
216
217binary: binary-arch binary-indep
760169fc 218
c72daea8 219build:
760169fc
SK
220build-arch:
221build-indep:
c72daea8
SK
222
223checkroot:
224 test root = "`whoami`"
225
226.PHONY: binary binary-arch binary-indep clean checkroot
227
228