generated from ParadoxV5/template-ruby-gem
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract
rbconfig
patch to rbconfig-patch.rb
This way, the new values are available without a full `require 'mkmf'`. Note that `rbconfig.rb` would hide the original `rbconfig` from the `$LOAD_PATH` which the current solution depends on to “require super”.
- Loading branch information
Showing
4 changed files
with
38 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
# Set up `RUBYOPT=-I/absolute/path/to/lib/mingw-make/` for subprocesses | ||
ENV['RUBYOPT'] = "#{ENV['RUBYOPT']} -I#{File.join __dir__, 'mingw-make'}" | ||
# Set up `RUBYOPT=-I/absolute/path/to/lib/mingw-make/ -rrbconfig-patch` for subprocesses | ||
ENV['RUBYOPT'] = "#{ENV['RUBYOPT']} -I#{File.join __dir__, 'mingw-make'} -rrbconfig-patch" | ||
ENV['MAKE'] ||= 'make' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
# Normally, RubyGems `require`s `rbconfig` itself, so overloading `require 'rbconfig'` may be ineffective. | ||
# Howëver, if RubyGems are disabled (`--disable-gems`), nameing this file `rbconfig.rb` would conflict with the design, | ||
# which depends on the original {RbConfig} to bypass the modified `$LOAD_PATH` to fetch the original {MakeMakefile}. | ||
|
||
require 'rbconfig' | ||
|
||
# Use `ruby -run` fall-backs | ||
install = 'ruby -run -e install -- -p' | ||
fixed = { | ||
'RM' => 'ruby -run -e rm -- -f', | ||
'RMALL' => 'ruby -run -e rm -- -rf', | ||
'RMDIRS' => 'ruby -run -e rmdir -- -p', | ||
'MAKEDIRS' => 'ruby -run -e mkdir -- -p', | ||
'CP' => 'ruby -run -e cp --', | ||
'INSTALL' => install | ||
} | ||
install_args = { | ||
'INSTALL_PROG' => '-m 0755', | ||
'INSTALL_DATA' => '-m 0644' | ||
} | ||
RbConfig::MAKEFILE_CONFIG.merge! fixed, install_args.transform_values { "$(INSTALL) #{_1}" } | ||
RbConfig::CONFIG.merge! fixed, install_args.transform_values { "#{install} #{_1}" } |