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
 }

Reply via email to