Commit | Line | Data |
---|---|---|
75721625 | 1 | #! /usr/bin/make -f |
2 | ||
5b078c11 MW |
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. | |
946d18b6 | 17 | DH_OPTIONS = --parallel |
52162d1b | 18 | |
5b078c11 | 19 | ## Default Debhelper actions. |
946d18b6 | 20 | %:; dh $@ $(DH_OPTIONS) |
75721625 | 21 | |
4a0b387c | 22 | ###-------------------------------------------------------------------------- |
5b078c11 | 23 | ### Multiple flavours. |
75721625 | 24 | |
5b078c11 MW |
25 | ## The various flavours of the library which we must build. |
26 | FLAVOURS = noadns adns | |
75721625 | 27 | |
5b078c11 MW |
28 | ## The build actions which we have to override. |
29 | DH_BUILD_OVERRIDES = configure clean build install test | |
75721625 | 30 | |
5b078c11 MW |
31 | ## How to perform build action for a particular library flavour. |
32 | define flavour-build-action | |
33 | dh_auto_$1 -Bdebian/build-$2 \ | |
a7a49baf | 34 | $(addprefix -O, $(DH_OPTIONS)) $(DH_OPTIONS_$2) \ |
5b078c11 | 35 | $(DH_$1_OPTIONS) $(DH_$1_OPTIONS_$2) |
75721625 | 36 | |
5b078c11 MW |
37 | endef |
38 | ||
39 | ## Override the build actions, and perform the relevant action for each | |
40 | ## flavour in turn. | |
9a38b772 MW |
41 | $(foreach t, $(DH_BUILD_OVERRIDES), dh-$t-hook):: %:; @: |
42 | $(foreach t, $(DH_BUILD_OVERRIDES), override_dh_auto_$t): \ | |
43 | override_dh_auto_%: dh-%-hook | |
5b078c11 | 44 | $(foreach f, $(FLAVOURS), $(call flavour-build-action,$*,$f)) |
75721625 | 45 | |
5b078c11 MW |
46 | ## Configuration options. |
47 | DH_configure_OPTIONS = -- --libexecdir='$${libdir}' | |
48 | DH_configure_OPTIONS_noadns = --without-adns | |
49 | DH_configure_OPTIONS_adns = --with-adns | |
75721625 | 50 | |
5b078c11 | 51 | ## Cleaning options. |
9a38b772 | 52 | dh-clean-hook:: |
5b078c11 | 53 | rm -rf debian/tmp-adns |
4a0b387c | 54 | |
5b078c11 MW |
55 | ## Installation options. |
56 | DH_install_OPTIONS_adns = --destdir=debian/tmp-adns | |
4a0b387c | 57 | |
5b078c11 MW |
58 | ###-------------------------------------------------------------------------- |
59 | ### Additional tweaks. | |
4a0b387c | 60 | |
a7a49baf MW |
61 | ## Don't try to rebuild our configure script. |
62 | DH_OPTIONS += --without=autoreconf | |
63 | ||
9a38b772 MW |
64 | ## Some of the install lists need to be generated. This is a little |
65 | ## annoying. | |
66 | GEN_INSTALL_PKGS = mlib2-adns | |
67 | GEN_INSTALL_FILES = $(foreach p, $(GEN_INSTALL_PKGS), debian/$p.install) | |
68 | $(GEN_INSTALL_FILES): debian/%.install: \ | |
69 | debian/%.install.in debian/changelog debian/rules | |
70 | sed 's,@ARCH@,$a,g' $< >$@.new && mv $@.new $@ | |
71 | dh-install-hook:: $(GEN_INSTALL_FILES); @: | |
72 | dh-clean-hook:: | |
73 | rm -f $(GEN_INSTALL_FILES) | |
74 | ||
e24857fe | 75 | ## Check that the shared-library symbols are plausible. |
5b078c11 | 76 | override_dh_makeshlibs: |
e24857fe | 77 | dh_makeshlibs -- -c4 |
4a0b387c MW |
78 | |
79 | ###----- That's all, folks -------------------------------------------------- |