From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 48662138E66 for ; Sun, 23 Feb 2014 12:30:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 43704E0ACE; Sun, 23 Feb 2014 12:29:59 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id BD1C2E0ACE for ; Sun, 23 Feb 2014 12:29:58 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7E85433EBB7 for ; Sun, 23 Feb 2014 12:29:57 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 227D51872B for ; Sun, 23 Feb 2014 12:29:56 +0000 (UTC) From: "Mark Wright" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mark Wright" Message-ID: <1393158569.f0cad413cc0ca8ca505652fda0d4cb154d631e4c.gienah@gentoo> Subject: [gentoo-commits] proj/sci:lapack-multibuild commit in: sci-libs/openblas/, sci-libs/openblas/files/ X-VCS-Repository: proj/sci X-VCS-Files: sci-libs/openblas/files/openblas-9999-cpuid_x86.patch sci-libs/openblas/openblas-9999.ebuild X-VCS-Directories: sci-libs/openblas/ sci-libs/openblas/files/ X-VCS-Committer: gienah X-VCS-Committer-Name: Mark Wright X-VCS-Revision: f0cad413cc0ca8ca505652fda0d4cb154d631e4c X-VCS-Branch: lapack-multibuild Date: Sun, 23 Feb 2014 12:29:56 +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-Archives-Salt: 4441c030-2f01-475d-815b-8dc18cea916e X-Archives-Hash: fb257d2d271c8a18a21752b09d13da9c commit: f0cad413cc0ca8ca505652fda0d4cb154d631e4c Author: gienah gentoo org> AuthorDate: Sun Feb 23 12:29:29 2014 +0000 Commit: Mark Wright gentoo org> CommitDate: Sun Feb 23 12:29:29 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=f0cad413 multilib as well for openblas --- .../openblas/files/openblas-9999-cpuid_x86.patch | 27 ++++++++ sci-libs/openblas/openblas-9999.ebuild | 78 +++++++++++++++++++--- 2 files changed, 95 insertions(+), 10 deletions(-) diff --git a/sci-libs/openblas/files/openblas-9999-cpuid_x86.patch b/sci-libs/openblas/files/openblas-9999-cpuid_x86.patch new file mode 100644 index 0000000..c6f2991 --- /dev/null +++ b/sci-libs/openblas/files/openblas-9999-cpuid_x86.patch @@ -0,0 +1,27 @@ +--- openblas-9999-orig/cpuid_x86.c 2014-02-23 15:25:22.199394761 +1100 ++++ openblas-9999/cpuid_x86.c 2014-02-23 16:41:02.727372869 +1100 +@@ -57,9 +57,23 @@ + void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx); + #else + static inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx){ ++#if __x86_64 + __asm__ __volatile__ + ("cpuid": "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx) : "a" (op) : "cc"); +- ++#else ++ __asm volatile( ++ "push %%ebx\n\t" ++ "cpuid\n\t" ++ "mov %%ebx, (%4)\n\t" ++ "pop %%ebx" ++ :"=a" (*eax), ++ "=c" (*ecx), ++ "=d" (*edx) ++ :"a" (op), ++ "cc" ++ "S" (ebx) ++ :"memory"); ++#endif + } + #endif + diff --git a/sci-libs/openblas/openblas-9999.ebuild b/sci-libs/openblas/openblas-9999.ebuild index 3e3cd52..1c2b6c6 100644 --- a/sci-libs/openblas/openblas-9999.ebuild +++ b/sci-libs/openblas/openblas-9999.ebuild @@ -4,7 +4,7 @@ EAPI=5 -inherit alternatives-2 eutils fortran-2 git-r3 multilib multibuild toolchain-funcs +inherit alternatives-2 eutils fortran-2 git-r3 multibuild multilib-build toolchain-funcs DESCRIPTION="Optimized BLAS library based on GotoBLAS2" HOMEPAGE="http://xianyi.github.com/OpenBLAS/" @@ -20,6 +20,12 @@ KEYWORDS="" INT64_SUFFIX="int64" BASE_PROFNAME="openblas" +MULTILIB_WRAPPED_HEADERS=( + /usr/include/openblas/cblas.h + /usr/include/openblas/f77blas.h + /usr/include/openblas/openblas_config.h +) + get_openblas_flags() { local openblas_flags="" use dynamic && \ @@ -54,23 +60,66 @@ get_profname() { echo "${profname}" } -pkg_setup() { +get_libname() { + local libname="${BASE_PROFNAME}" + if [[ "${MULTIBUILD_ID}" =~ "_${INT64_SUFFIX}" ]]; then + libname+="_${INT64_SUFFIX}" + fi + echo "${libname}" +} + +int64_multilib_get_enabled_abis() { # The file /usr/include/openblas/openblas_config.h is generated during the install. # By listing the int64 variant first, the int64 variant /usr/include/openblas/openblas_config.h # will be overwritten by the normal variant in the install, which removes the # #define OPENBLAS_USE64BITINT for us. We then specify it in Cflags in the # /usr/lib64/pkg-config/openblas-int64-{threads,openmp}.pc file. - MULTIBUILD_VARIANTS=() + local MULTIBUILD_VARIANTS=( ) use int64 && \ MULTIBUILD_VARIANTS+=( ${BASE_PROFNAME}_${INT64_SUFFIX} ) - MULTIBUILD_VARIANTS+=( ${BASE_PROFNAME} ) + MULTIBUILD_VARIANTS+=( $(multilib_get_enabled_abis) ) + echo "${MULTIBUILD_VARIANTS[*]}" } -src_prepare() { +# @FUNCTION: _int64_multilib_multibuild_wrapper +# @USAGE: ... +# @INTERNAL +# @DESCRIPTION: +# Initialize the environment for ABI selected for multibuild. +_int64_multilib_multibuild_wrapper() { + debug-print-function ${FUNCNAME} "${@}" + + if [[ ! "${MULTIBUILD_ID}" =~ "_${INT64_SUFFIX}" ]]; then + local ABI=${MULTIBUILD_VARIANT} + multilib_toolchain_setup "${ABI}" + export FC="$(tc-getFC) $(get_abi_CFLAGS)" + export F77="$(tc-getF77) $(get_abi_CFLAGS)" + fi + "${@}" +} + +# @FUNCTION: int64_multilib_copy_sources +# @DESCRIPTION: +# Create a single copy of the package sources for each enabled ABI. +# +# The sources are always copied from initial BUILD_DIR (or S if unset) +# to ABI-specific build directory matching BUILD_DIR used by +# multilib_foreach_abi(). +int64_multilib_copy_sources() { + debug-print-function ${FUNCNAME} "${@}" + + local MULTIBUILD_VARIANTS=( $(int64_multilib_get_enabled_abis) ) multibuild_copy_sources } +src_prepare() { + epatch "${FILESDIR}/${PN}-9999-cpuid_x86.patch" + local MULTIBUILD_VARIANTS=( $(int64_multilib_get_enabled_abis) ) + int64_multilib_copy_sources +} + src_configure() { + local MULTIBUILD_VARIANTS=( $(int64_multilib_get_enabled_abis) ) my_configure() { # lapack and lapacke are not modified from upstream lapack sed \ @@ -81,15 +130,17 @@ src_configure() { -e "s:^#\s*\(NO_LAPACKE\)\s*=.*:\1=1:" \ -i Makefile.rule || die } - multibuild_foreach_variant run_in_build_dir my_configure + multibuild_foreach_variant run_in_build_dir _int64_multilib_multibuild_wrapper my_configure } src_compile() { + local MULTIBUILD_VARIANTS=( $(int64_multilib_get_enabled_abis) ) # openblas already does multi-jobs MAKEOPTS+=" -j1" my_src_compile () { local openblas_flags=$(get_openblas_flags) local profname=$(get_profname) + local libname=$(get_libname) einfo "Compiling profile ${profname}" # cflags already defined twice unset CFLAGS @@ -110,7 +161,7 @@ src_compile() { Description: ${DESCRIPTION} Version: ${PV} URL: ${HOMEPAGE} - Libs: -L\${libdir} -l${MULTIBUILD_ID} + Libs: -L\${libdir} -l${libname} Libs.private: -lm EOF if [[ "${MULTIBUILD_ID}" =~ "_${INT64_SUFFIX}" ]]; then @@ -126,18 +177,20 @@ src_compile() { fi mv libs/libopenblas* . || die } - multibuild_foreach_variant run_in_build_dir my_src_compile + multibuild_foreach_variant run_in_build_dir _int64_multilib_multibuild_wrapper my_src_compile } src_test() { + local MULTIBUILD_VARIANTS=( $(int64_multilib_get_enabled_abis) ) my_src_test () { local openblas_flags=$(get_openblas_flags) emake tests ${openblas_flags} } - multibuild_foreach_variant run_in_build_dir my_src_test + multibuild_foreach_variant run_in_build_dir _int64_multilib_multibuild_wrapper my_src_test } src_install() { + local MULTIBUILD_VARIANTS=( $(int64_multilib_get_enabled_abis) ) my_src_install () { local openblas_flags=$(get_openblas_flags) local profname=$(get_profname) @@ -167,8 +220,13 @@ src_install() { eend $? done fi + if [[ ${#MULTIBUILD_VARIANTS[@]} -gt 1 ]]; then + multilib_prepare_wrappers + multilib_check_headers + fi } - multibuild_foreach_variant run_in_build_dir my_src_install + multibuild_foreach_variant run_in_build_dir _int64_multilib_multibuild_wrapper my_src_install + multilib_install_wrappers dodoc GotoBLAS_{01Readme,03FAQ,04FAQ,05LargePage,06WeirdPerformance}.txt dodoc *md Changelog.txt