summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: ec2149889a453204ec2b4ede710d394a2ff8fb0a (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
#!/usr/bin/make -f

# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

include /usr/share/dpkg/pkg-info.mk

# see FEATURE AREAS in dpkg-buildflags(1)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# Disable LTO on ppc64el as it causes crashes (LP: #2055151).
# This has been spotted in Ubuntu, where LTO is enabled by
# default, but it likely that Debian would be affected too.
ifeq ($(DEB_HOST_ARCH),ppc64el)
export DEB_BUILD_MAINT_OPTIONS += optimize=-lto
endif

%:
	dh $@ --with python3 -X.la

override_dh_auto_configure:
	dh_auto_configure -- \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--with-openssl \
		--with-mysql \
		--with-pgsql \
		--with-boost-libs=-lboost_system \
		--enable-generate-docs \
		--enable-generate-messages \
		--enable-shell \
		--disable-static \
		--disable-rpath \
		--enable-generate-parser \
		--disable-dependency-tracking \
		--enable-perfdhcp \
		--without-werror \
		--with-site-packages=/usr/lib/python3/dist-packages

execute_after_dh_auto_build-indep:
	# Do not download external JS components in binary documentation package
	# Inspired by similar removal in python-pyopencl
	# Thanks to Andreas Beckmann
	find doc/sphinx/_build/html -name '*.html' -exec sed -r -i -e '\,( *)<script async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>,i \1<script src="/usr/share/javascript/mathjax/MathJax.js"></script>' {} +
	find doc/sphinx/_build/html -name '*.html' -exec sed -r -i -e 's,https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js,/usr/share/javascript/mathjax/config/TeX-MML-AM_CHTML.js,' {} +

execute_after_dh_install:
	dh_apparmor -pkea-ctrl-agent --profile-name=usr.sbin.kea-ctrl-agent
	dh_apparmor -pkea-dhcp4-server --profile-name=usr.sbin.kea-dhcp4
	dh_apparmor -pkea-dhcp6-server --profile-name=usr.sbin.kea-dhcp6
	dh_apparmor -pkea-dhcp-ddns-server --profile-name=usr.sbin.kea-dhcp-ddns
	dh_apparmor -pkea-common --profile-name=usr.sbin.kea-lfc

override_dh_auto_test:
	dh_auto_test --no-parallel

execute_after_dh_auto_install:
	rm -rv \
	    debian/tmp/usr/share/doc/kea/ChangeLog \
	    debian/tmp/usr/share/doc/kea/COPYING \
	    debian/tmp/usr/lib/python3/dist-packages/kea/__pycache__
	# log to stdout (i.e. to to the systemd journal), and use a shorter log
	# pattern that avoids logging information made redundant by the journal.
	# adapted from: https://gitlab.isc.org/isc-projects/kea-packaging/-/blob/master/debian/rules
	sed -i -e 's/"output": .*/"output": "stdout",/' -e 's@// "pattern"@"pattern"@' debian/tmp/etc/kea/kea-*.conf

# Since we do not maintain a symbols file for the libraries shipped in
# kea-common, make the shlibs control file more strict, generating dependencies
# such as "libkea-util 52 kea-common (= 2.2.0-5)" instead of the less strict
# "libkea-util 52 kea-common (>= 2.2.0)".
override_dh_makeshlibs:
	dh_makeshlibs -pkea-common -V'kea-common (= ${DEB_VERSION})'
	dh_makeshlibs -Nkea-common