aboutsummaryrefslogtreecommitdiff
blob: c17fb396cd6f7f7391aba48df17feb06aa3eca45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=5

AUTOTOOLS_AUTORECONF=yes

inherit toolchain-funcs git-r3

DESCRIPTION="C/C++ library for working with human genetic variation data"
HOMEPAGE="http://atgu.mgh.harvard.edu/plinkseq"
EGIT_REPO_URI="https://bitbucket.org/statgen/plinkseq.git"
# https://bitbucket.org/statgen/plinkseq/commits/all
# http://pngu.mgh.harvard.edu/~purcell/plink/download.shtml

LICENSE="GPL-2"
SLOT="0"
KEYWORDS=""
IUSE=""

DEPEND="sys-libs/zlib
	dev-libs/protobuf
	www-servers/mongoose
	!sci-biology/fsl" # file collision on /usr/bin/mm
RDEPEND="${DEPEND}"

src_prepare(){
	sed -e "s/gcc/$(tc-getCC)/g;s/g++/$(tc-getCXX)/g;s/-O3/${CFLAGS}/g" -i config_defs.Makefile || die
	sed -e "s/= -static/=/g" -i config_defs.Makefile || die
	rm -rf sources/ext/protobuf-* || die
	rm sources/ext/protobuf sources/ext/sources/include/google || die
	rm -rf sources/mongoose || die
	sed -e 's@^all:.*@all: # skipping compilation of bundled dev-libs/protobuf@' -i sources/ext/Makefile || die
	find . -name \*.proto | while read f; do \
		d=`dirname $f`; \
		pushd $d; \
		protoc --cpp_out=. *.proto || exit 255; \
		popd; \
	done || die
	#
	# recopy the updated files
	cp -p sources/plinkseq/sources/lib/matrix.pb.h sources/plinkseq/sources/include/plinkseq/matrix.pb.h || die
	cp -p sources/plinkseq/sources/lib/variant.pb.h sources/plinkseq/sources/include/plinkseq/variant.pb.h || die
	sed -e 's/google::protobuf::internal::kEmptyString/google::protobuf::internal::GetEmptyStringAlreadyInited()/g' -i sources/plinkseq/sources/lib/matrix.pb.cpp || die
	sed -e 's/google::protobuf::internal::kEmptyString/google::protobuf::internal::GetEmptyStringAlreadyInited()/g' -i sources/plinkseq/sources/lib/variant.pb.cpp || die
	local myinc=`pkg-config protobuf --variable=includedir`
	sed -e "s@\$(PROTOBUF_LIB_BASE_DIR)/\$(INC_DIR)/@$myinc@" -i Makefile || die
	local mylib=`pkg-config protobuf --variable=libdir`
	sed -e "s@$(PROTOBUF_LIB_BASE_DIR)/$(BLD_LIB_DIR)/@$mylib@" -i Makefile || die
	local mylibs=`pkg-config protobuf --libs`
	sed -e "s@libprotobuf.a@$mylibs@" -i Makefile || die
}

src_install(){
	cd build/execs || die
	# TODO: avoid file collision with sci-biology/fsl
	# https://bitbucket.org/statgen/plinkseq/issue/9/rename-mm-filename-to-plinkseq_mm
	# TODO: avoid file collision with www-servers/mongoose
	dobin gcol browser pseq behead mm smp tab2vcf pdas
}