also add -fwrapv to CFLAGS (addresses #698908)
[alioth/cvs.git] / debian / rules
index effd4ba..49cbde5 100755 (executable)
@@ -1,42 +1,42 @@
 #!/usr/bin/make -f
-# $MirOS: contrib/hosted/tg/deb/cvs/debian/rules,v 1.9 2011/07/28 11:23:54 tg Exp $
-#-
-# -*- makefile -*-
-# Sample debian/rules that uses debhelper.
-# This file was originally written by Joey Hess and Craig Small.
-# As a special exception, when this file is copied by dh-make into a
-# dh-make output file, you may use that output file without restriction.
-# This special exception was added by Craig Small in version 0.37 of dh-make.
+# $MirOS: contrib/hosted/tg/deb/cvs/debian/rules,v 1.22 2013/06/26 17:54:04 tg Exp $
 
-CC?=           gcc
-CFLAGS=                -Wall -g
-
-ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
-CFLAGS+=       -O0
+CC?=                   gcc
+CONFIGURE_ENV:=                CC='${CC}'
+EXTRA_CFLAGS=          -Wall -fno-strict-aliasing -Wformat
+# addresses part of #698908
+EXTRA_CFLAGS+=         -fwrapv
+# for now. uses are mostly checked.
+EXTRA_CFLAGS+=         -Wno-unused-result
+EXTRA_CPPFLAGS=                -D_GNU_SOURCE -DUSE_LIBBSD
+
+ifneq (,$(wildcard /usr/share/dpkg/buildflags.mk))
+# dpkg-dev (>= 1.16.1~)
+DEB_CFLAGS_MAINT_APPEND=${EXTRA_CFLAGS}
+DEB_CPPFLAGS_MAINT_APPEND=${EXTRA_CPPFLAGS}
+DEB_BUILD_MAINT_OPTIONS=hardening=+all
+DPKG_EXPORT_BUILDFLAGS=        Yes
+include /usr/share/dpkg/buildflags.mk
 else
-CFLAGS+=       -O2
+# old-fashioned way to determine build flags
+CFLAGS=                        -O$(if $(findstring noopt,${DEB_BUILD_OPTIONS}),0,2) -g
+CFLAGS+=               ${EXTRA_CFLAGS}
+CPPFLAGS+=             ${EXTRA_CPPFLAGS}
+CONFIGURE_ENV+=                CFLAGS='${CFLAGS}'
+CONFIGURE_ENV+=                CPPFLAGS='${CPPFLAGS}'
+CONFIGURE_ENV+=                LDFLAGS='${LDFLAGS}'
 endif
 
 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
-NUMJOBS=       $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
-MAKEFLAGS+=    -j${NUMJOBS}
+NUMJOBS=               $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+MAKEFLAGS+=            -j${NUMJOBS}
 endif
 
-CPPFLAGS+=     -D_GNU_SOURCE
-CFLAGS+=       -fno-strict-aliasing -Wformat
+LIBS+=                 -lbsd
 
-CPPFLAGS+=     -DUSE_LIBBSD
-LIBS+=         -lbsd
-
-CONFIGURE_ENV:=                CC='${CC}'
-CONFIGURE_ENV+=                CFLAGS='${CFLAGS}'
-CONFIGURE_ENV+=                CPPFLAGS='${CPPFLAGS}'
 CONFIGURE_ENV+=                LIBS='${LIBS}'
 CONFIGURE_ENV+=                CSH=/bin/csh
 
-# check takes forever, so assume the safe choice
-CONFIGURE_ENV+=                ac_cv_func_working_mktime=no
-
 CONFIGURE_ARGS:=       --prefix=/usr \
                        --infodir=/usr/share/info \
                        --mandir=/usr/share/man \
@@ -52,7 +52,7 @@ CONFIGURE_ARGS:=      --prefix=/usr \
                        --enable-case-sensitivity \
                        --enable-encryption \
                        --disable-lock-compatibility \
-                       --disable-rootcommit \
+                       --enable-rootcommit \
                        --disable-old-info-format-support \
                        --enable-config-override=no \
                        --without-krb4 \
@@ -72,19 +72,19 @@ CLEANFILES:=                autom4te.cache debian/CVSTEMP debian/.*_stamp \
                        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 \
+                       doc/getdate-cvs.texi m4/mktime.m4 \
                        vms/config.h windows-NT/config.h
 
 debian/.configure_stamp:
        dh_testdir
        -rm -rf ${CLEANFILES}
-       cp /usr/share/misc/config.guess /usr/share/misc/config.sub build-aux/
+       dh_autoreconf
        mkdir debian/builddir debian/stagedir
        cd debian/builddir && \
            env ${CONFIGURE_ENV} sh ../../configure ${CONFIGURE_ARGS}
        @:>$@
 
-build: debian/.build_stamp
+build build-indep build-arch: debian/.build_stamp
 
 debian/.build_stamp: debian/.configure_stamp
        dh_testdir
@@ -94,16 +94,16 @@ debian/.build_stamp: debian/.configure_stamp
 
 clean:
        dh_testdir
+       dh_autoreconf_clean
        -rm -rf ${CLEANFILES}
        dh_clean
 
-install: debian/.install_stamp
+binary-indep:
 
-debian/.install_stamp: debian/.build_stamp
+binary-arch: debian/.build_stamp
        dh_testdir
        dh_testroot
-       dh_clean -k
-       dh_installdirs
+       if test -x "$$(which dh_prep)"; then dh_prep; else dh_clean -k; fi
        -rm -rf debian/stagedir
        mkdir -p debian/stagedir/clogs
        cd debian/builddir && \
@@ -119,18 +119,19 @@ debian/.install_stamp: debian/.build_stamp
        #cp m4/ChangeLog debian/stagedir/clogs/ChangeLog.m4
        #cp man/ChangeLog debian/stagedir/clogs/ChangeLog.man
        #cp tools/ChangeLog debian/stagedir/clogs/ChangeLog.tools
-       nroff -man -Tascii contrib/cvshelp.man | \
-           col -b >debian/stagedir/cvshelp.txt
-       @:>$@
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
-       dh_testdir
-       dh_testroot
+       # fat and nonsensical to ship this
+       rm -f debian/stagedir/usr/share/cvs/contrib/rcs-5.7-commitid.patch
+       # uses csh
+       rm -f debian/stagedir/usr/share/cvs/contrib/sccs2rcs
+       # unsafe
+       rm -f debian/stagedir/usr/share/cvs/contrib/commit_prep
+       rm -f debian/stagedir/usr/share/cvs/contrib/cvs_acls
+       rm -f debian/stagedir/usr/share/cvs/contrib/log
+       rm -f debian/stagedir/usr/share/cvs/contrib/log_accum
+       rm -f debian/stagedir/usr/share/cvs/contrib/mfpipe
+       rm -f debian/stagedir/usr/share/cvs/contrib/rcslock
+       # we ship cvs-switchroot(1) instead
+       rm -f debian/stagedir/usr/share/cvs/contrib/newcvsroot
        dh_installchangelogs debian/stagedir/clogs/ChangeLog
        dh_installdocs
        dh_install
@@ -138,7 +139,7 @@ binary-arch: build install
        dh_installman
        dh_link
        dh_strip
-       dh_compress
+       dh_compress -X.pdf
        cd debian/cvs/usr/share/cvs/contrib && chmod +x descend.sh rcs2sccs.sh
        dh_fixperms
        dh_installdeb
@@ -148,4 +149,4 @@ binary-arch: build install
        dh_builddeb
 
 binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install check
+.PHONY: binary binary-arch binary-indep build build-arch build-indep clean