dh_installdocs is n̲o̲t nodocs-clean…
[alioth/cvs.git] / debian / rules
1 #!/usr/bin/make -f
2
3 DEB_BUILD_ARCH=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
4 DEB_HOST_ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH)
5 DEB_BUILD_GNU_TYPE=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
6 DEB_HOST_GNU_TYPE=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
7
8 # is ${CC} defined anywhere (other than implicit rules?)
9 ifneq (,$(findstring $(origin CC),default undefined))
10 # no - then default to gcc (or cross-gcc)
11 ifneq (${DEB_BUILD_ARCH},${DEB_HOST_ARCH})
12 CC=                     ${DEB_HOST_GNU_TYPE}-gcc
13 else
14 CC=                     gcc
15 endif
16 endif
17
18 CONFIGURE_ENV:=         CC='${CC}'
19 EXTRA_CFLAGS=           -Wall -fno-strict-aliasing -Wformat
20 # addresses part of #698908
21 EXTRA_CFLAGS+=          -fwrapv
22 # for now. uses are mostly checked.
23 EXTRA_CFLAGS+=          -Wno-unused-result
24 EXTRA_CPPFLAGS=         -D_GNU_SOURCE -DUSE_LIBBSD
25
26 ifneq (,$(wildcard /usr/share/dpkg/buildflags.mk))
27 # dpkg-dev (>= 1.16.1~)
28 DEB_CFLAGS_MAINT_APPEND=${EXTRA_CFLAGS}
29 DEB_CPPFLAGS_MAINT_APPEND=${EXTRA_CPPFLAGS}
30 DEB_BUILD_MAINT_OPTIONS=hardening=+all
31 DPKG_EXPORT_BUILDFLAGS= Yes
32 include /usr/share/dpkg/buildflags.mk
33 else
34 # old-fashioned way to determine build flags
35 CFLAGS=                 -O$(if $(findstring noopt,${DEB_BUILD_OPTIONS}),0,2) -g
36 CFLAGS+=                ${EXTRA_CFLAGS}
37 CPPFLAGS+=              ${EXTRA_CPPFLAGS}
38 CONFIGURE_ENV+=         CFLAGS='${CFLAGS}'
39 CONFIGURE_ENV+=         CPPFLAGS='${CPPFLAGS}'
40 CONFIGURE_ENV+=         LDFLAGS='${LDFLAGS}'
41 endif
42
43 LIBS+=                  -lbsd
44
45 CONFIGURE_ENV+=         LIBS='${LIBS}'
46 CONFIGURE_ENV+=         CSH=/bin/csh
47
48 CONFIGURE_ARGS:=        --build=${DEB_BUILD_GNU_TYPE} \
49                         --host=${DEB_HOST_GNU_TYPE} \
50                         --prefix=/usr \
51                         --infodir=/usr/share/info \
52                         --mandir=/usr/share/man \
53                         --sysconfdir=/etc \
54                         --disable-dependency-tracking \
55                         --disable-maintainer-mode \
56                         --disable-pam \
57                         --disable-nls \
58                         --enable-client \
59                         --enable-password-authenticated-client \
60                         --enable-server \
61                         --enable-proxy \
62                         --enable-case-sensitivity \
63                         --enable-encryption \
64                         --disable-lock-compatibility \
65                         --enable-rootcommit \
66                         --disable-old-info-format-support \
67                         --enable-config-override=no \
68                         --without-krb4 \
69                         --with-gssapi \
70                         --with-external-zlib \
71                         --with-rsh=ssh \
72                         --with-editor=/usr/bin/editor \
73                         --with-tmpdir=/var/tmp \
74                         --with-umask=002 \
75                         --with-cvs-admin-group=_cvsadmin
76
77 MAKE_ARGS:=             MAKEINFO=makeinfo
78 MAKE_ARGS+=             MAKEINFOFLAGS=--no-split
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 fi
165         dh_installdocs
166         dh_install
167         dh_installinfo
168         dh_installman
169         dh_link
170         dh_strip
171         dh_compress -X.pdf
172         cd debian/cvs/usr/share/cvs/contrib && chmod +x descend.sh rcs2sccs.sh
173         dh_fixperms
174         dh_installdeb
175         dh_shlibdeps
176         dh_gencontrol
177         dh_md5sums
178         dh_builddeb -- -Zgzip -z9
179
180 binary: binary-indep binary-arch
181 .PHONY: binary binary-arch binary-indep build build-arch build-indep clean