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

ruby-changes:45374

From: nobu <ko1@a...>
Date: Sat, 28 Jan 2017 14:02:47 +0900 (JST)
Subject: [ruby-changes:45374] nobu:r57447 (trunk): extension gems in static-linked-exts

nobu	2017-01-28 14:02:41 +0900 (Sat, 28 Jan 2017)

  New Revision: 57447

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

  Log:
    extension gems in static-linked-exts
    
    * template/configure-ext.mk.tmpl: --no-extstatic option to gems.
    
    * template/exts.mk.tmpl: include extension gems.

  Modified files:
    trunk/template/configure-ext.mk.tmpl
    trunk/template/exts.mk.tmpl
Index: template/configure-ext.mk.tmpl
===================================================================
--- template/configure-ext.mk.tmpl	(revision 57446)
+++ template/configure-ext.mk.tmpl	(revision 57447)
@@ -14,25 +14,27 @@ opt = OptionParser.new do |o| https://github.com/ruby/ruby/blob/trunk/template/configure-ext.mk.tmpl#L14
 end
 srcdir ||= File.dirname(File.dirname(__FILE__))
 exts = {}
-[["exts", "ext"], ["gems", "gems"]].each do |t, dir|
-  exts[t] = Dir.glob("#{srcdir}/#{dir}/*/").map {|n| n[(srcdir.size+1)..-2]}
+[
+  ["exts", "ext", "--extstatic $(EXTSTATIC)"],
+  ["gems", "gems", "--no-extstatic"],
+].each do |t, dir, opt|
+  exts[t] = [opt, Dir.glob("#{srcdir}/#{dir}/*/").map {|n| n[(srcdir.size+1)..-2]}]
 end
 %>
 MINIRUBY = <%=miniruby%>
 SCRIPT_ARGS = <%=script_args%>
-EXTMK_ARGS = $(SCRIPT_ARGS) --extstatic $(EXTSTATIC) \
-	     --gnumake=$(gnumake) --extflags="$(EXTLDFLAGS)" \
+EXTMK_ARGS = $(SCRIPT_ARGS) --gnumake=$(gnumake) --extflags="$(EXTLDFLAGS)" \
 
 all: exts gems
 exts:
 gems:
 
-% exts.each do |t, dirs|
+% exts.each do |t, (opt, dirs)|
 %   dirs.each do |dir|
 <%=t%>: <%=dir%>/exts.mk
 <%=dir%>/exts.mk: FORCE
 	$(Q)$(MINIRUBY) $(srcdir)/ext/extmk.rb --make='$(MAKE)' \
-		--command-output=$@ $(EXTMK_ARGS) \
+		--command-output=$@ $(EXTMK_ARGS) <%=opt%> \
 		-- subconfigure $(@D)
 %   end
 % end
Index: template/exts.mk.tmpl
===================================================================
--- template/exts.mk.tmpl	(revision 57446)
+++ template/exts.mk.tmpl	(revision 57447)
@@ -16,11 +16,13 @@ opt = OptionParser.new do |o| https://github.com/ruby/ruby/blob/trunk/template/exts.mk.tmpl#L16
   o.on('--gnumake=BOOL') {|v| gnumake = v == 'yes'}
   o.order!(ARGV)
 end
-Dir.glob("ext/*/exts.mk") do |e|
+Dir.glob("{ext,gems}/*/exts.mk") do |e|
+  gem = /\Agems(?=\/)/ =~ e
   s = File.read(e)
   s.scan(/^(extensions|EXT[A-Z]+)[ \t]*=[ \t]*((?>(?>[^\\\n]|\\.)*\\\n)*(?>[^\\\n]|\\.)*)$/) do |n, v|
     v.gsub!(/\\\n[ \t]*/, ' ')
     next if v.empty?
+    next if gem and n != "extensions"
     v = v.split
     m = macros[n] ||= []
     case n
@@ -30,12 +32,16 @@ Dir.glob("ext/*/exts.mk") do |e| https://github.com/ruby/ruby/blob/trunk/template/exts.mk.tmpl#L32
       macros[n] = m | v
     end
   end
-  r = s[/^all static: (.+)$/, 1]
-  deps << $&
-  rubies |= r.split if r
+  if gem
+    r = ""
+  else
+    r = s[/^all static: (.+)$/, 1]
+    deps << $&
+    rubies |= r.split if r
+    r = "(?:#{Regexp.new(r)})|"
+  end
   s.scan(%r"^(ext/\S+)/[^/\s:]+:[ \t]*\1/static$|
-            ^(?:
-              (?:#{Regexp.new(r)})|
+            ^(?:#{r}
               all|static|install(?:-(?:so|rb))?|
               (?:dist|real)?clean
              ):.+$
@@ -83,7 +89,6 @@ end https://github.com/ruby/ruby/blob/trunk/template/exts.mk.tmpl#L89
 %>
 
 extensions =<%= macros["extensions"].fold(column) %>
-gems =
 EXTOBJS =<%= macros["EXTOBJS"].fold(column) %>
 EXTLIBS =<%= macros["EXTLIBS"].fold(column) %>
 EXTSO =<%= macros["EXTSO"].fold(column) %>
@@ -116,7 +121,7 @@ ext/extinit.<%=objext%>: https://github.com/ruby/ruby/blob/trunk/template/exts.mk.tmpl#L121
 
 % targets.product(macros["extensions"].map {|e|e.chomp("/.")}) do |t, e|
 <%=e%>/<%=t%>:
-	$(Q)<%= submake %> $(MFLAGS) $(SUBMAKEOPTS) V=$(V) $(@F)
+	$(Q)<%= submake %> $(MFLAGS) V=$(V) $(@F)
 % end
 
 extso:

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

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