commit:     cbe0d928b5c7dbe615e129da4d5079f46324aef8
Author:     Martin Mokrejš <mmokrejs <AT> fold <DOT> natur <DOT> cuni <DOT> cz>
AuthorDate: Tue Jan 10 01:00:37 2017 +0000
Commit:     Martin Mokrejs <mmokrejs <AT> fold <DOT> natur <DOT> cuni <DOT> cz>
CommitDate: Tue Jan 10 01:00:37 2017 +0000
URL:        https://gitweb.gentoo.org/proj/sci.git/commit/?id=cbe0d928

sci-biology/megahit: distinguish openmp compiler switches

Package-Manager: Portage-2.3.3, Repoman-2.3.1

 sci-biology/megahit/megahit-9999.ebuild | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/sci-biology/megahit/megahit-9999.ebuild 
b/sci-biology/megahit/megahit-9999.ebuild
index def7fd6..a23d2c2 100644
--- a/sci-biology/megahit/megahit-9999.ebuild
+++ b/sci-biology/megahit/megahit-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -23,8 +23,20 @@ RDEPEND="${DEPEND}
 
 # use make use_gpu=1 to compile it and turn on --use-gpu to activate GPU 
acceleration when running megahit
 
+pkg_setup() {
+       use openmp && ! tc-has-openmp && die "Please switch to an openmp 
compatible compiler"
+}
+
 src_prepare(){
        default
+       if [[ $(tc-getCXX) =~ g++ ]]; then
+               local eopenmp=-fopenmp
+       elif [[ $(tc-getCXX) =~ cxx ]]; then
+               local eopenmp=-openmp
+               sed -e "s#-fopenmp#-openmp#" -i Makefile || die
+       else
+               elog "Cannot detect compiler type so not setting openmp support"
+       fi
        sed -e "s#^CXXFLAGS = -g -O2#CXXFLAGS = ${CFLAGS}#" -i Makefile || die
 }
 

Reply via email to