summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Barrié <etienne.barrie@gmail.com>2026-02-12 12:06:32 +0100
committerJean Boussier <jean.boussier@gmail.com>2026-02-12 15:26:16 +0100
commit727b99f9c5dca7ee8d6529171d3e0754855f5fb7 (patch)
treedc7538c020d99c00cbe3f48ab4e855e4d389c71b
parentc251767fbeacc95963a1c68feed976e8d492d3fc (diff)
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.
-rwxr-xr-xenc/make_encmake.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/enc/make_encmake.rb b/enc/make_encmake.rb
index 4be5c42888..e5ed4eb4b5 100755
--- a/enc/make_encmake.rb
+++ b/enc/make_encmake.rb
@@ -1,7 +1,11 @@
#! ./miniruby
dir = File.expand_path("../..", __FILE__)
-$:.unshift(Dir.pwd, "#{dir}/tool/lib", "#{dir}/lib")
+# The source lib directory provides the standard library for miniruby.
+# Don't add it when running with baseruby to avoid loading both
+# baseruby's cgi/escape.so and source cgi/escape.rb via erb.
+$:.unshift("#{dir}/lib") unless defined?(CROSS_COMPILING)
+$:.unshift(Dir.pwd, "#{dir}/tool/lib")
if $".grep(/mkmf/).empty?
$" << "mkmf.rb"
load File.expand_path("lib/mkmf.rb", dir)