Files @ dc53e5004f02
Branch filter:

Location: portage-overlay.git/sci-mathematics/rstudio/rstudio-0.95.263.ebuild

dc53e5004f02 4.4 KiB application/vnd.gentoo.ebuild Show Annotation Show as Raw Download as Raw
chain
update net-misc/pyload to 0.4.9
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="4"
inherit cmake-utils pam versionator

MY_GWTVER="2.4.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"
	# Adding -DDISTRO_SHARE=... to append-flags breaks cmake so using
	# this sed hack for now. ~RMH
	DISTRO_DIR="\"share/${PN}\""
	sed -i -e "s|DISTRO_SHARE|${DISTRO_DIR}|" src/cpp/server/ServerOptions.cpp
	sed -i -e "s|DISTRO_SHARE|${DISTRO_DIR}|" src/cpp/session/SessionOptions.cpp
}

src_configure() {
	# Set the proper version number (no more 99.9.9). ~RMH
	export RSTUDIO_VERSION_MAJOR=$(get_version_component_range 1)
	export RSTUDIO_VERSION_MINOR=$(get_version_component_range 2)
	export RSTUDIO_VERSION_PATCH=$(get_version_component_range 3)
	local mycmakeargs=(-DDISTRO_SHARE=share/${PN})
	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
	# Add a desktop entry. ~RMH
	if use desktop; then
		sed -e "s|\@VERSION\@|${PV}|" "${FILESDIR}/${PN}-${PN}.desktop" > "${T}/${PN}-${PN}.desktop"
		ls ${T}
		domenu "${T}/${PN}-${PN}.desktop" || die
	fi
}

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