e557a19b83098454bd5b6394b6c8ce36bb3afe81
[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         # warning: this takes a *lot* of time!
116         # idea: run this under Valgrind to take even more time ;)
117         cd debian/builddir && ${MAKE} ${MAKE_ARGS} check
118 endif
119         @:>$@
120
121 clean:
122         dh_testdir
123         dh_autoreconf_clean
124         -rm -rf ${CLEANFILES}
125         dh_clean
126
127 binary-indep:
128
129 binary-arch: debian/.build_stamp
130         dh_testdir
131         dh_testroot
132         if test -x "$$(which dh_prep)"; then dh_prep; else dh_clean -k; fi
133         -rm -rf debian/stagedir
134         mkdir -p debian/stagedir/clogs
135         cd debian/builddir && \
136             ${MAKE} ${MAKE_ARGS} DESTDIR=${CURDIR}/debian/stagedir install
137         cat ChangeLog ChangeLog.zoo >debian/stagedir/clogs/ChangeLog
138         cat doc/ChangeLog doc/ChangeLog.fsf >debian/stagedir/clogs/ChangeLog.doc
139         #cat lib/ChangeLog lib/ChangeLog.fsf >debian/stagedir/clogs/ChangeLog.lib
140         #cat src/ChangeLog src/ChangeLog-97 src/ChangeLog-96 src/ChangeLog-9395 \
141         #    src/ChangeLog-9194 >debian/stagedir/clogs/ChangeLog.src
142         cp src/ChangeLog debian/stagedir/clogs/ChangeLog.src
143         cp contrib/ChangeLog debian/stagedir/clogs/ChangeLog.contrib
144         cp diff/ChangeLog debian/stagedir/clogs/ChangeLog.diff
145         #cp m4/ChangeLog debian/stagedir/clogs/ChangeLog.m4
146         #cp man/ChangeLog debian/stagedir/clogs/ChangeLog.man
147         #cp tools/ChangeLog debian/stagedir/clogs/ChangeLog.tools
148         # fat and nonsensical to ship this
149         rm -f debian/stagedir/usr/share/cvs/contrib/rcs-5.7-commitid.patch
150         # uses csh
151         rm -f debian/stagedir/usr/share/cvs/contrib/sccs2rcs
152         # unsafe
153         rm -f debian/stagedir/usr/share/cvs/contrib/commit_prep
154         rm -f debian/stagedir/usr/share/cvs/contrib/cvs_acls
155         rm -f debian/stagedir/usr/share/cvs/contrib/log
156         rm -f debian/stagedir/usr/share/cvs/contrib/log_accum
157         rm -f debian/stagedir/usr/share/cvs/contrib/mfpipe
158         rm -f debian/stagedir/usr/share/cvs/contrib/rcslock
159         # we ship cvs-switchroot(1) instead
160         rm -f debian/stagedir/usr/share/cvs/contrib/newcvsroot
161         dh_installchangelogs debian/stagedir/clogs/ChangeLog
162 ifneq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
163         # this will cause lintian warnings as it installs the doc-base files
164 endif
165         dh_installdocs
166         dh_install
167         mv debian/cvs/usr/share/cvs/contrib/intro.doc \
168             debian/cvs/usr/share/doc/cvs/intro.txt
169         dh_installinfo
170         dh_installman
171         dh_link
172         dh_strip
173         dh_compress -X.pdf
174         cd debian/cvs/usr/share/cvs/contrib && chmod +x descend.sh rcs2sccs.sh
175         dh_fixperms
176         dh_installdeb
177         dh_shlibdeps
178         dh_gencontrol
179         dh_md5sums
180         dh_builddeb -- -Zgzip -z9
181
182 binary: binary-indep binary-arch
183 .PHONY: binary binary-arch binary-indep build build-arch build-indep clean