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
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

View file

@ -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
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: