# Copyright 1999-2010 Gentoo Foundation# Distributed under the terms of the GNU General Public License v2# $Header: $inherit multilibDESCRIPTION="R language addon for postgresql database"HOMEPAGE="http://www.joeconway.com/plr/"SRC_URI="http://www.joeconway.com/plr/${P}.tar.gz"LICENSE="GPL-2"SLOT="0"KEYWORDS="~amd64 ~x86"IUSE=""RDEPEND="dev-lang/R >=dev-db/postgresql-server-8.3"DEPEND="${RDEPEND}"S="${WORKDIR}/contrib/${PN}"src_unpack() { unpack ${A} # the build system wants 'contrib' to be part of the path mkdir "${WORKDIR}/contrib" mv "${WORKDIR}/${PN}" "${S}"}src_compile() { USE_PGXS=1 emake -j1 || die "emake failed"}src_install() { USE_PGXS=1 emake -j1 DESTDIR="${D}" install || die "emake install failed"}pkg_postinst() { local sharepath="/usr/share/postgresql/contrib" elog "PL/R has been built against the currently eselected version of PostgreSQL." ewarn "If you want to install PL/R for other versions of postgres, please use eselect" ewarn "to select the other version and then re-emerge this package." elog elog "To install PL/R to your database issue" elog elog "\t psql -d mydatabase -U pg_username < ${sharepath}/plr.sql" elog elog "You may have to login as database administrator." elog elog "You have to define PL/R as TRUSTED language to allow non-administrators" elog "to use it. Change the CREATE LANGUAGE statement in the plr.sql file" elog "into" elog elog "\t CREATE TRUSTED LANGUAGE plr HANDLER plr_call_handler;" elog elog "update the database as shown above and allow a specific user to" elog "use PL/R by" elog elog "\t GRANT USAGE ON LANGUAGE plr TO pg_username;" elog elog "For further information on PL/R have a look at http://www.joeconway.com/plr/"}