2008/10/25

Building Subversion 1.5 on a Mac

I often need the latest SVN client and server tools on my Mac, but I do not need nor want the fink or macports tools. SVN 1.5 brings very nice features, such as merging.


The following instructions are for Leopard machines. Instructions won't work on a Tiger or earlier OS X releases.


You'll need a working development environment - the following instructions assume you've already installed the GNU toolchain which comes with Xcode (GCC 4.0)


# Download the latest SVN 1.5.x archive # replace 'x' with the actual release (1.5.4 by the time of writing)
wget http://subversion.tigris.org/downloads/subversion-1.5.x.tar.bz2
# Download the latest companion archive for SVN 1.5.x
wget http://subversion.tigris.org/downloads/subversion-deps-1.5.x.tar.bz2
# Untar the main archive
tar xjvf ../subversion-1.5.?.tar.bz2
# Untar the missing dependencies (and only these ones)
tar xjvf ../subversion-deps-1.5.?.tar.bz2 subversion-1.5.?/neon
subversion-1.5.?/serf
# Let's start. It would be nice to perform an out-of-source build of SVN, but early SVN 1.5.x release simply do not build in an out-of-source environment. So fall back to a in-source build for now
cd subversion-1.5.?/
# Be sure to use the simplest PATH environment. # If you have installed other tools (such as MacPorts or fink, you might run into dependencies nightmares)
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Use the following configure settings. SVN will be installed in /usr/local/subversion, so it's easy to get rid of this version and/or replace it with a future release
./configure --enable-shared --disable-static --with-apxs --with-ssl
--with-apr=/usr/bin/apr-1-config --with-apr-util=/usr/bin/apu-1-config
--prefix=/usr/local/subversion
# Before starting to build SVN, you need to edit serf/Makefile, and remove every single occurence of "-static", or the build would fail
vim serf/Makefile
:%s/-static//g
:wq
# Start the build. # Nearly everyone owns a multi-core CPU Mac nowadays, so let speed up the build, spawning several processes at once
make -j2
# Optional: if you need the Python modules, let's build them
make -j2 swig-py
# Leopard comes with a built-in release of Subversion (1.4.x) # Let's backup the Apache modules first
pushd /usr/libexec/apache2/
sudo mv mod_authz_svn.so mod_authz_svn.so.orig
sudo mv mod_dav_svn.so mod_dav_svn.so.orig
popd
# Install the fresh built version of Subversion to /usr/local/
subversion
sudo make install
# Optional: install Python Subversion wrapper
sudo make install-swig-py
# Optional: replace the default Python wrapper with the new ones pushd /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python
sudo mv svn svn.orig
sudo mv libsvn libsvn.orig
sudo ln -s /usr/local/subversion/lib/svn-python/svn
sudo ln -s /usr/local/subversion/lib/svn-python/libsvn
popd
# Optional but recommended: # SVN 1.5 working copies cannot be used with a prior release of SVN, such as the one that comes with Leopard. If you access a 1.4 WC with a 1.5 client, the WC is automatically updated to the 1.5 format, which prevent any further access from the default 1.4 tools. To avoid compatibility issue, I recommend you only use *one* major release of SVN tools on your machine # Replace the pristine release of SVN with the new one
pushd /usr/bin
for f in svn*; do sudo mv $f $f.orig; sudo ln -s
/usr/local/subversion/bin/$f; done
popd
# Once you double check SVN 1.5.x is up and running, you can get rid of your source+build directory
cd ..
rm -rf subversion-*
Enjoy !
$> svn --version
svn, version 1.5.4 (r33841)
   compiled Oct 24 2008, 23:31:22

No comments: