chiark / gitweb /
Use dh(1). WIP.
[userv-utils.git] / debian / rules
1 #!/usr/bin/make -f
2
3 # Copyright 1996-2013 Ian Jackson <ijackson@chiark.greenend.org.uk>
4 # Copyright 1998 David Damerell <damerell@chiark.greenend.org.uk>
5 # Copyright 1999,2003
6 #    Chancellor Masters and Scholars of the University of Cambridge
7 # Copyright 2010 Tony Finch <fanf@dotat.at>
8 #
9 # This is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 # General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with userv-utils; if not, see http://www.gnu.org/licenses/.
21
22 subdirs_build=  ipif www-cgi git-daemon
23 subdirs_nobuild=dyndns groupmanage misc
24 package=        userv-utils
25 packages_indep= userv-dyndns userv-groupmanage userv-misc userv-git-daemon
26 packages_arch=  userv-ipif userv-cgi
27 packages=       $(packages_indep) $(packages_arch)
28
29 cwd=    $(shell pwd)
30 d=      $(cwd)/debian
31 t=      $d/tmp
32
33 %:
34         dh $@
35
36 override_dh_auto_configure:
37
38 override_dh_auto_build:
39         $(checkdir)
40         set -e; for s in $(subdirs_build); do \
41                 $(MAKE) -C $$s all depr=disable; \
42         done
43         touch build
44
45 override_dh_auto_install:
46         $(checkdir)
47         rm -rf $t
48         set -e; for s in $(subdirs_build) $(subdirs_nobuild); do \
49                 $(MAKE) -C $$s install install-docs install-examples \
50                         prefix=$t/userv-$$s/usr \
51                         etcdir=$t/userv-$$s/etc \
52                         vardir=$t/userv-$$s/var \
53                         depr=disable \
54                         gituser=root; \
55         done
56         cd $t; for f in *; do rm -rf ../$$f; mv $$f ..; done
57
58 override_dh_install:
59         mv debian/userv-www-cgi debian/userv-cgi
60         mv debian/userv-groupmanage/usr/share/doc/groupmanage \
61            debian/userv-groupmanage/usr/share/doc/userv-groupmanage
62         @:
63         set -e; for p in $(packages); do \
64                 install -d $t/$$p/DEBIAN $t/$$p/usr/share/doc/$$p; \
65                 cp debian/copyright debian/changelog \
66                         $t/$$p/usr/share/doc/$$p/; \
67                 ln -s changelog.gz \
68                         $t/$$p/usr/share/doc/$$p/changelog.Debian.gz; \
69                 gzip -9v $t/$$p/usr/share/doc/$$p/changelog; \
70                 done
71         @:
72         rename 's/\.example$$//' $t/userv-ipif/etc/userv/vpn/*.example \
73                 $t/userv-dyndns/etc/userv/dyndns-service-users.example \
74                 $t/userv-groupmanage/etc/groupmanage.conf.example
75         rename 's/\.distrib$$//' $t/*/etc/userv/services.d/*.distrib
76         rename 's/$$/\.disabled/' $t/userv-misc/etc/userv/services.d/mailq
77         set -e; for p in $(packages); do \
78                 cd $t/$$p; \
79                 test ! -d etc || \
80                   find etc -type f -exec printf '/%s\n' '{}' ';' \
81                         >>DEBIAN/conffiles; \
82         done
83         @:
84         mv $t/userv-misc/usr/bin/mailq $t/userv-misc/usr/bin/mailq.userv
85         @:
86
87 override_dh_auto_clean:
88         $(checkdir)
89         rm -f build
90         set -e; for s in $(subdirs_build); do \
91                 $(MAKE) -C $$s -i distclean || \
92                 $(MAKE) -C $$s -f Makefile.in distclean; \
93         done
94         rm -rf *~ debian/tmp debian/*~ debian/files* debian/substvars*
95
96 define checkdir
97         test -f ipif/service.c
98 endef
99
100 # Below here is fairly generic really
101
102 checkroot:
103         $(checkdir)
104         test root = "`whoami`"