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