commit:     42f362924ffcccf2cecfbd18f52bbb7eabf9f28e
Author:     Martin Mokrejs <mmokrejs <AT> fold <DOT> natur <DOT> cuni <DOT> cz>
AuthorDate: Sun Apr 22 22:34:23 2018 +0000
Commit:     Martin Mokrejs <mmokrejs <AT> fold <DOT> natur <DOT> cuni <DOT> cz>
CommitDate: Sun Apr 22 22:34:23 2018 +0000
URL:        https://gitweb.gentoo.org/proj/sci.git/commit/?id=42f36292

sci-biology/megahit: respect cuda USE flag

Package-Manager: Portage-2.3.31, Repoman-2.3.9

 sci-biology/megahit/megahit-9999.ebuild | 27 +++++++++++++++++++++------
 sci-biology/megahit/metadata.xml        |  3 +++
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/sci-biology/megahit/megahit-9999.ebuild 
b/sci-biology/megahit/megahit-9999.ebuild
index 2fd8fa242..e403604ca 100644
--- a/sci-biology/megahit/megahit-9999.ebuild
+++ b/sci-biology/megahit/megahit-9999.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
 
-inherit git-r3 toolchain-funcs
+inherit git-r3 toolchain-funcs eutils
 
 DESCRIPTION="Metagenome assembler using succinct de Bruijn graph approach with 
CUDA"
 HOMEPAGE="https://github.com/voutcn/megahit
@@ -13,14 +13,14 @@ EGIT_REPO_URI="https://github.com/voutcn/megahit.git";
 LICENSE="GPL-3"
 SLOT="0"
 KEYWORDS=""
-IUSE="+openmp"
+IUSE="+openmp cuda"
 
 DEPEND=""
 RDEPEND="${DEPEND}
-       sys-libs/zlib"
+       sys-libs/zlib
+       cuda? ( >=dev-util/nvidia-cuda-toolkit-5 dev-libs/cudnn )"
 # >=gcc-4.4
-
-# use make use_gpu=1 to compile it and turn on --use-gpu to activate GPU 
acceleration when running megahit
+# contains bundled copy og idba from https://github.com/loneknightpy/idba
 
 pkg_setup() {
        use openmp && ! tc-has-openmp && die "Please switch to an openmp 
compatible compiler"
@@ -36,10 +36,25 @@ src_prepare(){
        else
                elog "Cannot detect compiler type so not setting openmp support"
        fi
+       if use cuda; then
+               local makeopts="use_gpu=1"
+       else
+               local makeopts=""
+       fi
        sed -e "s#^CXXFLAGS = -g -O2#CXXFLAGS = ${CFLAGS}#" -i Makefile || die
 }
 
+src_compile(){
+       emake $makeopts
+}
+
 src_install(){
        dobin megahit megahit_toolkit megahit_sdbg_build megahit_asm_core
        dodoc README.md
 }
+
+pkg_postinst(){
+       einfo "The maximum k-mer size is 255. You can edit kMaxK in 
definitions.h"
+       einfo "and recompile, eventually"
+       einfo "If you enabled GPU then use 'megahit --use-gpu' to activate it."
+}

diff --git a/sci-biology/megahit/metadata.xml b/sci-biology/megahit/metadata.xml
index bbab8b46d..a4779f691 100644
--- a/sci-biology/megahit/metadata.xml
+++ b/sci-biology/megahit/metadata.xml
@@ -12,4 +12,7 @@
        <upstream>
                <remote-id type="github">voutcn/megahit</remote-id>
        </upstream>
+       <use>
+               <flag name="cuda">Enable NVIDIA GTX680 (4G memory) and Tesla 
K40c (12G memory) with CUDA 5.5, 6.0 and 6.5</flag>
+       </use>
 </pkgmetadata>

Reply via email to