ruby/lib/rubygems/ext/configure_builder.rb
Yuta Saito 273d41b9e3 [rubygems/rubygems] Add --target-rbconfig option to gem install and gem update commands
This patch adds `--target-rbconfig` option to specify the rbconfig.rb file
for the deployment target platform. This is useful when cross-compiling
gems. At the moment, this option is only available for `extconf.rb`-based
extensions.

https://github.com/rubygems/rubygems/commit/cf2843f7a2
2024-06-18 00:59:35 +00:00

27 lines
772 B
Ruby

# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++
class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder
def self.build(extension, dest_path, results, args=[], lib_dir=nil, configure_dir=Dir.pwd,
target_rbconfig=Gem.target_rbconfig)
if target_rbconfig.path
warn "--target-rbconfig is not yet supported for configure-based extensions. Ignoring"
end
unless File.exist?(File.join(configure_dir, "Makefile"))
cmd = ["sh", "./configure", "--prefix=#{dest_path}", *args]
run cmd, results, class_name, configure_dir
end
make dest_path, results, configure_dir, target_rbconfig: target_rbconfig
results
end
end