Re: [PATCH] Linking the Ruby bindings on windows
From: Joe Swatosh <joe.swatosh_at_gmail.com>
Date: 2006-12-30 16:59:14 CET
On 12/29/06, Joe Swatosh <joe.swatosh@gmail.com> wrote:
I liked this idea. so I went ahead and mimicked the way that the
--
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. Mimicked the way that Python was determining
the include and library paths.
]]]
Index: build/generator/gen_win.py
===================================================================
--- build/generator/gen_win.py (revision 22838)
+++ 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()
@@ -707,6 +710,8 @@
fakeincludes.append(self.swig_libdir)
if target.lang == "python":
fakeincludes.extend(self.python_includes)
+ if target.lang == "ruby":
+ fakeincludes.extend(self.ruby_includes)
fakeincludes.append(self.apath(self.zlib_path))
@@ -738,6 +743,8 @@
or isinstance(target, gen_base.TargetSWIGLib)):
if target.lang == "python" and self.python_libdir:
fakelibdirs.append(self.python_libdir)
+ if target.lang == "ruby" and self.ruby_libdir:
+ fakelibdirs.append(self.ruby_libdir)
return fakelibdirs
@@ -782,6 +789,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 +965,30 @@
finally:
fp.close()
+ def _find_ruby(self):
+ "Find the right Ruby library name to link swig bindings with"
+ self.ruby_includes = []
+ self.ruby_libdir = ""
+ proc = os.popen('ruby -rrbconfig -e ' + escape_shell_arg(
+ "puts Config::CONFIG['LIBRUBY'];"
+ "puts Config::CONFIG['archdir'];"
+ "puts Config::CONFIG['libdir'];"), 'r')
+ try:
+ libruby = proc.readline()[:-1]
+ if libruby:
+ msg = 'Found installed ruby.'
+ self.ruby_lib = libruby
+ self.ruby_includes.append(proc.readline()[:-1])
+ self.ruby_libdir = proc.readline()[:-1]
+ 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:
+ proc.close()
+
+
def _find_python(self):
"Find the appropriate options for creating SWIG-based Python modules"
self.python_includes = []
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Dec 30 16:59:24 2006
|
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.