commit:     374cd76846cd1bfcaa3821ce56d747b0d671e00e
Author:     gienah <gienah <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 13 10:14:04 2014 +0000
Commit:     Mark Wright <gienah <AT> gentoo <DOT> org>
CommitDate: Mon Oct 13 10:14:04 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=374cd768

Refactor to lapack-reference use the fortran-int64.eclass. Add the virtual to 
PDEPEND. Call fortran-int64_ensure_blas to check the blas pkg-config file is 
available, and the blas-int64 pkg-config file if the int64 USE flag is 
specified. Remove the sed -e /export/s:lapack::g line for CMakeLists.txt, as I 
do not wish to change this line: "export(TARGETS ${ALL_TARGETS} FILE 
lapack-targets.cmake)".  Change the addition of the xblas library to the 
Requires of the pkg-config file to allow for using an int64 build of xblas, by 
renaming BLAS_PROFNAME to BLAS_REQUIRES then including xblas in the 
-DBLAS_REQUIRES in src_configure. Try to fix 
https://github.com/gentoo-science/sci/issues/275 and Bug 524830 - 
sci-libs/arpack - configure: ld: cannot find -llapack_rs6k by calculating the 
blas pkg-config file to add to the Requires - needs testing.

---
 sci-libs/lapack-reference/ChangeLog                |  14 ++
 .../lapack-reference/lapack-reference-9999.ebuild  | 161 +++++----------------
 2 files changed, 50 insertions(+), 125 deletions(-)

diff --git a/sci-libs/lapack-reference/ChangeLog 
b/sci-libs/lapack-reference/ChangeLog
index d50e3cc..4fcbb7b 100644
--- a/sci-libs/lapack-reference/ChangeLog
+++ b/sci-libs/lapack-reference/ChangeLog
@@ -2,6 +2,20 @@
 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
 # $Header: /var/cvsroot/gentoo-x86/sci-libs/lapack-reference/ChangeLog,v 1.51 
2010/10/02 20:49:51 grobian Exp $
 
+  13 Oct 2014; Mark Wright <[email protected]> lapack-reference-9999.ebuild:
+  Refactor to lapack-reference use the fortran-int64.eclass. Add the virtual to
+  PDEPEND. Call fortran-int64_ensure_blas to check the blas pkg-config file is
+  available, and the blas-int64 pkg-config file if the int64 USE flag is
+  specified. Remove the sed -e /export/s:lapack::g line for CMakeLists.txt, as
+  I do not wish to change this line: "export(TARGETS ${ALL_TARGETS} FILE
+  lapack-targets.cmake)". Change the addition of the xblas library to the
+  Requires of the pkg-config file to allow for using an int64 build of xblas,
+  by renaming BLAS_PROFNAME to BLAS_REQUIRES then including xblas in the
+  -DBLAS_REQUIRES in src_configure. Try to fix
+  https://github.com/gentoo-science/sci/issues/275 and Bug 524830 -
+  sci-libs/arpack - configure: ld: cannot find -llapack_rs6k by calculating the
+  blas pkg-config file to add to the Requires - needs testing.
+
   08 Oct 2014; Honza Macháček <[email protected]>
   lapack-reference-9999.ebuild:
   The circular dependency on virtual/lapack removed.

diff --git a/sci-libs/lapack-reference/lapack-reference-9999.ebuild 
b/sci-libs/lapack-reference/lapack-reference-9999.ebuild
index 02e8871..75000dd 100644
--- a/sci-libs/lapack-reference/lapack-reference-9999.ebuild
+++ b/sci-libs/lapack-reference/lapack-reference-9999.ebuild
@@ -3,7 +3,9 @@
 # $Header: $
 
 EAPI=5
-inherit fortran-2 cmake-utils multibuild alternatives-2 multilib-build 
toolchain-funcs
+EBASE_PROFNAME="reflapack"
+ESTATIC_MULTIBUILD=1
+inherit fortran-2 cmake-utils multibuild alternatives-2 multilib-build 
toolchain-funcs fortran-int64
 
 if [[ ${PV} == "9999" ]] ; then
        # The master ESVN_REPO_URI is difficult to access, the git mirror is 
easier
@@ -33,101 +35,22 @@ IUSE="int64 static-libs test xblas"
 RDEPEND="
        >=virtual/blas-2.1-r1[int64?]
        xblas? ( sci-libs/xblas[fortran] )"
-
 DEPEND="${RDEPEND}
        virtual/pkgconfig"
+PDEPEND="
+       >=virtual/lapack-3.5-r2[int64?]"
 
 S="${WORKDIR}/${MYP}"
 
-INT64_SUFFIX="int64"
-STATIC_SUFFIX="static"
-BASE_PROFNAME="reflapack"
-
-get_profname() {
-       local profname="${1:-${BASE_PROFNAME}}"
-       if [[ "${MULTIBUILD_ID}" =~ "_${INT64_SUFFIX}" ]]; then
-               profname+="-${INT64_SUFFIX}"
-       fi
-       echo "${profname}"
-}
-
-get_variant_suffix() {
-       local profname="${1:-$(get_profname)}"
-       local variant_suffix="${profname//${BASE_PROFNAME}/}"
-       echo "${variant_suffix}"
-}
-
-get_blas_module() {
-       local module_name="blas"
-       if [[ "${MULTIBUILD_ID}" =~ "_${INT64_SUFFIX}" ]]; then
-               module_name+="-${INT64_SUFFIX}"
-       fi
-       echo "${module_name}"
-}
-
-get_blas_profname() {
-       local profname="${1:-$(get_profname)}"
-       local variant_suffix=$(get_variant_suffix "${profname}")
-       local blas_profile=$(eselect $(get_blas_module) show)
-       local selected_blas_profile="${blas_profile}"
-       local blas_no_int64="${selected_blas_profile/-int64/}"
-       local blas_base="${blas_no_int64%-*}"
-       local 
blas_name="${blas_no_int64/${blas_base}/${blas_base}${variant_suffix}}"
-       echo "${blas_name}"
-}
-
-get_lapack_module() {
-       local module_name="lapack"
-       if [[ "${MULTIBUILD_ID}" =~ "_${INT64_SUFFIX}" ]]; then
-               module_name+="-${INT64_SUFFIX}"
-       fi
-       echo "${module_name}"
-}
-
-int64_multilib_get_enabled_abis() {
-       local MULTILIB_VARIANTS=( $(multilib_get_enabled_abis) )
-       local MULTILIB_INT64_VARIANTS=()
-       local i
-       for i in "${MULTILIB_VARIANTS[@]}"; do
-               if use int64 && [[ "${i}" =~ 64$ ]]; then
-                       MULTILIB_INT64_VARIANTS+=( "${i}_${INT64_SUFFIX}" )
-               fi
-               MULTILIB_INT64_VARIANTS+=( "${i}" )
-       done
-       local MULTIBUILD_VARIANTS=()
-       local j
-       for j in "${MULTILIB_INT64_VARIANTS[@]}"; do
-               use static-libs && MULTIBUILD_VARIANTS+=( 
"${j}_${STATIC_SUFFIX}" )
-               MULTIBUILD_VARIANTS+=( "${j}" )
-       done
-       echo "${MULTIBUILD_VARIANTS[@]}"
-}
-
-# @FUNCTION: _int64_multilib_multibuild_wrapper
-# @USAGE: <argv>...
-# @INTERNAL
-# @DESCRIPTION:
-# Initialize the environment for ABI selected for multibuild.
-_int64_multilib_multibuild_wrapper() {
-       debug-print-function ${FUNCNAME} "${@}"
-       local v="${MULTIBUILD_VARIANT/_${INT64_SUFFIX}/}"
-       local ABI="${v/_${STATIC_SUFFIX}/}"
-       multilib_toolchain_setup "${ABI}"
-       "${@}"
-}
-
 src_prepare() {
-       local MULTIBUILD_VARIANTS=( $(int64_multilib_get_enabled_abis) )
-       if use int64; then
-               local blas_int64_profname=$(get_blas_profname 
"${BASE_PROFNAME}-${INT64_SUFFIX}")
-               $(tc-getPKG_CONFIG) --exists "${blas_int64_profname}" || die 
"Use int64 requires ${blas_int64_profname}"
-       fi
+       fortran-int64_ensure_blas
 
        # rename library to avoid collision with other lapack implementations
-       local LIBNAME="${PROFNAME//-/_}"
+       # ${PROFNAME}, ${LIBNAME} and ${BLAS_REQUIRES} are not defined here, 
they
+       # are in single quotes in the following seds.  They are set later by
+       # defining a cmake variables with -DPROFNAME etc in src_configure.
        sed -i \
                -e 's:BINARY_DIR}/lapack.pc:BINARY_DIR}/${PROFNAME}.pc:' \
-               -e '/export/s:lapack:${LIBNAME}:g' \
                -e '/ALL_TARGETS/s:lapack):${LIBNAME}):' \
                -e '/LAPACK_LIBRARIES/s:lapack:${LIBNAME}:g' \
                CMakeLists.txt || die
@@ -135,8 +58,9 @@ src_prepare() {
                -e 's:(lapack:(${LIBNAME}:g' \
                SRC/CMakeLists.txt || die
        sed -i \
+               -e '/Name: /s:lapack:${PROFNAME}:' \
                -e 's:-llapack:-l${LIBNAME}:g' \
-               -e 's/Requires: blas/Requires: 
${BLAS_PROFNAME}\nFflags=${LAPACK_PKGCONFIG_FFLAGS}/' \
+               -e '/Requires: 
/s:blas:${BLAS_REQUIRES}\nFflags=${LAPACK_PKGCONFIG_FFLAGS}:' \
                lapack.pc.in || die
        # some string does not get passed properly
        sed -i \
@@ -146,42 +70,32 @@ src_prepare() {
        sed -i \
                -e '/lapack_install_library(tmglib)/d' \
                TESTING/MATGEN/CMakeLists.txt || die
-       # if xblas is used add it in the .pc file
-       if use xblas ; then
-               sed -i \
-                       -e '/Requires/s:blas:blas xblas:' \
-                       lapack.pc.in || die
-       fi
 }
 
 src_configure() {
-       local MULTIBUILD_VARIANTS=( $(int64_multilib_get_enabled_abis) )
+       local MULTIBUILD_VARIANTS=( $(fortran-int64_multilib_get_enabled_abis) )
        my_src_configure() {
-               local profname=$(get_profname)
+               local profname=$(fortran-int64_get_profname)
                local libname="${profname//-/_}"
-               local blas_profname=$(get_blas_profname)
+               local blas_profname=$(fortran-int64_get_blas_profname)
+               local xblas_profname=$(fortran-int64_get_xblas_profname)
+               local blas_requires="${blas_profname}"
+               use xblas && \
+                       blas_requires+=" ${xblas_profname}"
                local mycmakeargs=(
                        -DPROFNAME="${profname}"
-                       -DBLAS_PROFNAME="${blas_profname}"
+                       -DBLAS_REQUIRES="${blas_requires}"
                        -DLIBNAME="${libname}"
                        -DUSE_OPTIMIZED_BLAS=ON
                        -DBLAS_LIBRARIES="$($(tc-getPKG_CONFIG) --libs 
${blas_profname})"
                        $(cmake-utils_use_build test TESTING)
                        $(cmake-utils_use_use xblas XBLAS)
-                       $@
+                       -DCMAKE_C_FLAGS="$($(tc-getPKG_CONFIG) --cflags 
${blas_profname}) ${CFLAGS}"
+                       -DCMAKE_CXX_FLAGS="$($(tc-getPKG_CONFIG) --cflags 
${blas_profname}) ${CXXFLAGS}"
+                       -DCMAKE_Fortran_FLAGS="$($(tc-getPKG_CONFIG) --cflags 
${blas_profname}) $(get_abi_CFLAGS) 
$(fortran-int64_get_fortran_int64_abi_fflags) ${FCFLAGS}"
+                       
-DLAPACK_PKGCONFIG_FFLAGS="$(fortran-int64_get_fortran_int64_abi_fflags)"
                )
-               if [[ "${MULTIBUILD_ID}" =~ "_${INT64_SUFFIX}" ]]; then
-                       mycmakeargs+=(
-                               -DCMAKE_Fortran_FLAGS="$($(tc-getPKG_CONFIG) 
--cflags ${blas_profname}) $(get_abi_CFLAGS) -fdefault-integer-8 ${FCFLAGS}"
-                               -DLAPACK_PKGCONFIG_FFLAGS="-fdefault-integer-8"
-                       )
-               else
-                       mycmakeargs+=(
-                               -DCMAKE_Fortran_FLAGS="$($(tc-getPKG_CONFIG) 
--cflags ${blas_profname}) $(get_abi_CFLAGS) ${FCFLAGS}"
-                               -DLAPACK_PKGCONFIG_FFLAGS=""
-                       )
-               fi
-               if [[ "${MULTIBUILD_ID}" =~ "_${STATIC_SUFFIX}" ]]; then
+               if $(fortran-int64_is_static_build); then
                        mycmakeargs+=(
                                -DBUILD_SHARED_LIBS=OFF
                                -DBUILD_STATIC_LIBS=ON
@@ -192,34 +106,31 @@ src_configure() {
                                -DBUILD_STATIC_LIBS=OFF
                        )
                fi
-               mycmakeargs+=(
-                       -DCMAKE_C_FLAGS="$($(tc-getPKG_CONFIG) --cflags 
${blas_profname}) ${CFLAGS}"
-                       -DCMAKE_CXX_FLAGS="$($(tc-getPKG_CONFIG) --cflags 
${blas_profname}) ${CXXFLAGS}"
-               )
                cmake-utils_src_configure
        }
-       multibuild_foreach_variant _int64_multilib_multibuild_wrapper 
my_src_configure
+       multibuild_foreach_variant fortran-int64_multilib_multibuild_wrapper 
my_src_configure
 }
 
 src_compile() {
-       local MULTIBUILD_VARIANTS=( $(int64_multilib_get_enabled_abis) )
-       multibuild_foreach_variant _int64_multilib_multibuild_wrapper 
cmake-utils_src_compile
+       local MULTIBUILD_VARIANTS=( $(fortran-int64_multilib_get_enabled_abis) )
+       multibuild_foreach_variant fortran-int64_multilib_multibuild_wrapper 
cmake-utils_src_compile
 }
 
 src_test() {
-       local MULTIBUILD_VARIANTS=( $(int64_multilib_get_enabled_abis) )
-       multibuild_foreach_variant _int64_multilib_multibuild_wrapper 
cmake-utils_src_test
+       local MULTIBUILD_VARIANTS=( $(fortran-int64_multilib_get_enabled_abis) )
+       multibuild_foreach_variant fortran-int64_multilib_multibuild_wrapper 
cmake-utils_src_test
 }
 
 src_install() {
-       local MULTIBUILD_VARIANTS=( $(int64_multilib_get_enabled_abis) )
+       local MULTIBUILD_VARIANTS=( $(fortran-int64_multilib_get_enabled_abis) )
        my_src_install()  {
                cmake-utils_src_install
-               if [[ ! "${MULTIBUILD_ID}" =~ "_${STATIC_SUFFIX}" ]]; then
-                       local profname=$(get_profname)
-                       alternatives_for $(get_lapack_module) $(get_profname 
"reference") 0 \
-                               
/usr/$(get_libdir)/pkgconfig/$(get_lapack_module).pc ${profname}.pc
+               if ! $(fortran-int64_is_static_build); then
+                       local profname=$(fortran-int64_get_profname)
+                       local provider=$(fortran-int64_get_lapack_provider)
+                       alternatives_for ${provider} 
$(fortran-int64_get_profname "reference") 0 \
+                               /usr/$(get_libdir)/pkgconfig/${provider}.pc 
${profname}.pc
                fi
        }
-       multibuild_foreach_variant _int64_multilib_multibuild_wrapper 
my_src_install
+       multibuild_foreach_variant fortran-int64_multilib_multibuild_wrapper 
my_src_install
 }

Reply via email to