openindiana 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. #!/usr/bin/env bash
  2. requirements_openindiana_lib_installed()
  3. {
  4. pkg info "$1" > /dev/null 2>&1 || return $?
  5. }
  6. requirements_openindiana_lib_available()
  7. {
  8. pkg info -r "$1" > /dev/null 2>&1 || return $?
  9. }
  10. requirements_openindiana_custom_lib_installed()
  11. {
  12. pkginfo -q "$1" || return $?
  13. }
  14. requirements_openindiana_libs_install()
  15. {
  16. __rvm_try_sudo pkg install "$@" ||
  17. {
  18. \typeset ret=$?
  19. case $ret in
  20. (4) return 0 ;; # means the package does not need updates
  21. esac
  22. return $ret
  23. }
  24. }
  25. requirements_openindiana_update_system()
  26. {
  27. __rvm_try_sudo pkg refresh && __rvm_try_sudo pkg update ||
  28. {
  29. \typeset ret=$?
  30. case $ret in
  31. (4) return 0 ;; # means nothing to install
  32. esac
  33. return $ret
  34. }
  35. }
  36. requirements_openindiana_check_custom()
  37. {
  38. for lib in "$@"
  39. do
  40. [[ " ${packages_custom[*]} " == *" $lib "* ]] ||
  41. requirements_openindiana_custom_lib_installed "$lib" || __rvm_add_once packages_custom "$lib"
  42. done
  43. unset lib
  44. }
  45. requirements_openindiana_check_opencsw_enabled()
  46. {
  47. requirements_openindiana_custom_lib_installed CSWpkgutil || return $?
  48. }
  49. requirements_openindiana_enable_opencsw()
  50. {
  51. __rvm_try_sudo pkgadd -a $rvm_path/config/solaris/noask -d https://get.opencsw.org/now CSWpkgutil > /dev/null 2>&1 || return $?
  52. }
  53. requirements_openindiana_install_custom()
  54. {
  55. requirements_openindiana_check_opencsw_enabled || requirements_openindiana_enable_opencsw
  56. __rvm_try_sudo /opt/csw/bin/pkgutil -iy "$@" -t https://mirror.opencsw.org/opencsw/unstable || return $?
  57. }
  58. requirements_openindiana_after()
  59. {
  60. # https://www.illumos.org/issues/782
  61. if ! __rvm_which automake >/dev/null 2>&1 && __rvm_which /usr/bin/automake-1.10 >/dev/null 2>&1
  62. then ln -s /usr/bin/automake-1.10 "${rvm_bin_path}"/automake
  63. fi
  64. if ! __rvm_which aclocal >/dev/null 2>&1 && __rvm_which /usr/bin/aclocal-1.10 >/dev/null 2>&1
  65. then ln -s /usr/bin/aclocal-1.10 "${rvm_bin_path}"/aclocal
  66. fi
  67. }
  68. requirements_openindiana_define()
  69. {
  70. case "$1" in
  71. (rvm)
  72. requirements_check bash curl text/gnu-patch
  73. ;;
  74. (jruby*)
  75. requirements_check make jdk
  76. if
  77. is_head_or_disable_binary "$1"
  78. then
  79. requirements_check git
  80. case $( jruby_installation_method "$1" ) in
  81. ant) requirements_check apache-ant ;;
  82. mvn) requirements_check_custom_after mvn=maven ;;
  83. esac
  84. fi
  85. ;;
  86. (ir*)
  87. requirements_check mono
  88. ;;
  89. (opal)
  90. requirements_check runtime/javascript/nodejs
  91. ;;
  92. (*-head)
  93. requirements_check git
  94. requirements_openindiana_define "${1%-head}"
  95. ;;
  96. (*)
  97. requirements_check_fallback \
  98. developer/gcc47 developer/gcc-47 \
  99. developer/gcc46 developer/gcc-46 \
  100. developer/gcc44 developer/gcc-43 developer/gcc/gcc-43
  101. requirements_check_fallback \
  102. developer/build/automake \
  103. developer/build/automake-111 \
  104. developer/build/automake-110
  105. requirements_check \
  106. text/gnu-patch system/header developer/build/autoconf \
  107. developer/build/libtool system/library/math/header-math \
  108. file/gnu-coreutils developer/object-file developer/build/gnu-make
  109. requirements_openindiana_check_custom CSWlibyaml-dev
  110. __rvm_update_configure_opt_dir "$1" "/opt/csw"
  111. ;;
  112. esac
  113. }
  114. requirements_openindiana_after()
  115. {
  116. if is_a_function requirements_openindiana_after_${_system_name}
  117. then requirements_openindiana_after_${_system_name} || return $?
  118. else requirements_openindiana_after_Other || return $?
  119. fi
  120. }
  121. requirements_openindiana_after_OmniOS()
  122. {
  123. case "${packages_installed[*]}" in
  124. (*developer/gcc47*)
  125. __rvm_update_configure_env CC="/opt/gcc-4.7.2/bin/gcc" ;;
  126. (*developer/gcc-3*)
  127. __rvm_update_configure_env CC="/usr/sfw/bin/gcc" ;;
  128. (*)
  129. return 1 ;;
  130. esac
  131. }
  132. requirements_openindiana_after_Other()
  133. {
  134. case "${packages_installed[*]}" in
  135. (*developer/gcc47*|*developer/gcc-47*)
  136. __rvm_update_configure_env CC="/usr/gcc/4.7/bin/gcc" ;;
  137. (*developer/gcc46*|*developer/gcc-46*)
  138. __rvm_update_configure_env CC="/usr/gcc/4.6/bin/gcc" ;;
  139. (*developer/gcc44*)
  140. __rvm_update_configure_env CC="/usr/gcc/4.4/bin/gcc" ;;
  141. (*developer/gcc-43*|*developer/gcc/gcc-43*)
  142. __rvm_update_configure_env CC="/usr/gcc/4.3/bin/gcc" ;;
  143. (*)
  144. return 1 ;;
  145. esac
  146. }
  147. requirements_omnios_before()
  148. {
  149. __lib_type=openindiana
  150. }