summaryrefslogtreecommitdiff
path: root/template
diff options
context:
space:
mode:
Diffstat (limited to 'template')
-rw-r--r--template/fake.rb.in10
1 files changed, 8 insertions, 2 deletions
diff --git a/template/fake.rb.in b/template/fake.rb.in
index c4bd21af53..b592fbd253 100644
--- a/template/fake.rb.in
+++ b/template/fake.rb.in
@@ -21,7 +21,7 @@ def src.value(name)
end
arg['versions'] = version = {}
File.read(File.join(arg['srcdir'], 'version.c')).
- scan(/rb_define_global_const\("(RUBY_\w+)",[^;]*?\bMK(?:INT|(STR))\(([^()]*)\)/m) do |n, s, v|
+ scan(/rb_define_(?:global_)?const\((mRuby, *)?"(?(1)|RUBY_)(\w+)",[^;]*?\bMK(?:INT|(STR))\(([^()]*)\)/m) do |_, n, s, v|
version[n] = arg[v] || src.value(v) || (s ? v : 0)
end
-%>
@@ -41,13 +41,19 @@ class Object
options = remove_const(:RUBY_DESCRIPTION)[/( \+[^\[\]\+]+)*(?= \[\S+\]\z)/]
constants.grep(/^RUBY_/) {|n| remove_const n}
% arg['versions'].each {|n, v|
- <%=n%> = <%if n=='RUBY_DESCRIPTION'
+ RUBY_<%=n%> = <%if n=='DESCRIPTION'
v1, v2 = v.split(/(?= \[\S+\]\z)/)
%><%=v1.dump.chomp('"')%>#{options}<%=
v2.dump[1..-1]%>.freeze<%
else%><%=v.inspect%><%end%>
% }
end
+module Ruby
+ constants.each {|n| remove_const n}
+% arg['versions'].each {|n, v|
+ <%=n%> = ::RUBY_<%=n%>
+% }
+end
builddir = File.dirname(File.expand_path(__FILE__))
libpathenv = libpathenv = "<%=arg['LIBPATHENV']%>"
preloadenv = preloadenv = "<%=arg['PRELOADENV']%>"