freebsd 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. #!/usr/bin/env bash
  2. # old handlers before pkgng
  3. requirements_freebsd_lib_installed()
  4. {
  5. pkg_info | __rvm_grep "^$1" >/dev/null 2>&1 || return $?
  6. }
  7. requirements_freebsd_libs_install()
  8. {
  9. __rvm_try_sudo pkg_add -r "$@" || return $?
  10. }
  11. # new handlers for pkgng
  12. requirements_freebsd_pkgng_lib_installed()
  13. {
  14. pkg info | __rvm_grep "^$1" >/dev/null 2>&1 || return $?
  15. }
  16. requirements_freebsd_pkgng_libs_install()
  17. {
  18. __rvm_try_sudo pkg install -y "$@" || return $?
  19. }
  20. requirements_freebsd_install_node()
  21. {
  22. # TODO: missing pkgng!
  23. if
  24. [[ -d /usr/ports ]]
  25. then
  26. __rvm_try_sudo portsnap fetch update || return $?
  27. else
  28. rvm_requiremnts_fail_or_run_action 2 \
  29. "Skipping portsnap fetch extract, make sure your system is up to date." \
  30. __rvm_try_sudo portsnap fetch extract || return $?
  31. packages_flags+=( "portsnap-extracted" )
  32. fi
  33. # plain make is required for sudo
  34. __rvm_try_sudo make -C /usr/ports/www/node install clean || return $?
  35. }
  36. requirements_freebsd_before_detect_package_manager()
  37. {
  38. if
  39. __rvm_version_compare ${_system_version} -ge 10.0
  40. then
  41. __lib_type="freebsd_pkgng"
  42. else
  43. __lib_type="freebsd"
  44. if
  45. __rvm_which pkg >/dev/null &&
  46. [[ -s /var/db/pkg/local.sqlite ]]
  47. then
  48. __lib_type+='_pkgng'
  49. fi
  50. fi
  51. }
  52. requirements_freebsd_before()
  53. {
  54. if
  55. __rvm_version_compare ${_system_version} -le 10.0
  56. then
  57. rvm_warn "rvm is best supported on FreeBSD 10+"
  58. fi
  59. requirements_freebsd_before_detect_package_manager
  60. # TODO: when the time is out deprecate the old pkg_tools https://wiki.freebsd.org/pkgng/CharterAndRoadMap
  61. }
  62. requirements_freebsd_libs_default()
  63. {
  64. requirements_check autoconf automake libtool bison readline libyaml sqlite3 gdbm
  65. }
  66. requirements_freebsd_update_system()
  67. {
  68. case "${__lib_type}" in
  69. (freebsd_pkgng)
  70. if
  71. [[ -s /usr/local/etc/pkg.conf ]]
  72. then
  73. __rvm_try_sudo pkg update || return $?
  74. fi
  75. ;;
  76. esac
  77. }
  78. requirements_freebsd_define()
  79. {
  80. case "$1" in
  81. (rvm)
  82. requirements_check bash curl
  83. ;;
  84. (jruby*)
  85. requirements_check make openjdk
  86. if
  87. is_head_or_disable_binary "$1"
  88. then
  89. requirements_check git
  90. case $( jruby_installation_method "$1" ) in
  91. ant) __rvm_which ant >/dev/null || requirements_check apache-ant ;;
  92. mvn) __rvm_which mvn >/dev/null || requirements_check maven3 ;;
  93. esac
  94. fi
  95. ;;
  96. (ir*)
  97. requirements_check mono
  98. ;;
  99. (opal)
  100. requirements_check_custom node
  101. ;;
  102. (rbx*)
  103. if
  104. __rvm_version_compare ${_system_version} -ge 10.0
  105. then
  106. rvm_configure_flags+=( --cc=clang --cxx=clang++ )
  107. requirements_check gmake llvm35
  108. rvm_warn "If rbx installation fails, make sure llvm-config is in your PATH"
  109. else
  110. rvm_warn "rbx installation by rvm is only supported on FreeBSD 10 or higher"
  111. fi
  112. ;;
  113. (*-head)
  114. requirements_check git
  115. requirements_freebsd_define "${1%-head}"
  116. requirements_freebsd_libs_default
  117. __rvm_update_configure_opt_dir "$1" "/usr/local"
  118. ;;
  119. (*)
  120. # OpenSSL is installed by default http://www.freebsd.org/crypto.html
  121. requirements_freebsd_libs_default
  122. __rvm_update_configure_opt_dir "$1" "/usr/local"
  123. ;;
  124. esac
  125. }