extmk.rb: fail for mandatory libraries

* ext/extmk.rb: fail if a mandatory extension library failed to
  configure.  [ruby-core:80759] [Feature #13302]

* template/exts.mk.tmpl: move `exit` at the end.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-04-20 08:13:16 +00:00
Родитель cafa438f80
Коммит b58a30e1c1
2 изменённых файлов: 17 добавлений и 5 удалений

Просмотреть файл

@ -473,6 +473,7 @@ default_exclude_exts =
else else
%w'*win32*' %w'*win32*'
end end
mandatory_exts = {}
withes, withouts = [["--with", nil], ["--without", default_exclude_exts]].collect {|w, d| withes, withouts = [["--with", nil], ["--without", default_exclude_exts]].collect {|w, d|
if !(w = %w[-extensions -ext].collect {|o|arg_config(w+o)}).any? if !(w = %w[-extensions -ext].collect {|o|arg_config(w+o)}).any?
d ? proc {|c1| d.any?(&c1)} : proc {true} d ? proc {|c1| d.any?(&c1)} : proc {true}
@ -480,13 +481,15 @@ withes, withouts = [["--with", nil], ["--without", default_exclude_exts]].collec
proc {true} proc {true}
else else
w = w.collect {|o| o.split(/,/)}.flatten w = w.collect {|o| o.split(/,/)}.flatten
w.collect! {|o| o == '+' ? d : o}.flatten! if d w.collect! {|o| o == '+' ? d : o}.flatten!
proc {|c1| w.any?(&c1)} proc {|c1| w.any?(&c1)}
end end
} }
cond = proc {|ext, *| cond = proc {|ext, *|
cond1 = proc {|n| File.fnmatch(n, ext)} withes.call(proc {|n|
withes.call(cond1) and !withouts.call(cond1) !n or (mandatory_exts[ext] = true if File.fnmatch(n, ext))
}) and
!withouts.call(proc {|n| File.fnmatch(n, ext)})
} }
($extension || %w[*]).each do |e| ($extension || %w[*]).each do |e|
e = e.sub(/\A(?:\.\/)+/, '') e = e.sub(/\A(?:\.\/)+/, '')
@ -716,12 +719,14 @@ begin
mf.puts "\n""note:\n" mf.puts "\n""note:\n"
unless fails.empty? unless fails.empty?
abandon = false
mf.puts %Q<\t@echo "*** Following extensions are not compiled:"> mf.puts %Q<\t@echo "*** Following extensions are not compiled:">
fails.each do |ext, (parent, err)| fails.each do |ext, (parent, err)|
abandon ||= mandatory_exts[ext]
mf.puts %Q<\t@echo "#{ext}:"> mf.puts %Q<\t@echo "#{ext}:">
if parent if parent
mf.puts %Q<\t@echo "\tCould not be configured. It will not be installed."> mf.puts %Q<\t@echo "\tCould not be configured. It will not be installed.">
err&.scan(/.+/) do |ee| err and err.scan(/.+/) do |ee|
mf.puts %Q<\t@echo "\t#{ee.gsub(/["`$^]/, '\\\\\\&')}"> mf.puts %Q<\t@echo "\t#{ee.gsub(/["`$^]/, '\\\\\\&')}">
end end
mf.puts %Q<\t@echo "\tCheck #{ext_prefix}/#{ext}/mkmf.log for more details."> mf.puts %Q<\t@echo "\tCheck #{ext_prefix}/#{ext}/mkmf.log for more details.">
@ -730,6 +735,9 @@ begin
end end
end end
mf.puts %Q<\t@echo "*** Fix the problems, then remove these directories and try again if you want."> mf.puts %Q<\t@echo "*** Fix the problems, then remove these directories and try again if you want.">
if abandon
mf.puts "\t""@exit 1"
end
end end
end end
end end

Просмотреть файл

@ -50,8 +50,10 @@ Dir.glob("{ext,gems}/*/exts.mk") do |e|
end end
s.scan(%r"^note:\n((?:\t.+\n)+)") do |(n)| s.scan(%r"^note:\n((?:\t.+\n)+)") do |(n)|
n = n.split(/^/) n = n.split(/^/)
e = (note.pop if /@exit/ =~ note[-1])
note.pop if n[-1] == note[-1] note.pop if n[-1] == note[-1]
note |= n note |= n
note << e if e
end end
end end
deps.uniq! deps.uniq!
@ -116,7 +118,9 @@ clean:
distclean: distclean:
-$(Q)$(RM) ext/extinit.c -$(Q)$(RM) ext/extinit.c
<%= deps.join("\n") %> % deps.each do |d|
<%= d %>
% end
% rubies.each do |ruby| % rubies.each do |ruby|
<%= ruby %>: <%= ruby %>: