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