Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 1 | #!/usr/bin/make -f |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 2 | # -*- makefile -*- |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 3 | |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 4 | # Uncomment this to turn on verbose mode. |
| 5 | export DH_VERBOSE=1 |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 6 | |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 7 | # Make sure lintian does not complain about missing hardenings. |
| 8 | export DEB_BUILD_MAINT_OPTIONS = hardening=+all |
Simon Ruderich | 91f4a5e | 2014-05-20 20:27:31 +0100 | [diff] [blame] | 9 | |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 10 | include /usr/share/dpkg/architecture.mk |
Simon Kelley | 97c83bb | 2012-05-28 18:21:59 +0100 | [diff] [blame] | 11 | |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 12 | PREFIX = /usr |
| 13 | # Upstream does not handle CPPFLAGS, so we add it to CFLAGS here. |
| 14 | CFLAGS += $(CPPFLAGS) |
| 15 | COPTS = |
Simon Kelley | 02ed24d | 2013-09-09 18:06:45 +0100 | [diff] [blame] | 16 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 17 | ifeq (,$(filter nodbus,$(DEB_BUILD_OPTIONS))) |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 18 | COPTS += -DHAVE_DBUS |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 19 | endif |
| 20 | |
Simon Kelley | 43cdf1c | 2017-05-21 22:12:44 +0100 | [diff] [blame] | 21 | ifeq (,$(filter noidn, $(DEB_BUILD_OPTIONS))) |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 22 | COPTS += -DHAVE_LIBIDN2 |
| 23 | endif |
| 24 | |
| 25 | ifeq (,$(filter nonftset, $(DEB_BUILD_OPTIONS))) |
| 26 | COPTS += -DHAVE_NFTSET |
Simon Kelley | 43cdf1c | 2017-05-21 22:12:44 +0100 | [diff] [blame] | 27 | endif |
| 28 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 29 | ifeq (,$(filter noconntrack,$(DEB_BUILD_OPTIONS))) |
Simon Kelley | 6ac3bc0 | 2014-10-03 08:48:11 +0100 | [diff] [blame] | 30 | ifeq ($(DEB_HOST_ARCH_OS),linux) |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 31 | COPTS += -DHAVE_CONNTRACK |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 32 | endif |
| 33 | endif |
| 34 | |
Simon Kelley | 3ddad24 | 2013-03-21 17:56:06 +0000 | [diff] [blame] | 35 | ifneq (,$(filter noipset,$(DEB_BUILD_OPTIONS))) |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 36 | COPTS += -DNO_IPSET |
Simon Kelley | 3b323bd | 2013-02-22 21:55:29 +0000 | [diff] [blame] | 37 | endif |
| 38 | |
Simon Kelley | 96c3879 | 2012-02-16 20:07:17 +0000 | [diff] [blame] | 39 | ifneq (,$(filter nodhcp6,$(DEB_BUILD_OPTIONS))) |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 40 | COPTS += -DNO_DHCP6 |
Simon Kelley | 127ea40 | 2012-02-11 22:14:52 +0000 | [diff] [blame] | 41 | endif |
| 42 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 43 | ifneq (,$(filter noipv6,$(DEB_BUILD_OPTIONS))) |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 44 | COPTS += -DNO_IPV6 |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 45 | endif |
| 46 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 47 | ifneq (,$(filter notftp,$(DEB_BUILD_OPTIONS))) |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 48 | COPTS += -DNO_TFTP |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 49 | endif |
| 50 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 51 | ifneq (,$(filter nodhcp,$(DEB_BUILD_OPTIONS))) |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 52 | COPTS += -DNO_DHCP |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 53 | endif |
| 54 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 55 | ifneq (,$(filter noscript,$(DEB_BUILD_OPTIONS))) |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 56 | COPTS += -DNO_SCRIPT |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 57 | endif |
| 58 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 59 | ifneq (,$(filter nortc,$(DEB_BUILD_OPTIONS))) |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 60 | COPTS += -DHAVE_BROKEN_RTC |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 61 | endif |
| 62 | |
Simon Kelley | 160f650 | 2014-02-04 16:49:41 +0000 | [diff] [blame] | 63 | ifeq (,$(filter nodnssec,$(DEB_BUILD_OPTIONS))) |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 64 | COPTS += -DHAVE_DNSSEC |
Simon Kelley | 00ec693 | 2014-01-28 11:08:57 +0000 | [diff] [blame] | 65 | endif |
| 66 | |
Simon Kelley | 6ac3bc0 | 2014-10-03 08:48:11 +0100 | [diff] [blame] | 67 | |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 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; \ |
Simon Kelley | 837e8f4 | 2020-06-26 22:13:27 +0100 | [diff] [blame] | 75 | fi |
Simon Kelley | 30e4a94 | 2018-02-16 19:56:56 +0000 | [diff] [blame] | 76 | |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 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 --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 | |
| 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 or location of |
| 106 | # some doc files. |
| 107 | # We would prefer do this via dh-exec if it would support dh_installdocs. |
Simon Kelley | 5d514f2 | 2019-03-01 16:52:02 +0000 | [diff] [blame] | 108 | ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS))) |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 109 | execute_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 Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 117 | endif |
| 118 | |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 119 | # 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. |
| 122 | override_dh_installman: |
| 123 | ifneq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS))) |
| 124 | rm -rf debian/dnsmasq-base*/usr/share/man |
| 125 | endif |
| 126 | dh_installman -p dnsmasq-utils --sourcedir=contrib/lease-tools |
| 127 | dh_installman --remaining-packages |