mruby 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #!/usr/bin/env bash
  2. mruby_install()
  3. {
  4. \typeset result temp_flags
  5. __rvm_check_for_bison # && Run like hell...
  6. if __rvm_check_for_bison
  7. then true
  8. else
  9. result=$?
  10. rvm_log "Bison required but not found. Halting."
  11. return $result
  12. fi
  13. __rvm_setup_compile_environment "${rvm_ruby_string}"
  14. true ${rvm_ruby_selected_flag:=0}
  15. \typeset directory db_configure_flags
  16. \typeset -a autoconf_flags
  17. (( rvm_ruby_selected_flag )) || __rvm_select
  18. rvm_log "Installing Ruby from source to: $rvm_ruby_home, this may take a while depending on your cpu(s)..."
  19. __rvm_cd "${rvm_src_path}"
  20. if __rvm_fetch_ruby
  21. then true
  22. else
  23. result=$?
  24. rvm_error "There has been an error fetching the ruby interpreter. Halting the installation."
  25. return $result
  26. fi
  27. if __rvm_cd "${rvm_src_path}/$rvm_ruby_string"
  28. then true
  29. else
  30. result=$?
  31. rvm_error "Source directory is missing. \nDid the download or extraction fail? \nHalting the installation."
  32. return $result
  33. fi
  34. if [[ -d "${rvm_path}/usr" ]]
  35. then
  36. __rvm_add_to_path prepend "${rvm_path}/usr/bin"
  37. builtin hash -r
  38. fi
  39. if __rvm_apply_patches
  40. then true
  41. else
  42. result="$?"
  43. rvm_error "There has been an error applying the specified patches. Halting the installation."
  44. return $result
  45. fi
  46. if __rvm_log_command "make" "$rvm_ruby_string - #compiling" ${rvm_ruby_make:-__rvm_make} "${rvm_make_flags[@]}"
  47. then true
  48. else
  49. result=$?
  50. rvm_error "There has been an error while running make. Halting the installation."
  51. return $result
  52. fi
  53. \command \mkdir -p "$rvm_ruby_home/"
  54. \command \mkdir -p "$rvm_ruby_gem_home/bin"
  55. \command \mkdir -p "$rvm_ruby_global_gems_path/bin"
  56. [[ -n "${rvm_ruby_make_install:-}" ]] || rvm_ruby_make_install=( __rvm_cp -Rf "${rvm_src_path}/$rvm_ruby_string"/{bin,mrblib,include} "$rvm_ruby_home/" )
  57. __rvm_log_command "install" "$rvm_ruby_string - #installing" "${rvm_ruby_make_install[@]}" ||
  58. {
  59. result=$?
  60. rvm_error "There has been an error while running make install. Halting the installation."
  61. return $result
  62. }
  63. \typeset __bin_file __target_file
  64. for __bin_file in "$rvm_ruby_home/bin"/m*
  65. do
  66. __bin_file="${__bin_file##*/}"
  67. __target_file="${__bin_file#m}"
  68. ln -s "${__bin_file}" "$rvm_ruby_home/bin/${__target_file}"
  69. done
  70. __rvm_ruby_config_save "$rvm_ruby_home/bin/ruby"
  71. __rvm_fetch_ruby_cleanup || return $?
  72. rvm_log "Install of $rvm_ruby_string - #complete "
  73. }