From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-876955-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 9777659CB2
	for <garchives@archives.gentoo.org>; Mon, 18 Apr 2016 10:33:37 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id D65BA21C016;
	Mon, 18 Apr 2016 10:33:34 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 7FFE521C016
	for <gentoo-commits@lists.gentoo.org>; Mon, 18 Apr 2016 10:33:34 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id C8A053408F0
	for <gentoo-commits@lists.gentoo.org>; Mon, 18 Apr 2016 10:33:32 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id D1DEA86F
	for <gentoo-commits@lists.gentoo.org>; Mon, 18 Apr 2016 10:33:30 +0000 (UTC)
From: "Tiziano Müller" <dev-zero@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Tiziano Müller" <dev-zero@gentoo.org>
Message-ID: <1460975603.036f87ea3e73231d043fa86b8f04d2bc5f17bb67.dev-zero@gentoo>
Subject: [gentoo-commits] dev/dev-zero:master commit in: sci-chemistry/cp2k/
X-VCS-Repository: dev/dev-zero
X-VCS-Files: sci-chemistry/cp2k/cp2k-3.0.ebuild
X-VCS-Directories: sci-chemistry/cp2k/
X-VCS-Committer: dev-zero
X-VCS-Committer-Name: Tiziano Müller
X-VCS-Revision: 036f87ea3e73231d043fa86b8f04d2bc5f17bb67
X-VCS-Branch: master
Date: Mon, 18 Apr 2016 10:33:30 +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
X-Archives-Salt: 71041703-a3a1-45d8-9fac-bea2d9d7cf4d
X-Archives-Hash: c7ff450582da7816eb55664b20d40f5d

commit:     036f87ea3e73231d043fa86b8f04d2bc5f17bb67
Author:     Tiziano Müller <dev-zero <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 18 10:33:23 2016 +0000
Commit:     Tiziano Müller <dev-zero <AT> gentoo <DOT> org>
CommitDate: Mon Apr 18 10:33:23 2016 +0000
URL:        https://gitweb.gentoo.org/dev/dev-zero.git/commit/?id=036f87ea

sci-chemistry/cp2k: support libint/libxc

 sci-chemistry/cp2k/cp2k-3.0.ebuild | 35 ++++++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/sci-chemistry/cp2k/cp2k-3.0.ebuild b/sci-chemistry/cp2k/cp2k-3.0.ebuild
index c589efb..b7daf1b 100644
--- a/sci-chemistry/cp2k/cp2k-3.0.ebuild
+++ b/sci-chemistry/cp2k/cp2k-3.0.ebuild
@@ -18,11 +18,13 @@ SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
 LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS="~amd64"
-IUSE="+fftw +openmp"
+IUSE="+fftw +libint +libxc +openmp"
 
 RDEPEND="virtual/blas
 	fftw? ( openmp? ( sci-libs/fftw:3.0=[fortran,openmp] )
-		!openmp? ( sci-libs/fftw:3.0=[fortran,threads] ) )"
+		!openmp? ( sci-libs/fftw:3.0=[fortran,threads] ) )
+	libint? ( sci-libs/libint:1 )
+	libxc? ( =sci-libs/libxc-2.2*[fortran] )"
 DEPEND="${RDEPEND}
 	virtual/pkgconfig
 	${PYTHON_DEPS}"
@@ -33,23 +35,34 @@ pkg_setup() {
 }
 
 src_configure() {
+	libs=()
+	pkgs=("lapack")
+
 	if use openmp ; then
 		append-fflags -fopenmp
 		append-ldflags -fopenmp
 	fi
 
-	declare -a libs defines
-
 	if use fftw ; then
+		append-cppflags -D__FFTW3
+
 		if use openmp ; then
-			libs+=($(pkg-config --libs fftw3_omp))
+			pkgs+=("fftw3_omp")
 		else
-			libs+=($(pkg-config --libs fftw3_threads))
+			pkgs+=("fftw3_threads")
 		fi
-		defines+=(-D__FFTW3)
-		echo ${defines[*]}
 	fi
 
+	if use libint ; then
+		append-cppflags -D__LIBINT
+		libs+=("-lint" "-lderiv")
+	fi
+	if use libxc ; then
+		append-cppflags -D__LIBXC2
+		libs+=("-lxc" "-lxcf90")
+	fi
+
+	# /usr/include must be included explicitly to have gfortran look for .mod-files there
 	cat > arch/custom.gentoo << EOF
 CC         = $(tc-getCC)
 # empty CPP var makes it use the compiler directly instead of two-step
@@ -57,10 +70,10 @@ CPP        =
 FC         = $(tc-getFC)
 LD         = $(tc-getFC)
 AR         = $(tc-getAR) -r
-CPPFLAGS   = ${defines[*]} ${CPPFLAGS}
-FCFLAGS    = -ffree-form -ffree-line-length-none ${defines[*]} ${CPPFLAGS} ${FCFLAGS}
+CPPFLAGS   = ${CPPFLAGS} $(pkg-config --cflags ${pkgs[*]})
+FCFLAGS    = -ffree-form -ffree-line-length-none ${CPPFLAGS} -I/usr/include $(pkg-config --cflags ${pkgs[*]}) ${FCFLAGS}
 LDFLAGS    = ${LDFLAGS}
-LIBS       = $(pkg-config --libs lapack) ${libs[*]}
+LIBS       = $(pkg-config --libs ${pkgs[*]}) ${libs[*]}
 DATA_DIR   = ${EPREFIX}/usr/share/cp2k
 EOF
 }