2016-02-01 07:43:26 -05:00
|
|
|
# frozen_string_literal: true
|
2007-11-10 02:48:56 -05:00
|
|
|
#--
|
|
|
|
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
|
|
|
# All rights reserved.
|
|
|
|
# See LICENSE.txt for permissions.
|
|
|
|
#++
|
|
|
|
|
2018-10-21 20:27:02 -04:00
|
|
|
require "shellwords"
|
|
|
|
|
2007-11-10 02:48:56 -05:00
|
|
|
class Gem::Ext::RakeBuilder < Gem::Ext::Builder
|
|
|
|
|
2018-05-30 09:01:35 -04:00
|
|
|
def self.build(extension, dest_path, results, args=[], lib_dir=nil)
|
2007-11-10 02:48:56 -05:00
|
|
|
if File.basename(extension) =~ /mkrf_conf/i then
|
2017-01-23 21:38:57 -05:00
|
|
|
cmd = "#{Gem.ruby} #{File.basename extension}".dup
|
2012-11-29 01:52:18 -05:00
|
|
|
cmd << " #{args.join " "}" unless args.empty?
|
2007-11-10 02:48:56 -05:00
|
|
|
run cmd, results
|
|
|
|
end
|
|
|
|
|
2011-01-28 18:46:47 -05:00
|
|
|
rake = ENV['rake']
|
|
|
|
|
|
|
|
rake ||= begin
|
2017-10-05 20:15:08 -04:00
|
|
|
"#{Gem.ruby} -rrubygems #{Gem.bin_path('rake', 'rake')}"
|
2011-01-28 18:46:47 -05:00
|
|
|
rescue Gem::Exception
|
|
|
|
end
|
|
|
|
|
|
|
|
rake ||= Gem.default_exec_format % 'rake'
|
|
|
|
|
2018-10-21 20:27:02 -04:00
|
|
|
rake_args = ["RUBYARCHDIR=#{dest_path}", "RUBYLIBDIR=#{dest_path}", *args]
|
|
|
|
run "#{rake} #{rake_args.shelljoin}", results
|
2007-11-10 02:48:56 -05:00
|
|
|
|
|
|
|
results
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|