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