ree 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #!/usr/bin/env bash
  2. ree_transform_configure_flags()
  3. {
  4. \typeset flag
  5. \typeset -a new_flags
  6. new_flags=()
  7. for flag in "${rvm_configure_flags[@]}"
  8. do
  9. new_flags+=( -c "${flag}" )
  10. done
  11. rvm_configure_flags=( "${new_flags[@]}" )
  12. }
  13. ree_install()
  14. {
  15. if
  16. [[ -n "$(echo "$rvm_ruby_version" | __rvm_awk '/^1\.8/{print}')" ]] && (( rvm_head_flag == 0 ))
  17. then
  18. ruby="ree-|ruby-1.8.|ruby-1.8.7-p|ruby-1.8.7-p374"
  19. __rvm_ensure_has_mri_ruby "$ruby" &&
  20. ruby="$(__rvm_mri_ruby "$ruby")" ||
  21. return $?
  22. rvm_log "Installing Ruby Enterprise Edition from source to: $rvm_ruby_home"
  23. __rvm_cd "${rvm_src_path}"
  24. if
  25. [[ -d "${rvm_src_path}/$rvm_ruby_string" ]] &&
  26. [[ -x "${rvm_src_path}/$rvm_ruby_string/installer" ]]
  27. then
  28. rvm_log "It appears that the archive has already been extracted. Skipping extract (use reinstall to do fresh installation)."
  29. else
  30. rvm_log "$rvm_ruby_string - #fetching ($rvm_ruby_package_file)"
  31. if
  32. "$rvm_scripts_path/fetch" "$rvm_ruby_url"
  33. then
  34. true
  35. else
  36. result=$?
  37. rvm_error "There has been an error while trying to fetch the source. \nHalting the installation."
  38. return $result
  39. fi
  40. __rvm_log_command "extract" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path}/$rvm_ruby_string" \
  41. __rvm_package_extract "${rvm_archives_path}/$rvm_ruby_package_file.$rvm_archive_extension" "${rvm_src_path}/" ||
  42. case $? in
  43. 199)
  44. rvm_error "\nUnrecognized archive format '$archive_format'"
  45. return 199
  46. ;;
  47. *)
  48. rvm_error "There has been an error while trying to extract the source. Halting the installation."
  49. return 1
  50. ;;
  51. esac
  52. __rvm_rm_rf "${rvm_src_path}/$rvm_ruby_string"
  53. \command \mv "${rvm_src_path}/$rvm_ruby_package_file" "${rvm_src_path}/$rvm_ruby_string"
  54. fi
  55. __rvm_cd "${rvm_src_path}/$rvm_ruby_string"
  56. __rvm_setup_compile_environment "${rvm_ruby_string}"
  57. #TODO: wait, what? Investigate line smell.
  58. mkdir -p "${rvm_ruby_home}/lib/ruby/gems/1.8/gems"
  59. ree_transform_configure_flags
  60. #TODO: are there any other versions then 1.8.6 || 1.8.7
  61. if
  62. [[ "Darwin" == "${_system_type}" ]] &&
  63. [[ "1.8.6" == "$rvm_ruby_version" || "1.8.7" == "$rvm_ruby_version" ]] &&
  64. [[ " ${rvm_ree_options[*]} " != *" --no-tcmalloc "* ]]
  65. then
  66. rvm_ree_options+=( --no-tcmalloc )
  67. fi
  68. __rvm_db "${rvm_ruby_interpreter}_configure_flags" "db_configure_flags"
  69. if [[ -n "${ZSH_VERSION:-}" ]]
  70. then rvm_configure_flags=( ${=db_configure_flags} "${rvm_configure_flags[@]}" )
  71. else rvm_configure_flags=( ${db_configure_flags} "${rvm_configure_flags[@]}" )
  72. fi
  73. __rvm_apply_patches "${rvm_src_path}/$rvm_ruby_string/source"
  74. result=$?
  75. if (( result == 0 )) && [[ "${_system_arch}" == "x86_64" ]]
  76. then
  77. __rvm_apply_patches "${rvm_src_path}/$rvm_ruby_string" lib64
  78. result=$?
  79. fi
  80. __rvm_apply_patches "${rvm_src_path}/$rvm_ruby_string" ruby-binary-shebang
  81. if (( result > 0 ))
  82. then
  83. rvm_error "There has been an error while trying to apply patches to ree. \nHalting the installation."
  84. return $result
  85. fi
  86. __rvm_log_command "install" "$rvm_ruby_string - #installing" \
  87. __rvm_with "$ruby" env \
  88. "${rvm_configure_env[@]}" ./installer -a "$rvm_rubies_path/$rvm_ruby_string" "${rvm_ree_options[@]}" "${rvm_configure_flags[@]}" ||
  89. return $?
  90. [[ -x "$rvm_rubies_path/$rvm_ruby_string"/bin/ruby ]] ||
  91. {
  92. rvm_error "There has been an error while trying to run the ree installer - bin/ruby was not created,
  93. check the log file: $( __rvm_ls -1t "${rvm_log_path}/${rvm_ruby_string:-}"/*_install.log | __rvm_tail -n 1 )"
  94. return 11
  95. }
  96. __rvm_initial_gemsets_create "$rvm_ruby_home/bin/ruby" &&
  97. __rvm_post_install
  98. else
  99. __rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_repo_url" "rvm_ruby_url"
  100. if [[ -z "$rvm_ruby_url" ]] ; then
  101. rvm_error "rvm does not know the rvm repo url for '${rvm_ruby_interpreter}_${rvm_ruby_version}'"
  102. result=1
  103. else
  104. rvm_ruby_repo_url="$rvm_ruby_url"
  105. __rvm_setup_compile_environment "${rvm_ruby_string}"
  106. __rvm_install_source $*
  107. fi
  108. fi
  109. }