#! /usr/bin/make -f
-CDBS = /usr/share/cdbs/1
-
-include $(CDBS)/rules/debhelper.mk
-include $(CDBS)/class/autotools.mk
+DH_OPTIONS = --parallel --without=autoreconf -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 += --libdir="\$${prefix}/lib"
+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.
-binary-install/python-tripe::
- dh_pycentral -ppython-tripe
+OVERRIDES += gencontrol
+dh-gencontrol-hook::
+ dpkg --status wireshark-common | \
+ sed -n 's/^Version: */tripe:Wireshark-Version=/p' \
+ >> debian/tripe-wireshark.substvars
###--------------------------------------------------------------------------
-### 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
+ init/tripe.conf >debian/tripe.default
-cleanbuilddir::
+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=python2
+OVERRIDES += python2
+dh_python2_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 --------------------------------------------------