update lintian overrides
[alioth/cvs.git] / debian / rules
1 #!/usr/bin/make -f
2
3 ifeq (,$(findstring terse,${DEB_BUILD_OPTIONS}))
4 export DH_VERBOSE=1
5 export V=1
6 export VERBOSE=1
7 endif
8
9 LC_ALL:=C
10 export LC_ALL
11
12 DEB_BUILD_ARCH?=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
13 DEB_HOST_ARCH?=$(shell dpkg-architecture -qDEB_HOST_ARCH)
14 DEB_BUILD_GNU_TYPE?=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
15 DEB_HOST_GNU_TYPE?=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
16
17 # is ${CC} defined anywhere (other than implicit rules?)
18 ifneq (,$(findstring $(origin CC),default undefined))
19 # no - then default to gcc (or cross-gcc)
20 ifneq (${DEB_BUILD_ARCH},${DEB_HOST_ARCH})
21 CC=                     ${DEB_HOST_GNU_TYPE}-gcc
22 else
23 CC=                     gcc
24 endif
25 endif
26
27 CONFIGURE_ENV:=         CC='${CC}'
28 EXTRA_CFLAGS=           -Wall -fno-strict-aliasing -Wformat
29 # addresses part of #698908
30 EXTRA_CFLAGS+=          -fwrapv
31 # for now. uses are mostly checked.
32 EXTRA_CFLAGS+=          -Wno-unused-result
33 EXTRA_CPPFLAGS=         -D_GNU_SOURCE -DUSE_LIBBSD
34
35 ifneq (,$(wildcard /usr/share/dpkg/buildflags.mk))
36 # dpkg-dev (>= 1.16.1~)
37 DEB_CFLAGS_MAINT_APPEND=${EXTRA_CFLAGS}
38 DEB_CPPFLAGS_MAINT_APPEND=${EXTRA_CPPFLAGS}
39 DEB_BUILD_MAINT_OPTIONS=hardening=+all
40 DPKG_EXPORT_BUILDFLAGS= Yes
41 include /usr/share/dpkg/buildflags.mk
42 else
43 # old-fashioned way to determine build flags
44 CFLAGS=                 -O$(if $(findstring noopt,${DEB_BUILD_OPTIONS}),0,2) -g
45 CFLAGS+=                ${EXTRA_CFLAGS}
46 CPPFLAGS+=              ${EXTRA_CPPFLAGS}
47 CONFIGURE_ENV+=         CFLAGS='${CFLAGS}'
48 CONFIGURE_ENV+=         CPPFLAGS='${CPPFLAGS}'
49 CONFIGURE_ENV+=         LDFLAGS='${LDFLAGS}'
50 endif
51
52 LIBS+=                  -lbsd
53
54 CONFIGURE_ENV+=         LIBS='${LIBS}'
55 CONFIGURE_ENV+=         CSH=/bin/csh
56 CONFIGURE_ENV+=         ac_cv_path_MKTEMP=/bin/mktemp
57
58 CONFIGURE_ARGS:=        --build=${DEB_BUILD_GNU_TYPE} \
59                         --host=${DEB_HOST_GNU_TYPE} \
60                         --prefix=/usr \
61                         --infodir=/usr/share/info \
62                         --mandir=/usr/share/man \
63                         --sysconfdir=/etc \
64                         --disable-dependency-tracking \
65                         --disable-maintainer-mode \
66                         --disable-pam \
67                         --disable-nls \
68                         --enable-client \
69                         --enable-password-authenticated-client \
70                         --enable-server \
71                         --enable-proxy \
72                         --enable-case-sensitivity \
73                         --enable-encryption \
74                         --disable-lock-compatibility \
75                         --enable-rootcommit \
76                         --disable-old-info-format-support \
77                         --enable-config-override=no \
78                         --without-krb4 \
79                         --with-gssapi \
80                         --with-external-zlib \
81                         --with-rsh=ssh \
82                         --with-editor=/usr/bin/editor \
83                         --with-tmpdir=/var/tmp \
84                         --with-umask=002 \
85                         --with-cvs-admin-group=_cvsadmin
86
87 MAKE_ARGS:=             MAKEINFO=makeinfo
88 MAKE_ARGS+=             MAKEINFOFLAGS=--no-split
89
90 CLEANFILES:=            autom4te.cache build-aux/config.guess \
91                         build-aux/config.sub cvs.spec debian/.*_stamp \
92                         debian/CVSTEMP debian/builddir debian/stagedir \
93                         doc/cvs-paper.pdf doc/cvs.1 doc/cvs.info* \
94                         doc/cvs.pdf doc/cvsclient.info* doc/cvsclient.pdf \
95                         doc/getdate-cvs.texi emx/Makefile os2/Makefile \
96                         vms/config.h windows-NT/config.h
97
98 debian/.configure_stamp:
99         dh_testdir
100         -rm -rf ${CLEANFILES}
101         cp /usr/share/misc/config.guess /usr/share/misc/config.sub build-aux/
102         dh_autoreconf
103         mkdir debian/builddir debian/stagedir
104         cd debian/builddir && \
105             env ${CONFIGURE_ENV} sh ../../configure ${CONFIGURE_ARGS}
106         # generate PDF 1.4 by default
107         ln -s ../../../build-aux/texinfo.tex debian/builddir/doc/texinfo-r.tex
108         printf '%s\n' \
109             '\pdfminorversion4\relax\pdfobjcompresslevel0\relax%' \
110             '\input texinfo-r.tex' \
111             >debian/builddir/doc/texinfo.tex
112         @:>$@
113
114 build-indep:
115 build build-arch: debian/.build_stamp
116
117 debian/.build_stamp: debian/.configure_stamp
118         dh_testdir
119         cd debian/builddir && ${MAKE} ${MAKE_ARGS}
120 ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
121         cd debian/builddir && ${MAKE} -C doc ${MAKE_ARGS} doc html info pdf txt
122 endif
123 ifneq (,$(filter sanity,$(DEB_BUILD_OPTIONS)))
124         # run the testsuite after build (DEB_BUILD_OPTIONS=sanity)
125         # warning: this takes a *lot* of time!
126         # idea: run this under Valgrind to take even more time ;)
127         cd debian/builddir && ${MAKE} ${MAKE_ARGS} check
128 endif
129         @:>$@
130
131 clean:
132         dh_testdir
133         dh_autoreconf_clean
134         -rm -rf ${CLEANFILES}
135         dh_clean
136
137 binary-indep:
138
139 binary-arch: debian/.build_stamp
140         dh_testdir
141         dh_testroot
142         if test -x "$$(which dh_prep)"; then dh_prep; else dh_clean -k; fi
143         -rm -rf debian/stagedir
144         mkdir -p debian/stagedir/clogs
145         cd debian/builddir && \
146             ${MAKE} ${MAKE_ARGS} DESTDIR=${CURDIR}/debian/stagedir install
147         cat ChangeLog ChangeLog.zoo >debian/stagedir/clogs/ChangeLog
148         cat doc/ChangeLog doc/ChangeLog.fsf >debian/stagedir/clogs/ChangeLog.doc
149         #cat lib/ChangeLog lib/ChangeLog.fsf >debian/stagedir/clogs/ChangeLog.lib
150         #cat src/ChangeLog src/ChangeLog-97 src/ChangeLog-96 src/ChangeLog-9395 \
151         #    src/ChangeLog-9194 >debian/stagedir/clogs/ChangeLog.src
152         cp src/ChangeLog debian/stagedir/clogs/ChangeLog.src
153         cp contrib/ChangeLog debian/stagedir/clogs/ChangeLog.contrib
154         cp diff/ChangeLog debian/stagedir/clogs/ChangeLog.diff
155         #cp m4/ChangeLog debian/stagedir/clogs/ChangeLog.m4
156         #cp man/ChangeLog debian/stagedir/clogs/ChangeLog.man
157         #cp tools/ChangeLog debian/stagedir/clogs/ChangeLog.tools
158         # fat and nonsensical to ship this
159         rm -f debian/stagedir/usr/share/cvs/contrib/rcs-5.7-commitid.patch
160         # uses csh
161         rm -f debian/stagedir/usr/share/cvs/contrib/sccs2rcs
162         # unsafe
163         rm -f debian/stagedir/usr/share/cvs/contrib/commit_prep
164         rm -f debian/stagedir/usr/share/cvs/contrib/cvs_acls
165         rm -f debian/stagedir/usr/share/cvs/contrib/log
166         rm -f debian/stagedir/usr/share/cvs/contrib/log_accum
167         rm -f debian/stagedir/usr/share/cvs/contrib/mfpipe
168         rm -f debian/stagedir/usr/share/cvs/contrib/rcslock
169         # we ship cvs-switchroot(1) instead
170         rm -f debian/stagedir/usr/share/cvs/contrib/newcvsroot
171         dh_installchangelogs debian/stagedir/clogs/ChangeLog
172 ifneq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
173         # this will cause lintian warnings as it installs the doc-base files
174 endif
175         dh_installdocs
176         dh_install
177         dh_installinfo
178         dh_installman
179         dh_link
180         dh_strip
181         dh_compress -X.pdf
182         cd debian/cvs/usr/share/cvs/contrib && chmod +x descend.sh rcs2sccs.sh
183         dh_fixperms
184         dh_installdeb
185         dh_shlibdeps
186         dh_gencontrol
187         dh_md5sums
188         dh_builddeb -- -Zgzip -z9
189
190 binary: binary-indep binary-arch
191 .PHONY: binary binary-arch binary-indep build build-arch build-indep clean