building static subversion 1.9 for epel 7

Setup mock:

mock -r epel-7-x86_64 --rootdir /tmp/mock --init
mock -r epel-7-x86_64 --rootdir /tmp/mock -i yum
mock -r epel-7-x86_64 --rootdir /tmp/mock --shell

Install dependencies:

yum install wget scons apr-devel apr-util-devel zlib-devel openssl-devel sqlite-devel perl-ExtUtils-Embed autoconf libtool

Download and build serf:

cd /tmp
wget https://www.apache.org/dist/serf/serf-1.3.9.tar.bz2
tar -xjf serf-1.3.9.tar.bz2
cd serf-1.3.9
scons

Download and build subversion:

cd /tmp
wget http://ftp.heikorichter.name/apache/subversion/subversion-1.9.7.tar.bz2
tar -xjf subversion-1.9.7.tar.bz2
cd subversion-1.9.7
./autogen.sh
./configure --disable-shared --enable-static --with-serf=/tmp/serf-1.3.9 CPPFLAGS="-I/tmp/serf-1.3.9" LDFLAGS="/tmp/serf-1.3.9/libserf-1.a"

Edit Makefile and change

SVN_SERF_LIBS = -lserf-1

into

SVN_SERF_LIBS =

Build

make -j5 svn

You will get a couple of unresolved symbols errors e.g.:

/tmp/subversion-1.9.7/subversion/libsvn_ra_serf/.libs/libsvn_ra_serf-1.a(serf.o): In function `ra_serf_get_description':
/tmp/subversion-1.9.7/subversion/libsvn_ra_serf/serf.c:75: undefined reference to `serf_lib_version'
...

Rerun the last command, but append /tmp/serf-1.3.9/libserf-1.a -lssl -lcrypto

The result is not a completely static build

# ldd ./svn | grep serf
#

but it contains serf:

# ./subversion/svn/svn --version
	svn, version 1.9.7 (r1800392)
	...
	* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
	  - using serf 1.3.9 (compiled with 1.3.9)
	  - handles 'http' scheme
	  - handles 'https' scheme
	...