maglev 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. #!/usr/bin/env bash
  2. maglev_install()
  3. {
  4. __rvm_ensure_has_mri_ruby
  5. compatible_ruby="$(__rvm_mri_ruby)"
  6. rvm_log "Running MagLev prereqs checking script."
  7. "$rvm_scripts_path/maglev" ||
  8. {
  9. result=$?
  10. rvm_error "Prerequisite checks have failed. \nHalting the installation."
  11. return $result
  12. }
  13. __rvm_cd "${rvm_src_path}"
  14. if
  15. [[ ! -d "${rvm_src_path}/$rvm_ruby_string" ]] ||
  16. (( ${rvm_head_flag:=0} == 1 ))
  17. then
  18. __rvm_fetch_ruby ||
  19. {
  20. result=$?
  21. rvm_error "There has been an error while trying to fetch the source. \nHalting the installation."
  22. exit $result
  23. }
  24. fi
  25. system="${_system_type}"
  26. arch="${_system_arch}"
  27. if [[ "${system}-${arch}" == "Darwin-x86_64" ]]
  28. then arch="i386"
  29. fi
  30. if
  31. (( ${rvm_head_flag:=0} == 1 ))
  32. then
  33. __rvm_cd "${rvm_src_path}/$rvm_ruby_string"
  34. rvm_gemstone_package_file="GemStone-$(__rvm_grep "^GEMSTONE" version.txt | cut -f2 -d-).${system}-${arch}"
  35. rvm_gemstone_url="$maglev_url/${rvm_gemstone_package_file}.${rvm_archive_extension}"
  36. fi
  37. rvm_log "Downloading the GemStone package, this may take a while depending on your connection..."
  38. "$rvm_scripts_path/fetch" "$rvm_gemstone_url" ||
  39. {
  40. result=$?
  41. rvm_error "There has been an error while trying to fetch the GemStone package.\nHalting the installation."
  42. return $result
  43. }
  44. __rvm_cd "${rvm_src_path}"
  45. if [[ -s "$rvm_ruby_package_file" ]]
  46. then \command \mv "$rvm_ruby_package_file" "${rvm_src_path}/$rvm_ruby_string"
  47. fi
  48. __rvm_cd "${rvm_src_path}/$rvm_ruby_string"
  49. if
  50. [[ -d "${rvm_src_path}/${rvm_gemstone_package_file}" ]]
  51. then
  52. __rvm_log_command "gemstone.fix_rights" \
  53. "Fixing gemstone rights" \
  54. chmod -R u+w "${rvm_src_path}/${rvm_gemstone_package_file}"
  55. else
  56. mkdir -p "${rvm_src_path}/${rvm_gemstone_package_file}"
  57. fi
  58. __rvm_log_command "extract" \
  59. "$rvm_ruby_string - #extracting $rvm_gemstone_package_file to ${rvm_src_path}" \
  60. __rvm_package_extract "${rvm_archives_path}/$rvm_gemstone_package_file.$rvm_archive_extension" "${rvm_src_path}" ||
  61. case $? in
  62. 199)
  63. rvm_error "\nUnrecognized archive format '$archive_format'"
  64. return 199
  65. ;;
  66. *)
  67. rvm_error "There has been an error while trying to extract the source. Halting the installation."
  68. return 1
  69. ;;
  70. esac
  71. ln -fs "${rvm_src_path}/$rvm_gemstone_package_file" "gemstone"
  72. __rvm_rm_rf $rvm_ruby_home
  73. __rvm_log_command "install" \
  74. "Installing maglev to $rvm_ruby_home" \
  75. __rvm_cp -Rf "${rvm_src_path}/$rvm_ruby_string" "$rvm_ruby_home"
  76. (
  77. __rvm_cd "$rvm_ruby_home/bin/"
  78. for binary in maglev-irb maglev-ruby maglev-gem
  79. do
  80. ln -fs "$binary" "${binary#maglev-}"
  81. done
  82. unset binary
  83. )
  84. __rvm_cd "$rvm_ruby_home"
  85. if
  86. (( ${rvm_head_flag:=0} == 1 ))
  87. then
  88. \command \git submodule update --init
  89. "$rvm_ruby_home/bin/maglev" force-reload
  90. fi
  91. ln -fs maglev.demo.key-${system}-${arch} etc/maglev.demo.key
  92. __rvm_log_command "build:maglev" \
  93. "Bootstrapping a new image" \
  94. "$rvm_wrappers_path/$compatible_ruby/rake" "build:maglev"
  95. [[ -e ${rvm_ruby_home}/etc/conf.d/maglev.conf ]] ||
  96. __rvm_log_command "stone.create" \
  97. "Creating default 'maglev' repository." \
  98. "$rvm_wrappers_path/$compatible_ruby/rake" "stone:create[maglev]" >/dev/null 2>&1
  99. __rvm_log_command "rdoc" \
  100. "Generating maglev HTML documentation" \
  101. "$rvm_wrappers_path/$compatible_ruby/rake" rdoc >/dev/null 2>&1
  102. __rvm_log_command "stwrappers" \
  103. "Generating smalltalk FFI." \
  104. "$rvm_wrappers_path/$compatible_ruby/rake" stwrappers >/dev/null 2>&1
  105. unset compatible_ruby
  106. __rvm_initial_gemsets_create_without_rubygems "$rvm_ruby_home/bin/ruby" &&
  107. __rvm_irbrc &&
  108. __rvm_fetch_ruby_cleanup
  109. }