| 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.1.ebuild,v 1.2 2012/07/04 19:27:38 bicatali 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 ~amd64-linux ~x86-fbsd ~x86-linux ~x64-macos"
|
| 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 |
virtual/fortran
|
| 26 |
cairo? ( x11-libs/cairo[X] x11-libs/pango )
|
| 27 |
icu? ( dev-libs/icu )
|
| 28 |
jpeg? ( virtual/jpeg )
|
| 29 |
lapack? ( virtual/lapack )
|
| 30 |
perl? ( dev-lang/perl )
|
| 31 |
png? ( media-libs/libpng )
|
| 32 |
readline? ( sys-libs/readline )
|
| 33 |
tk? ( dev-lang/tk )
|
| 34 |
X? ( x11-libs/libXmu x11-misc/xdg-utils )"
|
| 35 |
|
| 36 |
DEPEND="${CDEPEND}
|
| 37 |
virtual/pkgconfig
|
| 38 |
doc? (
|
| 39 |
virtual/latex-base
|
| 40 |
dev-texlive/texlive-fontsrecommended
|
| 41 |
)"
|
| 42 |
|
| 43 |
RDEPEND="${CDEPEND}
|
| 44 |
( || ( <sys-libs/zlib-1.2.5.1-r1 >=sys-libs/zlib-1.2.5.1-r2[minizip] ) )
|
| 45 |
app-arch/xz-utils
|
| 46 |
java? ( >=virtual/jre-1.5 )"
|
| 47 |
|
| 48 |
RESTRICT="minimal? ( test )"
|
| 49 |
|
| 50 |
R_DIR="${EPREFIX}/usr/$(get_libdir)/${PN}"
|
| 51 |
|
| 52 |
pkg_setup() {
|
| 53 |
if use openmp; then
|
| 54 |
FORTRAN_NEED_OPENMP=1
|
| 55 |
tc-has-openmp || die "Please enable openmp support in your compiler"
|
| 56 |
fi
|
| 57 |
fortran-2_pkg_setup
|
| 58 |
filter-ldflags -Wl,-Bdirect -Bdirect
|
| 59 |
# avoid using existing R installation
|
| 60 |
unset R_HOME
|
| 61 |
# Temporary fix for bug #419761
|
| 62 |
if [[ ($(tc-getCC) == *gcc) && ($(gcc-version) == 4.7) ]]; then
|
| 63 |
append-flags -fno-ipa-cp-clone
|
| 64 |
fi
|
| 65 |
}
|
| 66 |
|
| 67 |
src_prepare() {
|
| 68 |
# gentoo bug #322965 (not applied upstream)
|
| 69 |
# https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14505
|
| 70 |
epatch "${FILESDIR}"/${PN}-2.11.1-parallel.patch
|
| 71 |
|
| 72 |
# respect ldflags (not applied upstream)
|
| 73 |
# https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14506
|
| 74 |
epatch "${FILESDIR}"/${PN}-2.12.1-ldflags.patch
|
| 75 |
|
| 76 |
# gentoo bug #383431
|
| 77 |
# https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14951
|
| 78 |
epatch "${FILESDIR}"/${PN}-2.13.1-zlib_header_fix.patch
|
| 79 |
|
| 80 |
# https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14953
|
| 81 |
epatch "${FILESDIR}"/${PN}-2.14.1-rmath-shared.patch
|
| 82 |
|
| 83 |
# fix packages.html for doc (gentoo bug #205103)
|
| 84 |
sed -i \
|
| 85 |
-e "s:../../../library:../../../../$(get_libdir)/R/library:g" \
|
| 86 |
src/library/tools/R/Rd.R || die
|
| 87 |
|
| 88 |
# fix Rscript path when installed (gentoo bug #221061)
|
| 89 |
sed -i \
|
| 90 |
-e "s:-DR_HOME='\"\$(rhome)\"':-DR_HOME='\"${R_DIR}\"':" \
|
| 91 |
src/unix/Makefile.in || die "sed unix Makefile failed"
|
| 92 |
|
| 93 |
# fix HTML links to manual (gentoo bug #273957)
|
| 94 |
sed -i \
|
| 95 |
-e 's:\.\./manual/:manual/:g' \
|
| 96 |
$(grep -Flr ../manual/ doc) || die "sed for HTML links failed"
|
| 97 |
|
| 98 |
use lapack && \
|
| 99 |
export LAPACK_LIBS="$(pkg-config --libs lapack)"
|
| 100 |
|
| 101 |
if use X; then
|
| 102 |
export R_BROWSER="$(type -p xdg-open)"
|
| 103 |
export R_PDFVIEWER="$(type -p xdg-open)"
|
| 104 |
fi
|
| 105 |
use perl && \
|
| 106 |
export PERL5LIB="${S}/share/perl:${PERL5LIB:+:}${PERL5LIB}"
|
| 107 |
|
| 108 |
# don't search /usr/local
|
| 109 |
sed -i -e '/FLAGS=.*\/local\//c\: # removed by ebuild' configure.ac || die
|
| 110 |
# Fix for Darwin (OS X)
|
| 111 |
if [[ ${CHOST} == *-darwin* ]] ; then
|
| 112 |
sed -e 's:-install_name libR.dylib:-install_name ${libdir}/R/lib/libR.dylib:' \
|
| 113 |
-e 's:-install_name libRlapack.dylib:-install_name ${libdir}/R/lib/libRlapack.dylib:' \
|
| 114 |
-e 's:-install_name libRblas.dylib:-install_name ${libdir}/R/lib/libRblas.dylib:' \
|
| 115 |
-e "/SHLIB_EXT/s/\.so/.dylib/" \
|
| 116 |
-i configure.ac || die
|
| 117 |
|
| 118 |
# sort of "undo" 2.14.1-rmath-shared.patch
|
| 119 |
sed "s:-Wl,-soname=libRmath.so:-install_name ${EPREFIX}/usr/$(get_libdir)/libRmath.dylib:" \
|
| 120 |
-i src/nmath/standalone/Makefile.in || die
|
| 121 |
fi
|
| 122 |
|
| 123 |
AT_M4DIR=m4 eaclocal
|
| 124 |
eautoconf
|
| 125 |
}
|
| 126 |
|
| 127 |
src_configure() {
|
| 128 |
econf \
|
| 129 |
--enable-byte-compiled-packages \
|
| 130 |
--enable-R-shlib \
|
| 131 |
--disable-R-framework \
|
| 132 |
--with-system-zlib \
|
| 133 |
--with-system-bzlib \
|
| 134 |
--with-system-pcre \
|
| 135 |
--with-system-xz \
|
| 136 |
--with-blas="$(pkg-config --libs blas)" \
|
| 137 |
--docdir="${EPREFIX}/usr/share/doc/${PF}" \
|
| 138 |
rdocdir="${EPREFIX}/usr/share/doc/${PF}" \
|
| 139 |
$(use_enable nls) \
|
| 140 |
$(use_enable openmp) \
|
| 141 |
$(use_enable profile R-profiling) \
|
| 142 |
$(use_enable profile memory-profiling) \
|
| 143 |
$(use_enable static-libs static) \
|
| 144 |
$(use_enable static-libs R-static-lib) \
|
| 145 |
$(use_with cairo) \
|
| 146 |
$(use_with icu ICU) \
|
| 147 |
$(use_with jpeg jpeglib) \
|
| 148 |
$(use_with lapack) \
|
| 149 |
$(use_with !minimal recommended-packages) \
|
| 150 |
$(use_with png libpng) \
|
| 151 |
$(use_with readline) \
|
| 152 |
$(use_with tiff libtiff) \
|
| 153 |
$(use_with tk tcltk) \
|
| 154 |
$(use_with X x)
|
| 155 |
}
|
| 156 |
|
| 157 |
src_compile() {
|
| 158 |
export VARTEXFONTS="${T}/fonts"
|
| 159 |
emake
|
| 160 |
emake -C src/nmath/standalone shared $(use static-libs && echo static)
|
| 161 |
use doc && emake info pdf
|
| 162 |
}
|
| 163 |
|
| 164 |
src_install() {
|
| 165 |
default
|
| 166 |
emake -C src/nmath/standalone DESTDIR="${D}" install
|
| 167 |
|
| 168 |
if use doc; then
|
| 169 |
emake DESTDIR="${D}" install-info install-pdf
|
| 170 |
dosym ../manual /usr/share/doc/${PF}/html/manual
|
| 171 |
fi
|
| 172 |
|
| 173 |
cat > 99R <<-EOF
|
| 174 |
LDPATH=${R_DIR}/lib
|
| 175 |
R_HOME=${R_DIR}
|
| 176 |
EOF
|
| 177 |
doenvd 99R
|
| 178 |
use bash-completion && newbashcomp "${WORKDIR}"/${BCP} ${PN}
|
| 179 |
# The buildsystem has a different understanding of install_names than what
|
| 180 |
# we require. Since it builds modules like shared objects (wrong), many
|
| 181 |
# objects (all modules) get an incorrect install_name. Fixing the build
|
| 182 |
# system here is not really trivial.
|
| 183 |
if [[ ${CHOST} == *-darwin* ]] ; then
|
| 184 |
local mod
|
| 185 |
pushd "${ED}"/usr/lib/R > /dev/null
|
| 186 |
for mod in $(find . -name "*.dylib") ; do
|
| 187 |
mod=${mod#./}
|
| 188 |
install_name_tool -id "${EPREFIX}/usr/lib/R/${mod}" \
|
| 189 |
"${mod}"
|
| 190 |
done
|
| 191 |
popd > /dev/null
|
| 192 |
fi
|
| 193 |
}
|
| 194 |
|
| 195 |
pkg_postinst() {
|
| 196 |
if use java; then
|
| 197 |
einfo "Re-initializing java paths for ${P}"
|
| 198 |
R CMD javareconf
|
| 199 |
fi
|
| 200 |
}
|