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