MSWin: Use MESSAGE_BEGIN/MESSAGE_END instead of bare echo

To strip enclosing double quotes.
This commit is contained in:
Nobuyoshi Nakada 2023-03-02 19:18:13 +09:00
parent 14355dde83
commit 72811deaa8
No known key found for this signature in database
GPG Key ID: 7CD2805BFA3770C6
2 changed files with 14 additions and 5 deletions

View File

@ -764,6 +764,13 @@ begin
mf.macro "NOTE_MESG", %w[$(RUBY) $(top_srcdir)/tool/lib/colorize.rb skip]
mf.macro "NOTE_NAME", %w[$(RUBY) $(top_srcdir)/tool/lib/colorize.rb fail]
%w[RM RMDIRS RMDIR RMALL].each {|w| mf.macro w, [RbConfig::CONFIG[w]]}
if $nmake
message = ['@(for %I in (', ') do @echo.%~I)']
else
message = ['@for line in', '; do echo "$$line"; done']
end
mf.macro "MESSAGE_BEGIN", [message.first]
mf.macro "MESSAGE_END", [message.last]
mf.puts
targets = %w[all install static install-so install-rb clean distclean realclean]
targets.each do |tgt|
@ -826,15 +833,17 @@ begin
fails.each do |ext, (parent, err)|
abandon ||= mandatory_exts[ext]
mf.puts %Q<\t@$(NOTE_NAME) "#{ext}:">
mf.puts "\t$(MESSAGE_BEGIN) \\"
if parent
mf.puts %Q<\t@echo "\tCould not be configured. It will not be installed.">
mf.puts %Q<\t"\tCould not be configured. It will not be installed." \\>
err and err.scan(/.+/) do |ee|
mf.puts %Q<\t@echo "\t#{ee.gsub(/["`$^]/, '\\\\\\&')}">
mf.puts %Q<\t"\t#{ee.gsub(/["`$^]/, '\\\\\\&')}" \\>
end
mf.puts %Q<\t@echo "\tCheck #{ext_prefix}/#{ext}/mkmf.log for more details.">
mf.puts %Q<\t"\tCheck #{ext_prefix}/#{ext}/mkmf.log for more details." \\>
else
mf.puts %Q<\t@echo "\tSkipped because its parent was not configured.">
mf.puts %Q<\t"\tSkipped because its parent was not configured." \\>
end
mf.puts "\t$(MESSAGE_END)"
end
mf.puts "note:\n"
mf.puts %Q<\t@$(NOTE_MESG) "*** Fix the problems, then remove these directories and try again if you want.">

View File

@ -27,7 +27,7 @@ contpat = /(?>(?>[^\\\n]|\\.)*\\\n)*(?>[^\\\n]|\\.)*/
Dir.glob("{ext,.bundle/gems}/*/exts.mk") do |e|
gem = e.start_with?(".bundle/gems/")
s = File.read(e)
s.scan(/^(extensions|SUBMAKEOPTS|EXT[A-Z]+|MFLAGS|NOTE_[A-Z]+)[ \t]*=[ \t]*(#{contpat})$/o) do |n, v|
s.scan(/^(extensions|SUBMAKEOPTS|EXT[A-Z]+|MFLAGS|MESSAGE_(?:BEGIN|END)|NOTE_[A-Z]+)[ \t]*=[ \t]*(#{contpat})$/o) do |n, v|
v.gsub!(/\\\n[ \t]*/, ' ')
next if v.empty?
n = "old_extensions" if n == "extensions" and !confexts.include?(e)