Gentoo Archives: gentoo-commits

From: Andrew Ammerlaan <andrewammerlaan@××××××.net>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:master commit in: eclass/
Date: Thu, 07 May 2020 11:13:57
Message-Id: 1588808155.bdffb505eca41fccdac6625b586f7a7ed05159b4.andrewammerlaan@gentoo
1 commit: bdffb505eca41fccdac6625b586f7a7ed05159b4
2 Author: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
3 AuthorDate: Wed May 6 23:28:47 2020 +0000
4 Commit: Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net>
5 CommitDate: Wed May 6 23:35:55 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=bdffb505
7
8 new eclass for R packages, taken from the R_Overlay
9
10 Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com>
11
12 eclass/R-packages-guru.eclass | 54 +++++++++++++++++++++++++++++++++++++++++++
13 1 file changed, 54 insertions(+)
14
15 diff --git a/eclass/R-packages-guru.eclass b/eclass/R-packages-guru.eclass
16 new file mode 100644
17 index 0000000..e365b03
18 --- /dev/null
19 +++ b/eclass/R-packages-guru.eclass
20 @@ -0,0 +1,54 @@
21 +# Copyright 1999-2018 Gentoo Foundation
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +inherit eutils
25 +
26 +EXPORT_FUNCTIONS src_unpack src_prepare src_compile src_install pkg_postinst
27 +
28 +SLOT="0"
29 +KEYWORDS="~amd64 ~x86"
30 +IUSE="byte-compile"
31 +
32 +DEPEND="dev-lang/R"
33 +RDEPEND="${DEPEND}"
34 +
35 +R-packages-guru_src_unpack() {
36 + unpack ${A}
37 + if [[ -d "${PN//_/.}" ]] && [[ ! -d "${P}" ]]; then
38 + mv ${PN//_/.} "${P}"
39 + fi
40 +}
41 +
42 +if has "${EAPI:-0}" 0 1 2 3 4 5; then
43 + R-packages-guru_src_prepare() {
44 + epatch_user
45 + }
46 +else
47 + R-packages-guru_src_prepare() {
48 + default
49 + }
50 +fi
51 +
52 +R-packages-guru_src_compile() {
53 + MAKEFLAGS="CFLAGS=${CFLAGS// /\\ } CXXFLAGS=${CXXFLAGS// /\\ } FFLAGS=${FFLAGS// /\\ } FCFLAGS=${FCFLAGS// /\\ } LDFLAGS=${LDFLAGS// /\\ }" \
54 + R CMD INSTALL . -l "${WORKDIR}" $(use byte-compile && echo "--byte-compile")
55 +}
56 +
57 +R-packages-guru_src_install() {
58 + insinto /usr/$(get_libdir)/R/site-library
59 + doins -r "${WORKDIR}"/${PN//_/.}
60 +}
61 +
62 +R-packages-guru_pkg_postinst() {
63 + if [[ "${_UNRESOLVABLE_PACKAGES:-}" ]]; then
64 + # _UNRESOLVABLE_PACKAGES is only set if it has more than zero items
65 + local _max=${#_UNRESOLVABLE_PACKAGES[*]} i=
66 +
67 + einfo "Dependency(-ies):"
68 + for (( i=0; i<"${_max}"; i++ )); do
69 + einfo "- ${_UNRESOLVABLE_PACKAGES[$i]}"
70 + done
71 + einfo 'are (is) suggested by upstream but could not be found.'
72 + einfo 'Please install it manually from the R interpreter if you need it.'
73 + fi
74 +}