# 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.2.x, 1.3.x 1.4.x or 1.5.x with these options:
  - Subversion client package
  - Subversion development package
- PyCXX V5.5.0 to build against Python 2 which is included in the pysvn source kit.
- PyCXX V6.0.0 to build against 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.4.6 and svn 1.5.4)
2. Fetch and expand the pysvn source code into extdir
3. Expand pycxx-5.4.2.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 builds: `tar xzf pycxx-5.5.0.tar.gz` into extdir/Import if not using a source kit
4. For Python 3 builds: `tar xzf pycxx-6.0.0.tar.gz` into extdir/Import if not using a source kit
5. `cd Source`
6. For Python 2 builds: backport the PySVN code using `python setup.py backport`
7. Create the Makefile using `python setup.py configure`
8. `make`
9. `cd Tests`
10. 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`