Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 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 | |
| 12 | package=dnsmasq-base |
| 13 | |
Simon Kelley | 97c83bb | 2012-05-28 18:21:59 +0100 | [diff] [blame] | 14 | CFLAGS = $(shell export DEB_BUILD_OPTIONS=$(DEB_BUILD_OPTIONS); dpkg-buildflags --get CFLAGS) |
| 15 | CFLAGS += $(shell dpkg-buildflags --get CPPFLAGS) |
| 16 | CFLAGS += -Wall -W |
| 17 | |
| 18 | LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 19 | |
Simon Kelley | 00ec693 | 2014-01-28 11:08:57 +0000 | [diff] [blame^] | 20 | COPTS = |
Simon Kelley | 97c83bb | 2012-05-28 18:21:59 +0100 | [diff] [blame] | 21 | |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 22 | TARGET = install-i18n |
| 23 | |
| 24 | DEB_BUILD_ARCH_OS := $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS) |
| 25 | |
Simon Kelley | 02ed24d | 2013-09-09 18:06:45 +0100 | [diff] [blame] | 26 | # Force package version based on git tags. |
| 27 | ifneq (,$(filter gitversion,$(DEB_BUILD_OPTIONS))) |
Simon Kelley | 1d1c795 | 2013-10-02 14:52:23 +0100 | [diff] [blame] | 28 | PACKAGE_VERSION = $(shell bld/get-version `pwd` | sed 's/test/~&/; s/[a-z]/~&/; s/-/./g; s/$$/-1/; s/^/-v/';) |
Simon Kelley | 02ed24d | 2013-09-09 18:06:45 +0100 | [diff] [blame] | 29 | endif |
| 30 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 31 | ifeq (,$(filter nodbus,$(DEB_BUILD_OPTIONS))) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 32 | COPTS += -DHAVE_DBUS |
| 33 | endif |
| 34 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 35 | ifeq (,$(filter noconntrack,$(DEB_BUILD_OPTIONS))) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 36 | ifeq ($(DEB_BUILD_ARCH_OS),linux) |
| 37 | COPTS += -DHAVE_CONNTRACK |
| 38 | endif |
| 39 | endif |
| 40 | |
Simon Kelley | 3ddad24 | 2013-03-21 17:56:06 +0000 | [diff] [blame] | 41 | ifneq (,$(filter noipset,$(DEB_BUILD_OPTIONS))) |
| 42 | COPTS += -DNO_IPSET |
Simon Kelley | 3b323bd | 2013-02-22 21:55:29 +0000 | [diff] [blame] | 43 | endif |
| 44 | |
Simon Kelley | 96c3879 | 2012-02-16 20:07:17 +0000 | [diff] [blame] | 45 | ifneq (,$(filter nodhcp6,$(DEB_BUILD_OPTIONS))) |
| 46 | COPTS += -DNO_DHCP6 |
Simon Kelley | 127ea40 | 2012-02-11 22:14:52 +0000 | [diff] [blame] | 47 | endif |
| 48 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 49 | ifneq (,$(filter noipv6,$(DEB_BUILD_OPTIONS))) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 50 | COPTS += -DNO_IPV6 |
| 51 | endif |
| 52 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 53 | ifneq (,$(filter notftp,$(DEB_BUILD_OPTIONS))) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 54 | COPTS += -DNO_TFTP |
| 55 | endif |
| 56 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 57 | ifneq (,$(filter nodhcp,$(DEB_BUILD_OPTIONS))) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 58 | COPTS += -DNO_DHCP |
| 59 | endif |
| 60 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 61 | ifneq (,$(filter noscript,$(DEB_BUILD_OPTIONS))) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 62 | COPTS += -DNO_SCRIPT |
| 63 | endif |
| 64 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 65 | ifneq (,$(filter nortc,$(DEB_BUILD_OPTIONS))) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 66 | COPTS += -DHAVE_BROKEN_RTC |
| 67 | endif |
| 68 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 69 | ifneq (,$(filter noi18n,$(DEB_BUILD_OPTIONS))) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 70 | TARGET = install |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 71 | ifeq (,$(filter noidn, $(DEB_BUILD_OPTIONS))) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 72 | COPTS += -DHAVE_IDN |
| 73 | endif |
| 74 | endif |
| 75 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 76 | ifneq (,$(filter uselua,$(DEB_BUILD_OPTIONS))) |
| 77 | COPTS += -DHAVE_LUASCRIPT |
| 78 | endif |
| 79 | |
Simon Kelley | 00ec693 | 2014-01-28 11:08:57 +0000 | [diff] [blame^] | 80 | ifneq (,$(filter usednssec,$(DEB_BUILD_OPTIONS))) |
| 81 | COPTS += -DHAVE_DNSSEC |
| 82 | endif |
| 83 | |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 84 | clean: |
| 85 | $(checkdir) |
| 86 | rm -rf debian/daemon debian/base debian/utils debian/*~ debian/files debian/substvars debian/utils-substvars |
| 87 | make clean |
| 88 | make -C contrib/wrt clean |
| 89 | |
| 90 | binary-indep: checkroot |
| 91 | $(checkdir) |
| 92 | rm -rf debian/daemon |
| 93 | install -m 755 \ |
| 94 | -d debian/daemon/DEBIAN \ |
| 95 | -d debian/daemon/usr/share/doc \ |
| 96 | -d debian/daemon/etc/init.d \ |
| 97 | -d debian/daemon/etc/dnsmasq.d \ |
| 98 | -d debian/daemon/etc/resolvconf/update.d \ |
| 99 | -d debian/daemon/usr/lib/resolvconf/dpkg-event.d \ |
| 100 | -d debian/daemon/etc/default \ |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 101 | -d debian/daemon/lib/systemd/system \ |
| 102 | -d debian/daemon/etc/insserv.conf.d |
| 103 | install -m 644 debian/conffiles debian/daemon/DEBIAN |
| 104 | install -m 755 debian/postinst debian/postrm debian/prerm debian/daemon/DEBIAN |
| 105 | install -m 755 debian/init debian/daemon/etc/init.d/dnsmasq |
| 106 | install -m 755 debian/resolvconf debian/daemon/etc/resolvconf/update.d/dnsmasq |
| 107 | install -m 755 debian/resolvconf-package debian/daemon/usr/lib/resolvconf/dpkg-event.d/dnsmasq |
| 108 | install -m 644 debian/default debian/daemon/etc/default/dnsmasq |
| 109 | install -m 644 dnsmasq.conf.example debian/daemon/etc/dnsmasq.conf |
| 110 | install -m 644 debian/readme.dnsmasq.d debian/daemon/etc/dnsmasq.d/README |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 111 | install -m 644 debian/systemd.service debian/daemon/lib/systemd/system/dnsmasq.service |
| 112 | install -m 644 debian/insserv debian/daemon/etc/insserv.conf.d/dnsmasq |
| 113 | ln -s $(package) debian/daemon/usr/share/doc/dnsmasq |
| 114 | cd debian/daemon && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums |
Simon Kelley | aa985be | 2013-09-11 10:28:39 +0100 | [diff] [blame] | 115 | dpkg-gencontrol $(PACKAGE_VERSION) -T -pdnsmasq -Pdebian/daemon |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 116 | chown -R root.root debian/daemon |
| 117 | chmod -R g-ws debian/daemon |
| 118 | dpkg --build debian/daemon .. |
| 119 | |
| 120 | binary-arch: checkroot |
| 121 | $(checkdir) |
| 122 | rm -rf debian/base |
| 123 | install -m 755 \ |
| 124 | -d debian/base/DEBIAN \ |
Simon Kelley | 4ba9b38 | 2012-07-29 17:07:48 +0100 | [diff] [blame] | 125 | -d debian/base/etc/dbus-1/system.d \ |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 126 | -d debian/base/usr/share/doc/$(package) \ |
| 127 | -d debian/base/usr/share/doc/$(package)/examples \ |
| 128 | -d debian/base/var/run \ |
| 129 | -d debian/base/var/lib/misc |
Simon Kelley | 43c271b | 2012-06-07 10:02:53 +0100 | [diff] [blame] | 130 | make $(TARGET) PREFIX=/usr DESTDIR=`pwd`/debian/base CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" COPTS="$(COPTS)" CC=gcc |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 131 | ifeq (,$(findstring nodocs,$(DEB_BUILD_OPTIONS))) |
| 132 | install -m 644 doc.html debian/base/usr/share/doc/$(package)/. |
| 133 | install -m 644 setup.html debian/base/usr/share/doc/$(package)/. |
| 134 | install -m 644 dnsmasq.conf.example debian/base/usr/share/doc/$(package)/examples/. |
| 135 | install -m 644 FAQ debian/base/usr/share/doc/$(package)/. |
| 136 | gzip -9 debian/base/usr/share/doc/$(package)/FAQ |
| 137 | install -m 644 CHANGELOG debian/base/usr/share/doc/$(package)/changelog |
| 138 | gzip -9 debian/base/usr/share/doc/$(package)/changelog |
| 139 | install -m 644 CHANGELOG.archive debian/base/usr/share/doc/$(package)/changelog.archive |
| 140 | gzip -9 debian/base/usr/share/doc/$(package)/changelog.archive |
| 141 | install -m 644 dbus/DBus-interface debian/base/usr/share/doc/$(package)/. |
| 142 | gzip -9 debian/base/usr/share/doc/$(package)/DBus-interface |
| 143 | endif |
Simon Kelley | 4ba9b38 | 2012-07-29 17:07:48 +0100 | [diff] [blame] | 144 | install -m 644 debian/dnsmasq-base.conffiles debian/base/DEBIAN/conffiles |
Simon Kelley | bc54ae3 | 2012-08-28 21:26:56 +0100 | [diff] [blame] | 145 | install -m 755 debian/dnsmasq-base.postinst debian/base/DEBIAN/postinst |
| 146 | install -m 755 debian/dnsmasq-base.postrm debian/base/DEBIAN/postrm |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 147 | install -m 644 debian/changelog debian/base/usr/share/doc/$(package)/changelog.Debian |
| 148 | gzip -9 debian/base/usr/share/doc/$(package)/changelog.Debian |
| 149 | install -m 644 debian/readme debian/base/usr/share/doc/$(package)/README.Debian |
| 150 | install -m 644 debian/copyright debian/base/usr/share/doc/$(package)/copyright |
Simon Kelley | 4ba9b38 | 2012-07-29 17:07:48 +0100 | [diff] [blame] | 151 | install -m 644 debian/dbus.conf debian/base/etc/dbus-1/system.d/dnsmasq.conf |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 152 | gzip -9 debian/base/usr/share/man/man8/dnsmasq.8 |
| 153 | for f in debian/base/usr/share/man/*; do \ |
| 154 | if [ -f $$f/man8/dnsmasq.8 ]; then \ |
| 155 | gzip -9 $$f/man8/dnsmasq.8 ; \ |
| 156 | fi \ |
| 157 | done |
| 158 | ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) |
| 159 | strip -R .note -R .comment debian/base/usr/sbin/dnsmasq |
| 160 | endif |
| 161 | cd debian/base && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums |
Simon Kelley | aa985be | 2013-09-11 10:28:39 +0100 | [diff] [blame] | 162 | dpkg-shlibdeps --warnings=1 debian/base/usr/sbin/dnsmasq |
Simon Kelley | 02ed24d | 2013-09-09 18:06:45 +0100 | [diff] [blame] | 163 | dpkg-gencontrol $(PACKAGE_VERSION) -pdnsmasq-base -Pdebian/base |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 164 | chown -R root.root debian/base |
| 165 | chmod -R g-ws debian/base |
| 166 | dpkg --build debian/base .. |
| 167 | |
| 168 | ifeq ($(DEB_BUILD_ARCH_OS),linux) |
| 169 | rm -rf debian/utils |
| 170 | install -m 755 -d debian/utils/DEBIAN \ |
| 171 | -d debian/utils/usr/share/man/man1 \ |
| 172 | -d debian/utils/usr/bin \ |
| 173 | -d debian/utils/usr/share/doc/dnsmasq-utils |
Simon Kelley | 43c271b | 2012-06-07 10:02:53 +0100 | [diff] [blame] | 174 | make -C contrib/wrt PREFIX=/usr DESTDIR=`pwd`/debian/utils CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" COPTS="$(COPTS)" CC=gcc |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 175 | install -m 755 contrib/wrt/dhcp_release debian/utils/usr/bin/dhcp_release |
| 176 | install -m 644 contrib/wrt/dhcp_release.1 debian/utils/usr/share/man/man1/dhcp_release.1 |
| 177 | gzip -9 debian/utils/usr/share/man/man1/dhcp_release.1 |
| 178 | install -m 755 contrib/wrt/dhcp_lease_time debian/utils/usr/bin/dhcp_lease_time |
| 179 | install -m 644 contrib/wrt/dhcp_lease_time.1 debian/utils/usr/share/man/man1/dhcp_lease_time.1 |
| 180 | install -m 644 debian/copyright debian/utils/usr/share/doc/dnsmasq-utils/copyright |
| 181 | install -m 644 debian/changelog debian/utils/usr/share/doc/dnsmasq-utils/changelog.Debian |
| 182 | gzip -9 debian/utils/usr/share/doc/dnsmasq-utils/changelog.Debian |
| 183 | gzip -9 debian/utils/usr/share/man/man1/dhcp_lease_time.1 |
| 184 | ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) |
| 185 | strip -R .note -R .comment debian/utils/usr/bin/dhcp_release |
| 186 | strip -R .note -R .comment debian/utils/usr/bin/dhcp_lease_time |
| 187 | endif |
| 188 | cd debian/utils && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums |
| 189 | dpkg-shlibdeps -Tdebian/utils-substvars debian/utils/usr/bin/dhcp_release debian/utils/usr/bin/dhcp_lease_time |
Simon Kelley | 02ed24d | 2013-09-09 18:06:45 +0100 | [diff] [blame] | 190 | dpkg-gencontrol $(PACKAGE_VERSION) -Tdebian/utils-substvars -pdnsmasq-utils -Pdebian/utils |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 191 | chown -R root.root debian/utils |
| 192 | chmod -R g-ws debian/utils |
| 193 | dpkg --build debian/utils .. |
| 194 | endif |
| 195 | |
| 196 | define checkdir |
| 197 | test -f Makefile -a -f debian/rules |
| 198 | endef |
| 199 | |
| 200 | # Below here is fairly generic really |
| 201 | |
| 202 | binary: binary-arch binary-indep |
Simon Kelley | 760169f | 2012-03-09 14:27:49 +0000 | [diff] [blame] | 203 | |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 204 | build: |
Simon Kelley | 760169f | 2012-03-09 14:27:49 +0000 | [diff] [blame] | 205 | build-arch: |
| 206 | build-indep: |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 207 | |
| 208 | checkroot: |
| 209 | test root = "`whoami`" |
| 210 | |
| 211 | .PHONY: binary binary-arch binary-indep clean checkroot |
| 212 | |
| 213 | |