summaryrefslogtreecommitdiff
path: root/lib/rubygems/ext
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems/ext/cargo_builder.rb32
1 files changed, 26 insertions, 6 deletions
@@ -14,7 +14,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
@profile = :release
end
- def build(_extension, dest_path, results, args = [], lib_dir = nil, cargo_dir = Dir.pwd)
require "tempfile"
require "fileutils"
@@ -43,16 +43,19 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
dlext_path = File.join(File.dirname(dylib_path), dlext_name)
FileUtils.cp(dylib_path, dlext_path)
# TODO: remove in RubyGems 4
if Gem.install_extension_in_lib && lib_dir
- FileUtils.mkdir_p lib_dir
- p [dlext_path, lib_dir]
- FileUtils.cp_r dlext_path, lib_dir, remove_destination: true
end
# move to final destination
- FileUtils.mkdir_p dest_path
- FileUtils.cp_r dlext_path, dest_path, remove_destination: true
ensure
# clean up intermediary build artifacts
FileUtils.rm_rf tmp_dest if tmp_dest
@@ -94,6 +97,23 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
ENV.fetch("CARGO", "cargo")
end
def rb_config_env
result = {}
RbConfig::CONFIG.each {|k, v| result["RBCONFIG_#{k}"] = v }