topaz 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/usr/bin/env bash
  2. topaz_install()
  3. {
  4. __rvm_cd "${rvm_src_path}"
  5. if [[ "$rvm_ruby_string" != *head* ]]
  6. then
  7. case "${_system_type} ${_system_arch}" in
  8. "Linux x86_64")
  9. version="linux64"
  10. ;;
  11. "Linux i386")
  12. version="linux32"
  13. ;;
  14. "Darwin x86_64")
  15. version="osx64"
  16. ;;
  17. *)
  18. rvm_error "Topaz only provides binary packages for Linux i386 and x86_64 and Darwin x86_64. You try to build the HEAD version"
  19. ;;
  20. esac
  21. rvm_ruby_package_file="$(__rvm_curl "${rvm_ruby_url}" | __rvm_grep -Eo "topaz-${version}-[^.]+\.tar\.bz2" | \command \head -1)"
  22. rvm_ruby_url="${rvm_ruby_url}/${rvm_ruby_package_file}"
  23. __rvm_cd "${rvm_archives_path}"
  24. __rvm_curl -O "$rvm_ruby_url" &&
  25. __rvm_log_command "extract" \
  26. "${rvm_ruby_string} - #extracting ${rvm_ruby_package_file} to ${rvm_src_path}" \
  27. __rvm_package_extract \
  28. "${rvm_archives_path}/${rvm_ruby_package_file}" "${rvm_src_path}" ||
  29. case $? in
  30. 199)
  31. rvm_error "\nUnrecognized archive format '$archive_format'"
  32. return 199
  33. ;;
  34. *)
  35. rvm_error "There has been an error while trying to extract the source. Halting the installation."
  36. return 1
  37. ;;
  38. esac
  39. \command \mv "${rvm_src_path}/topaz" "${rvm_src_path}/$rvm_ruby_string"
  40. else
  41. rvm_ruby_url="${rvm_ruby_repo_url}"
  42. __rvm_fetch_ruby || return $?
  43. __rvm_rm_rf pypy
  44. __rvm_rm_rf rply
  45. __rvm_curl -O https://bitbucket.org/pypy/pypy/get/default.tar.bz2
  46. \command \tar xf default.tar.bz2
  47. __rvm_rm_rf default.tar.bz2
  48. \command \mv pypy* pypy
  49. __rvm_curl -O https://github.com/alex/rply/archive/master.zip
  50. \command \unzip master.zip
  51. __rvm_rm_rf master.zip
  52. \command \mv rply* rply
  53. __rvm_cd "${rvm_src_path}/$rvm_ruby_string"
  54. _old_python_path="$PYTHONPATH"
  55. export PYTHONPATH="${rvm_src_path}/pypy:${rvm_src_path}/rply:${rvm_src_path}/$rvm_ruby_string"
  56. __rvm_log_command "python" \
  57. "Building topaz with JIT, this will take a (long) while." \
  58. /usr/bin/env python "${rvm_src_path}/pypy/rpython/translator/goal/translate.py" -Ojit "${rvm_src_path}/${rvm_ruby_string}/targettopaz.py"
  59. export PYTHONPATH="$_old_python_path"
  60. fi
  61. __rvm_rm_rf $rvm_ruby_home
  62. __rvm_log_command "install" \
  63. "Installing topaz to $rvm_ruby_home" \
  64. __rvm_cp -Rf "${rvm_src_path}/${rvm_ruby_string}" "${rvm_ruby_home}"
  65. __rvm_cd "$rvm_ruby_home/bin/"
  66. \command \ln -fs "topaz" "ruby"
  67. __rvm_initial_gemsets_create "$rvm_ruby_home/bin/ruby" &&
  68. __rvm_fetch_ruby_cleanup
  69. }