chiark / gitweb /
configure.ac, debian/: Overhaul Wireshark plugin build machinery.
[tripe] / debian / rules
index f17c0cb9a2001f0504552534c1db2769be89fb85..01625b27fa5aafbd3ebf927508eaaa3be848b74c 100755 (executable)
@@ -1,78 +1,73 @@
 #! /usr/bin/make -f
 
-export DH_COMPAT = 4
-
-build:
-       rm -rf build deb-build
-       mkdir deb-build
-       cd deb-build; ../configure \
-               --prefix=/usr --mandir=/usr/share/man \
-               --with-tunnel="linux slip" \
-               --with-configdir=/etc/tripe \
-               --with-socketdir=/var/run \
-               --with-logfile=/var/log/tripe.log \
-               --with-pidfile=/var/run/tripectl.pid \
-               --with-initconfig=/etc/default/tripe \
-               --with-wireshark
-       make -C deb-build
-       touch build
-
-clean:
-       dh_clean
-       rm -rf deb-build build
-
-install: build
-       dh_clean
-       make -C deb-build install DESTDIR=`pwd`/debian/tmp
-       mkdir -p debian/tmp/etc/tripe/peers
-       mkdir -p debian/tmp/etc/default
-       mkdir -p debian/tmp/etc/init.d
-       cp deb-build/init/tripe-init debian/tmp/etc/init.d/tripe
-       chmod 755 debian/tmp/etc/init.d/tripe
-       cp init/tripe.conf debian/tmp/etc/default/tripe
-       mkdir -p debian/tmp/usr/share/doc/tripe-keys/examples
-       cp keys/tripe-keys.master \
-               debian/tmp/usr/share/doc/tripe-keys/examples
-       dh_install --sourcedir=debian/tmp
-       mkdir -p debian/tripe-ethereal
-
-binary-indep: install
-       dh_testdir -i
-       dh_testroot -i
-       dh_compress -i
-       dh_installdocs -i
-       dh_installlogrotate -i
-       dh_gencontrol -i
-       dh_fixperms -i
-       dh_installdeb -i
-       dh_md5sums -i
-       dh_builddeb -i
-
-binary-arch: install
-       dpkg --status wireshark | \
+DH_OPTIONS              = --parallel -Bdebian/build
+
+###--------------------------------------------------------------------------
+### Configuration.
+
+OVERRIDES              += auto_configure
+dh_auto_configure_OPTS  = --
+
+## 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"
+
+## 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"
+
+###--------------------------------------------------------------------------
+### The wireshark plugin.
+
+OVERRIDES              += gencontrol
+dh-gencontrol-hook::
+       dpkg --status wireshark-common | \
                sed -n 's/^Version: */tripe:Wireshark-Version=/p' \
                >> debian/tripe-wireshark.substvars
-       dh_testdir -a
-       dh_testroot -a
-       dh_compress -a
-       dh_installdocs -a
-       dh_strip -a
-       dh_shlibdeps -a
-       dh_installlogrotate -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
-       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
+
+OVERRIDES              += shlibdeps
+dh_shlibdeps_OPTS      += -Xwireshark/plugins
+
+###--------------------------------------------------------------------------
+### The startup script and related machinery.
+
+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/' \
+               init/tripe.conf >debian/tripe.default
+
+OVERRIDES              += clean
+dh-clean-hook::
+       rm -f debian/tripe.init debian/tripe.default
+
+###--------------------------------------------------------------------------
+### 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
+
+###--------------------------------------------------------------------------
+### Some machinery for overriding Debhelper in a structured way.
+
+%:; dh $@ $(DH_OPTIONS)
+
+$(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 --------------------------------------------------