blob: 717a5eabeac284eeef69b94eea6036e1de3c0973 [file] [log] [blame]
Simon Kelleyc72daea2012-01-05 21:33:27 +00001#!/usr/bin/make -f
Tarun Kundu12e3b2e2024-08-15 16:16:53 -07002# -*- makefile -*-
Simon Kelleyc72daea2012-01-05 21:33:27 +00003
Tarun Kundu12e3b2e2024-08-15 16:16:53 -07004# Uncomment this to turn on verbose mode.
5export DH_VERBOSE=1
Simon Kelleyc72daea2012-01-05 21:33:27 +00006
Tarun Kundu12e3b2e2024-08-15 16:16:53 -07007# Make sure lintian does not complain about missing hardenings.
8export DEB_BUILD_MAINT_OPTIONS = hardening=+all
Simon Ruderich91f4a5e2014-05-20 20:27:31 +01009
Tarun Kundu12e3b2e2024-08-15 16:16:53 -070010include /usr/share/dpkg/architecture.mk
Simon Kelley97c83bb2012-05-28 18:21:59 +010011
Tarun Kundu12e3b2e2024-08-15 16:16:53 -070012PREFIX = /usr
13# Upstream does not handle CPPFLAGS, so we add it to CFLAGS here.
14CFLAGS += $(CPPFLAGS)
15COPTS =
Simon Kelley02ed24d2013-09-09 18:06:45 +010016
Simon Kelley62779782012-02-10 21:19:25 +000017ifeq (,$(filter nodbus,$(DEB_BUILD_OPTIONS)))
Tarun Kundu12e3b2e2024-08-15 16:16:53 -070018 COPTS += -DHAVE_DBUS
Simon Kelleyc72daea2012-01-05 21:33:27 +000019endif
20
Simon Kelley43cdf1c2017-05-21 22:12:44 +010021ifeq (,$(filter noidn, $(DEB_BUILD_OPTIONS)))
Tarun Kundu12e3b2e2024-08-15 16:16:53 -070022 COPTS += -DHAVE_LIBIDN2
23endif
24
25ifeq (,$(filter nonftset, $(DEB_BUILD_OPTIONS)))
26 COPTS += -DHAVE_NFTSET
Simon Kelley43cdf1c2017-05-21 22:12:44 +010027endif
28
Simon Kelley62779782012-02-10 21:19:25 +000029ifeq (,$(filter noconntrack,$(DEB_BUILD_OPTIONS)))
Simon Kelley6ac3bc02014-10-03 08:48:11 +010030ifeq ($(DEB_HOST_ARCH_OS),linux)
Tarun Kundu12e3b2e2024-08-15 16:16:53 -070031 COPTS += -DHAVE_CONNTRACK
Simon Kelleyc72daea2012-01-05 21:33:27 +000032endif
33endif
34
Simon Kelley3ddad242013-03-21 17:56:06 +000035ifneq (,$(filter noipset,$(DEB_BUILD_OPTIONS)))
Tarun Kundu12e3b2e2024-08-15 16:16:53 -070036 COPTS += -DNO_IPSET
Simon Kelley3b323bd2013-02-22 21:55:29 +000037endif
38
Simon Kelley96c38792012-02-16 20:07:17 +000039ifneq (,$(filter nodhcp6,$(DEB_BUILD_OPTIONS)))
Tarun Kundu12e3b2e2024-08-15 16:16:53 -070040 COPTS += -DNO_DHCP6
Simon Kelley127ea402012-02-11 22:14:52 +000041endif
42
Simon Kelley62779782012-02-10 21:19:25 +000043ifneq (,$(filter noipv6,$(DEB_BUILD_OPTIONS)))
Tarun Kundu12e3b2e2024-08-15 16:16:53 -070044 COPTS += -DNO_IPV6
Simon Kelleyc72daea2012-01-05 21:33:27 +000045endif
46
Simon Kelley62779782012-02-10 21:19:25 +000047ifneq (,$(filter notftp,$(DEB_BUILD_OPTIONS)))
Tarun Kundu12e3b2e2024-08-15 16:16:53 -070048 COPTS += -DNO_TFTP
Simon Kelleyc72daea2012-01-05 21:33:27 +000049endif
50
Simon Kelley62779782012-02-10 21:19:25 +000051ifneq (,$(filter nodhcp,$(DEB_BUILD_OPTIONS)))
Tarun Kundu12e3b2e2024-08-15 16:16:53 -070052 COPTS += -DNO_DHCP
Simon Kelleyc72daea2012-01-05 21:33:27 +000053endif
54
Simon Kelley62779782012-02-10 21:19:25 +000055ifneq (,$(filter noscript,$(DEB_BUILD_OPTIONS)))
Tarun Kundu12e3b2e2024-08-15 16:16:53 -070056 COPTS += -DNO_SCRIPT
Simon Kelleyc72daea2012-01-05 21:33:27 +000057endif
58
Simon Kelley62779782012-02-10 21:19:25 +000059ifneq (,$(filter nortc,$(DEB_BUILD_OPTIONS)))
Tarun Kundu12e3b2e2024-08-15 16:16:53 -070060 COPTS += -DHAVE_BROKEN_RTC
Simon Kelley62779782012-02-10 21:19:25 +000061endif
62
Simon Kelley160f6502014-02-04 16:49:41 +000063ifeq (,$(filter nodnssec,$(DEB_BUILD_OPTIONS)))
Tarun Kundu12e3b2e2024-08-15 16:16:53 -070064 COPTS += -DHAVE_DNSSEC
Simon Kelley00ec6932014-01-28 11:08:57 +000065endif
66
Simon Kelley6ac3bc02014-10-03 08:48:11 +010067
Tarun Kundu12e3b2e2024-08-15 16:16:53 -070068%:
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; \
Simon Kelley837e8f42020-06-26 22:13:27 +010075 fi
Simon Kelley30e4a942018-02-16 19:56:56 +000076
Tarun Kundu12e3b2e2024-08-15 16:16:53 -070077# Upstream builds and installs in one go, so do we.
78override_dh_auto_build:
79
80override_dh_auto_install:
81 dh_auto_build -p dnsmasq-base --no-parallel -- 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 --no-parallel -- 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
93override_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
101override_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 or location of
106# some doc files.
107# We would prefer do this via dh-exec if it would support dh_installdocs.
Simon Kelley5d514f22019-03-01 16:52:02 +0000108ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
Tarun Kundu12e3b2e2024-08-15 16:16:53 -0700109execute_after_dh_installdocs:
110 for d in $(CURDIR)/debian/dnsmasq-base*/usr/share/doc/dnsmasq-base*; do \
111 cd $$d; \
112 mv readme README.Debian; \
113 mv CHANGELOG.archive changelog.archive; \
114 mkdir examples; \
115 mv dnsmasq.conf.example examples/; \
116 done
Simon Kelleyc72daea2012-01-05 21:33:27 +0000117endif
118
Tarun Kundu12e3b2e2024-08-15 16:16:53 -0700119# If 'nodoc' is present in DEB_BUILD_OPTIONS, drop the man pages already
120# installed by the upstream build script. Then, let dh_installman do what
121# else needs doing.
122override_dh_installman:
123ifneq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
124 rm -rf debian/dnsmasq-base*/usr/share/man
125endif
126 dh_installman -p dnsmasq-utils --sourcedir=contrib/lease-tools
127 dh_installman --remaining-packages