| 1 |
#!/usr/bin/make -f |
| 2 |
# -*- makefile -*- |
| 3 |
|
| 4 |
# Uncomment this to turn on verbose mode. |
| 5 |
#export DH_VERBOSE=1 |
| 6 |
|
| 7 |
export DEB_BUILD_MAINT_OPTIONS = hardening=+all |
| 8 |
export DPKG_GENSYMBOLS_CHECK_LEVEL=4 |
| 9 |
|
| 10 |
# DEB_BUILD_OPTIONS=parallel=N |
| 11 |
PARALLEL = $(subst parallel=,-j,$(filter parallel=%,${DEB_BUILD_OPTIONS})) |
| 12 |
|
| 13 |
# the main python version (single) |
| 14 |
PYVER=$(shell py3versions -vd) |
| 15 |
# extra python versions to build if any (plural) |
| 16 |
# To enable multiple pyversions: |
| 17 |
# Build-Depends: python3-all-dev vs python3-dev in d/control. |
| 18 |
#PYVERS=$(filter-out ${PYVER},$(shell py3versions -vs)) |
| 19 |
# This does not (yet) work for different python versions, b/c each next install |
| 20 |
# rule below overrides python module files installed by the previous install, |
| 21 |
# so we end up with just the last module. Also, the upstream build system has |
| 22 |
# bugs building pyldns in a subdir. |
| 23 |
# We can do a loop over $PYVERS in build target and run make _ldns.la in turn, |
| 24 |
# with all python-related definitions taken directly from python$vers-config, |
| 25 |
# removing ldns_wrapper.*o before each step, and saving resulting _ldns.la |
| 26 |
# under a version-specific name. But this is too ugly already. Upstream should |
| 27 |
# grow up a real module description file like setup.py and whole thing will be |
| 28 |
# built automatically from there instead of using all the wrong custom |
| 29 |
# commands, and it will automatically build things for multiple versions too, |
| 30 |
# so we'll no need to override many targets in there. |
| 31 |
# For now, build only for a single pyversion is supported. |
| 32 |
PYVERS= |
| 33 |
|
| 34 |
CONFIGFLAGS=--disable-rpath --enable-ed25519 --disable-ldns-config \ |
| 35 |
--with-trust-anchor=/usr/share/dns/root.key |
| 36 |
|
| 37 |
build-arch build-indep build \ |
| 38 |
install-indep install-arch install \ |
| 39 |
binary-arch binary-indep binary \ |
| 40 |
clean \ |
| 41 |
: %: |
| 42 |
dh $@ |
| 43 |
.PHONY: build-arch build-indep build \ |
| 44 |
install-indep install-arch install \ |
| 45 |
binary-arch binary-indep binary \ |
| 46 |
clean |
| 47 |
|
| 48 |
override_dh_auto_configure: |
| 49 |
PYTHON_VERSION=${PYVER} dh_auto_configure -B build/main -- $(CONFIGFLAGS) --with-examples --with-drill --with-pyldns --disable-gost |
| 50 |
for pyvers in $(PYVERS); do \ |
| 51 |
PYTHON_VERSION=$$pyvers dh_auto_configure -B build/python-$$pyvers -- $(CONFIGFLAGS) --with-pyldns; \ |
| 52 |
done |
| 53 |
|
| 54 |
override_dh_auto_build: |
| 55 |
${MAKE} -C build/main ${PARALLEL} all doc |
| 56 |
for pyvers in $(PYVERS); do \ |
| 57 |
${MAKE} -C build/python-$$pyvers pyldns;\ |
| 58 |
done |
| 59 |
|
| 60 |
override_dh_auto_install: |
| 61 |
${MAKE} -C build/main DESTDIR=${CURDIR}/debian/tmp install install-doc |
| 62 |
for pyvers in $(PYVERS); do \ |
| 63 |
${MAKE} DESTDIR=${CURDIR}/debian/tmp -C build/python-$$pyvers install-pyldns install-pyldnsx;\ |
| 64 |
done |
| 65 |
# upstream wrongly builds static library for the python module (.a & .la) |
| 66 |
rm -fv debian/tmp/usr/lib/python*/*-packages/_ldns.*a |
| 67 |
|
| 68 |
override_dh_auto_clean: |
| 69 |
rm -rf build/ |
| 70 |
# generated even when doing build in a separate directory: |
| 71 |
rm -f contrib/python/ldns.py contrib/python/ldns_wrapper.c |
| 72 |
|
| 73 |
override_dh_auto_test: |
| 74 |
# tests in Makefile.in are not distributed |