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