]> git.ipfire.org Git - thirdparty/pdns.git/blob - build-scripts/debian-recursor/rules
Re-do Lua detection
[thirdparty/pdns.git] / build-scripts / debian-recursor / rules
1 #!/usr/bin/make -f
2
3 # Enable hardening features for daemons
4 # Note: blhc (build log hardening check) will find these false positives: CPPFLAGS 2 missing, LDFLAGS 1 missing
5 export DEB_BUILD_MAINT_OPTIONS=hardening=+bindnow,+pie
6 DPKG_EXPORT_BUILDFLAGS = 1
7 # Include buildflags.mk so we can append to the vars it sets.
8 include /usr/share/dpkg/buildflags.mk
9
10 ENABLE_SYSTEMD := --enable-systemd --with-systemd=/lib/systemd/system
11 LIBSYSTEMD_DEV := , libsystemd-dev
12 DEBHELPER_WITH_SYSTEMD := --with systemd
13
14 ENABLE_LIBSODIUM := --enable-libsodium
15 LIBSODIUM_DEV := , libsodium-dev
16
17 ENABLE_NETSNMP := --with-net-snmp
18 NETSNMP_DEV := , libsnmp-dev
19
20 # $(ID) and $(VERSION_ID) come from the environment, source this from /etc/os-release
21 ifeq ($(ID), ubuntu)
22 ifeq ($(VERSION_ID), 14.04)
23 # Disable building with and depending on systemd on Ubuntu Trusty
24 ENABLE_SYSTEMD=
25 LIBSYSTEMD_DEV=
26 DEBHELPER_WITH_SYSTEMD=
27
28 # Also disable libsodium
29 ENABLE_LIBSODIUM=
30 LIBSODIUM_DEV=
31 endif
32 endif
33
34 ifeq ($(ID), debian)
35 ifeq ($(VERSION_ID), 9)
36 # SNMP is linked to OpenSSL 1.0 while we link against OpenSSL 1.1
37 ENABLE_NETSNMP = --without-net-snmp
38 NETSNMP_DEV =
39 endif
40 endif
41
42 debian/control: debian/control.in
43 sed -e "s!@LIBSYSTEMDDEV@!$(LIBSYSTEMD_DEV)!" \
44 -e "s!@LIBSODIUMDEV@!$(LIBSODIUM_DEV)!" \
45 -e "s!@LIBSNMPDEV@!$(LIBSNMP_DEV)!" \
46 $< > $@
47
48 # Use new build system
49 %:
50 dh $@ \
51 --with autoreconf \
52 --parallel \
53 $(DEBHELPER_WITH_SYSTEMD)
54
55 override_dh_auto_configure:
56 ./configure \
57 --host=$(DEB_HOST_GNU_TYPE) \
58 --build=$(DEB_BUILD_GNU_TYPE) \
59 --prefix=/usr \
60 --sysconfdir=/etc/powerdns \
61 --mandir=\$${prefix}/share/man \
62 --infodir=\$${prefix}/share/info \
63 --libdir='$${prefix}/lib/$(DEB_HOST_MULTIARCH)' \
64 --libexecdir='$${prefix}/lib' \
65 --with-lua=luajit \
66 --with-protobuf=yes \
67 $(ENABLE_NETSNMP) \
68 $(ENABLE_SYSTEMD) \
69 $(ENABLE_LIBSODIUM)
70
71 override_dh_auto_install:
72 ./pdns_recursor --config | sed \
73 -e 's!# config-dir=.*!config-dir=/etc/powerdns!' \
74 -e 's!# local-address=.*!local-address=127.0.0.1!' \
75 -e 's!# quiet=.*!quiet=yes!' \
76 -e 's!# setgid=.*!setgid=pdns!' \
77 -e 's!# setuid=.*!setuid=pdns!' \
78 -e 's!# include-dir=.*!include-dir=/etc/powerdns/recursor.d/!' \
79 > debian/pdns-recursor/etc/powerdns/recursor.conf
80 dh_auto_install -- STRIP_BINARIES=0
81 rm -f debian/pdns-recursor/etc/powerdns/recursor.conf-dist
82
83 override_dh_strip:
84 dh_strip --dbg-package=pdns-recursor-dbg
85
86 override_dh_installinit:
87 dh_installinit --error-handler=initscript_error -- defaults 19 85
88
89 override_dh_auto_test:
90 $(MAKE) check || (cat test-suite.log && false)