| 1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/dev-lang/R/R-2.15.0.ebuild,v 1.8 2012/10/07 13:35:21 jlec Exp $ |
| 4 |
|
| 5 |
EAPI=4 |
| 6 |
|
| 7 |
inherit bash-completion-r1 autotools eutils flag-o-matic fortran-2 multilib versionator toolchain-funcs |
| 8 |
|
| 9 |
BCP=${PN}-20120306.bash_completion |
| 10 |
DESCRIPTION="Language and environment for statistical computing and graphics" |
| 11 |
HOMEPAGE="http://www.r-project.org/" |
| 12 |
SRC_URI="mirror://cran/src/base/R-2/${P}.tar.gz |
| 13 |
bash-completion? ( http://dev.gentoo.org/~bicatali/distfiles/${BCP}.bz2 )" |
| 14 |
|
| 15 |
LICENSE="|| ( GPL-2 GPL-3 ) LGPL-2.1" |
| 16 |
SLOT="0" |
| 17 |
KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd" |
| 18 |
IUSE="bash-completion cairo doc icu java jpeg lapack minimal nls openmp perl png profile readline static-libs tiff tk X" |
| 19 |
REQUIRED_USE="png? ( || ( cairo X ) ) jpeg? ( || ( cairo X ) ) tiff? ( || ( cairo X ) )" |
| 20 |
|
| 21 |
CDEPEND="app-arch/bzip2 |
| 22 |
app-text/ghostscript-gpl |
| 23 |
dev-libs/libpcre |
| 24 |
virtual/blas |
| 25 |
cairo? ( x11-libs/cairo[X] x11-libs/pango ) |
| 26 |
icu? ( dev-libs/icu ) |
| 27 |
jpeg? ( virtual/jpeg ) |
| 28 |
lapack? ( virtual/lapack ) |
| 29 |
perl? ( dev-lang/perl ) |
| 30 |
png? ( media-libs/libpng ) |
| 31 |
readline? ( sys-libs/readline ) |
| 32 |
tk? ( dev-lang/tk ) |
| 33 |
X? ( x11-libs/libXmu x11-misc/xdg-utils )" |
| 34 |
|
| 35 |
DEPEND="${CDEPEND} |
| 36 |
virtual/pkgconfig |
| 37 |
doc? ( |
| 38 |
virtual/latex-base |
| 39 |
dev-texlive/texlive-fontsrecommended |
| 40 |
)" |
| 41 |
|
| 42 |
RDEPEND="${CDEPEND} |
| 43 |
( || ( <sys-libs/zlib-1.2.5.1-r1 >=sys-libs/zlib-1.2.5.1-r2[minizip] ) ) |
| 44 |
app-arch/xz-utils |
| 45 |
java? ( >=virtual/jre-1.5 )" |
| 46 |
|
| 47 |
RESTRICT="minimal? ( test )" |
| 48 |
|
| 49 |
R_DIR="${EPREFIX}/usr/$(get_libdir)/${PN}" |
| 50 |
|
| 51 |
pkg_setup() { |
| 52 |
if use openmp; then |
| 53 |
FORTRAN_NEED_OPENMP=1 |
| 54 |
tc-has-openmp || die "Please enable openmp support in your compiler" |
| 55 |
fi |
| 56 |
fortran-2_pkg_setup |
| 57 |
filter-ldflags -Wl,-Bdirect -Bdirect |
| 58 |
# avoid using existing R installation |
| 59 |
unset R_HOME |
| 60 |
# Temporary fix for bug #419761 |
| 61 |
if [[ ($(tc-getCC) == *gcc) && ($(gcc-version) == 4.7) ]]; then |
| 62 |
append-flags -fno-ipa-cp-clone |
| 63 |
fi |
| 64 |
} |
| 65 |
|
| 66 |
src_prepare() { |
| 67 |
# gentoo bug #322965 (not applied upstream) |
| 68 |
# https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14505 |
| 69 |
epatch "${FILESDIR}"/${PN}-2.11.1-parallel.patch |
| 70 |
|
| 71 |
# respect ldflags (not applied upstream) |
| 72 |
# https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14506 |
| 73 |
epatch "${FILESDIR}"/${PN}-2.12.1-ldflags.patch |
| 74 |
|
| 75 |
# gentoo bug #383431 |
| 76 |
# https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14951 |
| 77 |
epatch "${FILESDIR}"/${PN}-2.13.1-zlib_header_fix.patch |
| 78 |
|
| 79 |
# tiff automagic |
| 80 |
# https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14952 |
| 81 |
epatch "${FILESDIR}"/${PN}-2.14.1-tiff.patch |
| 82 |
|
| 83 |
# https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14953 |
| 84 |
epatch "${FILESDIR}"/${PN}-2.14.1-rmath-shared.patch |
| 85 |
|
| 86 |
# too many warning crash, bug #405463 |
| 87 |
# https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14954 |
| 88 |
epatch "${FILESDIR}"/${PN}-2.14.1-warnings-buffer-overflow.patch |
| 89 |
|
| 90 |
# applied upstream for next R |
| 91 |
epatch \ |
| 92 |
"${FILESDIR}"/${PN}-2.14.2-library-writability.patch \ |
| 93 |
"${FILESDIR}"/${PN}-2.14.2-prune-package-update.patch |
| 94 |
|
| 95 |
# fix packages.html for doc (gentoo bug #205103) |
| 96 |
sed -i \ |
| 97 |
-e "s:../../../library:../../../../$(get_libdir)/R/library:g" \ |
| 98 |
src/library/tools/R/Rd.R || die |
| 99 |
|
| 100 |
# fix Rscript path when installed (gentoo bug #221061) |
| 101 |
sed -i \ |
| 102 |
-e "s:-DR_HOME='\"\$(rhome)\"':-DR_HOME='\"${R_DIR}\"':" \ |
| 103 |
src/unix/Makefile.in || die "sed unix Makefile failed" |
| 104 |
|
| 105 |
# fix HTML links to manual (gentoo bug #273957) |
| 106 |
sed -i \ |
| 107 |
-e 's:\.\./manual/:manual/:g' \ |
| 108 |
$(grep -Flr ../manual/ doc) || die "sed for HTML links failed" |
| 109 |
|
| 110 |
use lapack && \ |
| 111 |
export LAPACK_LIBS="$(pkg-config --libs lapack)" |
| 112 |
|
| 113 |
if use X; then |
| 114 |
export R_BROWSER="$(type -p xdg-open)" |
| 115 |
export R_PDFVIEWER="$(type -p xdg-open)" |
| 116 |
fi |
| 117 |
use perl && \ |
| 118 |
export PERL5LIB="${S}/share/perl:${PERL5LIB:+:}${PERL5LIB}" |
| 119 |
AT_M4DIR=m4 eaclocal |
| 120 |
eautoconf |
| 121 |
} |
| 122 |
|
| 123 |
src_configure() { |
| 124 |
econf \ |
| 125 |
--enable-byte-compiled-packages \ |
| 126 |
--enable-R-shlib \ |
| 127 |
--with-system-zlib \ |
| 128 |
--with-system-bzlib \ |
| 129 |
--with-system-pcre \ |
| 130 |
--with-system-xz \ |
| 131 |
--with-blas="$(pkg-config --libs blas)" \ |
| 132 |
--docdir="${EPREFIX}/usr/share/doc/${PF}" \ |
| 133 |
rdocdir="${EPREFIX}/usr/share/doc/${PF}" \ |
| 134 |
$(use_enable nls) \ |
| 135 |
$(use_enable openmp) \ |
| 136 |
$(use_enable profile R-profiling) \ |
| 137 |
$(use_enable profile memory-profiling) \ |
| 138 |
$(use_enable static-libs static) \ |
| 139 |
$(use_enable static-libs R-static-lib) \ |
| 140 |
$(use_with cairo) \ |
| 141 |
$(use_with icu ICU) \ |
| 142 |
$(use_with jpeg jpeglib) \ |
| 143 |
$(use_with lapack) \ |
| 144 |
$(use_with !minimal recommended-packages) \ |
| 145 |
$(use_with png libpng) \ |
| 146 |
$(use_with readline) \ |
| 147 |
$(use_with tiff libtiff) \ |
| 148 |
$(use_with tk tcltk) \ |
| 149 |
$(use_with X x) |
| 150 |
} |
| 151 |
|
| 152 |
src_compile(){ |
| 153 |
export VARTEXFONTS="${T}/fonts" |
| 154 |
emake |
| 155 |
emake -C src/nmath/standalone shared $(use static-libs && echo static) |
| 156 |
use doc && emake info pdf |
| 157 |
} |
| 158 |
|
| 159 |
src_install() { |
| 160 |
default |
| 161 |
emake -C src/nmath/standalone DESTDIR="${D}" install |
| 162 |
|
| 163 |
if use doc; then |
| 164 |
emake DESTDIR="${D}" install-info install-pdf |
| 165 |
dosym ../manual /usr/share/doc/${PF}/html/manual |
| 166 |
fi |
| 167 |
|
| 168 |
cat > 99R <<-EOF |
| 169 |
LDPATH=${R_DIR}/lib |
| 170 |
R_HOME=${R_DIR} |
| 171 |
EOF |
| 172 |
doenvd 99R |
| 173 |
use bash-completion && newbashcomp "${WORKDIR}"/${BCP} ${PN} |
| 174 |
} |
| 175 |
|
| 176 |
pkg_postinst() { |
| 177 |
if use java; then |
| 178 |
einfo "Re-initializing java paths for ${P}" |
| 179 |
R CMD javareconf |
| 180 |
fi |
| 181 |
} |