chiark / gitweb /
df890974725a5b630ad9787af3fd18a498491c22
[userv-utils.git] / debian / rules
1 #!/usr/bin/make -f
2
3 # Copyright 1996-2013,2016 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 ucgi git-daemon
23 subdirs_nobuild=dyndns groupmanage misc
24 package=        userv-utils
25 packages_indep= userv-dyndns userv-groupmanage userv-utils userv-git-daemon
26 packages_arch=  userv-ipif userv-cgi
27 packages=       $(packages_indep) $(packages_arch)
28
29 SHELL=/bin/bash
30
31 cwd=    $(shell pwd)
32 d=      $(cwd)/debian
33
34 %:
35         dh $@
36
37 override_dh_auto_configure:
38
39 override_dh_auto_build:
40         $(checkdir)
41         set -e; for s in $(subdirs_build); do \
42                 $(MAKE) -C $$s all; \
43         done
44         touch build
45
46 override_dh_auto_install:
47         $(checkdir)
48         -
49         set -e; for p in $(packages); do rm -rf $d/$$p; done
50         -
51         set -e; for s in $(subdirs_build) $(subdirs_nobuild); do \
52                 t=$d/userv-$$s; \
53                 rm -rf $$t; \
54                 $(MAKE) -C $$s install install-docs install-examples \
55                         prefix=$$t/usr \
56                         etcdir=$$t/etc \
57                         vardir=$$t/var \
58                         gituser=root \
59                 ; \
60         done
61         -
62         mv debian/userv-misc debian/userv-utils
63         -
64         mv $d/userv-ipif/usr/share/doc/userv-ipif/{service.c.txt,ipif.txt}
65         -
66         rename 's/^/ucgi-/' debian/userv-www-cgi/usr/share/doc/*
67         -
68         set -e; for p in userv-ipif userv-ucgi; do              \
69                 (cd debian/$$p/usr/share/doc;                   \
70                  mv $$p userv-utils);                           \
71                 cp -al debian/$$p/. debian/userv-utils/.;       \
72         done
73         -
74         perl -pe 's{/usr/local/}{/usr/}' ucgi/www-cgi   \
75                 >debian/userv-utils/etc/userv/services.d/www-cgi
76         -
77         mv debian/userv-groupmanage/usr/share/doc/groupmanage \
78            debian/userv-groupmanage/usr/share/doc/userv-groupmanage
79         -
80         rename 's/\.example$$//' $d/userv-ipif/etc/userv/vpn/*.example \
81                 $d/userv-dyndns/etc/userv/dyndns-service-users.example \
82                 $d/userv-groupmanage/etc/groupmanage.conf.example
83         rename 's/\.distrib$$//' $d/*/etc/userv/services.d/*.distrib
84         -
85         mv $d/userv-utils/usr/bin/mailq $d/userv-utils/usr/bin/mailq.userv
86         -
87         set -e; cd $d/userv-utils/etc/userv;                    \
88                 mkdir services-available;                       \
89                 mv services.d/* services-available/
90
91 override_dh_install:
92
93 override_dh_auto_clean:
94         $(checkdir)
95         rm -f build
96         set -e; for s in $(subdirs_build); do \
97                 $(MAKE) -C $$s -i distclean || \
98                 $(MAKE) -C $$s -f Makefile.in distclean; \
99         done
100         rm -rf *~ debian/tmp debian/*~ debian/files* debian/substvars*
101
102 define checkdir
103         test -f ipif/service.c
104 endef
105
106 # Below here is fairly generic really
107
108 checkroot:
109         $(checkdir)
110         test root = "`whoami`"