# Building pysvn Extension

## Prerequisites

To build pysvn you will require:

- Python 2.2 or later with these options:
  - Python runtime package
  - Python development package
  - Python pyexpat package
- subversion 1.5.x or 1.6.x with these options:
  - Subversion client package
  - Subversion development package
- PyCXX V6.1.1 to build against Python 2 or Python 3 which is included in the pysvn source kit.

Some distributions will split python and subversion into more the one package.

You will need to find all the packages that give you the options listed above.

### Building on win32

These instructions assume you have Microsoft Visual C++ 6.0 to compile the code and INNO 4.0.10 to create the installation kit.

Note: You must build with MSVC 6.0 as python 2.3 and earlier was built with that version.

Note: You must build with MSVC 2003.NET for python 2.4 or Python 2.5.

Note: You must build with MSVC 2008 (9.0) for Python 2.6 or later and python 3.0 or later.

1. Build subversion (tested with SVN 1.5.6 and svn 1.6.9)
2. Fetch and expand the pysvn source code into extdir
3. Expand pycxx-6.1.1.tar.gz into extdir\Import if not using a source kit
4. Edit Builder\builder_custom_init.cmd to match the locations of the sources.
5. `cd Builder`
6. `builder_custom_init.cmd`
7. `nmake -f win32.mak build`

To install the built kit

1. Uninstall any previous kit (control panel's Add/Remove programs)
2. `nmake -f win32.mak install`

### Building on unix and Mac OS X systems.

1. Install subversion.
   When installing from packages you will need to install the devel packages as well. For example on Fedora/Redhat subversion-devel, apr-devel, apr-util-devel and their dependancies.
2. Get the pysvn source code
3. For Python 2 or Python 3 builds: `tar xzf pycxx-6.1.1.tar.gz` into extdir/Import if not using a source kit
4. `cd Source`
5. For Python 2 builds: backport the PySVN code using `python setup.py backport`
6. Create the Makefile using `python setup.py configure`
7. `make`
8. `cd Tests`
9. Test pysvn by running `make`

Install pysvn by copying the following from Extension/Source to python site-specific directory.

- `mkdir python-libdir/site-packages/pysvn`
- `cp pysvn/__init__.py python-libdir/site-packages/pysvn`
- `cp pysvn/_pysvn*.so python-libdir/site-packages/pysvn`