rstudio-0.99.902.ebuild 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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. PATCHES=(
  84. "${FILESDIR}/${PN}-0.99.879-prefs.patch"
  85. "${FILESDIR}/${PN}-0.99.879-paths.patch"
  86. "${FILESDIR}/${PN}-0.99.879-clang-pandoc.patch"
  87. "${FILESDIR}/${PN}-0.98.490-linker_flags.patch"
  88. "${FILESDIR}/${PN}-0.98.1091-boost-1.57.patch"
  89. "${FILESDIR}/${PN}-0.99.473-qtsingleapplication.patch"
  90. "${FILESDIR}/${PN}-0.99.486-systemd.patch"
  91. )
  92. src_unpack() {
  93. unpack ${P}.tar.gz gwt-${GWT_VER}.zip
  94. cd "${S}" || die
  95. mkdir -p src/gwt/lib/{gin,gwt} \
  96. dependencies/common/dictionaries \
  97. src/gwt/lib/selenium/${SELENIUM_VER} \
  98. src/gwt/lib/selenium/chromedriver/${CHROMEDRIVER_VER} || die
  99. mv ../gwt-${GWT_VER} src/gwt/lib/gwt/${GWT_VER} || die
  100. unzip -qd src/gwt/lib/gin/${GIN_VER} \
  101. "${DISTDIR}"/gin-${GIN_VER}.zip || die
  102. unzip -qd dependencies/common/dictionaries \
  103. "${DISTDIR}"/core-dictionaries.zip || die
  104. unzip -qd src/gwt/lib/selenium/${SELENIUM_VER} \
  105. "${DISTDIR}"/selenium-java-${SELENIUM_VER}.zip || die
  106. cp "${DISTDIR}"/selenium-server-standalone-${SELENIUM_VER}.jar \
  107. src/gwt/lib/selenium/${SELENIUM_VER}/ || die
  108. cp "${DISTDIR}"/chromedriver-linux \
  109. src/gwt/lib/selenium/chromedriver/${CHROMEDRIVER_VER}/ || die
  110. cd dependencies/common || die
  111. unpack packrat-${PACKRAT_VER}.tar.gz
  112. unpack rmarkdown-${RMARKDOWN_VER}.tar.gz
  113. unpack shinyapps-${SHINYAPPS_VER}.tar.gz
  114. unpack rsconnect_${RSCONNECT_VER}.tar.gz
  115. cp "${DISTDIR}"/rmarkdown-${RMARKDOWN_VER}.tar.gz \
  116. . || die
  117. cp "${DISTDIR}"/packrat-${PACKRAT_VER}.tar.gz \
  118. . || die
  119. cp "${DISTDIR}"/shinyapps-${SHINYAPPS_VER}.tar.gz \
  120. . || die
  121. cp "${DISTDIR}"/rsconnect_${RSCONNECT_VER}.tar.gz \
  122. . || die
  123. }
  124. src_prepare() {
  125. java-pkg-2_src_prepare
  126. egit_clean
  127. epatch "${PATCHES[@]}"
  128. # Enable CMake to install our .service file for systemd usage
  129. mkdir -vp "${S}/src/cpp/server/lib/systemd/system" || die
  130. cp -v "${FILESDIR}/rstudio-server.service.in" "${S}/src/cpp/server/lib/systemd/system/" || die
  131. # Adding -DDISTRO_SHARE=... to append-flags breaks cmake so using
  132. # this sed hack for now. ~RMH
  133. sed -i \
  134. -e "s|DISTRO_SHARE|\"share/${PN}\"|g" \
  135. src/cpp/server/ServerOptions.cpp \
  136. src/cpp/session/SessionOptions.cpp || die
  137. # use mathjax from system
  138. ln -sf "${EPREFIX}"/usr/share/mathjax dependencies/common/mathjax-23 || die
  139. # make sure icons and mime stuff are with prefix
  140. sed -i \
  141. -e "s:/usr:${EPREFIX}/usr:g" \
  142. CMakeGlobals.txt src/cpp/desktop/CMakeLists.txt || die
  143. # On Gentoo the rstudio-server configuration file is /etc/conf.d/rstudio-server.conf
  144. sed -e "s@/etc/rstudio/rserver.conf@${EROOT}etc/conf.d/rstudio-server.conf@" \
  145. -i src/cpp/server/ServerOptions.cpp \
  146. || die
  147. # Set the rsession.conf file location for Gentoo prefix
  148. sed -e "s@/etc/rstudio/rsession.conf@${EROOT}etc/rstudio/rsession.conf@" \
  149. -i src/cpp/session/SessionOptions.cpp \
  150. || die
  151. # dev-qt/qtsingleapplication-2.6.1_p20150629 does not provide a cmake module.
  152. # It provides a library that has its version number appended to the end,
  153. # which is difficult to handle in cmake, as find_library does not support
  154. # searching for wildcard library names. So I find the library name from the
  155. # qmake spec, and then sed this into the patched src/cpp/desktop/CMakeLists.txt.
  156. rm -rf "${S}"/src/cpp/desktop/3rdparty || die
  157. local s=$(grep '\-lQt$${QT_MAJOR_VERSION}Solutions_SingleApplication' \
  158. "${EROOT}"/usr/lib64/qt5/mkspecs/features/qtsingleapplication.prf \
  159. | sed -e 's@\$\${QT_MAJOR_VERSION}@5@' \
  160. -e 's@LIBS \*= -l@@')
  161. sed -e "s@Qt5Solutions_SingleApplication-2.6@${s}@g" \
  162. -i "${S}"/src/cpp/desktop/CMakeLists.txt \
  163. || die
  164. # The git commit for tag v0.99.902
  165. sed -e 's@git ARGS rev-parse HEAD@echo ARGS 4daf125408b86eeba48a39f62df34eb81d934639@'\
  166. -i "${S}"/CMakeLists.txt \
  167. "${S}"/CMakeGlobals.txt \
  168. || die
  169. }
  170. src_configure() {
  171. export RSTUDIO_VERSION_MAJOR=$(get_version_component_range 1)
  172. export RSTUDIO_VERSION_MINOR=$(get_version_component_range 2)
  173. export RSTUDIO_VERSION_PATCH=$(get_version_component_range 3)
  174. local mycmakeargs=(
  175. -DDISTRO_SHARE=share/${PN}
  176. $(cmake-utils_use !dedicated RSTUDIO_INSTALL_FREEDESKTOP)
  177. -DRSTUDIO_TARGET=$(usex dedicated "Server" "$(usex server "Development" "Desktop")")
  178. -DQT_QMAKE_EXECUTABLE="${EROOT}"usr/lib64/qt5/bin/qmake
  179. -DRSTUDIO_VERIFY_R_VERSION=FALSE
  180. )
  181. cmake-utils_src_configure
  182. }
  183. src_compile() {
  184. # Avoid the rest of the oracle-jdk-bin-1.8.0.60 sandbox violations F: mkdir S: deny
  185. # P: /root/.oracle_jre_usage.
  186. export ANT_OPTS="-Duser.home=${T}"
  187. cmake-utils_src_compile
  188. }
  189. src_install() {
  190. export ANT_OPTS="-Duser.home=${T}"
  191. cmake-utils_src_install
  192. pax-mark m "${ED}usr/bin/rstudio"
  193. doconfd "${FILESDIR}"/rstudio-server.conf
  194. dodir /etc/rstudio
  195. insinto /etc/rstudio
  196. doins "${FILESDIR}"/rsession.conf
  197. dosym /etc/conf.d/rstudio-server.conf /etc/rstudio/rserver.conf
  198. if use dedicated || use server; then
  199. dopamd src/cpp/server/extras/pam/rstudio
  200. newinitd "${FILESDIR}"/rstudio-server.initd rstudio-server
  201. fi
  202. }
  203. pkg_preinst() {
  204. use dedicated || gnome2_icon_savelist
  205. java-pkg-2_pkg_preinst
  206. }
  207. pkg_postinst() {
  208. use dedicated || { fdo-mime_desktop_database_update
  209. fdo-mime_mime_database_update
  210. gnome2_icon_cache_update ;}
  211. if use dedicated || use server; then
  212. enewgroup rstudio-server
  213. enewuser rstudio-server -1 -1 -1 rstudio-server
  214. fi
  215. }
  216. pkg_postrm() {
  217. use dedicated || { fdo-mime_desktop_database_update
  218. fdo-mime_mime_database_update
  219. gnome2_icon_cache_update ;}
  220. }