From cc33dd2b675f4ce8e9dd96498d4da9b1725cd2b7 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 28 Jan 2017 05:02:41 +0000 Subject: [PATCH] extension gems in static-linked-exts * template/configure-ext.mk.tmpl: --no-extstatic option to gems. * template/exts.mk.tmpl: include extension gems. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- template/configure-ext.mk.tmpl | 14 ++++++++------ template/exts.mk.tmpl | 21 +++++++++++++-------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/template/configure-ext.mk.tmpl b/template/configure-ext.mk.tmpl index 0d079a4fde..069b58a571 100644 --- a/template/configure-ext.mk.tmpl +++ b/template/configure-ext.mk.tmpl @@ -14,25 +14,27 @@ opt = OptionParser.new do |o| 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 diff --git a/template/exts.mk.tmpl b/template/exts.mk.tmpl index 222cf2f001..6215e5da0e 100644 --- a/template/exts.mk.tmpl +++ b/template/exts.mk.tmpl @@ -16,11 +16,13 @@ opt = OptionParser.new do |o| 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| 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 %> 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%>: % 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: