You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Morten Ludvigsen <mo...@2ps.dk> on 2002/10/19 15:53:29 UTC

[PATCH] Building swig bindings outside the source tree

My first patch :-)

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.

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_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	Sat Oct 19 16:40:10 2002
@@ -9,6 +9,11 @@

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

+SWIG_SRC_DIR = $(top_srcdir)/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 +163,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 +214,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         \
+	(cd subversion/bindings/swig/python;                       \
+	 $(PYTHON) $(SWIG_SRC_DIR)/python/setup.py                 \
+	    -I$(SWIG_SRC_DIR)                                      \
+	    -I$(top_srcdir)/subversion/include $(SVN_APR_INCLUDES) \
+	    -S$(SWIG_SRC_DIR)                                      \
+	    -L$(prefix)/lib -L$(SVN_APR_PREFIX)/lib                \
             build)

 install-swig-py-ext:
 	(cd subversion/bindings/swig/python;                \
-	 $(PYTHON) setup.py install --prefix $(prefix))
+	 $(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	Sat Oct 19 14:58:53 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

SV: [PATCH] Building swig bindings outside the source tree

Posted by Morten Ludvigsen <mo...@2ps.dk>.
Of course I only tested it in a seperate build tree :-/

I'll send a new patch when it works in the source tree as well :-)

Regards,

Morten Ludvigsen
2-People Software
Denmark

> -----Oprindelig meddelelse-----
> Fra: cmpilato@collab.net [mailto:cmpilato@collab.net]
> Sendt: 19. oktober 2002 18:18
> Til: Morten Ludvigsen
> Cc: Subversion - Dev
> Emne: Re: [PATCH] Building swig bindings outside the source tree
> 
> 
> "Morten Ludvigsen" <mo...@2ps.dk> writes:
> 
> > My first patch :-)
> > 
> > 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.
> 
> I like the spirit of the patch, but I'm having trouble getting it
> work.  I build in my source tree, if that helps you any:
> % make swig-py-ext
> 
>  (cd subversion/bindings/swig/python;                       \
>   /usr/bin/python2 ./subversion/bindings/swig/python/setup.py     
>             \
>      -I./subversion/bindings/swig                                      \
>      -I./subversion/include -I/usr/local/apache2/include  \
>      -S./subversion/bindings/swig                                      \
>      -L/usr/local/lib -L/usr/local/apache2/lib                \
>              build)
>  /usr/bin/python2: can't open file 
> './subversion/bindings/swig/python/setup.py'
>  make: *** [swig-py-ext] Error 2
> 
> Here's part of your adjusted Makefile rule for reference:
> 
>   swig-py-ext:
> 	  (cd subversion/bindings/swig/python;                       \
> 	   $(PYTHON) $(SWIG_SRC_DIR)/python/setup.py                 \
>   [...]
> 
> $(SWIG_SRC_DIR) is not guaranteed to be an absolute path, so cd'int
> into the swig/python dir, and then running a script under
> $(SWIG_SRC_DIR) could be ... well, you can see in my error above what
> it's trying to do.
> 
> Awaiting your next patch,
> C-Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Building swig bindings outside the source tree

Posted by cm...@collab.net.
"Morten Ludvigsen" <mo...@2ps.dk> writes:

> My first patch :-)
> 
> 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.

I like the spirit of the patch, but I'm having trouble getting it
work.  I build in my source tree, if that helps you any:
% make swig-py-ext

 (cd subversion/bindings/swig/python;                       \
  /usr/bin/python2 ./subversion/bindings/swig/python/setup.py                 \
     -I./subversion/bindings/swig                                      \
     -I./subversion/include -I/usr/local/apache2/include  \
     -S./subversion/bindings/swig                                      \
     -L/usr/local/lib -L/usr/local/apache2/lib                \
             build)
 /usr/bin/python2: can't open file './subversion/bindings/swig/python/setup.py'
 make: *** [swig-py-ext] Error 2

Here's part of your adjusted Makefile rule for reference:

  swig-py-ext:
	  (cd subversion/bindings/swig/python;                       \
	   $(PYTHON) $(SWIG_SRC_DIR)/python/setup.py                 \
  [...]

$(SWIG_SRC_DIR) is not guaranteed to be an absolute path, so cd'int
into the swig/python dir, and then running a script under
$(SWIG_SRC_DIR) could be ... well, you can see in my error above what
it's trying to do.

Awaiting your next patch,
C-Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org