chiark / gitweb /
@@ -1,4 +1,4 @@
[chiark-utils.git] / debian / rules
1 #!/usr/bin/make -f
2
3 subdirs=        backup
4 package=        chiark-utils
5 packages_indep= chiark-backup
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         #
45         install -d $t/chiark-rwbuffer/usr/bin
46         cd $t/chiark-backup/usr/bin && \
47                 mv readbuffer writebuffer $t/chiark-rwbuffer/usr/bin
48
49 binary-hook-chiark-backup:
50 binary-hook-chiark-rwbuffer:
51
52 binary-one:
53         set -e; for f in preinst postinst prerm postrm conffiles; do \
54                 test -f debian/$p/$$f || continue; \
55                 cp debian/$p/$$f $t/$p/DEBIAN/$$f; \
56                 chmod u=rwX,go=rX $t/$p/DEBIAN/$$f; \
57         done
58         dpkg-gencontrol -p$p -P$t/$p -Tdebian/sv-$p
59         chown -R root.root debian/tmp
60         chmod -R g-ws debian/tmp
61         debian/rules binary-hook-$p
62         dpkg --build $t/$p ..
63
64 binary-indep:   checkroot build binary-prep
65         set -e; for p in $(packages_indep); do \
66                 debian/rules binary-one p=$$p; done
67
68 binary-arch:    checkroot build binary-prep
69         $(checkdir)
70         dpkg-shlibdeps -Tdebian/sv-chiark-rwbuffer $t/chiark-rwbuffer/usr/bin/*
71         set -e; for p in $(packages_arch); \
72                 do debian/rules binary-one p=$$p; done
73
74 define checkdir
75         test -f backup/writebuffer.c
76 endef
77
78 # Below here is fairly generic really
79
80 binary:         binary-indep binary-arch
81
82 source diff:
83         @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
84
85 checkroot:
86         $(checkdir)
87         test root = "`whoami`"
88
89 .PHONY: binary binary-arch binary-indep clean checkroot