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

sci-biology/idba: distinguish openmp cflags, fix compile and install steps

Package-Manager: Portage-2.3.3, Repoman-2.3.1

 sci-biology/idba/idba-1.1.1.ebuild | 22 ++++++++++++++++++++--
 sci-biology/idba/idba-9999.ebuild  | 25 ++++++++++++++++++++++---
 2 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/sci-biology/idba/idba-1.1.1.ebuild 
b/sci-biology/idba/idba-1.1.1.ebuild
index d061f9a..2c923af 100644
--- a/sci-biology/idba/idba-1.1.1.ebuild
+++ b/sci-biology/idba/idba-1.1.1.ebuild
@@ -12,19 +12,37 @@ 
SRC_URI="https://storage.googleapis.com/google-code-archive-downloads/v2/code.go
 LICENSE="GPL-2+"
 SLOT="0"
 KEYWORDS="~amd64 ~x86"
-IUSE=""
+IUSE="openmp"
 
 DEPEND=""
 RDEPEND="${DEPEND}"
 
+pkg_setup() {
+       use openmp && ! tc-has-openmp && die "Please switch to an openmp 
compatible compiler"
+}
+
 src_prepare(){
        # Makefile.am also forces '-fopenmp -pthread', do we care?
+       #code stolen from velvet-1.2.10.ebuild
+       if [[ $(tc-getCC) =~ gcc ]]; then
+               local eopenmp=-fopenmp
+       elif [[ $(tc-getCC) =~ icc ]]; then
+               local eopenmp=-openmp
+               sed -e 's/-fopenmp/-openmp/' -i BUILD || die
+       else
+               elog "Cannot detect compiler type so not setting openmp support"
+       fi
        find . -name Makefile.in | while read f; do \
-               sed -e 's/-Wall -O3//' -i $f || die
+               sed -e "s/-Wall -O3//" -i $f || die
        done || die
+       sed -e 's/"-Wall", "-O3", //' -i BUILD || die
        default
 }
 
+src_compile(){
+       sh build.sh || die
+}
+
 src_install(){
        default
        # https://github.com/loneknightpy/idba/issues/23

diff --git a/sci-biology/idba/idba-9999.ebuild 
b/sci-biology/idba/idba-9999.ebuild
index da7f888..1932d8c 100644
--- a/sci-biology/idba/idba-9999.ebuild
+++ b/sci-biology/idba/idba-9999.ebuild
@@ -4,7 +4,7 @@
 
 EAPI=6
 
-inherit git-r3
+inherit git-r3 toolchain-funcs
 
 DESCRIPTION="De novo De Bruijn graph assembler iteratively using multimple 
k-mers"
 HOMEPAGE="http://i.cs.hku.hk/~alse/hkubrg/projects/idba_ud";
@@ -13,21 +13,40 @@ EGIT_REPO_URI="https://github.com/loneknightpy/idba.git";
 LICENSE="GPL-2+"
 SLOT="0"
 KEYWORDS=""
-IUSE=""
+IUSE="openmp"
 
 DEPEND=""
 RDEPEND="${DEPEND}"
 
+pkg_setup() {
+       use openmp && ! tc-has-openmp && die "Please switch to an openmp 
compatible compiler"
+}
+
 src_prepare(){
+       if [[ $(tc-getCC) =~ gcc ]]; then
+               local eopenmp=-fopenmp
+       elif [[ $(tc-getCC) =~ icc ]]; then
+               local eopenmp=-openmp
+               sed -e 's/-fopenmp/-openmp/' -i BUILD || die
+       else
+               elog "Cannot detect compiler type so not setting openmp support"
+       fi
        find . -name Makefile.in | while read f; do \
-               sed -e 's/-Wall -O3//' -i $f || die
+               sed -e "s/-Wall -O3 ${eopenmp}//" -i $f || die
        done
+       sed -e 's/"-Wall", "-O3", //' -i BUILD || die
        default
 }
 
+src_compile(){
+       sh build.sh || die
+}
+
 src_install(){
        default
        # https://github.com/loneknightpy/idba/issues/23
+       mkdir -p "${D}"/usr/bin || die
+       mv "${D}"/usr/local/bin/* "${D}"/usr/bin/ || die
        rm "${D}"/usr/bin/scan.py "${D}"/usr/bin/run-unittest.py || die
        rm bin/test bin/*.o bin/Makefile* || die # avoid file collision
        dobin bin/* # https://github.com/loneknightpy/idba/issues/23

Reply via email to