From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org)
	by finch.gentoo.org with esmtp (Exim 4.60)
	(envelope-from <gentoo-commits+bounces-434664-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1S3pwv-00063t-JZ
	for garchives@archives.gentoo.org; Sat, 03 Mar 2012 14:28:42 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id D908CE071E;
	Sat,  3 Mar 2012 14:28:29 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	by pigeon.gentoo.org (Postfix) with ESMTP id 9B2CDE071E
	for <gentoo-commits@lists.gentoo.org>; Sat,  3 Mar 2012 14:28:29 +0000 (UTC)
Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 5F43B1B4013
	for <gentoo-commits@lists.gentoo.org>; Sat,  3 Mar 2012 14:28:28 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by hornbill.gentoo.org (Postfix) with ESMTP id 21E34E542A
	for <gentoo-commits@lists.gentoo.org>; Sat,  3 Mar 2012 14:28:27 +0000 (UTC)
From: "Jens-Malte Gottfried" <jmg@godefridus.de>
To: gentoo-commits@lists.gentoo.org
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Jens-Malte Gottfried" <jmg@godefridus.de>
Message-ID: <1330784814.c1e83820b43f582dd4e6c8b3c33d243522220809.jmg@gentoo>
Subject: [gentoo-commits] proj/sci:master commit in: sci-mathematics/petsc/
X-VCS-Repository: proj/sci
X-VCS-Files: sci-mathematics/petsc/metadata.xml sci-mathematics/petsc/petsc-3.2_p6.ebuild
X-VCS-Directories: sci-mathematics/petsc/
X-VCS-Committer: jmg
X-VCS-Committer-Name: Jens-Malte Gottfried
X-VCS-Revision: c1e83820b43f582dd4e6c8b3c33d243522220809
X-VCS-Branch: master
Date: Sat,  3 Mar 2012 14:28:27 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: quoted-printable
X-Archives-Salt: 143d345b-ff02-4832-aa1e-3d52598b768d
X-Archives-Hash: 4bb95cb319c7b17c361542be854f4411

commit:     c1e83820b43f582dd4e6c8b3c33d243522220809
Author:     Jens-Malte Gottfried <jmgottfried <AT> web <DOT> de>
AuthorDate: Sat Mar  3 14:26:54 2012 +0000
Commit:     Jens-Malte Gottfried <jmg <AT> godefridus <DOT> de>
CommitDate: Sat Mar  3 14:26:54 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=3Dproj/sci.git;a=3Dc=
ommit;h=3Dc1e83820

further simplification, added more optional deps

simplification using the petsc_with script proposed by
bicatali (slightly reworked, some fixes)
added boost dependency and thread support

---
 sci-mathematics/petsc/metadata.xml        |    1 +
 sci-mathematics/petsc/petsc-3.2_p6.ebuild |   64 +++++++++++++++++------=
------
 2 files changed, 38 insertions(+), 27 deletions(-)

diff --git a/sci-mathematics/petsc/metadata.xml b/sci-mathematics/petsc/m=
etadata.xml
index 079f8ff..7f25b9f 100644
--- a/sci-mathematics/petsc/metadata.xml
+++ b/sci-mathematics/petsc/metadata.xml
@@ -3,6 +3,7 @@
 <pkgmetadata>
 <herd>sci-mathematics</herd>
 <use>
+  <flag name=3D"boost">Use boost (dev-libs/boost)</flag>
   <flag name=3D"hypre">Use HYPRE (sci-mathematics/hypre) for preconditio=
ning</flag>
   <flag name=3D"metis">Use METIS (sci-libs/parmetis) for partitioning</f=
lag>
   <flag name=3D"complex-scalars">Make scalars complex</flag>

diff --git a/sci-mathematics/petsc/petsc-3.2_p6.ebuild b/sci-mathematics/=
petsc/petsc-3.2_p6.ebuild
index 643e146..7f090fc 100644
--- a/sci-mathematics/petsc/petsc-3.2_p6.ebuild
+++ b/sci-mathematics/petsc/petsc-3.2_p6.ebuild
@@ -15,7 +15,7 @@ SRC_URI=3D"http://ftp.mcs.anl.gov/pub/petsc/release-sna=
pshots/${MY_P}.tar.gz"
 LICENSE=3D"petsc"
 SLOT=3D"0"
 KEYWORDS=3D"~x86 ~amd64"
-IUSE=3D"complex-scalars cxx debug doc fortran hdf5 hypre metis mpi X"
+IUSE=3D"boost complex-scalars cxx debug doc fortran hdf5 hypre metis mpi=
 threads X"
=20
 RDEPEND=3D"mpi? ( virtual/mpi[cxx?,fortran?] )
 	X? ( x11-libs/libX11 )
@@ -24,6 +24,7 @@ RDEPEND=3D"mpi? ( virtual/mpi[cxx?,fortran?] )
 	hypre? ( sci-libs/hypre )
 	metis? ( sci-libs/parmetis )
 	hdf5? ( sci-libs/hdf5[!mpi?] )
+	boost? ( dev-libs/boost )
 "
=20
 DEPEND=3D"${RDEPEND}
@@ -37,6 +38,7 @@ S=3D"${WORKDIR}/${MY_P}"
=20
 src_prepare(){
 	epatch "${FILESDIR}/${PN}-configure-pic.patch"
+	epatch "${FILESDIR}/${PN}-disable-env-warnings.patch"
 	epatch "${FILESDIR}/${PN}-disable-rpath.patch"
 }
=20
@@ -45,14 +47,28 @@ src_configure(){
 	petsc_enable(){
 		use "$1" && echo "--with-${2:-$1}=3D1" || echo "--with-${2:-$1}=3D0"
 	}
+	# add external library:
+	# petsc_with use_flag libname libdir
+	# petsc_with use_flag libname lib include
+	petsc_with() {
+		local myuse p=3D${2:-${1}}
+		if use ${1}; then
+			myuse=3D"--with-${p}=3D1"
+			if [[ $# =3D=3D 4 ]]; then
+				myuse=3D"${myuse} --with-${p}-lib=3D\"${3}\""
+				myuse=3D"${myuse} --with-${p}-include=3D${4}"
+			else
+				myuse=3D"${myuse} --with-${p}-dir=3D${EPREFIX}${3:-/usr}"
+			fi
+		else
+			myuse=3D"--with-${p}=3D0"
+		fi
+		echo ${myuse}
+	}
 	# select between configure options depending on use flag
-	pestc_select() {
+	petsc_select() {
 		use "$1" && echo "--with-$2=3D$3" || echo "--with-$2=3D$4"
 	}
-	# add info about library include dirs and lib file
-	petsc_lib_info(){
-		use "$1" && echo "--with-${4:-$1}-include=3D$2 --with-${4:-$1}-lib=3D$=
3"
-	}
=20
 	local mylang
 	local myopt
@@ -64,21 +80,17 @@ src_configure(){
 	export PETSC_DIR=3D"${S}"
 	export PETSC_ARCH=3D"linux-gnu-${mylang}-${myopt}"
=20
-	# flags difficult to pass due to correct quoting of spaces
-	local myconf
-	myconf[1]=3D"CFLAGS=3D${CFLAGS}"
-	myconf[2]=3D"CXXFLAGS=3D${CXXFLAGS}"
-	myconf[3]=3D"LDFLAGS=3D${LDFLAGS}"
-	myconf[4]=3D"--with-blas-lapack-lib=3D$(pkg-config --libs lapack)"
-
 	if use debug; then
 		strip-flags
 		filter-flags -O*
 	fi
=20
 	# run petsc configure script
-	python "${S}/config/configure.py" \
+	./configure \
 		--prefix=3D"${EPREFIX}/usr" \
+		CFLAGS=3D"${CFLAGS}" \
+		CXXFLAGS=3D"${CXXFLAGS}" \
+		LDFLAGS=3D"${LDFLAGS}" \
 		--with-shared-libraries \
 		--with-single-library \
 		--with-clanguage=3D${mylang} \
@@ -86,27 +98,28 @@ src_configure(){
 		--with-petsc-arch=3D${PETSC_ARCH} \
 		--with-precision=3Ddouble \
 		--with-gnu-compilers \
+		--with-blas-lapack-lib=3D"$(pkg-config --libs lapack)" \
 		$(petsc_enable debug debugging) \
-		$(petsc_enable fortran) \
 		$(petsc_enable mpi) \
 		$(petsc_select mpi cc /usr/bin/mpicc $(tc-getCC)) \
 		$(petsc_select mpi cxx /usr/bin/mpicxx $(tc-getCXX)) \
-		$(use fortran && $(pestc_select mpi fc /usr/bin/mpif77 $(tc-getF77))) =
\
+		$(petsc_enable fortran) \
+		$(use fortran && echo "$(petsc_select mpi fc /usr/bin/mpif77 $(tc-getF=
77))") \
 		$(petsc_enable mpi mpi-compilers) \
-		$(petsc_enable X) \
+		$(petsc_with X) \
+		$(petsc_with boost) \
+		$(petsc_enable threads pthread) \
+		$(petsc_enable threads pthreadclasses) \
 		--with-windows-graphics=3D0 \
 		--with-matlab=3D0 \
 		--with-python=3D0 \
 		--with-cmake=3D/usr/bin/cmake \
-		$(petsc_enable hdf5) \
-		$(petsc_lib_info hdf5 /usr/include /usr/$(get_libdir)/libhdf5.so) \
-		$(petsc_enable hypre) \
-		$(petsc_lib_info hypre /usr/include/hypre /usr/$(get_libdir)/libHYPRE.=
so) \
-		$(petsc_enable metis parmetis) \
-		$(petsc_lib_info metis /usr/include/parmetis /usr/$(get_libdir)/libpar=
metis.so parmetis) \
+		$(petsc_with hdf5) \
+		$(petsc_with hypre hypre /usr/$(get_libdir)/libHYPRE.so /usr/include/h=
ypre) \
+		$(petsc_with metis parmetis) \
 		$(petsc_select complex-scalars scalar-type complex real) \
 		--with-scotch=3D0 \
-		"${myconf[@]}"
+		${EXTRA_ECONF} || die "configuration failed"
 }
=20
 src_install(){
@@ -159,7 +172,4 @@ pkg_postinst() {
 	elog "The petsc ebuild is still under development."
 	elog "Help us improve the ebuild in:"
 	elog "http://bugs.gentoo.org/show_bug.cgi?id=3D53386"
-	elog "Note that PETSC_ARCH may be dropped in future since " \
-		"upstream now also supports installations without " \
-		"different subdirectories."
 }