]>
Commit | Line | Data |
---|---|---|
3d089cf2 PL |
1 | #!/usr/bin/make -f |
2 | DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) | |
3 | DEB_HOST_ARCH_BITS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_BITS) | |
4 | DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) | |
5 | ||
6 | # Backends | |
578ed45d | 7 | backends := bind ldap pipe gmysql godbc gpgsql gsqlite3 geoip lua lua2 mydns remote random opendbx tinydns |
3d089cf2 PL |
8 | |
9 | # Disable systemd integration on non-linux archs | |
10 | ifeq ($(DEB_HOST_ARCH_OS),linux) | |
11 | CONFIGURE_ARGS += --enable-systemd --with-systemd=/lib/systemd/system | |
12 | else | |
13 | CONFIGURE_ARGS += --disable-systemd | |
14 | endif | |
15 | ||
16 | ||
17 | # Use new build system | |
18 | %: | |
19 | dh $@ \ | |
20 | --with autoreconf \ | |
21 | --with systemd \ | |
22 | --parallel | |
23 | ||
24 | override_dh_auto_configure: | |
25 | test -f pdns/dnslabeltext.cc && mv pdns/dnslabeltext.cc debian/dnslabeltext.cc.moved || true | |
26 | dh_auto_configure -- \ | |
27 | --sysconfdir=/etc/powerdns \ | |
28 | --with-dynmodules="$(backends)" \ | |
29 | --with-modules="" \ | |
30 | --enable-tools \ | |
cb264691 | 31 | --with-libsodium \ |
17477d10 | 32 | --with-lua=luajit \ |
3d089cf2 PL |
33 | --with-protobuf \ |
34 | --enable-unit-tests \ | |
35 | --enable-experimental-pkcs11 \ | |
17477d10 PL |
36 | --enable-lua-records \ |
37 | --enable-ixfrdist \ | |
3d089cf2 PL |
38 | $(CONFIGURE_ARGS) |
39 | ||
40 | # pdns-server has a debug package | |
41 | override_dh_strip: | |
42 | dh_strip --dbg-package=pdns-server-dbg | |
43 | ||
44 | override_dh_systemd_enable: | |
45 | dh_systemd_enable --name=pdns | |
46 | ||
47 | # init script needs to be named pdns, not pdns-server. if no pdns-backend | |
48 | # is installed, start will fail, so pass --no-start. backends will trigger | |
49 | # a restart. | |
50 | override_dh_installinit: | |
51 | dh_installinit --error-handler=initscript_error --no-start --restart-after-upgrade --name=pdns | |
52 | ||
53 | override_dh_install: | |
54 | dh_install | |
55 | ./pdns/pdns_server --no-config --config | sed \ | |
56 | -e 's!# module-dir=.*!!' \ | |
57 | -e 's!# include-dir=.*!&\ninclude-dir=/etc/powerdns/pdns.d!' \ | |
58 | -e 's!# launch=.*!&\nlaunch=!' \ | |
59 | -e 's!# setgid=.*!setgid=pdns!' \ | |
60 | -e 's!# setuid=.*!setuid=pdns!' \ | |
3d089cf2 PL |
61 | > debian/pdns-server/etc/powerdns/pdns.conf |
62 | ifeq ($(DEB_HOST_ARCH_BITS),32) | |
63 | echo RestrictAddressFamilies is broken on 32bit, removing it from service file | |
64 | perl -ni -e 'print unless /RestrictAddressFamilies/' debian/pdns-server/lib/systemd/system/*.service | |
65 | endif | |
66 | ||
67 | # Verbose tests (shows used compiler/linker and their flags) | |
68 | override_dh_auto_test: | |
69 | echo Skipping make test, as dependencies are missing. | |
70 | make check -- V=1 || (cat pdns/test-suite.log && false) | |
71 | ||
72 | # Verbose build (shows used compiler/linker and their flags) | |
73 | override_dh_auto_build-arch: | |
74 | dh_auto_build -- V=1 MAKEOPTS=-j2 | |
75 | ||
76 | override_dh_fixperms: | |
77 | dh_fixperms | |
78 | # these files often contain passwords. | |
79 | chmod 0600 debian/pdns-server/etc/powerdns/pdns.conf | |
80 | ||
81 | # restore moved files | |
82 | override_dh_clean: | |
83 | test -f debian/dnslabeltext.cc.moved && mv debian/dnslabeltext.cc.moved pdns/dnslabeltext.cc || true | |
84 | dh_clean |