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