chiark / gitweb /
debian/rules: Fix FTCBFS: Use host tools provided from dpkg
[userv.git] / debian / rules
index 09c928700bf35b08d5bbadd009b8bcc2b5d317bc..65c44fc9c58586ead8d02e60845454abe2bcc7c9 100755 (executable)
@@ -5,30 +5,38 @@ package=userv
 
 t=debian/tmp
 
+DPKG_EXPORT_BUILDTOOLS=1
+include /usr/share/dpkg/buildtools.mk
+
 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
-       INSTOPTS= LDFLAGS=-s INSTALL_PROGRAM='install -c -s'
+       INSTOPTS= LDFLAGS=-s INSTALL_PROGRAM='install -c -s --strip-program=$(STRIP)'
 else
        INSTOPTS= INSTALL_PROGRAM='install -c'
 endif
 
-build:
+makebuildargs := OPTIMISE= \
+ XCFLAGS="$(shell dpkg-buildflags --get CFLAGS)" \
+ XCPPFLAGS="$(shell dpkg-buildflags --get CPPFLAGS)" \
+ XLDFLAGS="$(shell dpkg-buildflags --get LDFLAGS)"
+
+build: build-arch build-indep
+
+build-arch:
        $(checkdir)
        ./configure --prefix=/usr
-       $(MAKE) all docs
-       touch build
+       $(MAKE) $(makebuildargs) all docs
+       touch build-arch
 
 clean:
        $(checkdir)
-       -rm -f build
-       -$(MAKE) -i distclean || $(MAKE) -f Makefile.in distclean
-       -rm -rf *~ $t debian/*~ debian/files* debian/substvars*
-       -rm -rf spec.html
+       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)
@@ -36,12 +44,11 @@ binary-arch:        checkroot build
        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/var/run/$(package)/
        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) \
+       $(MAKE) $(INSTOPTS) $(makebuildargs) \
                prefix=$t/usr etcdir=$t/etc \
                docdir=$t/usr/share/doc/userv \
                mandir=$t/usr/share/man \
@@ -57,9 +64,9 @@ binary-arch:  checkroot build
        cp debian/lintian $t/usr/share/lintian/overrides/userv
        dpkg-shlibdeps daemon client
        dpkg-gencontrol -isp
-       chown -R root.root $t
-       chmod -R og=rX $t
-       chmod 700 $t/var/run/userv
+       dh_fixperms -Pdebian/tmp
+       chown root.root debian/tmp/usr/bin/userv
+       chmod 4755 debian/tmp/usr/bin/userv
        dpkg --build $t ..
 
 define checkdir