public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Justin Lecher" <jlec@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/sci:master commit in: sci-libs/openblas/
Date: Mon,  6 Oct 2014 05:56:37 +0000 (UTC)	[thread overview]
Message-ID: <1411815957.5b5e9e7d6c21a48ad35d3fc033902201a71a06d4.jlec@gentoo> (raw)

commit:     5b5e9e7d6c21a48ad35d3fc033902201a71a06d4
Author:     gienah <gienah <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 18 14:01:11 2014 +0000
Commit:     Justin Lecher <jlec <AT> gentoo <DOT> org>
CommitDate: Sat Sep 27 11:05:57 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=5b5e9e7d

multibuild openblas when USE=int64 is specified.

---
 sci-libs/openblas/ChangeLog            |   3 +
 sci-libs/openblas/openblas-9999.ebuild | 221 +++++++++++++++++++++------------
 2 files changed, 142 insertions(+), 82 deletions(-)

diff --git a/sci-libs/openblas/ChangeLog b/sci-libs/openblas/ChangeLog
index caf34f2..b4f5886 100644
--- a/sci-libs/openblas/ChangeLog
+++ b/sci-libs/openblas/ChangeLog
@@ -2,6 +2,9 @@
 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
 # $Header: $
 
+  18 Feb 2014; Mark Wright <gienah@gentoo.org> openblas-9999.ebuild:
+  multibuild openblas when USE=int64 is specified.
+
   06 Jan 2014; Justin Lecher <jlec@gentoo.org> openblas-9999.ebuild,
   metadata.xml:
   Switch from git-2 to git-r3

diff --git a/sci-libs/openblas/openblas-9999.ebuild b/sci-libs/openblas/openblas-9999.ebuild
index 618c03b..3bd158a 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 toolchain-funcs
+inherit alternatives-2 eutils fortran-2 git-r3 multilib multibuild toolchain-funcs
 
 DESCRIPTION="Optimized BLAS library based on GotoBLAS2"
 HOMEPAGE="http://xianyi.github.com/OpenBLAS/"
@@ -14,105 +14,162 @@ EGIT_BRANCH="develop"
 
 LICENSE="BSD"
 SLOT="0"
-IUSE="int64 dynamic openmp static-libs threads"
+IUSE="dynamic int64 openmp static-libs threads"
 KEYWORDS=""
 
-src_configure() {
-	# lapack and lapacke are not modified from upstream lapack
-	sed \
-		-e "s:^#\s*\(CC\)\s*=.*:\1=$(tc-getCC):" \
-		-e "s:^#\s*\(FC\)\s*=.*:\1=$(tc-getFC):" \
-		-e "s:^#\s*\(COMMON_OPT\)\s*=.*:\1=${CFLAGS}:" \
-		-e "s:^#\s*\(NO_LAPACK\)\s*=.*:\1=1:" \
-		-e "s:^#\s*\(NO_LAPACKE\)\s*=.*:\1=1:" \
-		-i Makefile.rule || die
-}
-
-openblas_compile() {
-	local profname=$1
-	einfo "Compiling profile ${profname}"
-	# cflags already defined twice
-	unset CFLAGS
-	emake clean
-	emake libs shared ${openblas_flags}
-	mkdir -p libs && mv libopenblas* libs/
-	# avoid pic when compiling static libraries, so re-compiling
-	if use static-libs; then
-		emake clean
-		emake libs ${openblas_flags} NO_SHARED=1 NEED_PIC=
-		mv libopenblas* libs/
-	fi
-	cat <<-EOF > ${profname}.pc
-		prefix=${EPREFIX}/usr
-		libdir=\${prefix}/$(get_libdir)
-		includedir=\${prefix}/include
-		Name: ${PN}
-		Description: ${DESCRIPTION}
-		Version: ${PV}
-		URL: ${HOMEPAGE}
-		Libs: -L\${libdir} -lopenblas
-		Libs.private: -lm
-		Cflags: -I\${includedir}/${PN}
-	EOF
-}
+INT64_SUFFIX="int64"
+BASE_PROFNAME="openblas"
 
-src_compile() {
-	# openblas already does multi-jobs
-	MAKEOPTS+=" -j1"
-	openblas_flags=""
-	local openblas_name=openblas
+get_openblas_flags() {
+	local openblas_flags=""
 	use dynamic && \
-		openblas_name+="-dynamic" && \
 		openblas_flags+=" DYNAMIC_ARCH=1 TARGET=GENERIC NUM_THREADS=64 NO_AFFINITY=1"
-	use int64 && \
-		openblas_name+="-int64" && \
-		openblas_flags+=" INTERFACE64=1"
-
+	if [[ "${MULTIBUILD_ID}" =~ "_${INT64_SUFFIX}" ]]; then
+		openblas_flags+=" INTERFACE64=1 LIBNAMESUFFIX=${INT64_SUFFIX}"
+	fi
 	# choose posix threads over openmp when the two are set
 	# yet to see the need of having the two profiles simultaneously
 	if use threads; then
-		openblas_name+="-threads"
 		openblas_flags+=" USE_THREAD=1 USE_OPENMP=0"
 	elif use openmp; then
-		openblas_name+="-openmp"
 		openblas_flags+=" USE_THREAD=0 USE_OPENMP=1"
 	fi
-	openblas_compile ${openblas_name}
-	mv libs/libopenblas* . || die
+	echo "${openblas_flags}"
+}
+
+get_profname() {
+	local profname="${BASE_PROFNAME}"
+	use dynamic && \
+		profname+="-dynamic"
+	if [[ "${MULTIBUILD_ID}" =~ "_${INT64_SUFFIX}" ]]; then
+		profname+="-${INT64_SUFFIX}"
+	fi
+	# choose posix threads over openmp when the two are set
+	# yet to see the need of having the two profiles simultaneously
+	if use threads; then
+		profname+="-threads"
+	elif use openmp; then
+		profname+="-openmp"
+	fi
+	echo "${profname}"
+}
+
+pkg_setup() {
+	# 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=()
+	use int64 && \
+		MULTIBUILD_VARIANTS+=( ${BASE_PROFNAME}_${INT64_SUFFIX} )
+	MULTIBUILD_VARIANTS+=( ${BASE_PROFNAME} )
+}
+
+src_prepare() {
+	multibuild_copy_sources
+}
+
+src_configure() {
+	my_configure() {
+		# lapack and lapacke are not modified from upstream lapack
+		sed \
+			-e "s:^#\s*\(CC\)\s*=.*:\1=$(tc-getCC):" \
+			-e "s:^#\s*\(FC\)\s*=.*:\1=$(tc-getFC):" \
+			-e "s:^#\s*\(COMMON_OPT\)\s*=.*:\1=${CFLAGS}:" \
+			-e "s:^#\s*\(NO_LAPACK\)\s*=.*:\1=1:" \
+			-e "s:^#\s*\(NO_LAPACKE\)\s*=.*:\1=1:" \
+			-i Makefile.rule || die
+	}
+	multibuild_foreach_variant run_in_build_dir my_configure
+}
+
+src_compile() {
+	# openblas already does multi-jobs
+	MAKEOPTS+=" -j1"
+	my_src_compile () {
+		local openblas_flags=$(get_openblas_flags)
+		local profname=$(get_profname)
+		einfo "Compiling profile ${profname}"
+		# cflags already defined twice
+		unset CFLAGS
+		emake clean
+		emake libs shared ${openblas_flags}
+		mkdir -p libs && mv libopenblas* libs/
+		# avoid pic when compiling static libraries, so re-compiling
+		if use static-libs; then
+			emake clean
+			emake libs ${openblas_flags} NO_SHARED=1 NEED_PIC=
+			mv libopenblas* libs/
+		fi
+		cat <<-EOF > ${profname}.pc
+			prefix=${EPREFIX}/usr
+			libdir=\${prefix}/$(get_libdir)
+			includedir=\${prefix}/include
+			Name: ${PN}
+			Description: ${DESCRIPTION}
+			Version: ${PV}
+			URL: ${HOMEPAGE}
+			Libs: -L\${libdir} -l${MULTIBUILD_ID}
+			Libs.private: -lm
+		EOF
+		if [[ "${MULTIBUILD_ID}" =~ "_${INT64_SUFFIX}" ]]; then
+			cat <<-EOF >> ${profname}.pc
+				Cflags: -DOPENBLAS_USE64BITINT -I\${includedir}/${PN}
+				Fflags=-fdefault-integer-8
+			EOF
+		else
+			cat <<-EOF >> ${profname}.pc
+				Cflags: -I\${includedir}/${PN}
+				Fflags=
+			EOF
+		fi
+		mv libs/libopenblas* . || die
+	}
+	multibuild_foreach_variant run_in_build_dir my_src_compile
 }
 
 src_test() {
-	emake tests ${openblas_flags}
+	my_src_test () {
+		local openblas_flags=$(get_openblas_flags)
+		emake tests ${openblas_flags}
+	}
+	multibuild_foreach_variant run_in_build_dir my_src_test
 }
 
 src_install() {
-	local pcfile
-	for pcfile in *.pc; do
-		local profname=${pcfile%.pc}
-		emake install \
-			PREFIX="${ED}"usr ${openblas_flags} \
-			OPENBLAS_INCLUDE_DIR="${ED}"usr/include/${PN} \
-			OPENBLAS_LIBRARY_DIR="${ED}"usr/$(get_libdir)
-		use static-libs || rm "${ED}"usr/$(get_libdir)/lib*.a
-		alternatives_for blas ${profname} 0 \
-			/usr/$(get_libdir)/pkgconfig/blas.pc ${pcfile}
-		alternatives_for cblas ${profname} 0 \
-			/usr/$(get_libdir)/pkgconfig/cblas.pc ${pcfile} \
-			/usr/include/cblas.h ${PN}/cblas.h
-		insinto /usr/$(get_libdir)/pkgconfig
-		doins ${pcfile}
-	done
+	my_src_install () {
+		local openblas_flags=$(get_openblas_flags)
+		local profname=$(get_profname)
+		local pcfile
+		for pcfile in *.pc; do
+			local profname=${pcfile%.pc}
+			emake install \
+				PREFIX="${ED}"usr ${openblas_flags} \
+				OPENBLAS_INCLUDE_DIR="${ED}"usr/include/${PN} \
+				OPENBLAS_LIBRARY_DIR="${ED}"usr/$(get_libdir)
+			use static-libs || rm "${ED}"usr/$(get_libdir)/lib*.a
+			alternatives_for blas ${profname} 0 \
+				/usr/$(get_libdir)/pkgconfig/blas.pc ${pcfile}
+			alternatives_for cblas ${profname} 0 \
+				/usr/$(get_libdir)/pkgconfig/cblas.pc ${pcfile} \
+				/usr/include/cblas.h ${PN}/cblas.h
+			insinto /usr/$(get_libdir)/pkgconfig
+			doins ${pcfile}
+		done
 
-	dodoc GotoBLAS_{01Readme,03FAQ,04FAQ,05LargePage,06WeirdPerformance}.txt
-	dodoc *md Changelog.txt
+		dodoc GotoBLAS_{01Readme,03FAQ,04FAQ,05LargePage,06WeirdPerformance}.txt
+		dodoc *md Changelog.txt
 
-	if [[ ${CHOST} == *-darwin* ]] ; then
-		cd "${ED}"/usr/$(get_libdir)
-		local d
-		for d in *.dylib ; do
-			ebegin "Correcting install_name of ${d}"
-			install_name_tool -id "${EPREFIX}/usr/$(get_libdir)/${d}" "${d}"
-			eend $?
-		done
-	fi
+		if [[ ${CHOST} == *-darwin* ]] ; then
+			cd "${ED}"/usr/$(get_libdir)
+			local d
+			for d in *.dylib ; do
+				ebegin "Correcting install_name of ${d}"
+				install_name_tool -id "${EPREFIX}/usr/$(get_libdir)/${d}" "${d}"
+				eend $?
+			done
+		fi
+	}
+	multibuild_foreach_variant run_in_build_dir my_src_install
 }


             reply	other threads:[~2014-10-06  5:56 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-06  5:56 Justin Lecher [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-08-28  7:37 [gentoo-commits] proj/sci:master commit in: sci-libs/openblas/ Benda XU
2017-08-25  6:28 Benda XU
2017-06-06  4:12 Benda XU
2017-04-30 10:25 Justin Lecher
2017-04-02  4:21 Benda XU
2016-02-21 15:16 Justin Lecher
2015-11-30 10:58 Justin Lecher
2015-11-30 10:58 Justin Lecher
2015-06-06 10:23 Justin Lecher
2015-06-06 10:23 Justin Lecher
2015-04-02 10:15 Justin Lecher
2015-04-02 10:15 Justin Lecher
2015-03-27 20:25 Denis Dupeyron
2014-10-20 18:01 Justin Lecher
2014-10-20 12:32 Mark Wright
2014-10-19 10:21 Mark Wright
2014-10-19  5:55 Mark Wright
2014-10-06  5:56 Justin Lecher
2014-10-06  5:56 Justin Lecher
2014-10-06  5:56 Justin Lecher
2014-10-06  5:56 Justin Lecher
2014-10-06  5:56 Justin Lecher
2014-01-06 18:33 Justin Lecher
2013-08-06 15:49 Sebastien Fabbro
2013-07-24 23:09 Sebastien Fabbro
2013-03-03 18:39 Sebastien Fabbro
2013-03-03 18:39 Sebastien Fabbro
2012-12-12 19:28 Sebastien Fabbro
2012-10-15 20:15 Andrea Arteaga
2012-10-08 17:35 Andrea Arteaga
2012-08-20  9:21 Andrea Arteaga
2012-06-26 22:27 Sebastien Fabbro
2012-05-07 14:57 Andrea Arteaga
2012-05-07 14:50 Andrea Arteaga
2012-03-23 20:45 Andrea Arteaga
2012-03-16 21:41 Sebastien Fabbro
2012-03-15 22:08 Francois Bissey
2012-03-15 22:01 Francois Bissey
2012-03-15  2:34 Francois Bissey
2011-08-17 17:21 Alexey Shvetsov
2011-08-17 15:45 Sebastien Fabbro
2011-08-16 23:51 Francois Bissey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1411815957.5b5e9e7d6c21a48ad35d3fc033902201a71a06d4.jlec@gentoo \
    --to=jlec@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox