X-Git-Url: https://git.distorted.org.uk/~mdw/mLib/blobdiff_plain/75721625ec223a178886db80533dbe97fb4c465e..10d1a23f7b657d31bbb0190d4ca64e09ad8f4479:/debian/rules diff --git a/debian/rules b/debian/rules index 1d58528..90210a9 100755 --- a/debian/rules +++ b/debian/rules @@ -1,54 +1,64 @@ #! /usr/bin/make -f -build: - rm -rf deb-build build; mkdir deb-build - cd deb-build; ../configure \ - --prefix=/usr \ - --mandir=/usr/share/man \ - --libexecdir=/usr/lib - make -C deb-build - make -C deb-build check - touch build - -clean: - dh_clean - rm -rf deb-build build - -install: build - dh_clean - make -C deb-build install DESTDIR=`pwd`/debian/tmp - rm -f debian/tmp/usr/lib/*.la - mkdir -p debian/mlib-dev/usr/lib debian/mlib-dev/usr/share/man - mv debian/tmp/usr/share/man/man3 debian/mlib-dev/usr/share/man - mv debian/tmp/usr/lib/*.a debian/mlib-dev/usr/lib - mv debian/tmp/usr/lib/*.so debian/mlib-dev/usr/lib - mv debian/tmp/usr/include debian/mlib-dev/usr - dh_strip -a - -binary-indep: - -binary-arch: install - dh_testdir -a - dh_testroot -a - dh_makeshlibs -a - dh_fixperms -a - dh_installman -a - dh_compress -a - dh_installdocs -a - dh_shlibdeps -a - dh_gencontrol -a - dh_installdeb -a - dh_md5sums -a - dh_builddeb -a - -binary: binary-indep binary-arch - -source: - rm -rf deb-build/*.tar.gz deb-build/=deb= - make -C deb-build dist PACKAGE=mlib - mkdir deb-build/=deb= - cd deb-build/=deb=; tar xvfz ../*.tar.gz - cd ..; dpkg-source -i -b mLib/deb-build/=deb=/* - rm -rf deb-build/=deb= - -.PHONY: binary binary-arch binary-indep clean install +###-------------------------------------------------------------------------- +### 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 + +## Default Debhelper actions. +%:; dh $@ $(DH_OPTIONS) + +###-------------------------------------------------------------------------- +### Multiple flavours. + +## The various flavours of the library which we must build. +FLAVOURS = noadns adns + +## The build actions which we have to override. +DH_BUILD_OVERRIDES = configure clean build install test + +## 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) + +endef + +## Override the build actions, and perform the relevant action for each +## flavour in turn. +$(foreach t, $(DH_BUILD_OVERRIDES), override_dh_auto_$t):: \ + override_dh_auto_%: + $(foreach f, $(FLAVOURS), $(call flavour-build-action,$*,$f)) + +## Configuration options. +DH_configure_OPTIONS = -- --libexecdir='$${libdir}' +DH_configure_OPTIONS_noadns = --without-adns +DH_configure_OPTIONS_adns = --with-adns + +## Cleaning options. +override_dh_auto_clean:: + rm -rf debian/tmp-adns + +## Installation options. +DH_install_OPTIONS_adns = --destdir=debian/tmp-adns + +###-------------------------------------------------------------------------- +### Additional tweaks. + +## 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 --------------------------------------------------