let’s get wild…
[alioth/cvs.git] / debian / rules
index 98bc258..ff29ee3 100755 (executable)
@@ -1,6 +1,20 @@
 #!/usr/bin/make -f
 
-CC?=                   gcc
+DEB_BUILD_ARCH=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
+DEB_HOST_ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH)
+DEB_BUILD_GNU_TYPE=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_HOST_GNU_TYPE=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+
+# is ${CC} defined anywhere (other than implicit rules?)
+ifneq (,$(findstring $(origin CC),default undefined))
+# no - then default to gcc (or cross-gcc)
+ifneq (${DEB_BUILD_ARCH},${DEB_HOST_ARCH})
+CC=                    ${DEB_HOST_GNU_TYPE}-gcc
+else
+CC=                    gcc
+endif
+endif
+
 CONFIGURE_ENV:=                CC='${CC}'
 EXTRA_CFLAGS=          -Wall -fno-strict-aliasing -Wformat
 # addresses part of #698908
@@ -36,7 +50,9 @@ LIBS+=                        -lbsd
 CONFIGURE_ENV+=                LIBS='${LIBS}'
 CONFIGURE_ENV+=                CSH=/bin/csh
 
-CONFIGURE_ARGS:=       --prefix=/usr \
+CONFIGURE_ARGS:=       --build=${DEB_BUILD_GNU_TYPE} \
+                       --host=${DEB_HOST_GNU_TYPE} \
+                       --prefix=/usr \
                        --infodir=/usr/share/info \
                        --mandir=/usr/share/man \
                        --sysconfdir=/etc \
@@ -66,12 +82,12 @@ CONFIGURE_ARGS:=    --prefix=/usr \
 MAKE_ARGS:=            MAKEINFO=makeinfo
 MAKE_ARGS+=            MAKEINFOFLAGS=--no-split
 
-CLEANFILES:=           autom4te.cache debian/CVSTEMP debian/.*_stamp \
-                       debian/builddir debian/stagedir \
-                       build-aux/config.guess build-aux/config.sub \
-                       doc/cvs.1 doc/cvs.info* doc/cvsclient.info* \
-                       doc/cvs.pdf doc/cvsclient.pdf \
-                       doc/getdate-cvs.texi \
+CLEANFILES:=           autom4te.cache build-aux/config.guess \
+                       build-aux/config.sub cvs.spec debian/.*_stamp \
+                       debian/CVSTEMP debian/builddir debian/stagedir \
+                       doc/cvs-paper.pdf doc/cvs.1 doc/cvs.info* \
+                       doc/cvs.pdf doc/cvsclient.info* doc/cvsclient.pdf \
+                       doc/getdate-cvs.texi emx/Makefile os2/Makefile \
                        vms/config.h windows-NT/config.h
 
 debian/.configure_stamp:
@@ -82,6 +98,11 @@ debian/.configure_stamp:
        mkdir debian/builddir debian/stagedir
        cd debian/builddir && \
            env ${CONFIGURE_ENV} sh ../../configure ${CONFIGURE_ARGS}
+       # generate PDF 1.4 by default
+       printf '%s\n' \
+           '\pdfminorversion4\relax\pdfobjcompresslevel0\relax%' \
+           '\input '"$$(pwd)"'/build-aux/texinfo.tex%' \
+           >debian/builddir/doc/texinfo.tex
        @:>$@
 
 build-indep:
@@ -94,6 +115,7 @@ debian/.build_stamp: debian/.configure_stamp
 ifneq (,$(filter sanity,$(DEB_BUILD_OPTIONS)))
        # run the testsuite after build (DEB_BUILD_OPTIONS=sanity)
        # warning: this takes a *lot* of time!
+       # idea: run this under Valgrind to take even more time ;)
        cd debian/builddir && ${MAKE} ${MAKE_ARGS} check
 endif
        @:>$@
@@ -152,7 +174,7 @@ binary-arch: debian/.build_stamp
        dh_shlibdeps
        dh_gencontrol
        dh_md5sums
-       dh_builddeb
+       dh_builddeb -- -Zgzip -z9
 
 binary: binary-indep binary-arch
 .PHONY: binary binary-arch binary-indep build build-arch build-indep clean