File diff 000000000000 → 000000000000
sci-mathematics/rstudio/rstudio-0.94.110.ebuild
Show inline comments
 
new file 100644
 
# Copyright 1999-2011 Gentoo Foundation
 
# Distributed under the terms of the GNU General Public License v2
 
# $Header: $
 
EAPI="4"
 
inherit cmake-utils pam
 

	
 
MY_GWTVER="2.3.0"
 
MY_GINVER="1.5"
 
DESCRIPTION="RStudio is an IDE for use with the R language."
 
HOMEPAGE="http://www.rstudio.org"
 
SRC_URI="https://github.com/rstudio/rstudio/tarball/v${PV} -> rstudio-${PV}.tar.gz
 
	https://s3.amazonaws.com/rstudio-buildtools/gin-${MY_GINVER}.zip ->
 
	rstudio-gin-${MY_GINVER}.zip
 
	https://s3.amazonaws.com/rstudio-buildtools/gwt-${MY_GWTVER}.zip ->
 
	rstudio-gwt-${MY_GWTVER}.zip"
 

	
 
# The rstudio source can download its dependencies itself. Most are in portage
 
# already, but not gwt and gin. Adding the source packages to SRC_URI instead of
 
# using the provided install script so that an `ebuild fetch' will actually get
 
# you everything you need, without requiring connectivity in the src_prepare
 
# phase.
 
LICENSE="AGPL-3"
 
SLOT="0"
 
KEYWORDS="~amd64 ~x86"
 
IUSE="+desktop server"
 
QTVER="4.7"
 
RDEPEND=">=dev-lang/R-2.11.1
 
	>=x11-libs/pango-1.14
 
	>=dev-libs/boost-1.42
 
	dev-libs/openssl
 
	desktop? (	>=x11-libs/qt-core-${QTVER}
 
				>=x11-libs/qt-gui-${QTVER}
 
				>=x11-libs/qt-webkit-${QTVER}
 
				>=x11-libs/qt-xmlpatterns-${QTVER} )
 
	server? ( virtual/pam )"
 
DEPEND="${RDEPEND}
 
	>=dev-util/cmake-2.6
 
	app-arch/unzip
 
	dev-java/ant-core
 
	virtual/jdk"
 

	
 
pkg_pretend() {
 
	if ! use desktop && ! use server; then
 
		eerror "Must select at least one of RStudio desktop or RStudio server to install"
 
	fi
 
}
 

	
 
src_unpack() {
 
	# since gin-1.5.zip has no toplevel dir, unpack that seperately
 
	unpack rstudio-${PV}.tar.gz rstudio-gwt-${MY_GWTVER}.zip
 
	mkdir "${WORKDIR}"/gin-${MY_GINVER}
 
	cd "${WORKDIR}"/gin-${MY_GINVER}
 
	unpack rstudio-gin-${MY_GINVER}.zip
 
	cd ..
 
	# packages extract to rstudio-rstudio-HASH, so find it this way so we don't
 
	# have to look up the hash for each version.
 
	S=$(ls -d "${WORKDIR}"/rstudio-rstudio-* | head -n 1)
 
	if [[ -z "${S}" ]]; then
 
		die "Failed to determine source directory."
 
	fi
 
}
 

	
 
src_prepare() {
 
	# extract the gin-ver.zip and gwt-ver.zip files to
 
	# the appropriate location
 
	mkdir -p "${S}"/src/gwt/lib/{gwt,gin}
 
	einfo "Adding missing gin to source."
 
	mv "${WORKDIR}"/gin-${MY_GINVER} "${S}"/src/gwt/lib/gin/${MY_GINVER}
 
	einfo "Adding missing gwt sdk to source."
 
	mv "${WORKDIR}"/gwt-${MY_GWTVER} "${S}"/src/gwt/lib/gwt/${MY_GWTVER}
 
	# And now we fix src/gwt/build.xml since java's user preference class is
 
	# braindead and insists on writing where it is not allowed.
 
	# much thanks to http://www.allaboutbalance.com/articles/disableprefs/
 
	epatch "${FILESDIR}/${P}-prefs.patch"
 
	# change the install path, as by default everything is dumped right under
 
	# the prefix.After fixing install paths, now fix the source so the program can 
 
	# find the moved resources.
 
	epatch "${FILESDIR}/${P}-paths.patch"
 
	# Some gcc hardening options were added, however since we add
 
	# "-Wl,--as-needed" we end up with "-Wl,--as-needed;-Wl,-z,relro" which
 
	# leads to linker errors about unknown options, if we make it so the
 
	# as-needed option is the last option on the line, everything is fine.
 
	epatch "${FILESDIR}/${P}-linker_flags.patch"
 
}
 

	
 
src_configure() {
 
	if use server; then
 
		if use desktop; then
 
			MYCMAKEARGS="-DRSTUDIO_TARGET=All"
 
		else
 
			MYCMAKEARGS="-DRSTUDIO_TARGET=Server"
 
		fi
 
	else
 
		MYCMAKEARGS="-DRSTUDIO_TARGET=Desktop"
 
	fi
 

	
 
	cmake-utils_src_configure
 
}
 

	
 
src_install() {
 
	cmake-utils_src_install
 

	
 
	if use server; then
 
		dopamd "${S}"/src/cpp/server/extras/pam/rstudio
 
		newinitd "${FILESDIR}"/rstudio-rserver.initd rstudio-rserver
 
	fi
 
}
 

	
 
pkg_postinst() {
 
	if use server; then
 
		enewgroup rstudio-server
 
		enewuser rstudio-server -1 -1 -1 rstudio-server
 
	fi
 
}