| 1 | #! /usr/bin/make -f |
| 2 | |
| 3 | ###-------------------------------------------------------------------------- |
| 4 | ### Preliminary definitions. |
| 5 | |
| 6 | ## The multiarch triple. |
| 7 | DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) |
| 8 | a := $(DEB_HOST_MULTIARCH) |
| 9 | |
| 10 | ## My version number, shorn of the Debian package version if any. |
| 11 | DEB_UPSTREAM_VERSION ?= \ |
| 12 | $(shell dpkg-parsechangelog | \ |
| 13 | sed -n "/^Version: \([^-]*\)\(-.*\)\?/s//\1/p") |
| 14 | v := $(DEB_UPSTREAM_VERSION) |
| 15 | |
| 16 | ## Default Debhelper options. |
| 17 | DH_OPTIONS = --parallel |
| 18 | |
| 19 | ## Default Debhelper actions. |
| 20 | %:; dh $@ $(DH_OPTIONS) |
| 21 | |
| 22 | ###-------------------------------------------------------------------------- |
| 23 | ### Multiple flavours. |
| 24 | |
| 25 | ## The various flavours of the library which we must build. |
| 26 | FLAVOURS = noadns adns |
| 27 | |
| 28 | ## The build actions which we have to override. |
| 29 | DH_BUILD_OVERRIDES = configure clean build install test |
| 30 | |
| 31 | ## How to perform build action for a particular library flavour. |
| 32 | define flavour-build-action |
| 33 | dh_auto_$1 -Bdebian/build-$2 \ |
| 34 | $(DH_OPTIONS) $(DH_OPTIONS_$2) \ |
| 35 | $(DH_$1_OPTIONS) $(DH_$1_OPTIONS_$2) |
| 36 | |
| 37 | endef |
| 38 | |
| 39 | ## Override the build actions, and perform the relevant action for each |
| 40 | ## flavour in turn. |
| 41 | $(foreach t, $(DH_BUILD_OVERRIDES), override_dh_auto_$t):: \ |
| 42 | override_dh_auto_%: |
| 43 | $(foreach f, $(FLAVOURS), $(call flavour-build-action,$*,$f)) |
| 44 | |
| 45 | ## Configuration options. |
| 46 | DH_configure_OPTIONS = -- --libexecdir='$${libdir}' |
| 47 | DH_configure_OPTIONS_noadns = --without-adns |
| 48 | DH_configure_OPTIONS_adns = --with-adns |
| 49 | |
| 50 | ## Cleaning options. |
| 51 | override_dh_auto_clean:: |
| 52 | rm -rf debian/tmp-adns |
| 53 | |
| 54 | ## Installation options. |
| 55 | DH_install_OPTIONS_adns = --destdir=debian/tmp-adns |
| 56 | |
| 57 | ###-------------------------------------------------------------------------- |
| 58 | ### Additional tweaks. |
| 59 | |
| 60 | ## Override the shared-library dependency information to allow any flavour. |
| 61 | override_dh_makeshlibs: |
| 62 | dh_makeshlibs -V"mlib2 (>= $v) | mlib2-adns (>= $v)" |
| 63 | |
| 64 | ###----- That's all, folks -------------------------------------------------- |