summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: 3c6f47510132c21e0dc6b82af117a8e2cfc04c64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/make -f

# Turn on all hardening flags, as we're a networked daemon.
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

# Vendor and version
CXXFLAGS += -DPACKAGEVERSION='"$(DEB_VERSION).$(DEB_VENDOR)"'

H2O_SOURCE_DIR=$(CURDIR)/debian/vendor-h2o/
H2O_BUILD_DIR=$(CURDIR)/debian/vendor-h2o-build/
H2O_INSTALL_DIR=$(CURDIR)/debian/vendor-h2o-destdir/
LDFLAGS += -L$(H2O_INSTALL_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)
CXXFLAGS += -I$(H2O_INSTALL_DIR)/usr/include

%:
	dh $@

override_dh_auto_clean:
	dh_auto_clean
	rm -f dnslabeltext.cc
	rm -rf $(H2O_BUILD_DIR) $(H2O_INSTALL_DIR)

vendored_libh2o:
	# Build vendorized copy of libh2o first
	mkdir $(H2O_BUILD_DIR) $(H2O_INSTALL_DIR)
	(cd $(H2O_BUILD_DIR) && CFLAGS='-fPIC' cmake -DWITH_PICOTLS=off -DWITH_BUNDLED_SSL=off -DWITH_MRUBY=off -DCMAKE_INSTALL_PREFIX=/usr $(H2O_SOURCE_DIR))
	$(MAKE) -C $(H2O_BUILD_DIR) install DESTDIR=$(H2O_INSTALL_DIR)

#LDFLAGS += -lh2o-evloop

override_dh_auto_configure: vendored_libh2o
	# Actually configure dnsdist now
	chmod a+x debian/configure-helpers/*
	PATH=debian/configure-helpers/:$$PATH dh_auto_configure -- \
	  --sysconfdir=/etc/dnsdist \
	  --enable-systemd --with-systemd=$$(pkgconf --variable=systemdsystemunitdir systemd) \
	  --enable-unit-tests \
	  --disable-silent-rules \
	  --enable-dnscrypt \
	  --enable-dns-over-https \
	  --enable-dns-over-tls \
	  --enable-dnstap \
	  --with-ebpf \
	  --with-gnutls=no \
	  --with-libsodium \
	  --with-libssl \
	  --with-lmdb \
	  --with-lua \
	  --with-net-snmp \
	  --with-nghttp2 \
	  --with-protobuf \
	  --with-re2 \
	  --with-service-user='_dnsdist' \
	  --with-service-group='_dnsdist' \
	  $(CONFIGURE_ARGS) PKG_CONFIG_PATH=$(H2O_INSTALL_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig:$(PKG_CONFIG_PATH)

override_dh_auto_build-arch:
	dh_auto_build -- V=1


override_dh_auto_test:
	echo tests disabled, require working ipv4 stack

override_dh_install:
	dh_auto_install
	install -m 0640 debian/config/dnsdist.conf debian/dnsdist/etc/dnsdist/
	rm debian/dnsdist/etc/dnsdist/dnsdist.conf-dist
	install -d debian/dnsdist/usr/share/dnsdist/snmp
	install -m 644 -t debian/dnsdist/usr/share/dnsdist/snmp DNSDIST-MIB.txt

override_dh_installexamples:
	cp dnsdist.conf-dist dnsdist.conf
	dh_installexamples
	rm -f dnsdist.conf

override_dh_fixperms:
	dh_fixperms
	chmod 0640 debian/dnsdist/etc/dnsdist/dnsdist.conf