commit:     64ff822f7d122a08ab0043641401df9207800a5c
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Sun Aug  4 14:47:19 2019 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Sun Aug  4 14:47:51 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=64ff822f

sci-libs/openblas: use pkg_setup to do the build env and checks.

Closes: https://github.com/gentoo/gentoo/pull/12576
Package-Manager: Portage-2.3.69, Repoman-2.3.12
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 sci-libs/openblas/openblas-0.3.6.ebuild | 47 +++++++++++++++------------------
 1 file changed, 21 insertions(+), 26 deletions(-)

diff --git a/sci-libs/openblas/openblas-0.3.6.ebuild 
b/sci-libs/openblas/openblas-0.3.6.ebuild
index 3a91ce44fc1..f52bf5c6ece 100644
--- a/sci-libs/openblas/openblas-0.3.6.ebuild
+++ b/sci-libs/openblas/openblas-0.3.6.ebuild
@@ -23,32 +23,26 @@ DEPEND="virtual/pkgconfig"
 
 PATCHES=( "${FILESDIR}/shared-blas-lapack.patch" )
 
-src_prepare() {
-       default
-       # Set compiler and common CFLAGS.
-       sed \
-               -e "/^#\s*CC/cCC=$(tc-getCC)" \
-               -e "/^#\s*FC/cFC=$(tc-getFC)" \
-               -e "/^#\s*COMMON_OPT/cCOMMON_OPT=${CFLAGS}" \
-               -i "${S}"/Makefile.rule || die
-}
+pkg_setup() {
+       fortran-2_pkg_setup
+       use openmp && tc-check-openmp
+       export CC=$(tc-getCC) FC=$(tc-getFC)
 
-openblas_flags() {
-       local flags=()
        use dynamic && \
-               flags+=( DYNAMIC_ARCH=1 TARGET=GENERIC NUM_THREADS=64 
NO_AFFINITY=1 )
+               export DYNAMIC_ARCH=1 TARGET=GENERIC NUM_THREADS=64 
NO_AFFINITY=1
+
+       # disable submake with -j
+       export MAKE_NB_JOBS=-1
+
+       USE_THREAD=0
        if use openmp; then
-               tc-check-openmp
-               flags+=( USE_THREAD=1 USE_OPENMP=1 )
+               USE_THREAD=1; USE_OPENMP=1;
        elif use pthread; then
-               flags+=( USE_THREAD=1 USE_OPENMP=0 )
-       else
-               flags+=( USE_THREAD=0 ) # serial
+               USE_THREAD=1; USE_OPENMP=0;
        fi
-       flags+=( DESTDIR="${D}" PREFIX="${EPREFIX}/usr" )
-       flags+=( OPENBLAS_INCLUDE_DIR='$(PREFIX)'/include/${PN} )
-       flags+=( OPENBLAS_LIBRARY_DIR='$(PREFIX)'/$(get_libdir) )
-       echo "${flags[@]}"
+       export USE_THREAD USE_OPENMP
+
+       export PREFIX="${EPREFIX}/usr"
 }
 
 src_unpack () {
@@ -60,19 +54,20 @@ src_unpack () {
 }
 
 src_compile () {
-       emake $(openblas_flags)
-       emake -Cinterface shared-blas-lapack $(openblas_flags)
+       emake
+       emake -Cinterface shared-blas-lapack
        if use index-64bit; then
-               emake -C"${S}-index-64bit" $(openblas_flags) INTERFACE64=1 
LIBPREFIX=libopenblas64
+               emake -C"${S}-index-64bit" INTERFACE64=1 LIBPREFIX=libopenblas64
        fi
 }
 
 src_test() {
-       emake tests $(openblas_flags)
+       emake tests
 }
 
 src_install () {
-       emake install $(openblas_flags)
+       emake install DESTDIR="${D}" 
OPENBLAS_INCLUDE_DIR='$(PREFIX)'/include/${PN} \
+               OPENBLAS_LIBRARY_DIR='$(PREFIX)'/$(get_libdir)
        dodoc GotoBLAS_*.txt *.md Changelog.txt
 
        if use eselect-ldso; then

Reply via email to