chiark / gitweb /
@@ -1,3 +1,10 @@
[chiark-utils.git] / debian / rules
1 #!/usr/bin/make -f
2
3 subdirs=        backup
4 package=        chiark-utils
5 packages_indep= chiark-backup chiark-named-conf
6 packages_arch=  chiark-rwbuffer
7 packages=       $(packages_indep) $(packages_arch)
8
9 cwd=    $(shell pwd)
10 d=      $(cwd)/debian
11 t=      $d/tmp
12
13 build:
14         $(checkdir)
15         set -e; for s in $(subdirs); do $(MAKE) -C $$s all; done
16         touch build
17
18 clean:
19         $(checkdir)
20         rm -f build
21         set -e; for s in $(subdirs); do \
22                 $(MAKE) -C $$s -i distclean || \
23                 $(MAKE) -C $$s -f Makefile.in distclean; \
24         done
25         rm -rf *~ debian/tmp debian/*~ debian/files* debian/substvars*
26
27 binary-prep:
28         $(checkdir)
29         rm -rf debian/tmp*
30         #
31         set -e; for p in $(packages); do \
32                 install -d $t/$$p/DEBIAN $t/$$p/usr/share/doc/$$p; \
33                 cp debian/copyright debian/changelog \
34                         $t/$$p/usr/share/doc/$$p; \
35                 ln -s changelog.gz \
36                         $t/$$p/usr/share/doc/$$p/changelog.Debian.gz; \
37                 gzip -9v $t/$$p/usr/share/doc/$$p/changelog; \
38                 done
39         #
40         $(MAKE) -C backup install install-docs install-examples \
41                 prefix=$t/chiark-backup/usr \
42                 etcdir=$t/chiark-backup/etc \
43                 varlib=$t/chiark-backup/var/lib \
44                 mandir=$t/chiark-backup/usr/share/man
45         #
46         $(MAKE) -C scripts install install-docs install-examples \
47                 prefix=$t/chiark-named-conf/usr \
48                 etcdir=$t/chiark-named-conf/etc \
49                 varlib=$t/chiark-named-conf/var/lib \
50                 mandir=$t/chiark-named-conf/usr/share/man
51         #
52         install -d $t/chiark-rwbuffer/usr/bin
53         install -d $t/chiark-rwbuffer/usr/share/man/man1
54         cd $t/chiark-backup/usr/bin && \
55                 mv readbuffer writebuffer $t/chiark-rwbuffer/usr/bin
56         cd $t/chiark-backup/usr/share/man/man1 && \
57                 mv readbuffer.1 writebuffer.1 $t/chiark-rwbuffer/usr/share/man/man1
58         gzip -9f $t/*/usr/share/man/man*/*
59
60 binary-hook-chiark-backup:
61 binary-hook-chiark-rwbuffer:
62 binary-hook-chiark-named-conf:
63
64 binary-one:
65         set -e; for f in preinst postinst prerm postrm conffiles; do \
66                 test -f debian/$p/$$f || continue; \
67                 cp debian/$p/$$f $t/$p/DEBIAN/$$f; \
68                 chmod u=rwX,go=rX $t/$p/DEBIAN/$$f; \
69         done
70         dpkg-gencontrol -p$p -P$t/$p -Tdebian/sv-$p
71         chown -R root.root debian/tmp
72         chmod -R g-ws debian/tmp
73         debian/rules binary-hook-$p
74         dpkg --build $t/$p ..
75
76 binary-indep:   checkroot build binary-prep
77         set -e; for p in $(packages_indep); do \
78                 debian/rules binary-one p=$$p; done
79
80 binary-arch:    checkroot build binary-prep
81         $(checkdir)
82         dpkg-shlibdeps -Tdebian/sv-chiark-rwbuffer $t/chiark-rwbuffer/usr/bin/*
83         set -e; for p in $(packages_arch); \
84                 do debian/rules binary-one p=$$p; done
85
86 define checkdir
87         test -f backup/writebuffer.c
88 endef
89
90 # Below here is fairly generic really
91
92 binary:         binary-indep binary-arch
93
94 source diff:
95         @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
96
97 checkroot:
98         $(checkdir)
99         test root = "`whoami`"
100
101 .PHONY: binary binary-arch binary-indep clean checkroot