The development box currently runs on CentOS and we often custom compile our own RPMs as those available as default are often hideously out of date or not available at all. The latter of the two seems to be the case for the Ruby Subversion bindings. I tend to prefer building the RPMs so I can maintain some element of package management and avoids the spewing of files that ‘make install’ causes – it also makes it easier to carry things across between machines.

I’ve tried to document the steps to help anyone else trying to achieve the same result – so i’ve included what I can translate from my notes!

The road to Subversion Ruby Bindings..

Prerequisites

I used my development machine to build this so it already had a lot of the development libraries on there. As such, there may be some prerequisites that I don’t explicitly state, but you should be able to determine what is required.

A couple of obvious prerequisites are:

  • ruby
  • ruby–devel
  • zlib
  • openssl
  • openssl–devel
  • expat–devel

Also, you may as well make sure your system is up to date before continuing.

yum update

SWIG

The source for subversion seems quite fussy about what versions to use – for SWIG it suggests a range with 1.3.29 being the latest supported update (I tried with 1.3.32 but ran into errors)

Pull down the source code and place it into your build directory. For a non RPM build then do the usual:

./configure
make
make install

For the RPM build I generated the swig.spec file from the source, and proceeded to build the RPMs (obviously you will need to configure your RPM build environment):

rpmbuild -ba swig.spec

This produced the required swig-1.3.29-1.i386.rpm which was then installed (you may need –U if you’ve got an older version of SWIG already installed):

rpm -i swig-1.3.29-1.i386.rpm

Neon

The neon library is also required and the preferred version is 0.25.5.

Pull down the source code and then either build from source or build the RPM. If you’re building from source you’ll need to include the ––with–ssl flag. If you’re building the RPM then grab the neon.spec file I used.

The resulting RPM files are neon-0.25.5-1.rpm and neon-devel-0.25.5-1.rpm – install both (only necessary on your build machine – if you’re reusing the RPMs once they’re all built you won’t need the devel packages).

APR and APR-Util

Thankfully (due to the good work of David Summers) I was able to find a reasonably up to date version of APR and APR–Util to avoid me having to build my own. Grab and install the following files:

Subversion

The final step is to build Subversion itself. Pull down version 1.4.5 and then place it in your source directory ready for building.

If you’re just making and installing then I can have a stab at the steps you should take, but obviously I went the RPM route so the following is untested:

rm -rf apr apr-util neon
./configure --with-openssl --with-ssl --with-swig --with-berkeley-db
make
make install
make swig-rb
make check-swig-rb
make install-swig-rb

If you’re taking the RPM route then here is the subversion.spec file – which is basically a modified version of that provided on David Summers’ site – updated to reflect the correct versions and add a ‘ruby’ RPM package along with those for Perl and Python.

The RPM files built will be:

  • subversion-1.4.5-1.i386.rpm
  • subversion-debuginfo-1.4.5-1.i386.rpm
  • subversion-devel-1.4.5-1.i386.rpm
  • subversion-perl-1.4.5-1.i386.rpm
  • subversion-python-1.4.5-1.i386.rpm
  • subversion-ruby-1.4.5-1.i386.rpm
  • subversion-tools-1.4.5-1.i386.rpm

Install subversion-1.4.5-1.i386.rpm and subversion-ruby-1.4.5-1.i386.rpm along with the other bindings if required.

Test it!

The final step is to test if it’s all working:

ruby -e 'puts require("svn/core")'

If you see the result true then you’re there! If not, somethings gone wrong so it’s time to step back and work out if it’s my instructions or if you’ve missed a step!