rstudio-0.99.473-r1.ebuild 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils user cmake-utils gnome2-utils pam versionator fdo-mime java-pkg-2 pax-utils
  5. # TODO
  6. # * package gin and gwt
  7. # * use dict from tree, linguas
  8. # * do src_test (use junit from tree?)
  9. # update from scripts in dependencies/common
  10. # egrep '(GWT_SDK_VER=|GIN_VER=|SELENIUM_VER=|CHROMEDRIVER_VER=)' dependencies/common/install-gwt
  11. GWT_VER=2.7.0
  12. GIN_VER=1.5
  13. SELENIUM_VER=2.37.0
  14. CHROMEDRIVER_VER=2.7
  15. # grep 'PANDOC_VERSION=' dependencies/common/update-pandoc
  16. PANDOC_VER=1.13.1
  17. # ls dependencies/common/*.tar.gz
  18. PACKRAT_VER=0.98.1000
  19. RMARKDOWN_VER=0.98.1000
  20. SHINYAPPS_VER=0.98.1000
  21. RSCONNECT_VER=0.4.1.4_fcac892a69817febd7b655b189bf57193260cda0
  22. DESCRIPTION="IDE for the R language"
  23. HOMEPAGE="
  24. http://www.rstudio.org
  25. https://github.com/rstudio/rstudio/"
  26. SRC_URI="
  27. https://github.com/rstudio/rstudio/archive/v${PV}.tar.gz -> ${P}.tar.gz
  28. https://s3.amazonaws.com/rstudio-buildtools/gin-${GIN_VER}.zip
  29. https://s3.amazonaws.com/rstudio-buildtools/gwt-${GWT_VER}.zip
  30. https://s3.amazonaws.com/rstudio-buildtools/selenium-java-${SELENIUM_VER}.zip
  31. https://s3.amazonaws.com/rstudio-buildtools/selenium-server-standalone-${SELENIUM_VER}.jar
  32. https://s3.amazonaws.com/rstudio-buildtools/chromedriver-linux
  33. https://s3.amazonaws.com/rstudio-dictionaries/core-dictionaries.zip
  34. https://dev.gentoo.org/~gienah/distfiles/packrat-${PACKRAT_VER}.tar.gz
  35. https://dev.gentoo.org/~gienah/distfiles/rmarkdown-${RMARKDOWN_VER}.tar.gz
  36. https://dev.gentoo.org/~gienah/distfiles/shinyapps-${SHINYAPPS_VER}.tar.gz
  37. https://dev.gentoo.org/~gienah/distfiles/rsconnect_${RSCONNECT_VER}.tar.gz
  38. "
  39. LICENSE="AGPL-3"
  40. SLOT="0"
  41. KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
  42. IUSE="dedicated server"
  43. QT_VER=5.4
  44. QT_SLOT=5
  45. RDEPEND="
  46. app-text/pandoc
  47. dev-haskell/pandoc-citeproc
  48. >=dev-lang/R-2.11.1
  49. >=dev-libs/boost-1.50:=
  50. >=dev-libs/mathjax-2.3
  51. dev-libs/openssl:0
  52. sys-apps/util-linux
  53. >=sys-devel/clang-3.5.0
  54. sys-libs/zlib
  55. >=virtual/jre-1.7:=
  56. x11-libs/pango
  57. !dedicated? (
  58. >=dev-qt/qtcore-${QT_VER}:${QT_SLOT}
  59. >=dev-qt/qtdeclarative-${QT_VER}:${QT_SLOT}
  60. >=dev-qt/qtdbus-${QT_VER}:${QT_SLOT}
  61. >=dev-qt/qtgui-${QT_VER}:${QT_SLOT}
  62. >=dev-qt/qtnetwork-${QT_VER}:${QT_SLOT}
  63. >=dev-qt/qtopengl-${QT_VER}:${QT_SLOT}
  64. >=dev-qt/qtpositioning-${QT_VER}:${QT_SLOT}
  65. >=dev-qt/qtprintsupport-${QT_VER}:${QT_SLOT}
  66. >=dev-qt/qtsingleapplication-2.6.1_p20150629[qt5]
  67. >=dev-qt/qtsensors-${QT_VER}:${QT_SLOT}
  68. >=dev-qt/qtsql-${QT_VER}:${QT_SLOT}
  69. >=dev-qt/qtsvg-${QT_VER}:${QT_SLOT}
  70. >=dev-qt/qtwebkit-${QT_VER}:${QT_SLOT}
  71. >=dev-qt/qtwidgets-${QT_VER}:${QT_SLOT}
  72. >=dev-qt/qtxml-${QT_VER}:${QT_SLOT}
  73. >=dev-qt/qtxmlpatterns-${QT_VER}:${QT_SLOT}
  74. server? ( virtual/pam )
  75. )
  76. dedicated? ( virtual/pam )"
  77. DEPEND="${RDEPEND}
  78. app-arch/unzip
  79. dev-java/ant-core
  80. >=virtual/jdk-1.7:=
  81. virtual/pkgconfig"
  82. # test? ( dev-java/junit:4 )
  83. src_unpack() {
  84. unpack ${P}.tar.gz gwt-${GWT_VER}.zip
  85. cd "${S}" || die
  86. mkdir -p src/gwt/lib/{gin,gwt} \
  87. dependencies/common/dictionaries \
  88. src/gwt/lib/selenium/${SELENIUM_VER} \
  89. src/gwt/lib/selenium/chromedriver/${CHROMEDRIVER_VER} || die
  90. mv ../gwt-${GWT_VER} src/gwt/lib/gwt/${GWT_VER} || die
  91. unzip -qd src/gwt/lib/gin/${GIN_VER} \
  92. "${DISTDIR}"/gin-${GIN_VER}.zip || die
  93. unzip -qd dependencies/common/dictionaries \
  94. "${DISTDIR}"/core-dictionaries.zip || die
  95. unzip -qd src/gwt/lib/selenium/${SELENIUM_VER} \
  96. "${DISTDIR}"/selenium-java-${SELENIUM_VER}.zip || die
  97. cp "${DISTDIR}"/selenium-server-standalone-${SELENIUM_VER}.jar \
  98. src/gwt/lib/selenium/${SELENIUM_VER}/ || die
  99. cp "${DISTDIR}"/chromedriver-linux \
  100. src/gwt/lib/selenium/chromedriver/${CHROMEDRIVER_VER}/ || die
  101. cd dependencies/common || die
  102. unpack packrat-${PACKRAT_VER}.tar.gz
  103. unpack rmarkdown-${RMARKDOWN_VER}.tar.gz
  104. unpack shinyapps-${SHINYAPPS_VER}.tar.gz
  105. unpack rsconnect_${RSCONNECT_VER}.tar.gz
  106. cp "${DISTDIR}"/rmarkdown-${RMARKDOWN_VER}.tar.gz \
  107. . || die
  108. cp "${DISTDIR}"/packrat-${PACKRAT_VER}.tar.gz \
  109. . || die
  110. cp "${DISTDIR}"/shinyapps-${SHINYAPPS_VER}.tar.gz \
  111. . || die
  112. cp "${DISTDIR}"/rsconnect_${RSCONNECT_VER}.tar.gz \
  113. . || die
  114. }
  115. src_prepare() {
  116. java-pkg-2_src_prepare
  117. egit_clean
  118. epatch \
  119. "${FILESDIR}"/${PN}-0.98.490-prefs.patch \
  120. "${FILESDIR}"/${PN}-0.99.473-paths.patch \
  121. "${FILESDIR}"/${PN}-0.99.473-clang-pandoc.patch \
  122. "${FILESDIR}"/${PN}-0.98.490-linker_flags.patch \
  123. "${FILESDIR}"/${PN}-0.98.1091-boost-1.57.patch \
  124. "${FILESDIR}"/${PN}-0.99.473-qtsingleapplication.patch
  125. # Adding -DDISTRO_SHARE=... to append-flags breaks cmake so using
  126. # this sed hack for now. ~RMH
  127. sed -i \
  128. -e "s|DISTRO_SHARE|\"share/${PN}\"|g" \
  129. src/cpp/server/ServerOptions.cpp \
  130. src/cpp/session/SessionOptions.cpp || die
  131. # use mathjax from system
  132. ln -sf "${EPREFIX}"/usr/share/mathjax dependencies/common/mathjax-23 || die
  133. # make sure icons and mime stuff are with prefix
  134. sed -i \
  135. -e "s:/usr:${EPREFIX}/usr:g" \
  136. CMakeGlobals.txt src/cpp/desktop/CMakeLists.txt || die
  137. # On Gentoo the rstudio-server configuration file is /etc/conf.d/rstudio-server.conf
  138. sed -e "s@/etc/rstudio/rserver.conf@${EROOT}etc/conf.d/rstudio-server.conf@" \
  139. -i src/cpp/server/ServerOptions.cpp \
  140. || die
  141. # Set the rsession.conf file location for Gentoo prefix
  142. sed -e "s@/etc/rstudio/rsession.conf@${EROOT}etc/rstudio/rsession.conf@" \
  143. -i src/cpp/session/SessionOptions.cpp \
  144. || die
  145. # dev-qt/qtsingleapplication-2.6.1_p20150629 does not provide a cmake module.
  146. # It provides a library that has its version number appended to the end,
  147. # which is difficult to handle in cmake, as find_library does not support
  148. # searching for wildcard library names. So I find the library name from the
  149. # qmake spec, and then sed this into the patched src/cpp/desktop/CMakeLists.txt.
  150. rm -rf "${S}"/src/cpp/desktop/3rdparty || die
  151. local s=$(grep '\-lQt$${QT_MAJOR_VERSION}Solutions_SingleApplication' \
  152. "${EROOT}"/usr/lib64/qt5/mkspecs/features/qtsingleapplication.prf \
  153. | sed -e 's@\$\${QT_MAJOR_VERSION}@5@' \
  154. -e 's@LIBS \*= -l@@')
  155. sed -e "s@Qt5Solutions_SingleApplication-2.6@${s}@g" \
  156. -i "${S}"/src/cpp/desktop/CMakeLists.txt \
  157. || die
  158. # Avoid some of the oracle-jdk-bin-1.8.0.60 sandbox violations F: mkdir S: deny
  159. # P: /root/.oracle_jre_usage.
  160. sed -e 's@\(\s*\)\(</classpath>\)@\1\2\n\1\<jvmarg value="-Duser.home=${env.T}"/>@g' \
  161. -i "${S}"/src/gwt/build.xml \
  162. || die
  163. }
  164. src_configure() {
  165. export RSTUDIO_VERSION_MAJOR=$(get_version_component_range 1)
  166. export RSTUDIO_VERSION_MINOR=$(get_version_component_range 2)
  167. export RSTUDIO_VERSION_PATCH=$(get_version_component_range 3)
  168. local mycmakeargs=(
  169. -DDISTRO_SHARE=share/${PN}
  170. $(cmake-utils_use !dedicated RSTUDIO_INSTALL_FREEDESKTOP)
  171. -DRSTUDIO_TARGET=$(usex dedicated "Server" "$(usex server "Development" "Desktop")")
  172. -DQT_QMAKE_EXECUTABLE="${EROOT}"usr/lib64/qt5/bin/qmake
  173. )
  174. cmake-utils_src_configure
  175. }
  176. src_compile() {
  177. # Avoid the rest of the oracle-jdk-bin-1.8.0.60 sandbox violations F: mkdir S: deny
  178. # P: /root/.oracle_jre_usage.
  179. export ANT_OPTS="-Duser.home=${T}"
  180. cmake-utils_src_compile
  181. }
  182. src_install() {
  183. export ANT_OPTS="-Duser.home=${T}"
  184. cmake-utils_src_install
  185. pax-mark m "${ED}usr/bin/rstudio"
  186. doconfd "${FILESDIR}"/rstudio-server.conf
  187. dodir /etc/rstudio
  188. insinto /etc/rstudio
  189. doins "${FILESDIR}"/rsession.conf
  190. dosym /etc/conf.d/rstudio-server.conf /etc/rstudio/rserver.conf
  191. if use dedicated || use server; then
  192. dopamd src/cpp/server/extras/pam/rstudio
  193. newinitd "${FILESDIR}"/rstudio-server.initd rstudio-server
  194. fi
  195. }
  196. pkg_preinst() {
  197. use dedicated || gnome2_icon_savelist
  198. java-pkg-2_pkg_preinst
  199. }
  200. pkg_postinst() {
  201. use dedicated || { fdo-mime_desktop_database_update
  202. fdo-mime_mime_database_update
  203. gnome2_icon_cache_update ;}
  204. if use dedicated || use server; then
  205. enewgroup rstudio-server
  206. enewuser rstudio-server -1 -1 -1 rstudio-server
  207. fi
  208. }
  209. pkg_postrm() {
  210. use dedicated || { fdo-mime_desktop_database_update
  211. fdo-mime_mime_database_update
  212. gnome2_icon_cache_update ;}
  213. }