1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* template/prelude.c.tmpl: Don't expand RbConfig::Config[...].

It is not used now.

* common.mk: prelude.c and golf_prelude.c doesn't depend on rbconfig.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2014-11-25 15:22:01 +00:00
parent afe02a2f19
commit 7df1831bae
3 changed files with 12 additions and 21 deletions

View file

@ -1,3 +1,10 @@
Wed Nov 26 00:20:48 2014 Tanaka Akira <akr@fsij.org>
* template/prelude.c.tmpl: Don't expand RbConfig::Config[...].
It is not used now.
* common.mk: prelude.c and golf_prelude.c doesn't depend on rbconfig.
Tue Nov 25 17:07:06 2014 Koichi Sasada <ko1@atdot.net>
* NEWS: add an "Implementation changes" section.

View file

@ -774,7 +774,7 @@ $(MINIPRELUDE_C): $(COMPILE_PRELUDE) {$(srcdir)}prelude.rb
$(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb -I$(srcdir) -o $@ \
$(srcdir)/template/prelude.c.tmpl prelude.rb
$(PRELUDE_C): $(COMPILE_PRELUDE) $(RBCONFIG) \
$(PRELUDE_C): $(COMPILE_PRELUDE) \
{$(srcdir)}lib/rubygems/defaults.rb \
{$(srcdir)}lib/rubygems/core_ext/kernel_gem.rb \
$(PRELUDE_SCRIPTS) $(PREP) $(LIB_SRCS)
@ -782,7 +782,7 @@ $(PRELUDE_C): $(COMPILE_PRELUDE) $(RBCONFIG) \
$(Q) $(MINIRUBY) $(srcdir)/tool/generic_erb.rb -I$(srcdir) -c -o $@ \
$(srcdir)/template/prelude.c.tmpl $(PRELUDE_SCRIPTS)
{$(VPATH)}golf_prelude.c: $(COMPILE_PRELUDE) $(RBCONFIG) {$(srcdir)}golf_prelude.rb $(PREP)
{$(VPATH)}golf_prelude.c: $(COMPILE_PRELUDE) {$(srcdir)}golf_prelude.rb $(PREP)
$(ECHO) generating $@
$(Q) $(MINIRUBY) $(srcdir)/tool/generic_erb.rb -I$(srcdir) -c -o $@ \
$(srcdir)/template/prelude.c.tmpl golf_prelude.rb

View file

@ -28,9 +28,7 @@ class Prelude
def initialize(init_name, preludes, vpath)
@init_name = init_name
@mkconf = nil
@have_sublib = false
@need_ruby_prefix = false
@vpath = vpath
@preludes = {}
@mains = preludes.map {|filename| translate(filename)[0]}
@ -45,20 +43,6 @@ class Prelude
@vpath.foreach(filename) do |line|
@preludes[filename] ||= result
line.sub!(/(?:^|\s+)\#(?:$|\s.*)/, '')
line.gsub!(/RbConfig::CONFIG\["(\w+)"\]/) {
key = $1
unless @mkconf
require './rbconfig'
@mkconf = RbConfig::MAKEFILE_CONFIG.merge('prefix'=>'#{TMP_RUBY_PREFIX}')
end
if RbConfig::MAKEFILE_CONFIG.has_key? key
val = RbConfig.expand("$(#{key})", @mkconf)
@need_ruby_prefix ||= /\A\#\{TMP_RUBY_PREFIX\}/ =~ val
c_esc(val)
else
"nil"
end
}
line.sub!(/require\s*\(?\s*(["'])(.*?)\1\)?/) do
orig, path = $&, $2
path = translate(path, true) rescue nil
@ -98,7 +82,7 @@ static const char prelude_code<%=i%>[] =
#define PRELUDE_COUNT <%=@have_sublib ? preludes.size : 0%>
% if @have_sublib or @need_ruby_prefix
% if @have_sublib
struct prelude_env {
volatile VALUE prefix_path;
#if PRELUDE_COUNT > 0
@ -153,7 +137,7 @@ prelude_require(VALUE self, VALUE nth)
void
Init_<%=@init_name%>(void)
{
% if @have_sublib or @need_ruby_prefix
% if @have_sublib
struct prelude_env memo;
ID name = rb_intern("TMP_RUBY_PREFIX");
VALUE prelude = Data_Wrap_Struct(rb_cData, 0, 0, &memo);
@ -173,7 +157,7 @@ Init_<%=@init_name%>(void)
rb_usascii_str_new(prelude_name<%=i%>, sizeof(prelude_name<%=i%>) - 1),
INT2FIX(1));
% end
% if @have_sublib or @need_ruby_prefix
% if @have_sublib
rb_gc_force_recycle(prelude);
% end