chiark / gitweb /
use dh_clean
[userv.git] / debian / rules
index 225bcfc..97bced1 100755 (executable)
@@ -1,55 +1,65 @@
 #!/usr/bin/make -f
 
+SHELL=/bin/bash
 package=userv
-revision=$(shell dpkg-parsechangelog | sed -n 's/^Version:.*-//p')
-verext=-$(revision)deb
 
-build:
+t=debian/tmp
+
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+       INSTOPTS= LDFLAGS=-s INSTALL_PROGRAM='install -c -s'
+else
+       INSTOPTS= INSTALL_PROGRAM='install -c'
+endif
+
+build: build-arch build-indep
+
+build-arch:
        $(checkdir)
        ./configure --prefix=/usr
-       $(MAKE) VEREXT=$(verext)
-       $(MAKE) spec.html VEREXT=$(verext)
-       touch build
+       $(MAKE) all docs
+       touch build-arch
 
 clean:
        $(checkdir)
-       -rm -f build
-       -$(MAKE) -i distclean || $(MAKE) -f Makefile.in distclean
-       -rm -rf *~ debian/tmp debian/*~ debian/files* debian/substvars*
+       rm -f build build-arch
+       $(MAKE) -i distclean || $(MAKE) -f Makefile.in distclean
+       rm -rf *~ $t
+       rm -rf spec.html spec.ps debian/substvars*
+       dh_clean
 
-binary-indep:  checkroot build
-       $(checkdir)
-# There are no architecture-independent files to be uploaded
-# generated by this package.  If there were any they would be
-# made here.
+build-indep:
+binary-indep:
 
 binary-arch:   checkroot build
        $(checkdir)
-       -rm -rf debian/tmp
-       install -d debian/tmp/{DEBIAN,etc/init.d} debian/tmp/usr/{sbin,bin}
-       install -d debian/tmp/etc/userv/{override,default}.d
-       install -d debian/tmp/usr/doc/$(package)/examples/
-       install -d debian/tmp/var/run/$(package)/
-       cp debian/{postinst,prerm,postrm,conffiles} debian/tmp/DEBIAN/.
-       cp debian/initd debian/tmp/etc/init.d/userv
-       chmod +x debian/tmp/DEBIAN/{postinst,prerm,postrm}
-       chmod +x debian/tmp/etc/init.d/userv
-       $(MAKE) LDFLAGS=-s INSTALL_PROGRAM='install -c -s' \
-               VEREXT=$(verext) \
-               prefix=debian/tmp/usr etcdir=debian/tmp/etc install
-       cp debian/copyright debian/tmp/usr/doc/$(package)/.
-       cp debian/changelog debian/tmp/usr/doc/$(package)/changelog.Debian
-       cp README debian/tmp/usr/doc/$(package)/README.upstream
-       cp Changelog debian/tmp/usr/doc/$(package)/changelog
-       cp system.default system.override debian/tmp/usr/doc/$(package)/examples
-       gzip -9v debian/tmp/usr/doc/$(package)/changelog{,.Debian}
-       cp -a spec.html debian/tmp/usr/doc/$(package)/
+       -rm -rf $t
+       install -d $t/{DEBIAN,etc/init.d} $t/usr/{sbin,bin}
+       install -d $t/etc/userv/{override,default}.d
+       install -d $t/usr/share/doc/$(package)/examples/
+       install -d $t/usr/share/lintian/overrides/
+       install -m 755 debian/{postinst,prerm,postrm} $t/DEBIAN/.
+       install -m 644 debian/conffiles $t/DEBIAN/.
+       install -m 755 debian/initd $t/etc/init.d/userv
+       $(MAKE) $(INSTOPTS) \
+               prefix=$t/usr etcdir=$t/etc \
+               docdir=$t/usr/share/doc/userv \
+               mandir=$t/usr/share/man \
+               install install-doc
+       cp debian/copyright $t/usr/share/doc/$(package)/.
+       cp debian/changelog $t/usr/share/doc/$(package)/changelog
+       cp README $t/usr/share/doc/$(package)/README.upstream
+       cp system.default system.override $t/usr/share/doc/$(package)/examples
+       ln -s changelog.gz $t/usr/share/doc/$(package)/changelog.Debian.gz
+       gzip -9v $t/usr/share/doc/$(package)/changelog \
+               $t/usr/share/man/man1/*.1 $t/usr/share/man/man8/*.8 \
+               $t/usr/share/doc/userv/*.ps
+       cp debian/lintian $t/usr/share/lintian/overrides/userv
        dpkg-shlibdeps daemon client
-       dpkg-gencontrol
-       chown -R root.root debian/tmp
-       chmod -R g-ws debian/tmp
-       chmod 700 debian/tmp/var/run/userv
-       dpkg --build debian/tmp ..
+       dpkg-gencontrol -isp
+       dh_fixperms -Pdebian/tmp
+       chown root.root debian/tmp/usr/bin/userv
+       chmod 4755 debian/tmp/usr/bin/userv
+       dpkg --build $t ..
 
 define checkdir
        test -f overlord.c -a -f lexer.l.m4 -a -f debian/rules