debian: Drop CDBS in favour of using Debhelper directly.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 14 Jun 2013 19:43:15 +0000 (20:43 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 28 Jun 2013 22:59:00 +0000 (23:59 +0100)
Makefile.am
debian/.gitignore
debian/compat [new file with mode: 0644]
debian/control
debian/rules

index 5a11eb7..1fe6fa1 100644 (file)
@@ -128,9 +128,18 @@ EXTRA_DIST         += config/maninst
 ## General stuff.
 EXTRA_DIST             += debian/rules debian/copyright
 EXTRA_DIST             += debian/control debian/changelog
+EXTRA_DIST             += debian/compat
+
+## mlib2
 EXTRA_DIST             += debian/mlib2.install
+
+## mlib2-adns
 EXTRA_DIST             += debian/mlib2-adns.install
-EXTRA_DIST             += debian/mlib-dev.install
+
+## mlib-bin
 EXTRA_DIST             += debian/mlib-bin.install
 
+## mlib-dev
+EXTRA_DIST             += debian/mlib-dev.install
+
 ###----- That's all, folks --------------------------------------------------
index dcad8f7..bc87143 100644 (file)
@@ -1,11 +1,11 @@
 ## General stuff.
 files
+build-*
 tmp
 tmp-*
 substvars
 *.debhelper
 *.substvars
-compat
 stamp-*
 *.log
 
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..45a4fb7
--- /dev/null
@@ -0,0 +1 @@
+8
index 7546231..131a859 100644 (file)
@@ -2,7 +2,7 @@ Source: mlib
 Section: libs
 Priority: extra
 Maintainer: Mark Wooding <mdw@distorted.org.uk>
-Build-Depends: debhelper (>= 4.0.2), libadns1-dev
+Build-Depends: debhelper (>= 8), libadns1-dev
 Standards-Version: 3.1.1
 
 Package: mlib2
index 5545dd1..90210a9 100755 (executable)
@@ -1,42 +1,64 @@
 #! /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), override_dh_auto_$t):: \
+               override_dh_auto_%:
+       $(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.
+override_dh_auto_clean::
+       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
 
-install/mlib2-adns::
-       $(DEB_MAKE_ENVVARS) $(MAKE) -C $(DEB_BUILDDIR_mlib2-adns) \
-               install DESTDIR=$(CURDIR)/debian/tmp-adns
+###--------------------------------------------------------------------------
+### Additional tweaks.
 
-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 --------------------------------------------------