chiark / gitweb /
debian/: Fix userv-ucgi docs rename
[userv-utils.git] / debian / rules
index 49772399a7142cf391b227b0816b637568be3bf8..9bd3c330779b132e2fb713dca83c49daebb01038 100755 (executable)
 #!/usr/bin/make -f
 
-subdirs_build= ipif www-cgi
+# Copyright 1996-2013,2016 Ian Jackson <ijackson@chiark.greenend.org.uk>
+# Copyright 1998 David Damerell <damerell@chiark.greenend.org.uk>
+# Copyright 1999,2003
+#    Chancellor Masters and Scholars of the University of Cambridge
+# Copyright 2010 Tony Finch <fanf@dotat.at>
+#
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with userv-utils; if not, see http://www.gnu.org/licenses/.
+
+subdirs_build= ipif ucgi git-daemon
 subdirs_nobuild=dyndns groupmanage misc
 package=       userv-utils
-packages_indep=        userv-dyndns userv-groupmanage userv-misc
+packages_indep=        userv-dyndns userv-groupmanage userv-utils userv-git-daemon
 packages_arch= userv-ipif userv-cgi
 packages=      $(packages_indep) $(packages_arch)
 
+SHELL=/bin/bash
+
 cwd=   $(shell pwd)
 d=     $(cwd)/debian
-t=     $d/tmp
 
-build:
-       $(checkdir)
-       set -e; for s in $(subdirs_build); do $(MAKE) -C $$s all; done
-       touch build
+%:
+       dh $@
+
+override_dh_auto_configure:
 
-clean:
+override_dh_auto_build:
        $(checkdir)
-       rm -f build
        set -e; for s in $(subdirs_build); do \
-               $(MAKE) -C $$s -i distclean || \
-               $(MAKE) -C $$s -f Makefile.in distclean; \
+               $(MAKE) -C $$s all; \
        done
-       rm -rf *~ debian/tmp debian/*~ debian/files* debian/substvars*
+       touch build
 
-binary-prep:
+override_dh_auto_install:
        $(checkdir)
-       rm -rf debian/tmp*
-       #
-       #
+       -
+       set -e; for p in $(packages); do rm -rf $d/$$p; done
+       -
        set -e; for s in $(subdirs_build) $(subdirs_nobuild); do \
+               t=$d/userv-$$s; \
+               rm -rf $$t; \
                $(MAKE) -C $$s install install-docs install-examples \
-                       prefix=$t/userv-$$s/usr \
-                       etcdir=$t/userv-$$s/etc \
-                       varlib=$t/userv-$$s/var/lib; \
-       done
-       #
-       mv debian/tmp/userv-www-cgi debian/tmp/userv-cgi
-       mv debian/tmp/userv-groupmanage/usr/share/doc/groupmanage \
-          debian/tmp/userv-groupmanage/usr/share/doc/userv-groupmanage
-       #
-       set -e; for p in $(packages); do \
-               install -d $t/$$p/DEBIAN $t/$$p/usr/share/doc/$$p; \
-               cp debian/copyright debian/changelog \
-                       $t/$$p/usr/share/doc/$$p/; \
-               ln -s changelog.gz \
-                       $t/$$p/usr/share/doc/$$p/changelog.Debian.gz; \
-               gzip -9v $t/$$p/usr/share/doc/$$p/changelog; \
-               done
-       #
-       rename 's/\.example$$//' $t/userv-ipif/etc/userv/vpn/*.example \
-               $t/userv-dyndns/etc/userv/dyndns-service-users.example \
-               $t/userv-groupmanage/etc/groupmanage.conf.example
-       rename 's/\.distrib$$//' $t/*/etc/userv/services.d/*.distrib
-       rename 's/$$/\.disabled/' $t/userv-misc/etc/userv/services.d/mailq
-       set -e; for p in $(packages); do \
-               cd $t/$$p; \
-               test ! -d etc || \
-                 find etc -type f -exec printf '/%s\n' '{}' ';' \
-                       >>DEBIAN/conffiles; \
+                       prefix=$$t/usr \
+                       etcdir=$$t/etc \
+                       vardir=$$t/var \
+                       gituser=root \
+               ; \
        done
-       #
-       mv $t/userv-misc/usr/bin/mailq $t/userv-misc/usr/bin/mailq.userv
-       #
-#      gzip -9f $t/*/usr/share/man/man*/*
-
-binary-hook-userv-misc:
-binary-hook-userv-groupmanage:
-binary-hook-userv-cgi:
-binary-hook-userv-dyndns:
-binary-hook-userv-ipif:
-
-binary-one:
-       set -e; for f in preinst postinst prerm postrm conffiles; do \
-               test -f debian/$p/$$f || continue; \
-               cp debian/$p/$$f $t/$p/DEBIAN/$$f; \
-               chmod u=rwX,go=rX $t/$p/DEBIAN/$$f; \
+       -
+       mv debian/userv-misc debian/userv-utils
+       -
+       mv $d/userv-ipif/usr/share/doc/userv-ipif/{service.c.txt,ipif.txt}
+       -
+       set -e; cd debian/userv-ucgi/usr/share/doc/userv-ucgi;  \
+               rename 's/^/ucgi-/' *
+       -
+       set -e; for p in userv-ipif userv-ucgi; do              \
+               (cd debian/$$p/usr/share/doc;                   \
+                mv $$p userv-utils);                           \
+               cp -al debian/$$p/. debian/userv-utils/.;       \
        done
-       dpkg-gencontrol -p$p -P$t/$p -Tdebian/sv-$p
-       chown -R root.root debian/tmp
-       chmod -R g-ws debian/tmp
-       debian/rules binary-hook-$p
-       dpkg --build $t/$p ..
+       -
+       perl -pe 's{/usr/local/}{/usr/}' ucgi/www-cgi   \
+               >debian/userv-utils/etc/userv/services.d/www-cgi
+       -
+       mv debian/userv-groupmanage/usr/share/doc/groupmanage \
+          debian/userv-groupmanage/usr/share/doc/userv-groupmanage
+       -
+       rename 's/\.example$$//' $d/userv-ipif/etc/userv/vpn/*.example \
+               $d/userv-dyndns/etc/userv/dyndns-service-users.example \
+               $d/userv-groupmanage/etc/groupmanage.conf.example
+       rename 's/\.distrib$$//' $d/*/etc/userv/services.d/*.distrib
+       -
+       mv $d/userv-utils/usr/bin/mailq $d/userv-utils/usr/bin/mailq.userv
+       -
+       set -e; cd $d/userv-utils/etc/userv;                    \
+               mkdir services-available;                       \
+               mv services.d/* services-available/
 
-binary-indep:  checkroot build binary-prep
-       set -e; for p in $(packages_indep); do \
-               debian/rules binary-one p=$$p; done
+override_dh_install:
 
-binary-arch:   checkroot build binary-prep
+override_dh_auto_clean:
        $(checkdir)
-       dpkg-shlibdeps -Tdebian/sv-userv-ipif \
-               $t/userv-ipif/usr/bin/udptunnel-forwarder \
-               $t/userv-ipif/usr/lib/userv/ipif
-       dpkg-shlibdeps -Tdebian/sv-userv-cgi \
-               $t/userv-cgi/usr/lib/userv/cgi/target \
-               $t/userv-cgi/usr/lib/userv/cgi/cgi/ucgi
-       set -e; for p in $(packages_arch); \
-               do debian/rules binary-one p=$$p; done
+       rm -f build
+       set -e; for s in $(subdirs_build); do \
+               $(MAKE) -C $$s -i distclean || \
+               $(MAKE) -C $$s -f Makefile.in distclean; \
+       done
+       rm -rf *~ debian/tmp debian/*~ debian/files* debian/substvars*
 
 define checkdir
        test -f ipif/service.c
@@ -105,13 +106,6 @@ endef
 
 # Below here is fairly generic really
 
-binary:                binary-indep binary-arch
-
-source diff:
-       @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
-
 checkroot:
        $(checkdir)
        test root = "`whoami`"
-
-.PHONY: binary binary-arch binary-indep clean checkroot