Sha256: 38112210f018b0e18d300019eca070f97448dc18eb65dce6611f3a8a3990a256
Contents?: true
Size: 1.24 KB
Versions: 8
Compression:
Stored size: 1.24 KB
Contents
task :default=>[:build] task :build do # only try to install extension on non windows / MRI 1.8 unless /mswin/ =~ RUBY_PLATFORM || RUBY_VERSION >= "1.9" || defined?(RUBY_ENGINE) && RUBY_ENGINE != "ruby" require 'rbconfig' ruby = File.join(Config::CONFIG["bindir"], Config::CONFIG["RUBY_INSTALL_NAME"]) ruby << Config::CONFIG["EXEEXT"] # escape string in case path to ruby executable contain spaces. ruby.sub!(/.*\s.*/m, '"\&"') results = `#{ruby} extconf.rb` unless File.exist? 'Makefile' raise "Makefile not found:\n\n#{results.join "\n"}" end dest_path = ENV["RUBYARCHDIR"] || File.join(File.dirname(__FILE__), "..", "lib") mf = File.read('Makefile') mf = mf.gsub(/^RUBYARCHDIR\s*=\s*\$[^$]*/, "RUBYARCHDIR = #{dest_path}") mf = mf.gsub(/^RUBYLIBDIR\s*=\s*\$[^$]*/, "RUBYLIBDIR = #{dest_path}") File.open('Makefile', 'wb') {|f| f.print mf} make_program = ENV['make'] unless make_program make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make' end ['', ' install'].each do |target| cmd = "#{make_program}#{target}" results << cmd + "\n" results << `#{cmd}` raise "make#{target} failed:\n\n#{results}" unless $?.success? end end end
Version data entries
8 entries across 8 versions & 2 rubygems