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