16: def self.make(dest_path, results)
17: unless File.exist? 'Makefile' then
18: raise Gem::InstallError, "Makefile not found:\n\n#{results.join "\n"}"
19: end
20:
21: mf = File.read('Makefile')
22: mf = mf.gsub(/^RUBYARCHDIR\s*=\s*\$[^$]*/, "RUBYARCHDIR = #{dest_path}")
23: mf = mf.gsub(/^RUBYLIBDIR\s*=\s*\$[^$]*/, "RUBYLIBDIR = #{dest_path}")
24:
25: File.open('Makefile', 'wb') {|f| f.print mf}
26:
27: make_program = ENV['make']
28: unless make_program then
29: make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
30: end
31:
32: ['', ' install'].each do |target|
33: cmd = "#{make_program}#{target}"
34: results << cmd
35: results << `#{cmd} #{redirector}`
36:
37: raise Gem::InstallError, "make#{target} failed:\n\n#{results}" unless
38: $?.exitstatus.zero?
39: end
40: end