commit:     c8700266779a240a5138507dde8bb06e3cc9d71b
Author:     Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 16 09:39:58 2022 +0000
Commit:     Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
CommitDate: Wed Feb 16 09:54:26 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c8700266

sci-chemistry/gromacs: Allow to build with clang

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Alexey Shvetsov <alexxy <AT> gentoo.org>

 ...macs-2022_rc1.ebuild => gromacs-2022_rc1-r1.ebuild} | 18 +++++++++++++++++-
 sci-chemistry/gromacs/metadata.xml                     |  2 ++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/sci-chemistry/gromacs/gromacs-2022_rc1.ebuild 
b/sci-chemistry/gromacs/gromacs-2022_rc1-r1.ebuild
similarity index 93%
rename from sci-chemistry/gromacs/gromacs-2022_rc1.ebuild
rename to sci-chemistry/gromacs/gromacs-2022_rc1-r1.ebuild
index 65c3ef90d719..347a8d4ac57e 100644
--- a/sci-chemistry/gromacs/gromacs-2022_rc1.ebuild
+++ b/sci-chemistry/gromacs/gromacs-2022_rc1-r1.ebuild
@@ -37,7 +37,7 @@ HOMEPAGE="http://www.gromacs.org/";
 #        base,    vmd plugins, fftpack from numpy,  blas/lapck from netlib,    
    memtestG80 library,  mpi_thread lib
 LICENSE="LGPL-2.1 UoI-NCSA !mkl? ( !fftw? ( BSD ) !blas? ( BSD ) !lapack? ( 
BSD ) ) cuda? ( LGPL-3 ) threads? ( BSD )"
 SLOT="0/${PV}"
-IUSE="blas cuda +custom-cflags +doc build-manual double-precision +fftw 
+gmxapi +gmxapi-legacy +hwloc lapack mkl mpi +offensive opencl openmp +python 
+single-precision test +threads +tng ${ACCE_IUSE}"
+IUSE="blas clang clang-cuda cuda  +custom-cflags +doc build-manual 
double-precision +fftw +gmxapi +gmxapi-legacy +hwloc lapack mkl mpi +offensive 
opencl openmp +python +single-precision test +threads +tng ${ACCE_IUSE}"
 
 CDEPEND="
        blas? ( virtual/blas )
@@ -54,6 +54,7 @@ CDEPEND="
        "
 BDEPEND="${CDEPEND}
        virtual/pkgconfig
+       clang? ( >=sys-devel/clang-6:* )
        build-manual? (
                app-doc/doxygen
                $(python_gen_cond_dep '
@@ -73,6 +74,7 @@ REQUIRED_USE="
        doc? ( !build-manual )
        cuda? ( single-precision )
        cuda? ( !opencl )
+       clang-cuda? ( clang cuda )
        mkl? ( !blas !fftw !lapack )
        ${PYTHON_REQUIRED_USE}"
 
@@ -114,6 +116,19 @@ src_prepare() {
 
        xdg_environment_reset #591952
 
+       # we can use clang as default
+       if use clang && ! tc-is-clang ; then
+               export CC=${CHOST}-clang
+               export CXX=${CHOST}-clang++
+       else
+               tc-export CXX CC
+       fi
+       # clang-cuda need to filter mfpmath
+       if use clang-cuda ; then
+               filter-mfpmath sse
+               filter-mfpmath i386
+       fi
+
        cmake_src_prepare
 
        use cuda && cuda_src_prepare
@@ -231,6 +246,7 @@ src_configure() {
                [[ ${x} = "double" ]] && p="-DGMX_DOUBLE=ON" || 
p="-DGMX_DOUBLE=OFF"
                local gpu=( "-DGMX_GPU=OFF" )
                [[ ${x} = "float" ]] && use cuda && gpu=( "-DGMX_GPU=CUDA" )
+               [[ ${x} = "float" ]] && use cuda-clang && gpu=( 
"-DGMX_GPU=CUDA" "-DGMX_CLANG_CUDA=ON" )
                use opencl && gpu=( "-DGMX_GPU=OPENCL" )
                mycmakeargs=(
                        ${mycmakeargs_pre[@]} ${p}

diff --git a/sci-chemistry/gromacs/metadata.xml 
b/sci-chemistry/gromacs/metadata.xml
index 0b64bbe8abdd..44ddb19d1d9d 100644
--- a/sci-chemistry/gromacs/metadata.xml
+++ b/sci-chemistry/gromacs/metadata.xml
@@ -11,6 +11,8 @@
        </maintainer>
        <use>
                <flag name="build-manual">Build manual instead of downloading 
it</flag>
+               <flag name="clang">Build gromacs with Clang instead of default 
compiler</flag>
+               <flag name="clang-cuda">Use clang for cuda units 
compilation</flag>
                <flag name="cuda">Enable cuda non-bonded kernels</flag>
                <flag name="double-precision">More precise calculations at the 
expense of speed</flag>
                <flag name="gmxapi">Add support for gmxapi library</flag>

Reply via email to