| 1 |
#!/usr/bin/make -f |
| 2 |
# -*- makefile -*- |
| 3 |
|
| 4 |
# Uncomment this to turn on verbose mode. |
| 5 |
export DH_VERBOSE=1 |
| 6 |
|
| 7 |
# Make sure lintian does not complain about missing hardenings. |
| 8 |
export DEB_BUILD_MAINT_OPTIONS = hardening=+all |
| 9 |
|
| 10 |
include /usr/share/dpkg/architecture.mk |
| 11 |
|
| 12 |
PREFIX = /usr |
| 13 |
# Upstream does not handle CPPFLAGS, so we add it to CFLAGS here. |
| 14 |
CFLAGS += $(CPPFLAGS) |
| 15 |
COPTS = |
| 16 |
|
| 17 |
ifeq (,$(filter nodbus,$(DEB_BUILD_OPTIONS))) |
| 18 |
COPTS += -DHAVE_DBUS |
| 19 |
endif |
| 20 |
|
| 21 |
ifeq (,$(filter noidn, $(DEB_BUILD_OPTIONS))) |
| 22 |
COPTS += -DHAVE_LIBIDN2 |
| 23 |
endif |
| 24 |
|
| 25 |
ifeq (,$(filter nonftset, $(DEB_BUILD_OPTIONS))) |
| 26 |
COPTS += -DHAVE_NFTSET |
| 27 |
endif |
| 28 |
|
| 29 |
ifeq (,$(filter noconntrack,$(DEB_BUILD_OPTIONS))) |
| 30 |
ifeq ($(DEB_HOST_ARCH_OS),linux) |
| 31 |
COPTS += -DHAVE_CONNTRACK |
| 32 |
endif |
| 33 |
endif |
| 34 |
|
| 35 |
ifneq (,$(filter noipset,$(DEB_BUILD_OPTIONS))) |
| 36 |
COPTS += -DNO_IPSET |
| 37 |
endif |
| 38 |
|
| 39 |
ifneq (,$(filter nodhcp6,$(DEB_BUILD_OPTIONS))) |
| 40 |
COPTS += -DNO_DHCP6 |
| 41 |
endif |
| 42 |
|
| 43 |
ifneq (,$(filter noipv6,$(DEB_BUILD_OPTIONS))) |
| 44 |
COPTS += -DNO_IPV6 |
| 45 |
endif |
| 46 |
|
| 47 |
ifneq (,$(filter notftp,$(DEB_BUILD_OPTIONS))) |
| 48 |
COPTS += -DNO_TFTP |
| 49 |
endif |
| 50 |
|
| 51 |
ifneq (,$(filter nodhcp,$(DEB_BUILD_OPTIONS))) |
| 52 |
COPTS += -DNO_DHCP |
| 53 |
endif |
| 54 |
|
| 55 |
ifneq (,$(filter noscript,$(DEB_BUILD_OPTIONS))) |
| 56 |
COPTS += -DNO_SCRIPT |
| 57 |
endif |
| 58 |
|
| 59 |
ifneq (,$(filter nortc,$(DEB_BUILD_OPTIONS))) |
| 60 |
COPTS += -DHAVE_BROKEN_RTC |
| 61 |
endif |
| 62 |
|
| 63 |
ifeq (,$(filter nodnssec,$(DEB_BUILD_OPTIONS))) |
| 64 |
COPTS += -DHAVE_DNSSEC |
| 65 |
endif |
| 66 |
|
| 67 |
|
| 68 |
%: |
| 69 |
# Ubuntu and derivates do not support runit, see |
| 70 |
# https://bugs.debian.org/960401 for details. |
| 71 |
if dpkg-vendor --derives-from Ubuntu; then \ |
| 72 |
dh $@; \ |
| 73 |
else \ |
| 74 |
dh $@ --with runit; \ |
| 75 |
fi |
| 76 |
|
| 77 |
# Upstream builds and installs in one go, so do we. |
| 78 |
override_dh_auto_build: |
| 79 |
|
| 80 |
override_dh_auto_install: |
| 81 |
dh_auto_build -p dnsmasq-base -- install-i18n \ |
| 82 |
BUILDDIR=debian/auto-build/dnsmasq-base \ |
| 83 |
DESTDIR=$(CURDIR)/debian/dnsmasq-base \ |
| 84 |
PREFIX=$(PREFIX) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \ |
| 85 |
COPTS="$(COPTS)" |
| 86 |
dh_auto_build -p dnsmasq-base-lua -- install-i18n \ |
| 87 |
BUILDDIR=debian/auto-build/dnsmasq-base-lua \ |
| 88 |
DESTDIR=$(CURDIR)/debian/dnsmasq-base-lua \ |
| 89 |
PREFIX=$(PREFIX) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \ |
| 90 |
LUA=lua5.4 COPTS="$(COPTS) -DHAVE_LUASCRIPT" |
| 91 |
dh_auto_build -p dnsmasq-utils -D contrib/lease-tools |
| 92 |
|
| 93 |
override_dh_auto_clean: |
| 94 |
dh_auto_clean -p dnsmasq-base -- \ |
| 95 |
BUILDDIR=debian/auto-build/dnsmasq-base |
| 96 |
dh_auto_clean -p dnsmasq-base-lua -- \ |
| 97 |
BUILDDIR=debian/auto-build/dnsmasq-base-lua |
| 98 |
rm -rf debian/auto-build |
| 99 |
dh_auto_clean -p dnsmasq-utils -D contrib/lease-tools |
| 100 |
|
| 101 |
override_dh_install: |
| 102 |
dh_install -p dnsmasq-utils --sourcedir=contrib/lease-tools |
| 103 |
dh_install --remaining-packages |
| 104 |
|
| 105 |
# If 'nodoc' is absent from DEB_BUILD_OPTIONS, correct name of some doc files. |
| 106 |
# We would prefer do this via dh-exec if it would support dh_installdocs. |
| 107 |
ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS))) |
| 108 |
execute_after_dh_installdocs: |
| 109 |
for d in $(CURDIR)/debian/dnsmasq-base*/usr/share/doc/dnsmasq-base*; do \ |
| 110 |
cd $$d; \ |
| 111 |
mv readme README.Debian; \ |
| 112 |
mv CHANGELOG.archive changelog.archive; \ |
| 113 |
done |
| 114 |
endif |
| 115 |
|
| 116 |
# If 'nodoc' is present in DEB_BUILD_OPTIONS, drop the man pages already |
| 117 |
# installed by the upstream build script. Then, let dh_installman do what |
| 118 |
# else needs doing. |
| 119 |
override_dh_installman: |
| 120 |
ifneq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS))) |
| 121 |
rm -rf debian/dnsmasq-base*/usr/share/man |
| 122 |
endif |
| 123 |
dh_installman -p dnsmasq-utils --sourcedir=contrib/lease-tools |
| 124 |
dh_installman --remaining-packages |