3
STATUS OF THE SWIG BINDINGS
7
The Python bindings are fairly well developed, although there are some
8
missing parts, most notably, there is no useful wrapping of the svn_ra APIs.
12
The Perl bindings are complete, with the exception of SVN::Wc, on which
13
very little work has been done.
17
The Ruby bindings are a recent development, and are only partially
18
implemented. The Ruby bindings API may change incompatibly as development
19
proceeds. They require SWIG 1.3.24 or later.
22
BUILDING SWIG BINDINGS FOR SVN ON UNIX
25
Step 1: Install a suitable version of SWIG (which is
26
currently swig versions 1.3.19 - 1.3.21, or 1.3.24 or above).
28
* Perhaps your distribution packages a suitable version - if it does
29
install it, and skip to the last bullet point in this section.
31
* Go to http://www.swig.org/, download the source tarball, and unpack.
33
* In the SWIG-1.3.xx directory, run ./configure.
35
If you plan to build the python bindings, and have a system
36
with more than one version of python installed, you may need
39
--with-python=/path/to/correct/python/binary
41
to the configure script. You need Python 2.0 or above.
43
If you plan to build the perl bindings, and have a system
44
with more than one version of perl installed, you may need
47
--with-perl5=/path/to/correct/perl/binary
49
to the configure script. You need Perl 5.8.0 or above.
53
For SWIG 1.3.24 or above:
54
Run 'make && make install'
56
For SWIG 1.3.19 - 1.3.21:
57
Run 'make && make runtime && make install && make install-runtime'
59
* To verify you have SWIG installed correctly, check that these things
60
were created, assuming your $PREFIX was /usr/local:
62
For SWIG 1.3.24 or above:
64
- /usr/local/share/swig/1.3.xx/ (containing lots of .i files)
66
For SWIG 1.3.19 - 1.3.21:
68
- /usr/local/lib/swig1.3/ (containing lots of .i files)
69
- /usr/local/lib/libswigpy.so (for Python)
70
- /usr/local/lib/libswigpl.so (for Perl)
72
In particular, you want to make sure that
73
libswigpy.so (if you want to use Python) and/or
74
libswigpl.so (if you want to use Perl) was/were built and installed.
77
Step 2: Build and Install Subversion.
79
See Subversion's own INSTALL file for details.
81
Make sure that Subversion's ./configure script sees your installed SWIG!
82
It tries to detect SWIG near the very end of its output.
84
Also make sure that the configure script sees the paths to the perl and/or
85
python executable you used to configure SWIG as above. If it does not then
86
you can specify the correct path by adding PYTHON=/path/to/python or
87
PERL=/path/to/perl onto the command line for configure. For example:
88
./configure PYTHON=/usr/bin/python2.2 PERL=/usr/bin/perl5.8.0
90
If Subversion's ./configure finds a SWIG that it's happy with, then
91
it will build special glue libraries to link svn to the swig bindings:
92
libsvn_swig_py.so (for Python)
93
libsvn_swig_perl.so (for Perl)
96
Step 3: Install Specific Language Bindings
100
1. Run 'make swig-py' from the top of the Subversion source tree,
101
to build the bindings.
103
(This will invoke SWIG on the *.i files, resulting in a collection
104
of .c source files. It will then compile and link those .c files into
107
2. Run 'make install-swig-py' (as root, typically)
108
from the top of the Subversion source tree. This will copy
109
your new Python libraries into the appropriate system location.
111
Note: If you don't have access to install to python's site-packages
112
directory, you can have the python modules install to your home
113
directory. You can do this by running
114
'make install-swig-py swig_pydir=~'.
116
Note: If you want to install to an alternate prefix (usually only
117
if you are building packages), you can supply the prefix here. An
118
example of doing this for building rpms looks like
119
'make install-swig-py DESTDIR=$RPM_BUILD_ROOT/usr'.
121
3. Make sure that whatever directory the bindings got installed in
122
is in your PYTHONPATH. That directory depends on how you
123
installed; a typical location is /usr/local/lib/svn-python/.
125
An nice way to do this is:
126
$ echo /usr/local/lib/svn-python \
127
> /usr/lib/python2.x/site-packages/subversion.pth
132
Perl 5.8.0 is required. You can specify the perl binary by passing
133
PERL=/path/to/perl as part of the configure command in the top level
134
of the Subversion source tree. Make sure that the perl version used
135
is the same one that you configured SWIG to run against during the
136
SWIG configure (see above).
138
1. Run `make swig-pl' from the top of the Subversion source tree.
140
2. Run `make check-swig-pl' from the top of the Subversion source
141
tree, to test the bindings
143
3. to install run `make install-swig-pl' from the top of the
144
Subversion source tree.
146
If you need to pass extra parameters to perl build process (Makefile.PL),
147
then you need to do this process somewhat different:
149
1. Run `make swig-pl-lib' from the top of the Subversion source tree.
151
2. Run `make install-swig-pl-lib'
153
3. cd subversion/bindings/swig/perl/native
155
4. Run `perl Makefile.PL EXTRAOPTIONSHERE`
157
5. Run `make install'
160
BUILDING SWIG BINDINGS FOR SVN ON WINDOWS
163
1. Install SWIG. Download the SWIG Windows zipfile (it's the same as the
164
source tarball except that it also includes a copy of swig.exe) from
168
and extract it somewhere, like C:\Program Files.
170
2. Install whatever languages you want to build runtimes for. Windows
171
versions of Python and Perl are available from:
173
http://www.python.org/
174
http://www.activestate.com/ActivePerl/
176
3. Configure Visual C++ with paths to swig.exe and language specific
177
libraries. In Visual C++ 6, go to Tools -> Options -> Directories.
178
In Visual C++ .NET, go to Tools -> Options -> Projects
181
Add the following paths:
183
Executable Directories:
186
(for example, C:\Program Files\SWIG-1.3.19)
188
For Perl, path to perl.exe
189
(for example, C:\Program Files\Perl\bin)
193
For Python, path to python##.lib
194
(for example, C:\Program Files\Python22\libs)
196
For Perl, path to perl##.lib
197
(for example, C:\Program Files\Perl\lib\CORE)
201
For Python, path to Python.h
202
(for example, C:\Program Files\Python22\include)
204
For Perl, path to perl.h
205
(for example, C:\Program Files\Perl\lib\CORE)
207
4. If you haven't already built Subversion, you should do so now.
208
Instructions are in the main INSTALL file. At the very least,
209
you need to run gen-make.py to generate Visual Studio project
212
5. Build the bindings. Open the Subversion workspace in Visual C++
213
(subversion_msvc.dsw or subversion_vcnet.sln) and build one or more
214
of the following projects:
219
6. Install the bindings. The procedure varies depending on the language.
221
For Python, create two folders:
223
<PYTHON>\Lib\site-packages\svn
224
<PYTHON>\Lib\site-packages\libsvn
226
Copy subversion\bindings\swig\python\svn\*.py into the svn folder.
227
Copy subversion\bindings\swig\python\*.py and
228
Release\subversion\bindings\swig\python\*.dll into the libsvn folder.
230
Optionally, you can run the following commands to compile the Python
231
sources into bytecode:
233
python <PYTHON>\lib\compileall.py <PYTHON>\Lib\site-packages\svn
234
python <PYTHON>\lib\compileall.py <PYTHON>\Lib\site-packages\libsvn
236
This can make the modules load faster for users without write access
237
to the site-packages directory.
239
For Perl, the bindings have be copied into a more complicated directory
240
structure inside the perl library directory. Running the commands below
241
from the subversion source directory will copy the files to the right
244
set PERL_LIBS="C:\Program Files\Perl\site\lib"
246
md %PERL_LIBS%\SVN %PERL_LIBS%\auto\SVN
247
copy subversion\bindings\swig\perl\native\*.pm %PERL_LIBS%\SVN
249
md %PERL_LIBS%\auto\SVN\_Client
250
copy Release\subversion\bindings\swig\perl\_Client.dll %PERL_LIBS%\auto\SVN\_Client
251
copy Release\subversion\bindings\swig\perl\_Client.pdb %PERL_LIBS%\auto\SVN\_Client
253
md %PERL_LIBS%\auto\SVN\_Core
254
copy Release\subversion\bindings\swig\perl\_Core.dll %PERL_LIBS%\auto\SVN\_Core
255
copy Release\subversion\bindings\swig\perl\_Core.pdb %PERL_LIBS%\auto\SVN\_Core
257
md %PERL_LIBS%\auto\SVN\_Delta
258
copy Release\subversion\bindings\swig\perl\_Delta.dll %PERL_LIBS%\auto\SVN\_Delta
259
copy Release\subversion\bindings\swig\perl\_Delta.pdb %PERL_LIBS%\auto\SVN\_Delta
261
md %PERL_LIBS%\auto\SVN\_Fs
262
copy Release\subversion\bindings\swig\perl\_Fs.dll %PERL_LIBS%\auto\SVN\_Fs
263
copy Release\subversion\bindings\swig\perl\_Fs.pdb %PERL_LIBS%\auto\SVN\_Fs
265
md %PERL_LIBS%\auto\SVN\_Ra
266
copy Release\subversion\bindings\swig\perl\_Ra.dll %PERL_LIBS%\auto\SVN\_Ra
267
copy Release\subversion\bindings\swig\perl\_Ra.pdb %PERL_LIBS%\auto\SVN\_Ra
269
md %PERL_LIBS%\auto\SVN\_Repos
270
copy Release\subversion\bindings\swig\perl\_Repos.dll %PERL_LIBS%\auto\SVN\_Repos
271
copy Release\subversion\bindings\swig\perl\_Repos.pdb %PERL_LIBS%\auto\SVN\_Repos
273
md %PERL_LIBS%\auto\SVN\_Wc
274
copy Release\subversion\bindings\swig\perl\_Wc.dll %PERL_LIBS%\auto\SVN\_Wc
275
copy Release\subversion\bindings\swig\perl\_Wc.pdb %PERL_LIBS%\auto\SVN\_Wc
277
TESTING AND USING SWIG BINDINGS
281
1. Verify that an 'svn' package has been installed correctly. You can
282
do this by running Python via 'python -c "from svn import client"'.
284
2. Try some demo programs. From the top of your svn working copy,
285
cd tools/examples/ and try running 'svnlook.py'.
287
3. Start writing your own scripts. Use the Subversion API definitions
290
subversion/include/svn_client.h
291
subversion/include/svn_delta.h
292
subversion/include/svn_fs.h
293
subversion/include/svn_ra.h
294
subversion/include/svn_repos.h
295
subversion/include/svn_wc.h
299
The perl bindings are using the standard module testing facilities
300
to do regression tests. Simply run make check-swig-pl as described in the