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