								-*-text-*-

BUILDING SWIG BINDINGS FOR SVN ON UNIX


Step 1:  Build & install the proper version of SWIG (which is
         currently swig 1.3.19 or newer).

    * Go to http://www.swig.org/, download the sourceball, unpack.

    * In the SWIG-X.X.X directory, run ./configure.

       If you plan to build the python bindings, and have a system
       with more than one version of python installed, you may need
       to pass

             --with-python=/path/to/correct/python/binary

       to the configure script.  You certainly don't want to use any
       version of python older than 2.0.

       If you plan to build the perl bindings, and have a system
       with more than one version of perl installed, you may need
       to pass

             --with-perl5=/path/to/correct/perl/binary

       to the configure script.  You need Perl 5.8.0 or above.

    * run 'make && make runtime && make install && make install-runtime'

    * To verify you have the goodz installed, check that these things
      were created, assuming your $PREFIX was /usr/local/lib:

           - /usr/local/lib/swig1.3/*.i
           - /usr/local/lib/libswig*.so
           - /usr/local/bin/swig

      In particular, you want to make sure that libswigpy.so was
      built and installed, since the python bindings are the most-used
      ones at the moment.


Step 2:  Build and Install Subversion.

  See Subversion's own INSTALL file for details.

  Make sure that Subversion's ./configure script sees your installed SWIG!
  It tries to detect SWIG near the very end of its output.

  Also make sure that the configure script sees the paths to the perl and/or
  python executable you used to configure SWIG as above.  If it does not then
  you can specify the correct path by adding PYTHON2=/path/to/python or
  PERL=/path/to/perl onto the command line for configure.  For example:
       ./configure PYTHON2=/usr/bin/python2.2 PERL=/usr/bin/perl5.8.0

  If Subversion's ./configure finds a SWIG that it's happy with, then
  it will build a special glue library to link svn to the swig-python
  bindings:  libsvn_swig_py.so (as well as any other languages).


Step 3:  Install Specific Language Bindings

*  Python

   1.  Run 'make swig-py' from the top of the
       Subversion source tree.  This will invoke SWIG on the *.i
       files, resulting in a collection of .c source files.  It will
       then compile and link those .c files into Python libraries.

   2.  Run 'make install-swig-py' (as root, typically)
       from the top of the Subversion source tree.  This will copy
       your new Python libraries into the appropriate system location.

       Note: If you don't have access to install to python's site-packages
       directory, you can have the python modules install to your home
       directory.  You can do this by running
       'make install-swig-py swig_pydir=~'.

       Note: If you want to install to an alternate prefix (usually only
       if you are building packages), you can supply the prefix here.  An
       example of doing this for building rpms looks like
       'make install-swig-py DESTDIR=$RPM_BUILD_ROOT/usr'.

   3.  Make sure that whatever directory the bindings got installed in
       is in your PYTHONPATH.  That directory depends on how you
       installed; a typical location is /usr/local/lib/svn-python/,
       see http://subversion.tigris.org/issues/show_bug.cgi?id=1125
       for some imminent improvements to the install process.

*  Perl

   Perl 5.8.0 is required.  You can specify the perl binary by passing
   PERL=/path/to/perl as part of the configure command in the top level
   of the Subversion source tree.  Make sure that the perl version used
   is the same one that you configured SWIG to run against during the
   SWIG configure (see above).

   1.  Run `make swig-pl' from the top of the Subversion source tree.

   2.  Run `make check-swig-pl' from the top of the Subversion source
       tree, to test the bindings 

   3.  to install run `make install-swig-pl' from the top of the
       Subversion source tree.

*  Java

   The Java bindings are still under development, and have not yet
   reached a functional state.  You can attempt to build them by
   running 'make swig-java' from the top level of the Subversion
   source tree.


BUILDING SWIG BINDINGS FOR SVN ON WINDOWS


   1.  Install SWIG. Download the SWIG Windows zipfile (it's the same as the
       source tarball except that it also includes a copy of swig.exe) from

           http://www.swig.org/

       and extract it somewhere, like C:\Program Files.

   2.  Install whatever languages you want to build runtimes for. Windows
       versions of Python, Perl, and Java are available from:

           http://www.python.org/
           http://www.activestate.com/ActivePerl/
           http://java.sun.com/j2se/

   3.  Configure Visual C++ with paths to swig.exe and language specific
       libraries. In Visual C++ 6, go to Tools -> Options -> Directories.
       In Visual C++ .NET, go to Tools -> Options -> Projects 
       -> VC++ Directories.

       Add the following paths:

           Executable Directories:

               Path to swig.exe
               (for example, C:\Program Files\SWIG-1.3.19)

               For Perl, path to perl.exe
               (for example, C:\Program Files\Perl\bin)

           Library Directories:

               For Python, path to python##.lib
               (for example, C:\Program Files\Python22\libs)

               For Perl, path to perl##.lib
               (for example, C:\Program Files\Perl\lib\CORE)

               For Java, path to jvm.lib library
               (for example C:\Program Files\j2sdk1.4.2\lib)

           Include Directories:

               For Python, path to Python.h
               (for example, C:\Program Files\Python22\include)

               For Perl, path to perl.h
               (for example, C:\Program Files\Perl\lib\CORE)

               For Java, path to JNI headers,
               (for example, C:\Program Files\j2sdk1.4.2\include)

               Also for Java, path to JNI Windows headers,
               (for example, C:\Program Files\j2sdk1.4.2\include\win32)

   4.  If you haven't already built Subversion, you should do so now.
       Instructions are in the main INSTALL file. At the very least,
       you need to run gen-make.py to generate Visual Studio project
       files.

   5.  Build the bindings. Open the Subversion workspace in Visual C++
       (subversion_msvc.dsw or subversion_vcnet.sln) and build one or more
       of the following projects:

           __SWIG_PYTHON__
           __SWIG_PERL__
           __SWIG_JAVA__

   6. Install the bindings. The procedure varies depending on the language.

      For Python, create two folders:

          <PYTHON>\Lib\site-packages\svn
          <PYTHON>\Lib\site-packages\libsvn

      Copy subversion\bindings\swig\python\svn\*.py into the svn folder.
      Copy subversion\bindings\swig\python\*.py and
      Release\subversion\bindings\swig\python\*.dll into the libsvn folder.

      Optionally, you can run the following commands to compile the Python
      sources into bytecode:

          python <PYTHON>\lib\compileall.py <PYTHON>\Lib\site-packages\svn
          python <PYTHON>\lib\compileall.py <PYTHON>\Lib\site-packages\libsvn

      This can make the modules load faster for users without write access
      to the site-packages directory.

      For Perl, the bindings have be copied into a more complicated directory
      structure inside the perl library directory. Running the commands below
      from the subversion source directory will copy the files to the right
      places:

        set PERL_LIBS="C:\Program Files\Perl\site\lib"

        md %PERL_LIBS%\SVN %PERL_LIBS%\auto\SVN
        copy subversion\bindings\swig\perl\native\*.pm %PERL_LIBS%\SVN

        md %PERL_LIBS%\auto\SVN\_Client
        copy Release\subversion\bindings\swig\perl\_Client.dll %PERL_LIBS%\auto\SVN\_Client
        copy Release\subversion\bindings\swig\perl\_Client.pdb %PERL_LIBS%\auto\SVN\_Client

        md %PERL_LIBS%\auto\SVN\_Core
        copy Release\subversion\bindings\swig\perl\_Core.dll %PERL_LIBS%\auto\SVN\_Core
        copy Release\subversion\bindings\swig\perl\_Core.pdb %PERL_LIBS%\auto\SVN\_Core
        copy Release\subversion\bindings\swig\perl\swigpl.dll %PERL_LIBS%\auto\SVN\_Core
        copy Release\subversion\bindings\swig\perl\swigpl.pdb %PERL_LIBS%\auto\SVN\_Core
        copy Release\subversion\bindings\swig\perl\libsvn_swig_perl\libsvn_swig_perl-1.dll %PERL_LIBS%\auto\SVN\_Core
        copy Release\subversion\bindings\swig\perl\libsvn_swig_perl\libsvn_swig_perl-1.pdb %PERL_LIBS%\auto\SVN\_Core

        md %PERL_LIBS%\auto\SVN\_Delta
        copy Release\subversion\bindings\swig\perl\_Delta.dll %PERL_LIBS%\auto\SVN\_Delta
        copy Release\subversion\bindings\swig\perl\_Delta.pdb %PERL_LIBS%\auto\SVN\_Delta

        md %PERL_LIBS%\auto\SVN\_Fs
        copy Release\subversion\bindings\swig\perl\_Fs.dll %PERL_LIBS%\auto\SVN\_Fs
        copy Release\subversion\bindings\swig\perl\_Fs.pdb %PERL_LIBS%\auto\SVN\_Fs

        md %PERL_LIBS%\auto\SVN\_Ra
        copy Release\subversion\bindings\swig\perl\_Ra.dll %PERL_LIBS%\auto\SVN\_Ra
        copy Release\subversion\bindings\swig\perl\_Ra.pdb %PERL_LIBS%\auto\SVN\_Ra

        md %PERL_LIBS%\auto\SVN\_Repos
        copy Release\subversion\bindings\swig\perl\_Repos.dll %PERL_LIBS%\auto\SVN\_Repos
        copy Release\subversion\bindings\swig\perl\_Repos.pdb %PERL_LIBS%\auto\SVN\_Repos

        md %PERL_LIBS%\auto\SVN\_Wc
        copy Release\subversion\bindings\swig\perl\_Wc.dll %PERL_LIBS%\auto\SVN\_Wc
        copy Release\subversion\bindings\swig\perl\_Wc.pdb %PERL_LIBS%\auto\SVN\_Wc

      For Java, there really is no installation procedure because Java doesn't
      have a central location where libraries can go.
      
      To use the Subversion bindings in a Java application you just need the
      following files:

        subversion\bindings\swig\java\build\svn-api.jar
        Release\subversion\bindings\swig\java\_client.dll
        Release\subversion\bindings\swig\java\_core.dll
        Release\subversion\bindings\swig\java\_delta.dll
        Release\subversion\bindings\swig\java\_fs.dll
        Release\subversion\bindings\swig\java\_ra.dll
        Release\subversion\bindings\swig\java\_repos.dll
        Release\subversion\bindings\swig\java\_wc.dll

     Your app needs to load one or more of the DLL files by calling
     System.loadLibrary() or System.load() and have the JAR file in
     its classpath.

TESTING AND USING SWIG BINDINGS

*  Python

   1.  Verify that an 'svn' package has been installed correctly.  You can
       do this by running Python via 'python -c "from svn import client"'.

   2.  Try some demo programs.  From the top of your svn working copy,
       cd tools/examples/ and try running 'svnlook.py'.

   3.  Start writing your own scripts. Use the Subversion API definitions
       and descriptions in:

           subversion/include/svn_client.h
           subversion/include/svn_delta.h
           subversion/include/svn_fs.h
           subversion/include/svn_ra.h
           subversion/include/svn_repos.h
           subversion/include/svn_wc.h

*  Perl

   The perl bindings are using the standard module testing facilities
   to do regression tests. Simply run make check-swig-pl as described in the
   install section.

*  Java
