chiark / gitweb /
debian: Build everything from actual sources
[userv.git] / debian / rules
index f58644d851b779937edff65187e5212673b69e4a..5d784d0aba7f486a73197c5a8132b1b47a26714a 100755 (executable)
@@ -1,66 +1,27 @@
 #!/usr/bin/make -f
 
+SHELL=/bin/bash
 package=userv
 
-build:
-       $(checkdir)
-       ./configure --prefix=/usr
-       $(MAKE)
-       $(MAKE) spec.html
-       touch build
+makebuildargs := OPTIMISE= \
+ XCFLAGS="$(shell dpkg-buildflags --get CFLAGS)" \
+ XCPPFLAGS="$(shell dpkg-buildflags --get CPPFLAGS)" \
+ XLDFLAGS="$(shell dpkg-buildflags --get LDFLAGS)"
 
-clean:
-       $(checkdir)
-       -rm -f build
-       -$(MAKE) -i distclean || $(MAKE) -f Makefile.in distclean
-       -rm -rf *~ debian/tmp debian/*~ debian/files* debian/substvars*
+%:
+       dh "$@"
 
-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.
+override_dh_auto_configure:
+       $(MAKE) -f Makefile.in maintainer-clean
+       ./autogen.sh
+       dh_auto_configure
 
-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' \
-               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
-       cp README debian/tmp/usr/doc/$(package)/README.upstream
-       cp system.default system.override debian/tmp/usr/doc/$(package)/examples
-       gzip -9v debian/tmp/usr/doc/$(package)/changelog
-       ln -s changelog.gz debian/tmp/usr/doc/$(package)/changelog.Debian.gz
-       cp -a spec.html debian/tmp/usr/doc/$(package)/
-       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 ..
+override_dh_auto_build:
+       $(MAKE) $(makebuildargs) all docs
 
-define checkdir
-       test -f overlord.c -a -f lexer.l.m4 -a -f debian/rules
-endef
+override_dh_auto_install:
+       $(MAKE) $(makebuildargs) install install-docs \
+               DESTDIR=$(PWD)/debian/userv
 
-# Below here is fairly generic really
-
-binary:                binary-indep binary-arch
-
-source diff:
-       @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
-
-checkroot:
-       $(checkdir)
-       test root = "`whoami`"
-
-.PHONY: binary binary-arch binary-indep clean checkroot
+override_dh_fixperms:
+       dh_fixperms -X usr/bin/userv