b8e5e1cbe61de1f348c7497f651981967a0bc011
[alioth/cvs.git] / debian / rules
1 #!/usr/bin/make -f
2 # $MirOS: contrib/hosted/tg/deb/cvs/debian/rules,v 1.24 2013/06/26 18:35:52 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 m4/mktime.m4 \
76                         vms/config.h windows-NT/config.h
77
78 debian/.configure_stamp:
79         dh_testdir
80         -rm -rf ${CLEANFILES}
81         cp /usr/share/gnulib/m4/mktime.m4 m4/
82         cp /usr/share/misc/config.guess /usr/share/misc/config.sub build-aux/
83         dh_autoreconf
84         mkdir debian/builddir debian/stagedir
85         cd debian/builddir && \
86             env ${CONFIGURE_ENV} sh ../../configure ${CONFIGURE_ARGS}
87         @:>$@
88
89 build-indep:
90 build build-arch: debian/.build_stamp
91
92 debian/.build_stamp: debian/.configure_stamp
93         dh_testdir
94         cd debian/builddir && ${MAKE} ${MAKE_ARGS}
95         cd debian/builddir && ${MAKE} -C doc ${MAKE_ARGS} doc html info pdf txt
96         @:>$@
97
98 clean:
99         dh_testdir
100         dh_autoreconf_clean
101         -rm -rf ${CLEANFILES}
102         dh_clean
103
104 binary-indep:
105
106 binary-arch: debian/.build_stamp
107         dh_testdir
108         dh_testroot
109         if test -x "$$(which dh_prep)"; then dh_prep; else dh_clean -k; fi
110         -rm -rf debian/stagedir
111         mkdir -p debian/stagedir/clogs
112         cd debian/builddir && \
113             ${MAKE} ${MAKE_ARGS} DESTDIR=${CURDIR}/debian/stagedir install
114         cat ChangeLog ChangeLog.zoo >debian/stagedir/clogs/ChangeLog
115         cat doc/ChangeLog doc/ChangeLog.fsf >debian/stagedir/clogs/ChangeLog.doc
116         #cat lib/ChangeLog lib/ChangeLog.fsf >debian/stagedir/clogs/ChangeLog.lib
117         #cat src/ChangeLog src/ChangeLog-97 src/ChangeLog-96 src/ChangeLog-9395 \
118         #    src/ChangeLog-9194 >debian/stagedir/clogs/ChangeLog.src
119         cp src/ChangeLog debian/stagedir/clogs/ChangeLog.src
120         cp contrib/ChangeLog debian/stagedir/clogs/ChangeLog.contrib
121         cp diff/ChangeLog debian/stagedir/clogs/ChangeLog.diff
122         #cp m4/ChangeLog debian/stagedir/clogs/ChangeLog.m4
123         #cp man/ChangeLog debian/stagedir/clogs/ChangeLog.man
124         #cp tools/ChangeLog debian/stagedir/clogs/ChangeLog.tools
125         # fat and nonsensical to ship this
126         rm -f debian/stagedir/usr/share/cvs/contrib/rcs-5.7-commitid.patch
127         # uses csh
128         rm -f debian/stagedir/usr/share/cvs/contrib/sccs2rcs
129         # unsafe
130         rm -f debian/stagedir/usr/share/cvs/contrib/commit_prep
131         rm -f debian/stagedir/usr/share/cvs/contrib/cvs_acls
132         rm -f debian/stagedir/usr/share/cvs/contrib/log
133         rm -f debian/stagedir/usr/share/cvs/contrib/log_accum
134         rm -f debian/stagedir/usr/share/cvs/contrib/mfpipe
135         rm -f debian/stagedir/usr/share/cvs/contrib/rcslock
136         # we ship cvs-switchroot(1) instead
137         rm -f debian/stagedir/usr/share/cvs/contrib/newcvsroot
138         dh_installchangelogs debian/stagedir/clogs/ChangeLog
139         dh_installdocs
140         dh_install
141         dh_installinfo
142         dh_installman
143         dh_link
144         dh_strip
145         dh_compress -X.pdf
146         cd debian/cvs/usr/share/cvs/contrib && chmod +x descend.sh rcs2sccs.sh
147         dh_fixperms
148         dh_installdeb
149         dh_shlibdeps
150         dh_gencontrol
151         dh_md5sums
152         dh_builddeb
153
154 binary: binary-indep binary-arch
155 .PHONY: binary binary-arch binary-indep build build-arch build-indep clean