diff options
author | David RodrÃguez <[email protected]> | 2022-06-14 15:26:37 +0200 |
---|---|---|
committer | git <[email protected]> | 2022-06-17 17:05:20 +0900 |
commit | 8855b68f970b34be4b39006b404391d06163573a (patch) | |
tree | 005cbcd6d3df47eebc20fd4e6e9f50349c123762 /lib/rubygems/ext/builder.rb | |
parent | 1aaeff8e36777e4ea0ac0917e3ddc7da573c1c32 (diff) |
[rubygems/rubygems] Don't modify RbConfig at all when building extensions
Instead, pass sitearchdir and sitelibdir directly to `make`.
This also removes the need to create and use the siteconf file at all
when generating makefiles.
https://github.com/rubygems/rubygems/commit/dea41fa2dc
Diffstat (limited to 'lib/rubygems/ext/builder.rb')
-rw-r--r-- | lib/rubygems/ext/builder.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb index a5b3363c21..c98ff643fc 100644 --- a/lib/rubygems/ext/builder.rb +++ b/lib/rubygems/ext/builder.rb @@ -17,7 +17,7 @@ class Gem::Ext::Builder $1.downcase end - def self.make(dest_path, results, make_dir = Dir.pwd) + def self.make(dest_path, results, make_dir = Dir.pwd, sitedir = nil) unless File.exist? File.join(make_dir, 'Makefile') raise Gem::InstallError, 'Makefile not found' end @@ -33,11 +33,18 @@ class Gem::Ext::Builder # The installation of the bundled gems is failed when DESTDIR is empty in mswin platform. destdir = (/\bnmake/i !~ make_program_name || ENV['DESTDIR'] && ENV['DESTDIR'] != "") ? 'DESTDIR=%s' % ENV['DESTDIR'] : '' + env = [destdir] + + if sitedir + env << 'sitearchdir=%s' % sitedir + env << 'sitelibdir=%s' % sitedir + end + ['clean', '', 'install'].each do |target| # Pass DESTDIR via command line to override what's in MAKEFLAGS cmd = [ *make_program, - destdir, + *env, target, ].reject(&:empty?) begin |