sci-libs/openblas: use pkg_setup to do the build env and checks.
authorBenda Xu <heroxbd@gentoo.org>
Sun, 4 Aug 2019 14:47:19 +0000 (22:47 +0800)
committerBenda Xu <heroxbd@gentoo.org>
Sun, 4 Aug 2019 14:47:51 +0000 (22:47 +0800)
Closes: https://github.com/gentoo/gentoo/pull/12576
Package-Manager: Portage-2.3.69, Repoman-2.3.12
Signed-off-by: Benda Xu <heroxbd@gentoo.org>
sci-libs/openblas/openblas-0.3.6.ebuild

index 3a91ce44fc1454d6c1ee6e2f399a0ec36311f16d..f52bf5c6ece1c08279ad7dbae27b5d974b98b770 100644 (file)
@@ -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