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

ruby-changes:43980

From: nobu <ko1@a...>
Date: Thu, 1 Sep 2016 14:24:24 +0900 (JST)
Subject: [ruby-changes:43980] nobu:r56053 (trunk): extmk.rb: hacks for bundled gems

nobu	2016-09-01 14:24:19 +0900 (Thu, 01 Sep 2016)

  New Revision: 56053

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

  Log:
    extmk.rb: hacks for bundled gems
    
    * ext/extmk.rb (gems): move dirty hacks for bundled gems from
      mkmf.rb.
    * lib/mkmf.rb (create_makefile): yield all configuration strings.

  Modified files:
    trunk/ChangeLog
    trunk/ext/extmk.rb
    trunk/lib/mkmf.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 56052)
+++ ChangeLog	(revision 56053)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Sep  1 14:24:16 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/extmk.rb (gems): move dirty hacks for bundled gems from
+	  mkmf.rb.
+
+	* lib/mkmf.rb (create_makefile): yield all configuration strings.
+
 Wed Aug 31 17:39:19 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/extmk.rb (create_makefile): make gem.build_complete file
Index: lib/mkmf.rb
===================================================================
--- lib/mkmf.rb	(revision 56052)
+++ lib/mkmf.rb	(revision 56053)
@@ -2260,11 +2260,8 @@ RULES https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L2260
 
     dllib = target ? "$(TARGET).#{CONFIG['DLEXT']}" : ""
     staticlib = target ? "$(TARGET).#$LIBEXT" : ""
-    mfile = open("Makefile", "wb")
     conf = configuration(srcprefix)
-    conf = yield(conf) if block_given?
-    mfile.puts(conf)
-    mfile.print "
+    conf << "\
 libpath = #{($DEFLIBPATH|$LIBPATH).join(" ")}
 LIBPATH = #{libpath}
 DEFFILE = #{deffile}
@@ -2293,17 +2290,20 @@ STATIC_LIB = #{staticlib unless $static. https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L2290
 TIMESTAMP_DIR = #{$extout ? '$(extout)/.timestamp' : '.'}
 " #"
     # TODO: fixme
-    install_dirs.each {|d| mfile.print("%-14s= %s\n" % d) if /^[[:upper:]]/ =~ d[0]}
-    sodir = !$extout ? '' :
-            $sodir ? $sodir+target_prefix :
-            '$(RUBYARCHDIR)'
+    install_dirs.each {|d| conf << ("%-14s= %s\n" % d) if /^[[:upper:]]/ =~ d[0]}
+    sodir = $extout ? '$(TARGET_SO_DIR)' : '$(RUBYARCHDIR)'
     n = '$(TARGET_SO_DIR)$(TARGET)'
-    mfile.print "
-TARGET_SO_DIR =#{(sodir && !sodir.empty? ? " #{sodir}/" : '')}
+    conf << "\
+TARGET_SO_DIR =#{$extout ? " $(RUBYARCHDIR)/" : ''}
 TARGET_SO     = $(TARGET_SO_DIR)$(DLLIB)
 CLEANLIBS     = $(TARGET_SO) #{config_string('cleanlibs') {|t| t.gsub(/\$\*/) {n}}}
 CLEANOBJS     = *.#{$OBJEXT} #{config_string('cleanobjs') {|t| t.gsub(/\$\*/, "$(TARGET)#{deffile ? '-$(arch)': ''}")} if target} *.bak
+" #"
 
+    conf = yield(conf) if block_given?
+    mfile = open("Makefile", "wb")
+    mfile.puts(conf)
+    mfile.print "
 all:    #{$extout ? "install" : target ? "$(DLLIB)" : "Makefile"}
 static: #{$extmk && !$static ? "all" : "$(STATIC_LIB)#{!$extmk ? " install-rb" : ""}"}
 .PHONY: all install static install-so install-rb
@@ -2339,7 +2339,7 @@ static: #{$extmk && !$static ? "all" : " https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L2339
         mfile.print "\t-$(Q)$(RMDIRS) #{fseprepl[dir]}#{$ignore_error}\n"
       else
         mfile.print "#{f} #{stamp}\n"
-        mfile.print "\t$(INSTALL_PROG) #{fseprepl[f]} $(RUBYARCHDIR)\n"
+        mfile.print "\t$(INSTALL_PROG) #{fseprepl[f]} #{dir}\n"
         if defined?($installed_list)
           mfile.print "\t@echo #{dir}/#{File.basename(f)}>>$(INSTALLED_LIST)\n"
         end
Index: ext/extmk.rb
===================================================================
--- ext/extmk.rb	(revision 56052)
+++ ext/extmk.rb	(revision 56053)
@@ -569,10 +569,22 @@ FileUtils::makedirs('gems') https://github.com/ruby/ruby/blob/trunk/ext/extmk.rb#L569
 Dir.chdir('gems')
 extout = $extout
 unless gems.empty?
+  def self.timestamp_file(name, target_prefix = nil)
+    name = @sodir if name == '$(TARGET_SO_DIR)'
+    super
+  end
+
   def self.create_makefile(*args, &block)
-    if super(*args, &block)
-      open("Makefile", "a") do |mf|
-        mf << %{
+    super(*args) do |conf|
+      conf.find do |s|
+        s.sub!(/^(TARGET_SO_DIR *= *)\$\(RUBYARCHDIR\)/) {
+          $1 + @sodir
+        }
+      end
+      conf << %{
+
+# default target
+all:
 
 build_complete = $(TARGET_SO_DIR)gem.build_complete
 install-so: build_complete
@@ -581,14 +593,12 @@ $(build_complete): $(TARGET_SO) https://github.com/ruby/ruby/blob/trunk/ext/extmk.rb#L593
 	$(Q) $(TOUCH) $@
 
 }
-      end
-      true
     end
   end
 end
 gems.each do |d|
   $extout = extout.dup
-  $sodir = "$(extout)/gems/$(arch)/#{d[%r{\A[^/]+}]}"
+  @sodir = "$(extout)/gems/$(arch)/#{d[%r{\A[^/]+}]}"
   extmake(d, 'gems')
 end
 $extout = extout

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

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