1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390
|
#!/usr/bin/make -f
# DEB_BUILD_OPTIONS supported:
# noopt Compile with gcc -O0 rather than -O2
# nostrip Do not strip binaries and libraries
# debug Enable additional debug support
# nocheck Skip test suites (synonym 'notest')
# -j[N] Passed into child 'make' processes for parallel builds
# Fully functional Java support is still a bit spotty on some Debian
# architectures. DISABLE_JAVAHL_ARCHS overrides ENABLE_JAVAHL=yes.
# Note: the Build-Depends line in debian/control must be kept in sync
# with DISABLE_JAVAHL_ARCHS.
ENABLE_JAVAHL := yes
DISABLE_JAVAHL_ARCHS := m68k mips mipsel arm hurd-i386
# We may need to disable libapache2-svn for one reason or another.
ENABLE_APACHE := yes
PWD := $(shell pwd)
DEB_BUILDDIR := BUILD
MAKE_B := $(MAKE) -C $(DEB_BUILDDIR)
export LANG := C
export HOME := $(DEB_BUILDDIR)/dummy_home
DPATCH_STAMPFN := debian/stamp-patch
include /usr/share/dpatch/dpatch.make
export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
export DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
# turn DEB_BUILD_OPTIONS='foo,bar' into DEB_BUILD_OPT_FOO and DEB_BUILD_OPT_BAR
d_b_o:=$(shell echo "$$DEB_BUILD_OPTIONS"|sed 's/[^-[:alnum:]]/ /g'|tr a-z A-Z)
$(foreach o, $(d_b_o), $(eval DEB_BUILD_OPT_$o := 1))
MAKE_-J := $(subst -J,-j,$(filter -J%, $(d_b_o)))
# How to fix "#!/usr/bin/env " lines: $(call fix_shebangs_in, /your/dir)
fix_shebangs_in = \
find $1 -type f | xargs -r egrep -m1 -c '^\#! ?/' | sed -n 's/:1//p' |\
xargs -r sed -i -e 's:^\#! */usr/bin/env perl.*:\#!/usr/bin/perl -w:' \
-e 's:^\#! */usr/bin/env pyth.*:\#!/usr/bin/python:' \
-e 's:^\#! */usr/bin/env ruby.*:\#!/usr/bin/$(RUBY):'
PERL_BINDINGDIR := subversion/bindings/swig/perl/native
confflags := \
--mandir=\$${prefix}/share/man \
--with-apr=/usr \
--with-apr-util=/usr \
--with-neon=/usr \
--prefix=/usr \
--with-berkeley-db=/usr \
--with-editor=/usr/bin/editor \
--with-ruby-sitedir=/usr/lib/ruby \
--with-swig=/usr
ifdef DEB_BUILD_OPT_DEBUG
confflags+= --enable-debug
endif
export EXTRA_CFLAGS := -O2
ifdef DEB_BUILD_OPT_NOOPT
EXTRA_CFLAGS := -O0
endif
ifneq (,$(filter $(DEB_HOST_ARCH), $(DISABLE_JAVAHL_ARCHS)))
ENABLE_JAVAHL :=
endif
export DH_OPTIONS
ifeq ($(ENABLE_JAVAHL), yes)
# jikes 1.22 cannot compile javahl.
confflags += --enable-javahl --without-jikes \
--with-jdk=/usr/lib/jvm/java-gcj \
--with-junit=/usr/share/java/junit.jar
else
DH_OPTIONS += -Nlibsvn-java -Nlibsvn-javahl
endif
ifeq ($(ENABLE_APACHE), yes)
confflags += --with-apxs=/usr/bin/apxs2 --disable-mod-activation
else
confflags += --without-apxs
DH_OPTIONS += -Nlibapache2-svn
endif
# FOR AUTOCONF 2.52 AND NEWER ONLY
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
confflags += --build $(DEB_HOST_GNU_TYPE)
else
confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif
# Run testsuite? RUN_TESTS will be set based on (a) existence of
# DEB_BUILD_OPTIONS='nocheck' or 'notest', (b) whether cross-compiling
RUN_TESTS :=
ifdef DEB_BUILD_OPT_NOTEST
DEB_BUILD_OPT_NOCHECK := 1
endif
ifndef DEB_BUILD_OPT_NOCHECK
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
RUN_TESTS := 1
endif
endif
PYTHON := python$(shell python -V 2>&1 | sed 's/.* \([0-9]\+\.[0-9]\+\).*/\1/')
RUBY_PKG := $(shell dh_listpackages | grep 'libsvn-ruby.')
RUBY := $(patsubst libsvn-%,%,$(RUBY_PKG))
TESTS_LD_LIBRARY_PATH := $(PWD)/$(DEB_BUILDDIR)/subversion/tests/.libs
# I'm not trying to be difficult: this check exists because building as
# root really _does_ fail. The failure mode as of 1.4.0 is test 17
# from switch_tests.py. Upstream response is "so don't build as root".
# (fakeroot does not fail, as it does not wrap the access(2) syscall.)
#
# We run this code from build-arch, since that's what actually fails as
# root, but also from autogen, since that will halt the build earlier.
define DONT_BE_ROOT
@if [ $$(id -u) = 0 ] && [ -z "$(FAKEROOTKEY)" ]; then \
echo >&2 "***"; \
echo >&2 "*** Building as root is not supported ***"; \
false; \
fi
endef
autogen: debian/stamp-autogen
debian/stamp-autogen:
$(DONT_BE_ROOT)
./autogen.sh
touch $@
configure: patch autogen debian/stamp-configure
debian/stamp-configure:
dh_testdir
mkdir -p $(DEB_BUILDDIR)
cd $(DEB_BUILDDIR) && \
PYTHON=/usr/bin/python RUBY=/usr/bin/$(RUBY) \
$(PWD)/configure $(confflags)
# Subversion upstream ships with Swig 1.3.25 pregenerated
# files, which may interact badly with the build if Debian swig
# is not version 1.3.25 - particularly with swig 1.3.24.
# Thus we unconditionally delete the pregenerated files.
$(MAKE_B) extraclean-swig
touch $@
build: build-arch build-indep
build-arch: configure debian/stamp-build-arch
debian/stamp-build-arch:
dh_testdir
$(DONT_BE_ROOT)
# note: autogen-swig does not support -jN
$(MAKE_B) autogen-swig
$(MAKE_B) $(MAKE_-J) all SVN_DB_LIBS=-ldb
$(MAKE_B) $(MAKE_-J) swig-py swig-pl swig-rb \
swig_pydir=/usr/lib/$(PYTHON)/site-packages/libsvn \
swig_pydir_extra=/usr/lib/$(PYTHON)/site-packages/svn
$(MAKE) -C $(DEB_BUILDDIR)/$(PERL_BINDINGDIR) $(MAKE_-J) all \
OPTIMIZE="-g -Wall $(EXTRA_CFLAGS)"
ifeq ($(ENABLE_JAVAHL), yes)
$(MAKE_B) javahl \
javahl_javadir=/usr/share/java \
javahl_libdir=/usr/lib \
javahl_javahdir=/usr/include/svn-javahl
endif
touch $@
ifneq ($(RUN_TESTS),)
@echo "###################################################"
@echo "Running testsuite - may take a while. To disable,"
@echo "use DEB_BUILD_OPTIONS=nocheck or edit debian/rules."
@echo
$(MAKE) $(MAKE_-J) -f debian/rules \
check-swig-py check-swig-pl check-swig-rb
ifeq ($(ENABLE_JAVAHL), yes)
# This fails on current free JVMs, according to Blair Zajac.
# Thus the "-" prefix, to ignore failure, for now.
-$(MAKE) -f debian/rules check-javahl
endif
# Run 'check' last, as it takes longest. 'cat tests.log' is for
# obtaining diagnostics from buildd logs.
@if ! $(MAKE) -f debian/rules check; then \
echo "###################################################"; \
echo "Testsuite failed, 'tests.log' follows:"; echo; \
cat $(DEB_BUILDDIR)/tests.log; \
exit 1; \
fi
endif
touch $@
build-indep: configure debian/stamp-build-indep
debian/stamp-build-indep:
$(MAKE_B) doc-api
touch $@
clean: unpatch clean2
clean2:
dh_testdir
dh_testroot
dh_clean
$(MAKE) -C debian/tools clean
-$(MAKE_B) extraclean
$(RM) -r $(DEB_BUILDDIR)
$(RM) build-outputs.mk gen-make.opts subversion/svn_private_config.h.in
find * -name \*.pyc -print0 | xargs -0 $(RM)
# these are (re)generated by autogen.sh
$(RM) configure build/libtool.m4 build/ltmain.sh
$(RM) debian/stamp-*
install-common: debian/stamp-install-common
debian/stamp-install-common:
dh_testdir
dh_testroot
dh_clean -k
for package in `dh_listpackages` ; do \
if [ -f debian/NEWS.Debian ] ; then \
mkdir -p debian/$$package/usr/share/doc/$$package; \
cp debian/NEWS.Debian \
debian/$$package/usr/share/doc/$$package; \
fi; \
lintiandir=debian/$$package/usr/share/lintian/overrides; \
if grep -q ^$$package: debian/lintian-overrides; then \
mkdir -p $$lintiandir; \
grep -B1 ^$$package: debian/lintian-overrides \
> $$lintiandir/$$package; \
fi; \
done
touch $@
install-indep: build-indep install-common debian/stamp-install-indep
debian/stamp-install-indep:
dh_installdirs -i
dh_install -i
mkdir -p debian/libsvn-doc/usr/share/doc/libsvn1
mkdir -p debian/libsvn-doc/usr/share/doc/libsvn-doc
cp -a $(DEB_BUILDDIR)/doc/doxygen/html \
debian/libsvn-doc/usr/share/doc/libsvn1/
ln -s ../libsvn1/html debian/libsvn-doc/usr/share/doc/libsvn-doc/
mkdir debian/libsvn-doc/usr/share/doc/libsvn1/examples
ln -s ../libsvn1/examples debian/libsvn-doc/usr/share/doc/libsvn-doc/
# Install files for 'subversion-tools' package.
install BUILD/tools/backup/hot-backup.py \
debian/subversion-tools/usr/bin/svn-hot-backup
rm debian/subversion-tools/usr/share/subversion/hook-scripts/*.in
rm -r debian/subversion-tools/usr/share/subversion/hook-scripts/mailer/tests
# Fix some scripts not to use #!/usr/bin/env.
$(call fix_shebangs_in, debian/*/usr/bin \
debian/subversion-tools/usr/share/subversion/hook-scripts)
cd debian/subversion-tools/usr/share/subversion/hook-scripts; \
chmod 0755 commit-email.pl commit-access-control.pl \
mailer/mailer.py verify-po.py svnperms.py;
# Remove suffixes from binaries in /usr/bin
prename 's/\.(sh|pl|rb|py)$$//' debian/*/usr/bin/*
pod2man -c 'User Commands' -r "" contrib/client-side/svn-clean \
BUILD/contrib/client-side/svn-clean.1
touch $@
install-arch: build-arch install-common debian/stamp-install-arch
debian/stamp-install-arch:
dh_installdirs -s
$(MAKE_B) local-install \
DESTDIR=$(PWD)/debian/tmp
sed -i 's:/usr/lib/lib\([^ ]*\).la:-l\1:g' debian/tmp/usr/lib/*.la
$(MAKE_B) install-swig-py \
DESTDIR=$(PWD)/debian/tmp \
swig_pydir=/usr/lib/$(PYTHON)/site-packages/libsvn \
swig_pydir_extra=/usr/lib/$(PYTHON)/site-packages/svn
$(RM) debian/tmp/usr/lib/$(PYTHON)/site-packages/libsvn/*.la
$(RM) debian/tmp/usr/lib/$(PYTHON)/site-packages/libsvn/*.a
ifeq ($(ENABLE_JAVAHL), yes)
$(MAKE_B) install-javahl \
DESTDIR=$(PWD)/debian/tmp \
javahl_javadir=/usr/share/java \
javahl_libdir=/usr/lib \
javahl_javahdir=/usr/include/svn-javahl
endif
# Create our default configuration files to be installed in
# /etc/subversion/
$(MAKE) -C debian/tools \
LD_LIBRARY_PATH=$(PWD)/debian/tmp/usr/lib \
DEB_SRCDIR=$(PWD) DEB_BUILDDIR=$(PWD)/$(DEB_BUILDDIR)
$(MAKE_B) install-swig-pl-lib \
DESTDIR=$(PWD)/debian/tmp
$(MAKE) -C $(DEB_BUILDDIR)/$(PERL_BINDINGDIR) install \
MAN3EXT=3perl DESTDIR=$(PWD)/debian/tmp
$(MAKE_B) install-swig-rb \
DESTDIR=$(PWD)/debian/tmp
find debian/tmp/usr/lib/ruby \( -name \*.a -o -name \*.la \) -print0 | \
xargs -0 $(RM)
dh_install -s
install -m644 tools/client-side/bash_completion \
debian/subversion/etc/bash_completion.d/subversion
ifeq ($(ENABLE_APACHE), yes)
install subversion/mod_authz_svn/INSTALL \
debian/libapache2-svn/usr/share/doc/libapache2-svn/INSTALL.authz
endif
cp tools/examples/svnshell.py debian/python-subversion/usr/bin/svnshell
$(call fix_shebangs_in, debian/python-subversion/usr/bin/svnshell)
touch $@
CHECK_DEFS := CLEANUP=true LC_ALL=C LD_LIBRARY_PATH="$(TESTS_LD_LIBRARY_PATH)"
CHECK_ALL := check-swig-py check-swig-pl check-swig-rb check
ifeq ($(ENABLE_JAVAHL), yes)
CHECK_ALL += check-javahl
endif
check-all: $(CHECK_ALL)
check-help:
@echo "$(MAKE) $(CHECK_ALL)"
$(CHECK_ALL)::
$(MAKE_B) $@ $(CHECK_DEFS)
check-swig-pl::
$(MAKE) -C $(DEB_BUILDDIR)/$(PERL_BINDINGDIR) test LC_ALL=C
binary-indep: build-indep install-indep
dh_testdir
dh_testroot
dh_installdocs -i
dh_installexamples -i
$(call fix_shebangs_in, debian/*/usr/share/doc/*/examples)
dh_installman -i
dh_installchangelogs -i CHANGES
$(RM) -r debian/libsvn-ruby/usr/share/doc/libsvn-ruby
$(RM) -r debian/libsvn-javahl/usr/share/doc/libsvn-javahl
ln -s $(RUBY_PKG) debian/libsvn-ruby/usr/share/doc/libsvn-ruby
ln -s libsvn-java debian/libsvn-javahl/usr/share/doc/libsvn-javahl
dh_compress -i
dh_fixperms -i
dh_perl -i
dh_installdeb -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
binary-arch: build-arch install-arch
dh_testdir
dh_testroot
dh_installdocs -s
dh_installexamples -s
$(call fix_shebangs_in, debian/*/usr/share/doc/*/examples)
dh_installchangelogs -s CHANGES
dh_fixperms -s
dh_strip -s
dh_compress -s
dh_makeshlibs -s -V'libsvn1 (>= 1.4)'
dh_perl -s
dh_pysupport -s
dh_installdeb -s
dh_shlibdeps -s -l$(PWD)/debian/libsvn1/usr/lib
dh_gencontrol -s
dh_md5sums -s
dh_builddeb -s
binary: binary-indep binary-arch
.PHONY: clean clean2 build binary install configure autogen
.PHONY: build-arch build-indep install-arch install-indep install-common
.PHONY: binary-arch binary-indep check-help $(CHECK_ALL)
|