Skip to content

Commit e2230af

Browse files
committed
Avoid loading source cgi/escape.rb with baseruby in enc/make_encmake.rb
Only add the source lib directory to $LOAD_PATH when running with miniruby, which needs it for the standard library (erb, fileutils, etc.). When running with baseruby (detected via CROSS_COMPILING defined by fake.rb), its own stdlib is already available and adding the source lib causes warnings with -w due to loading both baseruby's cgi/escape.so and the source cgi/escape.rb via erb.
1 parent c46fe31 commit e2230af

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

enc/make_encmake.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
#! ./miniruby
22

33
dir = File.expand_path("../..", __FILE__)
4-
$:.unshift(Dir.pwd, "#{dir}/tool/lib", "#{dir}/lib")
4+
# The source lib directory provides the standard library for miniruby.
5+
# Don't add it when running with baseruby to avoid loading both
6+
# baseruby's cgi/escape.so and source cgi/escape.rb via erb.
7+
$:.unshift("#{dir}/lib") unless defined?(CROSS_COMPILING)
8+
$:.unshift(Dir.pwd, "#{dir}/tool/lib")
59
if $".grep(/mkmf/).empty?
610
$" << "mkmf.rb"
711
load File.expand_path("lib/mkmf.rb", dir)

0 commit comments

Comments
 (0)