chiark / gitweb /
configure.ac, debian/: Overhaul Wireshark plugin build machinery.
[tripe] / debian / rules
index 9525b985353cf970ce6ef22c9acb66b26562a312..01625b27fa5aafbd3ebf927508eaaa3be848b74c 100755 (executable)
@@ -1,71 +1,73 @@
 #! /usr/bin/make -f
 
-CDBS = /usr/share/cdbs/1
-
-include $(CDBS)/rules/debhelper.mk
-include $(CDBS)/class/autotools.mk
+DH_OPTIONS              = --parallel -Bdebian/build
 
 ###--------------------------------------------------------------------------
-### General settings.
-
-DEB_BUILDDIR = $(CURDIR)/build
-DEB_MAKE_CHECK_TARGET = check
+### Configuration.
 
-###--------------------------------------------------------------------------
-### Correct configuration.
+OVERRIDES              += auto_configure
+dh_auto_configure_OPTS  = --
 
-## This will need changing on other kernels.
-default_tunnel = linux
+## Various files and directories.
+dh_auto_configure_OPTS += --libexecdir="\$${libdir}/tripe"
+dh_auto_configure_OPTS += --with-configdir="/etc/tripe"
+dh_auto_configure_OPTS += --with-socketdir="/var/run"
+dh_auto_configure_OPTS += --with-logfile="/var/log/tripe/tripe.log"
+dh_auto_configure_OPTS += --with-pidfile="/var/run/tripectl.pid"
 
-## Configuration arguments.
-DEB_CONFIGURE_EXTRA_FLAGS = \
-       --with-tunnel="$(default_tunnel) slip" \
-       --with-configdir="/etc/tripe" \
-       --with-socketdir="/var/run" \
-       --with-logfile="/var/log/tripe/tripe.log" \
-       --with-pidfile="/var/run/tripectl.pid" \
-       --with-initconfig="/etc/default/tripe" \
-       --with-wireshark="/usr/lib/wireshark/libwireshark0/plugins"
+## The default tunnel.  If we try to port this to other kernels, we'll need
+## something more complicated here.
+dh_auto_configure_OPTS += --with-tunnel="linux slip"
 
 ###--------------------------------------------------------------------------
-### Python.
+### The wireshark plugin.
+
+OVERRIDES              += gencontrol
+dh-gencontrol-hook::
+       dpkg --status wireshark-common | \
+               sed -n 's/^Version: */tripe:Wireshark-Version=/p' \
+               >> debian/tripe-wireshark.substvars
 
-binary-install/python-tripe::
-       dh_pycentral -ppython-tripe
+OVERRIDES              += shlibdeps
+dh_shlibdeps_OPTS      += -Xwireshark/plugins
 
 ###--------------------------------------------------------------------------
-### Install the startup scripts.
+### The startup script and related machinery.
 
-install/tripe::
-       cp $(DEB_BUILDDIR)/init/tripe-init debian/tripe.init
+dh_auto_configure_OPTS += --with-initconfig="/etc/default/tripe"
+
+OVERRIDES              += installinit
+dh-installinit-hook::
+       cp debian/build/init/tripe-init debian/tripe.init
        sed 's/^#\(user\|group\)/\1/' \
-               $(DEB_SRCDIR)/init/tripe.conf >debian/tripe.default
-       mkdir -p debian/tripe/usr/share/doc/tripe/examples
-       for i in tripe-ipif ipif-peers tripe-upstart greet knock; do \
-         cp $(DEB_BUILDDIR)/contrib/$$i \
-               debian/tripe/usr/share/doc/tripe/examples; \
-       done
-
-cleanbuilddir::
+               init/tripe.conf >debian/tripe.default
+
+OVERRIDES              += clean
+dh-clean-hook::
        rm -f debian/tripe.init debian/tripe.default
 
 ###--------------------------------------------------------------------------
-### Install configuration files.
-
-install/tripe-peer-services::
-       install -m644 $(DEB_SRCDIR)/peerdb/peers.in \
+### Other things.
+
+## Python stuff.
+DH_OPTIONS             += --with=python-central
+OVERRIDES              += pycentral
+dh_pycentral_OPTS      += -ppython-tripe
+
+## The peer database.
+OVERRIDES              += install
+dh-install-hook::
+       mkdir -p debian/tripe-peer-services/etc/tripe/peers.d
+       install -m644 peerdb/peers.in \
                debian/tripe-peer-services/etc/tripe/peers.d/10base
 
 ###--------------------------------------------------------------------------
-### Wireshark plugin.
+### Some machinery for overriding Debhelper in a structured way.
 
-## Grab the version we built against, so we can put it in the dependencies.
-install/tripe-wireshark::
-       dpkg --status wireshark | \
-               sed -n 's/^Version: */tripe:Wireshark-Version=/p' \
-               >> debian/tripe-wireshark.substvars
+%:; dh $@ $(DH_OPTIONS)
 
-## Don't track dependencies for the plugin.  We have it covered already.
-DEB_DH_SHLIBDEPS_ARGS_tripe-wireshark += -Xwireshark/plugins
+$(foreach o, $(sort $(OVERRIDES)), dh-$o-hook)::; @:
+$(foreach o, $(sort $(OVERRIDES)), override_dh_$o): override_dh_%: dh-%-hook
+       dh_$* $(addprefix -O, $(DH_OPTIONS)) $(dh_$*_OPTS)
 
 ###----- That's all, folks --------------------------------------------------