Skip to content

Commit

Permalink
sci-biology/yaha: Fix build with gcc-5 and respect build tools
Browse files Browse the repository at this point in the history
Package-Manager: Portage-2.3.3, Repoman-2.3.1
Signed-off-by: Justin Lecher <[email protected]>
  • Loading branch information
jlec committed Feb 19, 2017
1 parent 48c6d4a commit b5c5e0e
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 5 deletions.
61 changes: 61 additions & 0 deletions sci-biology/yaha/files/yaha-9999-buildsystem.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
diff --git a/Makefile b/Makefile
index 44fa872..b844ba6 100644
--- a/Makefile
+++ b/Makefile
@@ -10,24 +10,27 @@ SDIR := src
ODIR := obj
BDIR := bin

+CC ?= gcc
+CXX ?= g++
+CFLAGS ?= -Wall -O3
+CXXFLAGS ?= -Wall -O3
+LDFLAGS ?=
+
+CFLAGS += -MMD -MP -std=gnu99
+CXXFLAGS += -MMD -MP
+LDFLAGS += -pthread
+
# Set up flags depending on mode
ifdef USERMODE
PROG := yaha
-CCFLAGS := -Wall -O3 -D COMPILE_USER_MODE -D BUILDNUM=$(BUILDNUM)
+CFLAGS += -D COMPILE_USER_MODE -D BUILDNUM=$(BUILDNUM)
+CXXFLAGS += -D COMPILE_USER_MODE -D BUILDNUM=$(BUILDNUM)
else
PROG := yaha$(BUILDNUM)
-CCFLAGS := -Wall -Winline -O3 -g -D BUILDNUM=$(BUILDNUM)
+CFLAGS += -g -D BUILDNUM=$(BUILDNUM)
+CXXFLAGS += -g -D BUILDNUM=$(BUILDNUM)
endif

-# Auto build dependency files.
-CCFLAGS += -MMD -MP
-
-CC := gcc
-CPP := g++
-CFLAGS := $(CCFLAGS) -std=gnu99
-CPPFLAGS := $(CCFLAGS)
-LDFLAGS := -pthread
-
# The list of object files.
OBJfiles := Main.o AlignArgs.o AlignHelpers.o AlignExtFrag.o AlignOutput.o BaseSeq.o Compress.o \
FileHelpers.o GraphPath.o Index.o Query.o QueryMatch.o QueryState.o SW.o Math.o
@@ -45,7 +48,7 @@ $(BDIR):

# Link the program
$(BDIR)/$(PROG): $(OBJS)
- $(CPP) $(LDFLAGS) -o $@ $(OBJS)
+ $(CXX) $(LDFLAGS) -o $@ $(OBJS)

# Include the dependencies.
# The actual objects will be built by the below generic rules based on these dependencies.
@@ -58,7 +61,7 @@ $(ODIR)/%.o: $(SDIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@

$(ODIR)/%.o: $(SDIR)/%.cpp
- $(CPP) $(CPPFLAGS) -c $< -o $@
+ $(CXX) $(CXXFLAGS) -c $< -o $@

.PHONY: clean
clean:
16 changes: 16 additions & 0 deletions sci-biology/yaha/files/yaha-9999-fpermissive.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
src/SW.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/SW.cpp b/src/SW.cpp
index 57d2773..3a9c225 100644
--- a/src/SW.cpp
+++ b/src/SW.cpp
@@ -796,7 +796,7 @@ int findAGSBackwardExtensionCarefully(QueryState_t * QS, ROFF rOff, char * qStr
////////////////////////

template <BOOL banded, BOOL extension, BOOL reverse, BOOL XCutoff>
-int findAffineGapScore(QueryState_t * QS, char * qStr, SUINT qLen, char * rStr, SUINT rLen, EditOpList_t * list, SUINT * addedQLen = NULL, SUINT * addedRLen = NULL)
+int findAffineGapScore(QueryState_t * QS, char * qStr, SUINT qLen, char * rStr, SUINT rLen, EditOpList_t * list, SUINT * addedQLen, SUINT * addedRLen)
{
// As we will go row by row, then column by column, we do not need to store all of the V, E, and F arrays.
// Instead we will store only the previous row and column for each.
18 changes: 13 additions & 5 deletions sci-biology/yaha/yaha-9999.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

EAPI=6

inherit git-r3
inherit flag-o-matic git-r3 toolchain-funcs

DESCRIPTION="DNA mapper for single-end reads to detect structural variants (SV)"
HOMEPAGE="https://github.com/GregoryFaust/yaha"
Expand All @@ -15,11 +15,19 @@ SLOT="0"
KEYWORDS=""
IUSE=""

DEPEND=""
RDEPEND="${DEPEND}"
PATCHES=(
"${FILESDIR}"/${P}-fpermissive.patch
"${FILESDIR}"/${P}-buildsystem.patch
)

# TODO: respect CFLAGS/CXXFLAGS
# https://github.com/GregoryFaust/yaha/issues/5
src_prepare() {
default
append-cflags '-DCOMPILE_USER_MODE' '-DBUILDNUM=$(BUILDNUM)' -std=gnu99
append-cxxflags '-DCOMPILE_USER_MODE' '-DBUILDNUM=$(BUILDNUM)'
tc-export CC CXX
export CFLAGS
export CXXFLAGS
}

src_install(){
dobin bin/yaha
Expand Down

0 comments on commit b5c5e0e

Please sign in to comment.