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

ruby-changes:45650

From: nobu <ko1@a...>
Date: Mon, 27 Feb 2017 14:55:38 +0900 (JST)
Subject: [ruby-changes:45650] nobu:r57723 (trunk): mkmf.rb: clean generated files

nobu	2017-02-27 14:55:32 +0900 (Mon, 27 Feb 2017)

  New Revision: 57723

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

  Log:
    mkmf.rb: clean generated files
    
    * lib/mkmf.rb (try_link0): remove generated files other than the
      executable file.

  Modified files:
    trunk/lib/mkmf.rb
Index: lib/mkmf.rb
===================================================================
--- lib/mkmf.rb	(revision 57722)
+++ lib/mkmf.rb	(revision 57723)
@@ -526,6 +526,7 @@ MSG https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L526
   end
 
   def try_link0(src, opt="", *opts, &b) # :nodoc:
+    exe = CONFTEST+$EXEEXT
     cmd = link_command("", opt)
     if $universal
       require 'tmpdir'
@@ -539,7 +540,10 @@ MSG https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L540
       end
     else
       try_do(src, cmd, *opts, &b)
-    end and File.executable?(CONFTEST+$EXEEXT)
+    end and File.executable?(exe) or return nil
+    exe
+  ensure
+    MakeMakefile.rm_rf(*Dir["#{CONFTEST}*"]-[exe])
   end
 
   # Returns whether or not the +src+ can be compiled as a C source and linked
@@ -553,10 +557,9 @@ MSG https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L557
   # [+src+] a String which contains a C source
   # [+opt+] a String which contains linker options
   def try_link(src, opt="", *opts, &b)
-    try_link0(src, opt, *opts, &b)
-  ensure
-    MakeMakefile.rm_f "#{CONFTEST}*"
-    MakeMakefile.rm_rf "#{CONFTEST}.dSYM"
+    exe = try_link0(src, opt, *opts, &b) or return false
+    MakeMakefile.rm_f exe
+    true
   end
 
   # Returns whether or not the +src+ can be compiled as a C source.  +opt+ is
@@ -730,7 +733,7 @@ int main() {printf("%"PRI_CONFTEST_PREFI https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L733
           end
         end
       ensure
-        MakeMakefile.rm_f "#{CONFTEST}*"
+        MakeMakefile.rm_f "#{CONFTEST}#{$EXEEXT}"
       end
     end
     nil

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

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