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