chiark / gitweb /
some packaging and makefile fixes (found in a working tree)
[userv.git] / debian / rules
1 #!/usr/bin/make -f
2
3 package=userv
4
5 t=debian/tmp
6
7 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
8         INSTOPTS= LDFLAGS=-s INSTALL_PROGRAM='install -c -s'
9 else
10         INSTOPTS= INSTALL_PROGRAM='install -c'
11 endif
12
13 build:
14         $(checkdir)
15         ./configure --prefix=/usr
16         $(MAKE) all docs
17         touch build
18
19 clean:
20         $(checkdir)
21         -rm -f build
22         -$(MAKE) -i distclean || $(MAKE) -f Makefile.in distclean
23         -rm -rf *~ $t debian/*~ debian/files* debian/substvars*
24         -rm -rf spec.html
25
26 binary-indep:   checkroot build
27         $(checkdir)
28 # There are no architecture-independent files to be uploaded
29 # generated by this package.  If there were any they would be
30 # made here.
31
32 binary-arch:    checkroot build
33         $(checkdir)
34         -rm -rf $t
35         install -d $t/{DEBIAN,etc/init.d} $t/usr/{sbin,bin}
36         install -d $t/etc/userv/{override,default}.d
37         install -d $t/usr/share/doc/$(package)/examples/
38         install -d $t/var/run/$(package)/
39         install -d $t/usr/share/lintian/overrides/
40         cp debian/{postinst,prerm,postrm,conffiles} $t/DEBIAN/.
41         cp debian/initd $t/etc/init.d/userv
42         chmod 755 $t/DEBIAN/{postinst,prerm,postrm}
43         chmod 755 $t/etc/init.d/userv
44         $(MAKE) $(INSTOPTS) \
45                 prefix=$t/usr etcdir=$t/etc \
46                 docdir=$t/usr/share/doc/userv \
47                 mandir=$t/usr/share/man \
48                 install install-doc
49         cp debian/copyright $t/usr/share/doc/$(package)/.
50         cp debian/changelog $t/usr/share/doc/$(package)/changelog
51         cp README $t/usr/share/doc/$(package)/README.upstream
52         cp system.default system.override $t/usr/share/doc/$(package)/examples
53         ln -s changelog.gz $t/usr/share/doc/$(package)/changelog.Debian.gz
54         gzip -9v $t/usr/share/doc/$(package)/changelog \
55                 $t/usr/share/man/man1/*.1 $t/usr/share/man/man8/*.8 \
56                 $t/usr/share/doc/userv/*.ps
57         cp debian/lintian $t/usr/share/lintian/overrides/userv
58         dpkg-shlibdeps daemon client
59         dpkg-gencontrol -isp
60         chown -R root.root $t
61         chmod -R og=rX $t
62         chmod 700 $t/var/run/userv
63         dpkg --build $t ..
64
65 define checkdir
66         test -f overlord.c -a -f lexer.l.m4 -a -f debian/rules
67 endef
68
69 # Below here is fairly generic really
70
71 binary:         binary-indep binary-arch
72
73 source diff:
74         @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
75
76 checkroot:
77         $(checkdir)
78         test root = "`whoami`"
79
80 .PHONY: binary binary-arch binary-indep clean checkroot