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

[PATCH] Linking the Ruby bindings on windows

From: Joe Swatosh <joe.swatosh_at_gmail.com>
Date: 2006-12-29 02:44:37 CET

Greetings,

The latest commits from kou do indeed cause the libsvn_swig_ruby to
compile with VC6 and SWIG 1.3.24. Unfortunately, the change committed
to build.conf doesn't appear to be sufficent to allow the bindings to
link. Below find a patch to build/generator/gen_win.py written by a
non-Python programmer that will cause the .dsp files for the Ruby
bindings to include linking with Ruby. (I just copied the way that it
was done for Perl and fiddled until the .dsp's looked right).

-Joe Swatosh

[[[

Generate project files for VC6 that will link the Ruby bindings with
the Ruby library.

* build/generator/gen_win.py
  Mimicked the way that Perl was determining what lib to link with when
  building the bindings.

]]]

Index: build/generator/gen_win.py
===================================================================
--- build/generator/gen_win.py (revision 22825)
+++ build/generator/gen_win.py (working copy)
@@ -145,6 +145,9 @@
     # Find the right Perl library name to link SWIG bindings with
     self._find_perl()

+ # Find the right Ruby library name to link SWIG bindings with
+ self._find_ruby()
+
     # Find the right Python include and libraries dirs for SWIG bindings
     self._find_python()

@@ -782,6 +785,11 @@
         and target.lang == 'perl'):
       nondeplibs.append(self.perl_lib)

+ if ((isinstance(target, gen_base.TargetSWIG)
+ or isinstance(target, gen_base.TargetSWIGLib))
+ and target.lang == 'ruby'):
+ nondeplibs.append(self.ruby_lib)
+
     for dep in self.get_win_depends(target, FILTER_LIBS):
       nondeplibs.extend(dep.msvc_libs)

@@ -953,6 +961,24 @@
     finally:
       fp.close()

+ def _find_ruby(self):
+ "Find the right Ruby library name to link swig bindings with"
+ fp = os.popen('ruby -e ' + escape_shell_arg(
+ 'print Config.expand(Config::CONFIG[\'LIBRUBY\'])'), 'r')
+ try:
+ libruby = fp.readline()
+ if libruby:
+ msg = 'Found installed ruby.'
+ self.ruby_lib = libruby
+ else:
+ msg = 'Could not detect Ruby version.'
+ self.ruby_lib = 'msvcrt-ruby18.lib'
+ sys.stderr.write('%s\n Ruby bindings will be linked with %s\n'
+ % (msg, self.ruby_lib))
+ finally:
+ fp.close()
+
+
   def _find_python(self):
     "Find the appropriate options for creating SWIG-based Python modules"
     self.python_includes = []

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Dec 29 02:46:48 2006

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

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