X-Git-Url: https://git.distorted.org.uk/~mdw/mLib/blobdiff_plain/ed8e37e2fbb61fc9e14d6141021dda6ae86a0e6b..cdbc7357cddc6a598264ef209e4bbaed0fdb3f5e:/debian/rules diff --git a/debian/rules b/debian/rules index 63a62d9..90210a9 100755 --- a/debian/rules +++ b/debian/rules @@ -1,79 +1,64 @@ #! /usr/bin/make -f -export DH_COMPAT = 4 - -build: - rm -rf deb-build deb-noadns build; mkdir deb-build deb-noadns - cd deb-build; ../configure \ - --with-adns \ - --prefix=/usr \ - --mandir=/usr/share/man \ - --libexecdir=/usr/lib - make -C deb-build - make -C deb-build check - cd deb-noadns; ../configure \ - --without-adns \ - --prefix=/usr \ - --mandir=/usr/share/man \ - --libexecdir=/usr/lib - make -C deb-noadns - make -C deb-noadns check - touch build - -clean: - dh_clean - rm -rf deb-build deb-noadns build - -install: build - dh_clean - make -C deb-noadns install DESTDIR=`pwd`/debian/mlib2 - mkdir -p debian/mlib-dev/usr/lib - mkdir -p debian/mlib-dev/usr/share/man - mkdir -p debian/mlib-dev/usr/bin - mv debian/mlib2/usr/bin/mLib-config debian/mlib-dev/usr/bin - mv debian/mlib2/usr/share/man/man3 debian/mlib-dev/usr/share/man - mv debian/mlib2/usr/lib/*.a debian/mlib-dev/usr/lib - mv debian/mlib2/usr/lib/*.so debian/mlib-dev/usr/lib - mv debian/mlib2/usr/lib/*.la debian/mlib-dev/usr/lib - mv debian/mlib2/usr/include debian/mlib-dev/usr - mkdir -p debian/mlib-bin/usr/share/man - mv debian/mlib2/usr/bin debian/mlib-bin/usr - mv debian/mlib2/usr/share/man/man1 debian/mlib-bin/usr/share/man - make -C deb-build install DESTDIR=`pwd`/debian/mlib2-adns - rmdir debian/mlib2-adns/usr/lib/mLib - rm -rf debian/mlib2-adns/usr/bin - rm -rf debian/mlib2-adns/usr/share/man - rm -rf debian/mlib2-adns/usr/include - rm debian/mlib2-adns/usr/lib/*.a - rm debian/mlib2-adns/usr/lib/*.so - rm debian/mlib2-adns/usr/lib/*.la - dh_strip -a - -binary-indep: - -binary-arch: install - dh_testdir -a - dh_testroot -a - dh_makeshlibs -a -V"mlib2 (>= 2.0.3) | mlib2-adns (>= 2.0.3)" - dh_installman -a - dh_compress -a - dh_installdocs -a - dh_strip -a - dh_shlibdeps -a - dh_gencontrol -a - dh_fixperms -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 - d=`pwd`; cd ..; dpkg-source -i -b $$d/deb-build/=deb=/* - rm -rf deb-build/=deb= - -.PHONY: binary binary-arch binary-indep clean install source +###-------------------------------------------------------------------------- +### 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 --------------------------------------------------