commit:     456c869b7e5ae4d6efd1c2293b1181e59a5e6a67
Author:     Martin Mokrejš <mmokrejs <AT> fold <DOT> natur <DOT> cuni <DOT> cz>
AuthorDate: Thu Feb 16 10:56:54 2017 +0000
Commit:     Martin Mokrejs <mmokrejs <AT> fold <DOT> natur <DOT> cuni <DOT> cz>
CommitDate: Thu Feb 16 10:56:54 2017 +0000
URL:        https://gitweb.gentoo.org/proj/sci.git/commit/?id=456c869b

sci-biology/freebayes: respect CC/CXX/CFLAGS/CXXFLAGS

Package-Manager: Portage-2.3.3, Repoman-2.3.1

 sci-biology/freebayes/freebayes-9999.ebuild | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/sci-biology/freebayes/freebayes-9999.ebuild 
b/sci-biology/freebayes/freebayes-9999.ebuild
index 1b1eb89ed..a5e640591 100644
--- a/sci-biology/freebayes/freebayes-9999.ebuild
+++ b/sci-biology/freebayes/freebayes-9999.ebuild
@@ -4,7 +4,7 @@
 
 EAPI=6
 
-inherit eutils git-r3
+inherit eutils git-r3 toolchain-funcs
 
 DESCRIPTION="Bayesian gen. variant detector to find short polymorphisms"
 HOMEPAGE="https://github.com/ekg/freebayes";
@@ -15,7 +15,7 @@ SLOT="0"
 KEYWORDS=""
 IUSE=""
 
-DEPEND=""
+DEPEND="dev-util/cmake"
 RDEPEND="${DEPEND}
        sci-libs/htslib
        sci-biology/bamtools
@@ -84,6 +84,23 @@ RDEPEND="${DEPEND}
 
 # g++ -O3 -D_FILE_OFFSET_BITS=64 -g -I../ttmath -I../bamtools/src/ 
-I../vcflib/src/ -I../vcflib/tabixpp/ -I../vcflib/smithwaterman/ 
-I../vcflib/multichoose/ -I../vcflib/filevercmp/ -I../vcflib/tabixpp/htslib 
-I../SeqLib -I../SeqLib/htslib -c freebayes.cpp
 
+src_prepare(){
+       find . -name Makefile | while read f; do \
+               sed -e "s/-O3 -D_FILE_OFFSET_BITS=64/${CFLAGS}/" -i $f || die
+               sed -e "s/^CFLAGS:= -O3/CFLAGS ?= ${CFLAGS}/" -i $f || die
+               sed -e "s/^CXX = g++/CXX = $(tc-getCXX)/;s/^CXX=g++/CXX = 
$(tc-getCXX)/" -i $f || die
+               sed -e "s/g++ /$(tc-getCXX) /" -i $f || die
+               sed -e "s/-O3/${CXXFLAGS}/" -i $f || die
+               sed -e "s/^CC[  ]*=[    ]gcc/CC = $(tc-getCC)/" -i $f || die
+               sed -e "s/-g -Wall -O2/${CFLAGS}/;s/-g -Wall 
-Wno-unused-function -O2/${CFLAGS}/" -i $f || die
+               sed -e "s/-O3 /${CFLAGS}/;s/ -O3/${CFLAGS}/" -i $f || die
+       done
+       sed -e "s/^C=gcc/C = $(tc-getCC)/" -i Makefile || die
+       sed -e "s/gcc/$(tc-getCC)/" -i SeqLib/bwa/Makefile 
SeqLib/fermi-lite/Makefile || die
+       sed -e "s/g++/$(tc-getCXX)/" -i SeqLib/src/Makefile.am || die
+       default
+}
+
 src_compile(){
        emake -j1 # vcflib/smithwaterman/ sometimes does not compile
 }

Reply via email to