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:
26: RbConfig::CONFIG['configure_args'] =~ /with-make-prog\=(\w+)/
27: make_program = $1 || 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: $?.success?
39: end
40: end