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

ruby-changes:49376

From: nobu <ko1@a...>
Date: Wed, 27 Dec 2017 10:58:24 +0900 (JST)
Subject: [ruby-changes:49376] nobu:r61491 (trunk): spec_helper.rb: must find libruby.so

nobu	2017-12-27 10:58:18 +0900 (Wed, 27 Dec 2017)

  New Revision: 61491

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61491

  Log:
    spec_helper.rb: must find libruby.so
    
    * spec/ruby/optional/capi/spec_helper.rb (compile_extension): if
      libruby.so should have been built but is not found, fail early.
      get mtime of the library just once.

  Modified files:
    trunk/spec/ruby/optional/capi/spec_helper.rb
Index: spec/ruby/optional/capi/spec_helper.rb
===================================================================
--- spec/ruby/optional/capi/spec_helper.rb	(revision 61490)
+++ spec/ruby/optional/capi/spec_helper.rb	(revision 61491)
@@ -24,18 +24,21 @@ def compile_extension(name) https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/spec_helper.rb#L24
   lib = "#{object_path}/#{ext}.#{RbConfig::CONFIG['DLEXT']}"
   ruby_header = "#{RbConfig::CONFIG['rubyhdrdir']}/ruby.h"
   libruby_so = RbConfig::CONFIG['LIBRUBY_SO']
-  ruby_library = "#{RbConfig::CONFIG['libdir']}/#{libruby_so}"
-  unless libruby_so and File.exist?(ruby_library)
-    # Statically-compiled lib in the binary, ignore this check
-    ruby_library = nil
-  end
 
-  return lib if File.exist?(lib) and
-                File.mtime(lib) > File.mtime("#{extension_path}/rubyspec.h") and
-                File.mtime(lib) > File.mtime("#{extension_path}/#{ext}.c") and
-                File.mtime(lib) > File.mtime(ruby_header) and
-                (!ruby_library || File.mtime(lib) > File.mtime(ruby_library)) and
-                true            # sentinel
+  begin
+    mtime = File.mtime(lib)
+  rescue Errno::ENOENT
+    # not found, then compile
+  else
+    case # if lib is older than headers, source or libruby, then recompile
+    when mtime <= File.mtime("#{extension_path}/rubyspec.h")
+    when mtime <= File.mtime("#{extension_path}/#{ext}.c")
+    when mtime <= File.mtime(ruby_header)
+    when libruby_so && mtime <= File.mtime("#{RbConfig::CONFIG['libdir']}/#{libruby_so}")
+    else
+      return lib # up-to-date
+    end
+  end
 
   # Copy needed source files to tmpdir
   tmpdir = tmp("cext_#{name}")

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

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