X-Git-Url: https://git.distorted.org.uk/~mdw/mLib/blobdiff_plain/4a0b387cc66628ea8bab3a5b3da1d8790d98d0ee..946d18b62315f50d6ce4e091f5ccfc37d9b050c9:/debian/rules diff --git a/debian/rules b/debian/rules index 5545dd1..f7796aa 100755 --- a/debian/rules +++ b/debian/rules @@ -1,42 +1,76 @@ #! /usr/bin/make -f -CDBS = /usr/share/cdbs/1 +###-------------------------------------------------------------------------- +### Preliminary definitions. + +## The multiarch triple. +DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) +a := $(DEB_HOST_MULTIARCH) + +## My version number, shorn of the Debian package version if any. +DEB_UPSTREAM_VERSION ?= \ + $(shell dpkg-parsechangelog | \ + sed -n "/^Version: \([^-]*\)\(-.*\)\?/s//\1/p") +v := $(DEB_UPSTREAM_VERSION) + +## Default Debhelper options. +DH_OPTIONS = --parallel -include $(CDBS)/rules/debhelper.mk -include $(CDBS)/class/autotools.mk +## Default Debhelper actions. +%:; dh $@ $(DH_OPTIONS) ###-------------------------------------------------------------------------- -### General settings. +### Multiple flavours. -DEB_BUILDDIR = $(CURDIR)/build -DEB_MAKE_CHECK_TARGET = check +## The various flavours of the library which we must build. +FLAVOURS = noadns adns -DEB_CONFIGURE_EXTRA_FLAGS = --without-adns -DEB_CONFIGURE_LIBEXECDIR = "\$${prefix}/lib" +## The build actions which we have to override. +DH_BUILD_OVERRIDES = configure clean build install test -DEB_DH_MAKESHLIBS_ARGS_ALL = \ - -V"mlib2 (>= $(DEB_UPSTREAM_VERSION)) | mlib2-adns (>= $(DEB_UPSTREAM_VERSION))" +## How to perform build action for a particular library flavour. +define flavour-build-action +dh_auto_$1 -Bdebian/build-$2 \ + $(DH_OPTIONS) $(DH_OPTIONS_$2) \ + $(DH_$1_OPTIONS) $(DH_$1_OPTIONS_$2) -###-------------------------------------------------------------------------- -### Building the ADNS version. +endef + +## Override the build actions, and perform the relevant action for each +## flavour in turn. +$(foreach t, $(DH_BUILD_OVERRIDES), dh-$t-hook):: %:; @: +$(foreach t, $(DH_BUILD_OVERRIDES), override_dh_auto_$t): \ + override_dh_auto_%: dh-%-hook + $(foreach f, $(FLAVOURS), $(call flavour-build-action,$*,$f)) -DEB_CONFIGURE_EXTRA_FLAGS_mlib2-adns = --with-adns -DEB_BUILDDIR_mlib2-adns = $(CURDIR)/build-adns +## Configuration options. +DH_configure_OPTIONS = -- --libexecdir='$${libdir}' +DH_configure_OPTIONS_noadns = --without-adns +DH_configure_OPTIONS_adns = --with-adns -configure/mlib2-adns:: - $(DEB_CONFIGURE_INVOKE) \ - $(cdbs_configure_flags) \ - $(DEB_CONFIGURE_EXTRA_FLAGS_mlib2-adns) \ - $(DEB_CONFIGURE_USER_FLAGS) +## Cleaning options. +dh-clean-hook:: + rm -rf debian/tmp-adns -build/mlib2-adns:: - $(DEB_MAKE_ENVVARS) $(MAKE) -C $(DEB_BUILDDIR_mlib2-adns) +## Installation options. +DH_install_OPTIONS_adns = --destdir=debian/tmp-adns + +###-------------------------------------------------------------------------- +### Additional tweaks. -install/mlib2-adns:: - $(DEB_MAKE_ENVVARS) $(MAKE) -C $(DEB_BUILDDIR_mlib2-adns) \ - install DESTDIR=$(CURDIR)/debian/tmp-adns +## Some of the install lists need to be generated. This is a little +## annoying. +GEN_INSTALL_PKGS = mlib2-adns +GEN_INSTALL_FILES = $(foreach p, $(GEN_INSTALL_PKGS), debian/$p.install) +$(GEN_INSTALL_FILES): debian/%.install: \ + debian/%.install.in debian/changelog debian/rules + sed 's,@ARCH@,$a,g' $< >$@.new && mv $@.new $@ +dh-install-hook:: $(GEN_INSTALL_FILES); @: +dh-clean-hook:: + rm -f $(GEN_INSTALL_FILES) -clean:: - rm -rf $(CURDIR)/debian/tmp-adns +## Override the shared-library dependency information to allow any flavour. +override_dh_makeshlibs: + dh_makeshlibs -V"mlib2 (>= $v) | mlib2-adns (>= $v)" ###----- That's all, folks --------------------------------------------------