[ruby-oci8-commit] [545] trunk/ruby-oci8: Use RUBY_VERSION instead of RbConfig::CONFIG[' ruby_version'] to know the ruby ABI version.

nobody at rubyforge.org nobody at rubyforge.org
Sun Dec 16 02:55:19 UTC 2012


Revision: 545
Author:   kubo
Date:     2012-12-16 02:55:19 +0000 (Sun, 16 Dec 2012)
Log Message:
-----------
Use RUBY_VERSION instead of RbConfig::CONFIG['ruby_version'] to know the ruby ABI version.
The latter may be changed by the configure option --with-ruby-version.
(github issue #24 reported by suhrawardi)

Modified Paths:
--------------
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/ext/oci8/extconf.rb
    trunk/ruby-oci8/lib/oci8.rb.in

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2012-12-03 10:42:33 UTC (rev 544)
+++ trunk/ruby-oci8/ChangeLog	2012-12-16 02:55:19 UTC (rev 545)
@@ -1,3 +1,9 @@
+2012-12-16  KUBO Takehiro  <kubo at jiubao.org>
+	* ext/oci8/extconf.rb, lib/oci8.rb.in: use RUBY_VERSION instead of
+	   RbConfig::CONFIG['ruby_version'] to know the ruby ABI version.
+	   The latter may be changed by the configure option --with-ruby-version.
+	   (github issue #24 reported by suhrawardi)
+
 2012-12-03  KUBO Takehiro  <kubo at jiubao.org>
 	* ext/oci8/oraconf.rb: add a script encoding magic comment for ruby 2.0.0 preview2.
 	    (github issue #25 reported by aboltart)

Modified: trunk/ruby-oci8/ext/oci8/extconf.rb
===================================================================
--- trunk/ruby-oci8/ext/oci8/extconf.rb	2012-12-03 10:42:33 UTC (rev 544)
+++ trunk/ruby-oci8/ext/oci8/extconf.rb	2012-12-16 02:55:19 UTC (rev 545)
@@ -135,11 +135,39 @@
 
 so_basename = 'oci8lib_'
 if ruby_engine == 'ruby'
-  # Config::CONFIG["ruby_version"] indicates the ruby API version.
-  #  1.8   - ruby 1.8.x
-  #  1.9.1 - ruby 1.9.1, 1.9.2
-  #  2.0.0 - ruby 2.0.0
-  so_basename += RbConfig::CONFIG["ruby_version"].gsub(/\W/, '')
+  # The extension library name includes the ruby ABI (application binary interface)
+  # version. It is for binary gems which contain more than one extension library
+  # and use correct one depending on the ABI version.
+  #
+  #  ruby version |  ABI version
+  # --------------+--------------
+  #    1.8.6      |   1.8
+  #    1.8.7      |   1.8
+  # --------------+--------------
+  #    1.9.0      |   1.9.0
+  #    1.9.1      |   1.9.1
+  #    1.9.2      |   1.9.1
+  #    1.9.3      |   1.9.1
+  # --------------+--------------
+  #    2.0.0      |   2.0.0
+  #    2.0.1      |   2.0.1  (See: [ruby-core:49578])
+  #     ...       |    ...
+  #
+  # Note: The ruby ABI version is same with RbConfig::CONFIG['ruby_version']
+  # if it wasn't explicitly changed by the configure option --with-ruby-version.
+  #
+  case RUBY_VERSION
+  when /^2\.0/
+    so_basename += RUBY_VERSION.gsub(/\W/, '')
+  when /^1\.9\.0/
+    raise 'unsupported ruby version: 1.9.0'
+  when /^1\.9/
+    so_basename += '191'
+  when /^1\.8/
+    so_basename += '18'
+  else
+    raise 'unsupported ruby version: ' + RUBY_VERSION
+  end
 else
   so_basename += ruby_engine
 end

Modified: trunk/ruby-oci8/lib/oci8.rb.in
===================================================================
--- trunk/ruby-oci8/lib/oci8.rb.in	2012-12-03 10:42:33 UTC (rev 544)
+++ trunk/ruby-oci8/lib/oci8.rb.in	2012-12-16 02:55:19 UTC (rev 545)
@@ -27,13 +27,32 @@
 
 so_basename = 'oci8lib_'
 if ruby_engine == 'ruby'
-  # The suffix number indicates the ruby API version.
-  #  1.8   - ruby 1.8.x
-  #  1.9.1 - ruby 1.9.1, 1.9.2
-  #  2.0.0 - ruby 2.0.0-dev at the present time.
+  # The extension library name includes the ruby ABI (application binary interface)
+  # version. It is for binary gems which contain more than one extension library
+  # and use correct one depending on the ABI version.
+  #
+  #  ruby version |  ABI version
+  # --------------+--------------
+  #    1.8.6      |   1.8
+  #    1.8.7      |   1.8
+  # --------------+--------------
+  #    1.9.0      |   1.9.0
+  #    1.9.1      |   1.9.1
+  #    1.9.2      |   1.9.1
+  #    1.9.3      |   1.9.1
+  # --------------+--------------
+  #    2.0.0      |   2.0.0
+  #    2.0.1      |   2.0.1  (See: [ruby-core:49578])
+  #     ...       |    ...
+  #
+  # Note: The ruby ABI version is same with RbConfig::CONFIG['ruby_version']
+  # if it wasn't explicitly changed by the configure option --with-ruby-version.
+  #
   case RUBY_VERSION
   when /^2\.0/
-    so_basename += '200'
+    so_basename += RUBY_VERSION.gsub(/\W/, '')
+  when /^1\.9\.0/
+    raise 'unsupported ruby version: 1.9.0'
   when /^1\.9/
     so_basename += '191'
   when /^1\.8/



More information about the ruby-oci8-commit mailing list