1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2017-01-28 05:02:41 +00:00
parent b3dbeb6e90
commit cc33dd2b67
2 changed files with 21 additions and 14 deletions

View file

@ -14,25 +14,27 @@ opt = OptionParser.new do |o|
end end
srcdir ||= File.dirname(File.dirname(__FILE__)) srcdir ||= File.dirname(File.dirname(__FILE__))
exts = {} 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 end
%> %>
MINIRUBY = <%=miniruby%> MINIRUBY = <%=miniruby%>
SCRIPT_ARGS = <%=script_args%> SCRIPT_ARGS = <%=script_args%>
EXTMK_ARGS = $(SCRIPT_ARGS) --extstatic $(EXTSTATIC) \ EXTMK_ARGS = $(SCRIPT_ARGS) --gnumake=$(gnumake) --extflags="$(EXTLDFLAGS)" \
--gnumake=$(gnumake) --extflags="$(EXTLDFLAGS)" \
all: exts gems all: exts gems
exts: exts:
gems: gems:
% exts.each do |t, dirs| % exts.each do |t, (opt, dirs)|
% dirs.each do |dir| % dirs.each do |dir|
<%=t%>: <%=dir%>/exts.mk <%=t%>: <%=dir%>/exts.mk
<%=dir%>/exts.mk: FORCE <%=dir%>/exts.mk: FORCE
$(Q)$(MINIRUBY) $(srcdir)/ext/extmk.rb --make='$(MAKE)' \ $(Q)$(MINIRUBY) $(srcdir)/ext/extmk.rb --make='$(MAKE)' \
--command-output=$@ $(EXTMK_ARGS) \ --command-output=$@ $(EXTMK_ARGS) <%=opt%> \
-- subconfigure $(@D) -- subconfigure $(@D)
% end % end
% end % end

View file

@ -16,11 +16,13 @@ opt = OptionParser.new do |o|
o.on('--gnumake=BOOL') {|v| gnumake = v == 'yes'} o.on('--gnumake=BOOL') {|v| gnumake = v == 'yes'}
o.order!(ARGV) o.order!(ARGV)
end end
Dir.glob("ext/*/exts.mk") do |e| Dir.glob("{ext,gems}/*/exts.mk") do |e|
gem = /\Agems(?=\/)/ =~ e
s = File.read(e) s = File.read(e)
s.scan(/^(extensions|EXT[A-Z]+)[ \t]*=[ \t]*((?>(?>[^\\\n]|\\.)*\\\n)*(?>[^\\\n]|\\.)*)$/) do |n, v| s.scan(/^(extensions|EXT[A-Z]+)[ \t]*=[ \t]*((?>(?>[^\\\n]|\\.)*\\\n)*(?>[^\\\n]|\\.)*)$/) do |n, v|
v.gsub!(/\\\n[ \t]*/, ' ') v.gsub!(/\\\n[ \t]*/, ' ')
next if v.empty? next if v.empty?
next if gem and n != "extensions"
v = v.split v = v.split
m = macros[n] ||= [] m = macros[n] ||= []
case n case n
@ -30,12 +32,16 @@ Dir.glob("ext/*/exts.mk") do |e|
macros[n] = m | v macros[n] = m | v
end end
end end
if gem
r = ""
else
r = s[/^all static: (.+)$/, 1] r = s[/^all static: (.+)$/, 1]
deps << $& deps << $&
rubies |= r.split if r rubies |= r.split if r
r = "(?:#{Regexp.new(r)})|"
end
s.scan(%r"^(ext/\S+)/[^/\s:]+:[ \t]*\1/static$| s.scan(%r"^(ext/\S+)/[^/\s:]+:[ \t]*\1/static$|
^(?: ^(?:#{r}
(?:#{Regexp.new(r)})|
all|static|install(?:-(?:so|rb))?| all|static|install(?:-(?:so|rb))?|
(?:dist|real)?clean (?:dist|real)?clean
):.+$ ):.+$
@ -83,7 +89,6 @@ end
%> %>
extensions =<%= macros["extensions"].fold(column) %> extensions =<%= macros["extensions"].fold(column) %>
gems =
EXTOBJS =<%= macros["EXTOBJS"].fold(column) %> EXTOBJS =<%= macros["EXTOBJS"].fold(column) %>
EXTLIBS =<%= macros["EXTLIBS"].fold(column) %> EXTLIBS =<%= macros["EXTLIBS"].fold(column) %>
EXTSO =<%= macros["EXTSO"].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| % targets.product(macros["extensions"].map {|e|e.chomp("/.")}) do |t, e|
<%=e%>/<%=t%>: <%=e%>/<%=t%>:
$(Q)<%= submake %> $(MFLAGS) $(SUBMAKEOPTS) V=$(V) $(@F) $(Q)<%= submake %> $(MFLAGS) V=$(V) $(@F)
% end % end
extso: extso: