зеркало из https://github.com/github/ruby.git
* enc/Makefile.in (.SUFFIXES): renamed to .trans.
* enc/make_encmake.rb: added --encs and --no-encs options. * enc/depend (TRANSVPATH): fix for nmake. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
ae04e36638
Коммит
13f1418d54
|
@ -1,3 +1,11 @@
|
||||||
|
Tue Aug 12 14:25:09 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* enc/Makefile.in (.SUFFIXES): renamed to .trans.
|
||||||
|
|
||||||
|
* enc/make_encmake.rb: added --encs and --no-encs options.
|
||||||
|
|
||||||
|
* enc/depend (TRANSVPATH): fix for nmake.
|
||||||
|
|
||||||
Tue Aug 12 14:19:53 2008 Minero Aoki <aamine@loveruby.net>
|
Tue Aug 12 14:19:53 2008 Minero Aoki <aamine@loveruby.net>
|
||||||
|
|
||||||
* lib/net/https.rb: supress syntax warning.
|
* lib/net/https.rb: supress syntax warning.
|
||||||
|
|
|
@ -381,7 +381,7 @@ encs: enc.mk $(LIBRUBY) $(PREP) transdb.h
|
||||||
|
|
||||||
enc.mk: $(srcdir)/enc/make_encmake.rb $(srcdir)/enc/Makefile.in $(srcdir)/enc/depend \
|
enc.mk: $(srcdir)/enc/make_encmake.rb $(srcdir)/enc/Makefile.in $(srcdir)/enc/depend \
|
||||||
$(srcdir)/lib/mkmf.rb $(RBCONFIG)
|
$(srcdir)/lib/mkmf.rb $(RBCONFIG)
|
||||||
$(MINIRUBY) $(srcdir)/enc/make_encmake.rb --builtin-encs="$(BUILTIN_ENCOBJS)" $@
|
$(MINIRUBY) $(srcdir)/enc/make_encmake.rb --builtin-encs="$(BUILTIN_ENCOBJS)" $@ $(ENCS)
|
||||||
|
|
||||||
.PRECIOUS: $(MKFILES)
|
.PRECIOUS: $(MKFILES)
|
||||||
|
|
||||||
|
|
|
@ -42,13 +42,14 @@ ldflags = $(LDFLAGS)
|
||||||
dldflags = @DLDFLAGS@
|
dldflags = @DLDFLAGS@
|
||||||
archflag = @ARCH_FLAG@
|
archflag = @ARCH_FLAG@
|
||||||
DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
|
DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
|
||||||
|
RUBY = $(MINIRUBY)
|
||||||
|
|
||||||
WORKDIRS = $(ENCSODIR) $(TRANSSODIR) enc enc/trans
|
WORKDIRS = $(ENCSODIR) $(TRANSSODIR) enc enc/trans
|
||||||
|
|
||||||
RM = @RM@
|
RM = @RM@
|
||||||
MAKEDIRS = @MAKEDIRS@
|
MAKEDIRS = @MAKEDIRS@
|
||||||
|
|
||||||
.SUFFIXES: .erb.c
|
.SUFFIXES: .trans
|
||||||
|
|
||||||
all: make-workdir
|
all: make-workdir
|
||||||
|
|
||||||
|
|
25
enc/depend
25
enc/depend
|
@ -1,6 +1,8 @@
|
||||||
% deffile = (true if /\$\(DEFFILE\)/ =~ CONFIG["LINK_SO"])
|
% deffile = (true if /\$\(DEFFILE\)/ =~ CONFIG["LINK_SO"])
|
||||||
% encs = Dir.open($srcdir) {|d| d.grep(/.+\.c\z/)} - BUILTIN_ENCS
|
% encs = Dir.open($srcdir) {|d| d.grep(/.+\.c\z/)} - BUILTIN_ENCS
|
||||||
% encs.each {|e| e.chomp!(".c")}
|
% encs.each {|e| e.chomp!(".c")}
|
||||||
|
% encs.reject! {|e| !ENC_PATTERNS.any? {|p| File.fnmatch?(p, e)}} if !ENC_PATTERNS.empty?
|
||||||
|
% encs.reject! {|e| NOENC_PATTERNS.any? {|p| File.fnmatch?(p, e)}}
|
||||||
% alphanumeric_order = proc {|e| e.scan(/(\d+)|(\D+)/).map {|n,a| a||[n.size,n.to_i]}.flatten}
|
% alphanumeric_order = proc {|e| e.scan(/(\d+)|(\D+)/).map {|n,a| a||[n.size,n.to_i]}.flatten}
|
||||||
% encs = encs.sort_by(&alphanumeric_order)
|
% encs = encs.sort_by(&alphanumeric_order)
|
||||||
% encs.unshift(encs.delete("encdb"))
|
% encs.unshift(encs.delete("encdb"))
|
||||||
|
@ -19,11 +21,14 @@
|
||||||
% atrans = atrans.sort_by(&alphanumeric_order)
|
% atrans = atrans.sort_by(&alphanumeric_order)
|
||||||
% trans = trans.sort_by(&alphanumeric_order)
|
% trans = trans.sort_by(&alphanumeric_order)
|
||||||
% trans.unshift(trans.delete("transdb"))
|
% trans.unshift(trans.delete("transdb"))
|
||||||
|
% trans |= atrans
|
||||||
% trans.map! {|e| "trans/#{e}"}
|
% trans.map! {|e| "trans/#{e}"}
|
||||||
% dependencies = encs + trans
|
% dependencies = encs + trans
|
||||||
% cleanlibs = Shellwords.shellwords(CONFIG["cleanlibs"] || "")
|
% cleanlibs = Shellwords.shellwords(CONFIG["cleanlibs"] || "")
|
||||||
% cleanobjs = Shellwords.shellwords(CONFIG["cleanobjs"] || "")
|
% cleanobjs = Shellwords.shellwords(CONFIG["cleanobjs"] || "")
|
||||||
% rule_subst = CONFIG["RULE_SUBST"] || "%s"
|
% rule_subst = CONFIG["RULE_SUBST"] || "%s"
|
||||||
|
% transvpath = rule_subst.dup.sub!(/\{[^{}]+\}/, '$(TRANSVPATH)/') || "enc/trans/%s"
|
||||||
|
% transvpath_prefix = rule_subst.dup.sub!(/\{[^{}]+\}/, '{$(TRANSVPATH)}') || ""
|
||||||
% if File::ALT_SEPARATOR
|
% if File::ALT_SEPARATOR
|
||||||
% pathrep = proc {|path| path.gsub('/', File::ALT_SEPARATOR).gsub(/\$\(([@<?*]\w?|\w+)\)/, "$(\\1:/=\\#{File::ALT_SEPARATOR})")}
|
% pathrep = proc {|path| path.gsub('/', File::ALT_SEPARATOR).gsub(/\$\(([@<?*]\w?|\w+)\)/, "$(\\1:/=\\#{File::ALT_SEPARATOR})")}
|
||||||
% else
|
% else
|
||||||
|
@ -42,7 +47,9 @@ ENCCLEANOBJS = <%=cleanobjs.map {|clean|
|
||||||
clean.gsub(/\$\*(\.\w+)?/) {"$(ENCOBJS#{$1 ? ":.#{CONFIG["OBJEXT"]}=#{$1}" : ""})"}
|
clean.gsub(/\$\*(\.\w+)?/) {"$(ENCOBJS#{$1 ? ":.#{CONFIG["OBJEXT"]}=#{$1}" : ""})"}
|
||||||
}.join(" ")%>
|
}.join(" ")%>
|
||||||
|
|
||||||
TRANSCSRCS = <%=atrans.map {|e| rule_subst % "enc/trans/#{e}.c"}.join(" \\\n\t ")%><%="\n" if trans.size>1%>
|
TRANSVPATH = $(srcdir)/enc/trans
|
||||||
|
|
||||||
|
TRANSCSRCS = <%=atrans.map {|e| transvpath % "#{e}.c"}.join(" \\\n\t ")%><%="\n" if trans.size>1%>
|
||||||
TRANSOBJS = <%=trans.map {|e|"enc/#{e}.$(OBJEXT)"}.join(" \\\n\t ")%><%="\n" if trans.size>1%>
|
TRANSOBJS = <%=trans.map {|e|"enc/#{e}.$(OBJEXT)"}.join(" \\\n\t ")%><%="\n" if trans.size>1%>
|
||||||
TRANSSOS = <%=trans.map {|e|"$(ENCSODIR)/#{e}.$(DLEXT)"}.join(" \\\n\t ")%><%="\n" if trans.size>1%>
|
TRANSSOS = <%=trans.map {|e|"$(ENCSODIR)/#{e}.$(DLEXT)"}.join(" \\\n\t ")%><%="\n" if trans.size>1%>
|
||||||
TRANSCLEANLIBS = <%=cleanlibs.map {|clean|
|
TRANSCLEANLIBS = <%=cleanlibs.map {|clean|
|
||||||
|
@ -61,10 +68,14 @@ srcs: $(TRANSCSRCS)
|
||||||
% end
|
% end
|
||||||
% compile_rules.each do |rule|
|
% compile_rules.each do |rule|
|
||||||
<%= rule % %w[c $(OBJEXT)] %>
|
<%= rule % %w[c $(OBJEXT)] %>
|
||||||
@$(MAKEDIRS) "$(@D)"
|
-@$(MAKEDIRS) "$(@D)"
|
||||||
<%=COMPILE_C%>
|
<%=COMPILE_C%>
|
||||||
|
|
||||||
% end
|
% end
|
||||||
|
|
||||||
|
<%=transvpath_prefix%>.trans<%=transvpath_prefix%>.c:
|
||||||
|
$(MINIRUBY) "$(srcdir)/tool/transcode-tblgen.rb" -vo "$@" "$<"
|
||||||
|
|
||||||
% unless encs.empty? or trans.empty?
|
% unless encs.empty? or trans.empty?
|
||||||
|
|
||||||
% unless encs.empty?
|
% unless encs.empty?
|
||||||
|
@ -75,10 +86,10 @@ $(TRANSOBJS): ruby.h intern.h config.h defines.h missing.h encoding.h oniguruma.
|
||||||
% end
|
% end
|
||||||
% atrans.each do |e|
|
% atrans.each do |e|
|
||||||
% src = "#{e}.trans"
|
% src = "#{e}.trans"
|
||||||
% src = [src, *IO.read(File.join($srcdir, "trans", src)).scan(/^\s*require\s+[\'\"]([^\'\"]*)/).flatten.map{|c|c+".rb"}]
|
|
||||||
|
|
||||||
<%=rule_subst % "enc/trans/#{e}.c"%>: <%= src.map {|e| rule_subst % "enc/trans/#{e}"}.join(" ")%> $(srcdir)/tool/transcode-tblgen.rb
|
<%=transvpath % "#{e}.c"%>: <%= transvpath % "#{e}.trans"%>
|
||||||
$(MINIRUBY) "$(srcdir)/tool/transcode-tblgen.rb" -vo "$@" <%= src.map {|e| %'"$(srcdir)/enc/trans/#{e}"'}.join(" ")%>
|
% src = [*IO.read(File.join($srcdir, "trans", src)).scan(/^\s*require\s+[\'\"]([^\'\"]*)/).flatten.map{|c|c+".rb"}]
|
||||||
|
<%=transvpath % "#{e}.c"%>: <%= src.map {|e| transvpath % "#{e}"}.join(" ")%> $(srcdir)/tool/transcode-tblgen.rb
|
||||||
% end
|
% end
|
||||||
|
|
||||||
% end
|
% end
|
||||||
|
@ -89,8 +100,8 @@ $(TRANSOBJS): ruby.h intern.h config.h defines.h missing.h encoding.h oniguruma.
|
||||||
% df = ("enc/#{e}.def" if deffile)
|
% df = ("enc/#{e}.def" if deffile)
|
||||||
$(ENCSODIR)/<%=e%>.$(DLEXT): <%=obj%>
|
$(ENCSODIR)/<%=e%>.$(DLEXT): <%=obj%>
|
||||||
% if df
|
% if df
|
||||||
echo EXPORTS > <%=df%>
|
echo> <%=df%> EXPORTS
|
||||||
echo <%=EXPORT_PREFIX%>Init_<%=File.basename(e)%> >> <%=df%>
|
echo>> <%=df%> <%=EXPORT_PREFIX%>Init_<%=File.basename(e)%>
|
||||||
% end
|
% end
|
||||||
@$(MAKEDIRS) "$(@D)"
|
@$(MAKEDIRS) "$(@D)"
|
||||||
<%=link_so.sub(/\$\(OBJS\)/) {obj}.sub(/\$\(DEFFILE\)/) {df}.gsub(/-(?:implib|pdb):/) {|s|"#{s}enc/#{e.sub(/[^\/]+\z/, '')}"}%>
|
<%=link_so.sub(/\$\(OBJS\)/) {obj}.sub(/\$\(DEFFILE\)/) {df}.gsub(/-(?:implib|pdb):/) {|s|"#{s}enc/#{e.sub(/[^\/]+\z/, '')}"}%>
|
||||||
|
|
|
@ -3,15 +3,32 @@
|
||||||
dir = File.expand_path("../..", __FILE__)
|
dir = File.expand_path("../..", __FILE__)
|
||||||
$:.unshift(dir)
|
$:.unshift(dir)
|
||||||
$:.unshift(".")
|
$:.unshift(".")
|
||||||
|
if $".grep(/mkmf/).empty?
|
||||||
$" << "mkmf.rb"
|
$" << "mkmf.rb"
|
||||||
load File.expand_path("lib/mkmf.rb", dir)
|
load File.expand_path("lib/mkmf.rb", dir)
|
||||||
|
end
|
||||||
require 'erb'
|
require 'erb'
|
||||||
|
|
||||||
if /--builtin-encs=/ =~ ARGV[0]
|
CONFIG["MAKEDIRS"] ||= '@$(MINIRUBY) -run -e mkdir -- -p'
|
||||||
BUILTIN_ENCS = $'.split.map {|e| File.basename(e, '.*') << '.c'}
|
|
||||||
|
BUILTIN_ENCS = []
|
||||||
|
ENC_PATTERNS = []
|
||||||
|
NOENC_PATTERNS = []
|
||||||
|
|
||||||
|
until ARGV.empty?
|
||||||
|
case ARGV[0]
|
||||||
|
when /\A--builtin-encs=/
|
||||||
|
BUILTIN_ENCS.concat $'.split.map {|e| File.basename(e, '.*') << '.c'}
|
||||||
|
ARGV.shift
|
||||||
|
when /\A--encs=/
|
||||||
|
ENC_PATTERNS.concat $'.split
|
||||||
|
ARGV.shift
|
||||||
|
when /\A--no-encs=/
|
||||||
|
NOENC_PATTERNS.concat $'.split
|
||||||
ARGV.shift
|
ARGV.shift
|
||||||
else
|
else
|
||||||
BUILTIN_ENCS = []
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if File.exist?(depend = File.join($srcdir, "depend"))
|
if File.exist?(depend = File.join($srcdir, "depend"))
|
||||||
|
|
Загрузка…
Ссылка в новой задаче