[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Building swig bindings outside the source tree

From: Morten Ludvigsen <morten_at_2ps.dk>
Date: 2002-10-20 15:22:16 CEST

My first patch - second edition :-)

In the INSTALL doc there is a description for building in a different
directory. This works for the main program, but not for the swig bindings.

This patch should fix that.

This time it should work in both the source tree and in a different build
dir.

If installing from a build in a different tree using "make
install-swig-py-ext"
two new warnings are generated:

  running install
  running build
  running build_py
* warning: build_py: package init file 'svn/__init__.py' not found (or not a
regular file)
* warning: build_py: package init file 'svn/__init__.py' not found (or not a
regular file)
  running build_ext
  skipping '_client' extension (up-to-date)
  skipping '_delta' extension (up-to-date)
  ...

As far as I can tell this is ugly but benign :-) The file "svn/__init__.py"
has
already been copied in "make swig-py-ext".

Regards,

Morten Ludvigsen
2-People Software
Denmark

Log:

Fixed configuration so that SWIG python bindings can be built outside
the source tree.

* Makefile.in
  Created new variables for swig directories:
  SWIG_SRC_DIR - the swig source directory in the source tree.
  SWIG_BUILD_DIR - the directory where swig bindings are built.
  SWIG_DIRS - the swig direcotries in the build tree.

  (mkdir-init): Make the directories in SWIG_DIRS.

  (swig-py-ext): Use symbolic directory references using SWIG_SRC_DIR.
                 Also specify the source dir for swig.

  (install-swig-py-ext): Use symbolic directory references using
SWIG_SRC_DIR.
                         Also specify the source dir for swig.

* subversion/bindings/swig/python/setup.py
  Added command line argument (-S) to specify the source directory.

Patch:

Index: Makefile.in
===================================================================
--- Makefile.in
+++ Makefile.in Sun Oct 20 14:35:19 2002
@@ -9,6 +9,12 @@

 DOC_DIRS = doc/programmer/design doc/handbook
doc/handbook/translations/french

+SWIG_SRC_DIR = $(abs_srcdir)/subversion/bindings/swig
+SWIG_BUILD_DIR = $(abs_builddir)/subversion/bindings/swig
+SWIG_DIRS = subversion/bindings/swig \
+ subversion/bindings/swig/python \
+ subversion/bindings/swig/python/svn
+
 EXTERNAL_PROJECT_DIRS = @SVN_SUBDIRS@

 NEON_LIBS = @NEON_LIBS@
@@ -158,7 +164,7 @@
                 tests.log

 mkdir-init:
- @list='$(BUILD_DIRS) $(DOC_DIRS)'; for i in $$list doc; do \
+ @list='$(BUILD_DIRS) $(DOC_DIRS) $(SWIG_DIRS)'; for i in $$list doc; do \
             echo "mkdir $$i" ; \
             $(MKDIR) $$i ; \
         done
@@ -209,15 +215,19 @@
         done

 swig-py-ext:
- (cd subversion/bindings/swig/python; \
- $(PYTHON) setup.py \
- -I.. -I../../../include $(SVN_APR_INCLUDES) \
- -L$(prefix)/lib -L$(SVN_APR_PREFIX)/lib \
- build)
+ (cd $(SWIG_SRC_DIR)/python; \
+ $(PYTHON) setup.py \
+ -I$(SWIG_SRC_DIR) \
+ -I$(abs_srcdir)/subversion/include $(SVN_APR_INCLUDES) \
+ -S$(SWIG_SRC_DIR) \
+ -L$(prefix)/lib -L$(SVN_APR_PREFIX)/lib \
+ build --build-base=$(SWIG_BUILD_DIR)/python/build)

 install-swig-py-ext:
- (cd subversion/bindings/swig/python; \
- $(PYTHON) setup.py install --prefix $(prefix))
+ (cd $(SWIG_BUILD_DIR)/python; \
+ $(PYTHON) $(SWIG_SRC_DIR)/python/setup.py \
+ -S$(SWIG_SRC_DIR) \
+ install --prefix $(prefix))

 ### Build a tarball.
 dist:
Index: subversion/bindings/swig/python/setup.py
===================================================================
--- subversion/bindings/swig/python/setup.py
+++ subversion/bindings/swig/python/setup.py Sun Oct 20 12:36:16 2002
@@ -32,6 +32,8 @@
         "search DIR for includes (multiple instances allowed)"
   print " -L dir " + \
         "search DIR for libraries (multiple instances allowed)"
+ print " -S dir " + \
+ "the DIR for the source of the subversion swig bindings"
   print " -s path " + \
         "use the swig binary found at PATH"
   sys.exit(0)
@@ -52,13 +54,15 @@
 # all the options that we allow (which is FAR less than the set of
 # distutils options). If we find that people actually care, we can
 # revisit this.
-options, leftovers = getopt.getopt(sys.argv[1:], "I:L:s:",
+options, leftovers = getopt.getopt(sys.argv[1:], "I:L:S:s:",
                                    ["prefix=", "install-dir="])
 for option in options:
   if option[0] == '-I':
     include_dirs.append(option[1])
   if option[0] == '-L':
     library_dirs.append(option[1])
+ if option[0] == '-S':
+ source_dir = option[1]
   if option[0] == '-s':
     swig_location = option[1]

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Oct 20 15:23:03 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.