Skip to content

Commit

Permalink
GNU Make needs DESTDIR on Windows environment like msys or mingw
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Nov 5, 2021
1 parent 03b11fc commit 7fd987d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/rubygems/ext/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ def self.make(dest_path, results, make_dir = Dir.pwd)

# try to find make program from Ruby configure arguments first
RbConfig::CONFIG['configure_args'] =~ /with-make-prog\=(\w+)/
make_program = ENV['MAKE'] || ENV['make'] || $1
unless make_program
make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
make_program_name = ENV['MAKE'] || ENV['make'] || $1
unless make_program_name
make_program_name = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
end
make_program = Shellwords.split(make_program)
make_program = Shellwords.split(make_program_name)

# The installation of the bundled gems is failed when DESTDIR is empty in mswin platform.
destdir = (ENV['DESTDIR'] && ENV['DESTDIR'] != "") ? 'DESTDIR=%s' % ENV['DESTDIR'] : ''
destdir = (/\bnmake/i !~ make_program_name || ENV['DESTDIR'] && ENV['DESTDIR'] != "") ? 'DESTDIR=%s' % ENV['DESTDIR'] : ''

['clean', '', 'install'].each do |target|
# Pass DESTDIR via command line to override what's in MAKEFLAGS
Expand Down

0 comments on commit 7fd987d

Please sign in to comment.