summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-25 15:22:01 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-25 15:22:01 +0000
commit7df1831bae12e3ff1018dd80eb30aec4d7b0a243 (patch)
tree42508623f90130f82b773fad42c4b579128fd8b1
parentafe02a2f1970202c1b7bf7ea7f4a09e8e05134f4 (diff)
* 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
-rw-r--r--ChangeLog7
-rw-r--r--common.mk4
-rw-r--r--template/prelude.c.tmpl22
3 files changed, 12 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 56c46a6..9eb3f6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/common.mk b/common.mk
index 20f5c70..189423d 100644
--- a/common.mk
+++ b/common.mk
@@ -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
diff --git a/template/prelude.c.tmpl b/template/prelude.c.tmpl
index c2f41da..1f00bd6 100644
--- a/template/prelude.c.tmpl
+++ b/template/prelude.c.tmpl
@@ -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