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