[前][次][番号順一覧][スレッド一覧]

ruby-changes:60648

From: Nobuyoshi <ko1@a...>
Date: Sat, 4 Apr 2020 11:19:24 +0900 (JST)
Subject: [ruby-changes:60648] 146330906f (master): Fixed the location of the shared library

https://git.ruby-lang.org/ruby.git/commit/?id=146330906f

From 146330906f0f1cada9179b2b57501e2b64aa5eed Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 29 Mar 2020 00:14:51 +0900
Subject: Fixed the location of the shared library

On platform where searchs shared libraries by `PATH` environment
variable (i.e., Windows), the shared library is installed in
`bindir`.  On other platforms, the library directory is directed
by `libdirname` indirectly.

diff --git a/spec/ruby/library/rbconfig/rbconfig_spec.rb b/spec/ruby/library/rbconfig/rbconfig_spec.rb
index 4d6824d..f88dc67 100644
--- a/spec/ruby/library/rbconfig/rbconfig_spec.rb
+++ b/spec/ruby/library/rbconfig/rbconfig_spec.rb
@@ -39,7 +39,9 @@ describe 'RbConfig::CONFIG' do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/rbconfig/rbconfig_spec.rb#L39
 
   guard -> {RbConfig::TOPDIR} do
     it "libdir/LIBRUBY_SO is the path to libruby and it exists if and only if ENABLE_SHARED" do
-      libdir = RbConfig::CONFIG[RbConfig::CONFIG['libdirname'] || 'libdir']
+      libdirname = RbConfig::CONFIG['LIBPATHENV'] == 'PATH' ? 'bindir' :
+                     RbConfig::CONFIG['libdirname']
+      libdir = RbConfig::CONFIG[libdirname]
       libruby_so = "#{libdir}/#{RbConfig::CONFIG['LIBRUBY_SO']}"
       case RbConfig::CONFIG['ENABLE_SHARED']
       when 'yes'
diff --git a/spec/ruby/optional/capi/spec_helper.rb b/spec/ruby/optional/capi/spec_helper.rb
index 74a6325..a7029a7 100644
--- a/spec/ruby/optional/capi/spec_helper.rb
+++ b/spec/ruby/optional/capi/spec_helper.rb
@@ -32,11 +32,9 @@ def compile_extension(name) https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/spec_helper.rb#L32
   ruby_header = "#{RbConfig::CONFIG['rubyhdrdir']}/ruby.h"
 
   if RbConfig::CONFIG["ENABLE_SHARED"] == "yes"
-    if PlatformGuard.windows?
-      libruby_so = "#{RbConfig::CONFIG['bindir']}/#{RbConfig::CONFIG['LIBRUBY_SO']}"
-    else
-      libruby_so = "#{RbConfig::CONFIG['libdir']}/#{RbConfig::CONFIG['LIBRUBY_SO']}"
-    end
+    libdirname = RbConfig::CONFIG['LIBPATHENV'] == 'PATH' ? 'bindir' :
+                   RbConfig::CONFIG['libdirname'] # defined since 2.1
+    libruby_so = "#{RbConfig::CONFIG[libdirname]}/#{RbConfig::CONFIG['LIBRUBY_SO']}"
   end
 
   begin
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]