chiark / gitweb /
ipif: Fix deprecation of udptunnel so it builds
[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 build:
34         $(checkdir)
35         set -e; for s in $(subdirs_build); do \
36                 $(MAKE) -C $$s all depr=disable; \
37         done
38         touch build
39
40 clean:
41         $(checkdir)
42         rm -f build
43         set -e; for s in $(subdirs_build); do \
44                 $(MAKE) -C $$s -i distclean || \
45                 $(MAKE) -C $$s -f Makefile.in distclean; \
46         done
47         rm -rf *~ debian/tmp debian/*~ debian/files* debian/substvars*
48
49 binary-prep:
50         $(checkdir)
51         rm -rf debian/tmp*
52         #
53         #
54         set -e; for s in $(subdirs_build) $(subdirs_nobuild); do \
55                 $(MAKE) -C $$s install install-docs install-examples \
56                         prefix=$t/userv-$$s/usr \
57                         etcdir=$t/userv-$$s/etc \
58                         vardir=$t/userv-$$s/var \
59                         depr=disable \
60                         gituser=root; \
61         done
62         #
63         mv debian/tmp/userv-www-cgi debian/tmp/userv-cgi
64         mv debian/tmp/userv-groupmanage/usr/share/doc/groupmanage \
65            debian/tmp/userv-groupmanage/usr/share/doc/userv-groupmanage
66         #
67         set -e; for p in $(packages); do \
68                 install -d $t/$$p/DEBIAN $t/$$p/usr/share/doc/$$p; \
69                 cp debian/copyright debian/changelog \
70                         $t/$$p/usr/share/doc/$$p/; \
71                 ln -s changelog.gz \
72                         $t/$$p/usr/share/doc/$$p/changelog.Debian.gz; \
73                 gzip -9v $t/$$p/usr/share/doc/$$p/changelog; \
74                 done
75         #
76         rename 's/\.example$$//' $t/userv-ipif/etc/userv/vpn/*.example \
77                 $t/userv-dyndns/etc/userv/dyndns-service-users.example \
78                 $t/userv-groupmanage/etc/groupmanage.conf.example
79         rename 's/\.distrib$$//' $t/*/etc/userv/services.d/*.distrib
80         rename 's/$$/\.disabled/' $t/userv-misc/etc/userv/services.d/mailq
81         set -e; for p in $(packages); do \
82                 cd $t/$$p; \
83                 test ! -d etc || \
84                   find etc -type f -exec printf '/%s\n' '{}' ';' \
85                         >>DEBIAN/conffiles; \
86         done
87         #
88         mv $t/userv-misc/usr/bin/mailq $t/userv-misc/usr/bin/mailq.userv
89         #
90 #       gzip -9f $t/*/usr/share/man/man*/*
91
92 binary-hook-userv-misc:
93 binary-hook-userv-groupmanage:
94 binary-hook-userv-cgi:
95 binary-hook-userv-dyndns:
96 binary-hook-userv-ipif:
97 binary-hook-userv-git-daemon:
98
99 binary-one:
100         set -e; for f in preinst postinst prerm postrm conffiles; do \
101                 test -f debian/$p/$$f || continue; \
102                 cp debian/$p/$$f $t/$p/DEBIAN/$$f; \
103                 chmod u=rwX,go=rX $t/$p/DEBIAN/$$f; \
104         done
105         dpkg-gencontrol -p$p -P$t/$p -Tdebian/sv-$p
106         chown -R root.root debian/tmp
107         chmod -R g-ws debian/tmp
108         debian/rules binary-hook-$p
109         dpkg --build $t/$p ..
110
111 binary-indep:   checkroot build binary-prep
112         set -e; for p in $(packages_indep); do \
113                 debian/rules binary-one p=$$p; done
114
115 binary-arch:    checkroot build binary-prep
116         $(checkdir)
117         dpkg-shlibdeps -Tdebian/sv-userv-ipif \
118                 $t/userv-ipif/usr/bin/udptunnel-forwarder \
119                 $t/userv-ipif/usr/lib/userv/ipif
120         dpkg-shlibdeps -Tdebian/sv-userv-cgi \
121                 $t/userv-cgi/usr/lib/userv/cgi/target \
122                 $t/userv-cgi/usr/lib/userv/cgi/cgi/ucgi
123         set -e; for p in $(packages_arch); \
124                 do debian/rules binary-one p=$$p; done
125
126 define checkdir
127         test -f ipif/service.c
128 endef
129
130 # Below here is fairly generic really
131
132 binary:         binary-indep binary-arch
133
134 source diff:
135         @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
136
137 checkroot:
138         $(checkdir)
139         test root = "`whoami`"
140
141 .PHONY: binary binary-arch binary-indep clean checkroot