mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
exts.mk: refine notes [Feature #13302]
* ext/extmk.rb: split notes into header and footer, which are common, from bodies which are unique for each extensions. * template/exts.mk.tmpl: now each notes are not one line, should not unique. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5651313b85
commit
3ca61bb04e
2 changed files with 27 additions and 20 deletions
13
ext/extmk.rb
13
ext/extmk.rb
|
@ -679,6 +679,8 @@ begin
|
||||||
submakeopts << 'UPDATE_LIBRARIES="$(UPDATE_LIBRARIES)"'
|
submakeopts << 'UPDATE_LIBRARIES="$(UPDATE_LIBRARIES)"'
|
||||||
submakeopts << 'SHOWFLAGS='
|
submakeopts << 'SHOWFLAGS='
|
||||||
mf.macro "SUBMAKEOPTS", submakeopts
|
mf.macro "SUBMAKEOPTS", submakeopts
|
||||||
|
mf.macro "NOTE_MESG", %w[echo]
|
||||||
|
mf.macro "NOTE_NAME", %w[echo]
|
||||||
mf.puts
|
mf.puts
|
||||||
targets = %w[all install static install-so install-rb clean distclean realclean]
|
targets = %w[all install static install-so install-rb clean distclean realclean]
|
||||||
targets.each do |tgt|
|
targets.each do |tgt|
|
||||||
|
@ -720,10 +722,14 @@ begin
|
||||||
mf.puts "\n""note:\n"
|
mf.puts "\n""note:\n"
|
||||||
unless fails.empty?
|
unless fails.empty?
|
||||||
abandon = false
|
abandon = false
|
||||||
mf.puts %Q<\t@echo "*** Following extensions are not compiled:">
|
mf.puts "note: note-body\n"
|
||||||
|
mf.puts "note-body:: note-header\n"
|
||||||
|
mf.puts "note-header:\n"
|
||||||
|
mf.puts %Q<\t@$(NOTE_MESG) "*** Following extensions are not compiled:">
|
||||||
|
mf.puts "note-body:: note-header\n"
|
||||||
fails.each do |ext, (parent, err)|
|
fails.each do |ext, (parent, err)|
|
||||||
abandon ||= mandatory_exts[ext]
|
abandon ||= mandatory_exts[ext]
|
||||||
mf.puts %Q<\t@echo "#{ext}:">
|
mf.puts %Q<\t@$(NOTE_NAME) "#{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 and err.scan(/.+/) do |ee|
|
err and err.scan(/.+/) do |ee|
|
||||||
|
@ -734,7 +740,8 @@ begin
|
||||||
mf.puts %Q<\t@echo "\tSkipped because its parent was not configured.">
|
mf.puts %Q<\t@echo "\tSkipped because its parent was not configured.">
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
mf.puts %Q<\t@echo "*** Fix the problems, then remove these directories and try again if you want.">
|
mf.puts "note:\n"
|
||||||
|
mf.puts %Q<\t@$(NOTE_MESG) "*** Fix the problems, then remove these directories and try again if you want.">
|
||||||
if abandon
|
if abandon
|
||||||
mf.puts "\t""@exit 1"
|
mf.puts "\t""@exit 1"
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ ECHO = $(ECHO1:0=@echo)
|
||||||
require './rbconfig'
|
require './rbconfig'
|
||||||
macros = {}
|
macros = {}
|
||||||
deps = []
|
deps = []
|
||||||
note = []
|
notes = {}
|
||||||
rubies = []
|
rubies = []
|
||||||
exeext = RbConfig::CONFIG['EXEEXT']
|
exeext = RbConfig::CONFIG['EXEEXT']
|
||||||
gnumake = false
|
gnumake = false
|
||||||
|
@ -16,10 +16,11 @@ 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
|
||||||
|
contpat = /(?>(?>[^\\\n]|\\.)*\\\n)*(?>[^\\\n]|\\.)*/
|
||||||
Dir.glob("{ext,gems}/*/exts.mk") do |e|
|
Dir.glob("{ext,gems}/*/exts.mk") do |e|
|
||||||
gem = /\Agems(?=\/)/ =~ e
|
gem = /\Agems(?=\/)/ =~ e
|
||||||
s = File.read(e)
|
s = File.read(e)
|
||||||
s.scan(/^(extensions|EXT[A-Z]+|MFLAGS)[ \t]*=[ \t]*((?>(?>[^\\\n]|\\.)*\\\n)*(?>[^\\\n]|\\.)*)$/) do |n, v|
|
s.scan(/^(extensions|EXT[A-Z]+|MFLAGS|NOTE_[A-Z]+)[ \t]*=[ \t]*(#{contpat})$/o) 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"
|
next if gem and n != "extensions"
|
||||||
|
@ -48,12 +49,15 @@ Dir.glob("{ext,gems}/*/exts.mk") do |e|
|
||||||
"x) do
|
"x) do
|
||||||
deps << $&.sub(/ +note$/, '')
|
deps << $&.sub(/ +note$/, '')
|
||||||
end
|
end
|
||||||
s.scan(%r"^note:\n((?:\t.+\n)+)") do |(n)|
|
s.scan(%r"^(note(?:-\w+)?):(:)?[ \t]*(#{contpat})\n((?:\t.+\n)*)"o) do |(t, m, d, n)|
|
||||||
|
note = (notes[t] ||= [[m||""], []])
|
||||||
|
note[0] |= d.split(/(?:\\\n|[ \t])[ \t]*/)
|
||||||
n = n.split(/^/)
|
n = n.split(/^/)
|
||||||
e = (note.pop if /@exit/ =~ note[-1])
|
if m
|
||||||
note.pop if n[-1] == note[-1]
|
note[1].concat(n)
|
||||||
note |= n
|
else
|
||||||
note << e if e
|
note[1] |= n
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
deps.uniq!
|
deps.uniq!
|
||||||
|
@ -92,19 +96,13 @@ else
|
||||||
mflags = " $(MFLAGS)"
|
mflags = " $(MFLAGS)"
|
||||||
end
|
end
|
||||||
-%>
|
-%>
|
||||||
% unless macros["MFLAGS"].empty?
|
% macros.each_pair do |k, v|
|
||||||
MFLAGS =<%= macros["MFLAGS"].fold(column) %>
|
<%=k%> =<%= v.fold(column) %>
|
||||||
% end
|
% end
|
||||||
% RbConfig::MAKEFILE_CONFIG.keys.grep(/RM/) do |k|
|
% RbConfig::MAKEFILE_CONFIG.keys.grep(/RM/) do |k|
|
||||||
<%=k%> = <%=RbConfig::MAKEFILE_CONFIG[k]%>
|
<%=k%> = <%=RbConfig::MAKEFILE_CONFIG[k]%>
|
||||||
% end
|
% end
|
||||||
|
|
||||||
extensions =<%= macros["extensions"].fold(column) %>
|
|
||||||
EXTOBJS =<%= macros["EXTOBJS"].fold(column) %>
|
|
||||||
EXTLIBS =<%= macros["EXTLIBS"].fold(column) %>
|
|
||||||
EXTSO =<%= macros["EXTSO"].fold(column) %>
|
|
||||||
EXTLDFLAGS =<%= macros["EXTLDFLAGS"].fold(column) %>
|
|
||||||
EXTINITS =<%= macros["EXTINITS"].fold(column) %>
|
|
||||||
SUBMAKEOPTS = DLDOBJS="$(EXTOBJS) $(EXTENCS)" EXTOBJS= \
|
SUBMAKEOPTS = DLDOBJS="$(EXTOBJS) $(EXTENCS)" EXTOBJS= \
|
||||||
EXTSOLIBS="$(EXTLIBS)" LIBRUBY_SO_UPDATE=$(LIBRUBY_EXTS) \
|
EXTSOLIBS="$(EXTLIBS)" LIBRUBY_SO_UPDATE=$(LIBRUBY_EXTS) \
|
||||||
EXTLDFLAGS="$(EXTLDFLAGS)" EXTINITS="$(EXTINITS)" \
|
EXTLDFLAGS="$(EXTLDFLAGS)" EXTINITS="$(EXTINITS)" \
|
||||||
|
@ -146,5 +144,7 @@ ext/extinit.<%=objext%>:
|
||||||
extso:
|
extso:
|
||||||
@echo EXTSO=$(EXTSO)
|
@echo EXTSO=$(EXTSO)
|
||||||
|
|
||||||
note:
|
% notes.each_pair do |k, (d, n)|
|
||||||
<%= note.join("") %>
|
<%= k %>:<%= d.join(' ') %>
|
||||||
|
<%= n.join("") %>
|
||||||
|
% end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue