From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id CFF7B15808B for ; Fri, 15 Apr 2022 20:34:41 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CC6EBE097E; Fri, 15 Apr 2022 20:34:32 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E8676E097D for ; Fri, 15 Apr 2022 20:34:31 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E19F33420F5 for ; Fri, 15 Apr 2022 20:34:30 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6935F430 for ; Fri, 15 Apr 2022 20:34:27 +0000 (UTC) From: "Alessandro Barbieri" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Alessandro Barbieri" Message-ID: <1650054861.4ec6a5d7055d7197a3eb9f8b9ab95a0c9a9e1b83.Alessandro-Barbieri@gentoo> Subject: [gentoo-commits] repo/proj/guru:dev commit in: eclass/ X-VCS-Repository: repo/proj/guru X-VCS-Files: eclass/R-packages.eclass X-VCS-Directories: eclass/ X-VCS-Committer: Alessandro-Barbieri X-VCS-Committer-Name: Alessandro Barbieri X-VCS-Revision: 4ec6a5d7055d7197a3eb9f8b9ab95a0c9a9e1b83 X-VCS-Branch: dev Date: Fri, 15 Apr 2022 20:34:27 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 5155c3ea-512c-4c88-b7be-62ecbead2970 X-Archives-Hash: 45145139fcc7f1ed3bb7b4eb1dbef604 commit: 4ec6a5d7055d7197a3eb9f8b9ab95a0c9a9e1b83 Author: Alessandro Barbieri gmail com> AuthorDate: Fri Apr 15 17:46:55 2022 +0000 Commit: Alessandro Barbieri gmail com> CommitDate: Fri Apr 15 20:34:21 2022 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=4ec6a5d7 R-packages.eclass: add documentation comments Signed-off-by: Alessandro Barbieri gmail.com> eclass/R-packages.eclass | 120 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 97 insertions(+), 23 deletions(-) diff --git a/eclass/R-packages.eclass b/eclass/R-packages.eclass index 6cbf9d7d3..51765af2b 100644 --- a/eclass/R-packages.eclass +++ b/eclass/R-packages.eclass @@ -1,9 +1,25 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +# @ECLASS: R-packages.eclass +# @AUTHOR: +# André Erdmann +# Denis Dupeyron +# Benda Xu +# Alessandro Barbieri +# @BLURB: eclass to build R packages +# @MAINTAINER: +# Alessandro Barbieri +# @SUPPORTED_EAPIS: 7 + inherit eutils optfeature toolchain-funcs -EXPORT_FUNCTIONS src_unpack src_prepare src_compile src_install pkg_postinst +case ${EAPI} in + 7) ;; + *) die "${ECLASS}: EAPI ${EAPI} unsupported." +esac + +EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install pkg_postinst SRC_URI="mirror://cran/src/contrib/${PN}_${PV}.tar.gz" HOMEPAGE="https://cran.r-project.org/package=${PN}" @@ -12,14 +28,24 @@ SLOT="0" DEPEND="dev-lang/R" RDEPEND="${DEPEND}" +BDEPEND="sys-apps/pkgcore" -dodocrm() { +# @FUNCTION: _movelink +# @INTERNAL +# @USAGE: [ ] +# @DESCRIPTION: +# will contain symlinks to everything in +_movelink() { if [ -e "${1}" ]; then - dodoc -r "${1}" - rm -rf "${1}" || die + local rp1="$(realpath ${1})" || die + mv "${rp1}" "${2}" || die + cp -rsf "${2}" "${rp1}" || die fi } +# @FUNCTION: R-packages_src_unpack +# @DESCRIPTION: +# function to unpack R packages into the right folder R-packages_src_unpack() { unpack ${A} if [[ -d "${PN//_/.}" ]] && [[ ! -d "${P}" ]]; then @@ -27,43 +53,91 @@ R-packages_src_unpack() { fi } +# @FUNCTION: R-packages_src_prepare +# @DESCRIPTION: +# function to remove unwanted files from the sources R-packages_src_prepare() { rm -f LICENSE || die default } +# @FUNCTION: R-packages_src_configure +# @DESCRIPTION: +# dummy function to disable configure +R-packages_src_configure() { :; } + +# @FUNCTION: R-packages_src_compile +# @DESCRIPTION: +# function that will pass some environment variables to R and then build/install the package R-packages_src_compile() { - MAKEFLAGS="AR=$(tc-getAR) CFLAGS=${CFLAGS// /\\ } CXXFLAGS=${CXXFLAGS// /\\ } FFLAGS=${FFLAGS// /\\ } FCFLAGS=${FCFLAGS// /\\ } LDFLAGS=${LDFLAGS// /\\ }" R CMD INSTALL . -l "${WORKDIR}" "--byte-compile" || die + MAKEFLAGS=" \ + ${MAKEFLAGS// /\\ } \ + AR=$(tc-getAR) \ + CC=$(tc-getCC) \ + CPP=$(tc-getCPP) \ + CXX=$(tc-getCXX) \ + FC=$(tc-getFC) \ + LD=$(tc-getLD) \ + NM=$(tc-getNM) \ + RANLIB=$(tc-getRANLIB) \ + CFLAGS=${CFLAGS// /\\ } \ + CPPFLAGS=${CPPFLAGS// /\\ } \ + CXXFLAGS=${CXXFLAGS// /\\ } \ + FFLAGS=${FFLAGS// /\\ } \ + FCFLAGS=${FCFLAGS// /\\ } \ + LDFLAGS=${LDFLAGS// /\\ } \ + MAKEOPTS=${MAKEOPTS// /\\ } \ + " \ + R CMD INSTALL . -l "${WORKDIR}" "--byte-compile" || die } + +# @FUNCTION: R-packages_src_install +# @DESCRIPTION: +# function to move the files in the right folders +# documentation and examples to docsdir, symlinked back to R site-library (to allow access from within R) +# everything else to R site-library R-packages_src_install() { - cd "${WORKDIR}/${PN//_/.}" || die + pushd "${WORKDIR}/${PN//_/.}" || die - dodocrm examples || die - #dodocrm DESCRIPTION || die #keep this - dodocrm NEWS.md || die - dodocrm README.md || die - dodocrm html || die + local DOCS_DIR="${ED}/usr/share/doc/${PF}" + mkdir -p "${DOCS_DIR}" || die + + for i in NEWS.md README.md DESCRIPTION examples ; do + _movelink "${i}" "${DOCS_DIR}/${i}" || die + done + + if [ -e html ]; then + _movelink html "${DOCS_DIR}/html" || die + docompress -x "${DOCS_DIR}/html" + fi if [ -e doc ]; then - if [ -e doc/html ]; then - docinto "${DOCSDIR}/html" - dodoc -r doc/*.html - rm -r doc/*.html || die - docompress -x "${DOCSDIR}/html" - fi - - docinto "${DOCSDIR}" - dodoc -r doc/. - rm -r doc || die + pushd doc || die + for i in * ; do + _movelink "${i}" "${DOCS_DIR}/${i}" || die + done + popd || die + fi + if [ -e doc/html ]; then + docompress -x "${DOCS_DIR}/html" fi + docompress -x "${DOCS_DIR}" insinto "/usr/$(get_libdir)/R/site-library" doins -r "${WORKDIR}/${PN//_/.}" } +# @FUNCTION: R-packages_pkg_postinst +# @DESCRIPTION: +# function that will prompt to install the suggested packages if they exist R-packages_pkg_postinst() { if [ -v SUGGESTED_PACKAGES ]; then - optfeature "having the upstream suggested packages" "${SUGGESTED_PACKAGES}" + for p in ${SUGGESTED_PACKAGES} ; do + pexist=$(pquery -n1 "${p}" 2>/dev/null) || die + if [ -n "${pexist}" ]; then + optfeature "having the upstream suggested package" "${p}" + fi + done fi }