Skip to content

Commit

Permalink
fix missing compiler for binary rubies, fix #1372
Browse files Browse the repository at this point in the history
  • Loading branch information
mpapis committed Dec 7, 2012
1 parent f300985 commit 43c6a4a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/external
@@ -1,6 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash


source "$rvm_scripts_path/base" source "$rvm_scripts_path/base"
source "$rvm_scripts_path/functions/build"



external_automount() external_automount()
{ {
Expand Down Expand Up @@ -119,6 +121,7 @@ external_mount()
__rvm_gemsets_initial __rvm_gemsets_initial
) )


__rvm_fix_gcc_path "$rvm_rubies_path"
__rvm_ruby_config_save "$ruby_path" "$rvm_rubies_path/$rvm_ruby_string/config" __rvm_ruby_config_save "$ruby_path" "$rvm_rubies_path/$rvm_ruby_string/config"
__rvm_fix_group_permissions "$rvm_rubies_path/$rvm_ruby_string" __rvm_fix_group_permissions "$rvm_rubies_path/$rvm_ruby_string"
__rvm_record_install "$rvm_ruby_string" __rvm_record_install "$rvm_ruby_string"
Expand Down Expand Up @@ -366,6 +369,7 @@ external_import_setup()
rvm_create_flag=1 __rvm_use rvm_create_flag=1 __rvm_use


__rvm_bin_script # environment + wrappers __rvm_bin_script # environment + wrappers
__rvm_fix_gcc_path "$rvm_rubies_path"
__rvm_gemsets_initial __rvm_gemsets_initial
__rvm_ruby_config_save "$rvm_rubies_path/$rvm_ruby_string/bin/ruby" "$rvm_rubies_path/$rvm_ruby_string/config" __rvm_ruby_config_save "$rvm_rubies_path/$rvm_ruby_string/bin/ruby" "$rvm_rubies_path/$rvm_ruby_string/config"
__rvm_record_install "$rvm_ruby_string" __rvm_record_install "$rvm_ruby_string"
Expand Down
21 changes: 21 additions & 0 deletions scripts/functions/build
Expand Up @@ -31,6 +31,27 @@ __rvm_found_compiler()
__rvm_selected_compiler || \which gcc 2>/dev/null __rvm_selected_compiler || \which gcc 2>/dev/null
} }


__rvm_fix_gcc_path()
{
typeset __config_file __cc_value __cc_new
__rvm_which $(
"$rvm_ruby_home/bin/ruby" -rrbconfig -e 'puts RbConfig::CONFIG["CC"]||"true"' 2>/dev/null
) >/dev/null 2>/dev/null ||
{
__cc_value="$( "$rvm_ruby_home/bin/ruby" -rrbconfig -e 'puts RbConfig::CONFIG["CC"]' 2>/dev/null )"
if
__config_file="$( find $rvm_ruby_home/ -name rbconfig.rb )" &&
GREP_OPTIONS="" \grep "CONFIG\[\"CC\"\]" "${__config_file}" >/dev/null
then
__cc_new="$( __rvm_found_compiler )"
rvm_debug "Fixing ruby compiler from '${__cc_value}' to '${__cc_new}'."
sed -i'' "s#CONFIG\[\"CC\"\].*$#CONFIG\[\"CC\"\] = ENV[\"CC\"] || \"${__cc_new}\"#" "${__config_file}"
else
rvm_warn "Installed ruby contains path to non existing compiler '${__config_file}', compiling native gems might be impossible."
fi
}
}

__rvm_run_compiler() __rvm_run_compiler()
{ {
typeset compiler typeset compiler
Expand Down

0 comments on commit 43c6a4a

Please sign in to comment.