commit:     b41f534524a6add32b78ff817576d8640a52b59a
Author:     Justin Lecher <jlec <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 29 11:22:47 2017 +0000
Commit:     Justin Lecher <jlec <AT> gentoo <DOT> org>
CommitDate: Sun Jan 29 11:59:22 2017 +0000
URL:        https://gitweb.gentoo.org/proj/sci.git/commit/?id=b41f5345

sci-libs/shtools: Multiple QA enhancements

Properly handle fortran
Properly handle multiple python versions
fix doc installation dir respect FCFLAGS, AR, FC, RANLIB
Add support for static-libs
Drop unnecessary . from DESCRIPTION

Package-Manager: Portage-2.3.3, Repoman-2.3.1
Signed-off-by: Justin Lecher <jlec <AT> gentoo.org>

 sci-libs/shtools/shtools-4.0.ebuild | 59 +++++++++++++++++++++++++++----------
 1 file changed, 43 insertions(+), 16 deletions(-)

diff --git a/sci-libs/shtools/shtools-4.0.ebuild 
b/sci-libs/shtools/shtools-4.0.ebuild
index 149c2bb..43bf743 100644
--- a/sci-libs/shtools/shtools-4.0.ebuild
+++ b/sci-libs/shtools/shtools-4.0.ebuild
@@ -5,7 +5,7 @@
 EAPI=6
 
 if [[ ${PV} == 9999 ]]; then
-       ECLASS="git-r3"
+       _ECLASS="git-r3"
        EGIT_REPO_URI="https://github.com/heroxbd/${PN^^}.git";
        S="${WORKDIR}"/${P}
 else
@@ -14,38 +14,65 @@ else
        S="${WORKDIR}"/${PN^^}-${PV/_/-}
 fi
 
-PYTHON_COMPAT=( python2_7 )
+PYTHON_COMPAT=( python{2_7,3_{4,5}} )
 
-inherit python-r1 flag-o-matic toolchain-funcs ${ECLASS}
+inherit fortran-2 flag-o-matic python-single-r1 toolchain-funcs ${_ECLASS}
 
-DESCRIPTION="Spherical harmonic transforms and reconstructions, rotations."
+DESCRIPTION="Spherical harmonic transforms and reconstructions, rotations"
 HOMEPAGE="http://shtools.ipgp.fr";
 
 LICENSE="BSD-4"
 SLOT="0"
 KEYWORDS="~amd64"
+IUSE="static-libs"
 
-RDEPEND="sci-libs/fftw:*
-       sys-devel/gcc:*[fortran]
+RDEPEND="
+       dev-python/numpy[${PYTHON_USEDEP}]
+       dev-python/matplotlib[${PYTHON_USEDEP}]
+       sci-libs/fftw:3.0=
        virtual/lapack
        virtual/blas
-       dev-python/numpy
-       dev-python/matplotlib
        ${PYTHON_DEPS}"
 
-DEPEND="${RDEPEND}"
+DEPEND="${RDEPEND}
+       virtual/pkgconfig
+"
 
-src_compile() {
+src_prepare() {
        append-ldflags -shared # needed by f2py
-        # needed by f2py in fortran 77 mode
-       use amd64 && append-fflags -fPIC
-       OPTS=( LAPACK=$($(tc-getPKG_CONFIG) lapack --libs-only-l)
+       # needed by f2py in fortran 77 mode
+       append-fflags -fPIC
+       [[ $(tc-getFC) =~ gfortran ]] && append-fflags -fno-second-underscore
+       export _pyver=$(python_is_python3 && echo 3 || echo 2)
+       export OPTS=(
+               LAPACK=$($(tc-getPKG_CONFIG) lapack --libs-only-l)
                BLAS=$($(tc-getPKG_CONFIG) blas --libs-only-l)
                FFTW=$($(tc-getPKG_CONFIG) fftw3 --libs-only-l)
-               PYTHON_VERSION=2 )
-       emake python ${OPTS[@]}
+               F95=$(tc-getFC)
+               F95FLAGS="${FCFLAGS}"
+               AR=$(tc-getAR)
+               RLIB=$(tc-getRANLIB)
+               PYTHON_VERSION=${_pyver}
+       )
+
+       sed \
+               -e '/mv/s:.so:*.so:g' \
+               -e "/SYSDOCPATH/s:${PN}:${PF}:g" \
+               -e "/www/s:/$:/html/:g" \
+               -i Makefile || die
+
+       default
+}
+
+src_compile() {
+       emake fortran "${OPTS[@]}"
+       emake python${_pyver} "${OPTS[@]}"
 }
 
 src_install() {
-       emake PREFIX="${EPREFIX}/usr" DESTDIR="${D}" ${OPTS[@]} install
+       emake PREFIX="${EPREFIX}/usr" DESTDIR="${D}" "${OPTS[@]}" 
install-fortran
+       emake PREFIX="${EPREFIX}/usr" DESTDIR="${D}" "${OPTS[@]}" 
install-python${_pyver}
+       if ! use static-libs; then
+               rm -rf "${ED}"/usr/$(get_libdir)/*.a || die
+       fi
 }

Reply via email to