aboutsummaryrefslogtreecommitdiff
blob: b57d6b19d75b7057fd42568021b9e39ef4b598d1 (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
62
63
64
65
66
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=5

inherit eutils toolchain-funcs

DESCRIPTION="Whole genome association analysis toolset"
HOMEPAGE="http://pngu.mgh.harvard.edu/~purcell/plink
	https://www.cog-genomics.org/plink2/"
SRC_URI="https://www.cog-genomics.org/static/bin/plink160731/plink_src.zip -> ${P}.zip"

LICENSE="GPL-3+"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="lapack"

DEPEND="
	app-arch/unzip
	virtual/pkgconfig"
RDEPEND="
	sys-libs/zlib
	lapack? ( virtual/lapack
		virtual/cblas )"

S="${WORKDIR}/"

# Package collides with net-misc/putty. Renamed to p-link following discussion with Debian.
# Package contains bytecode-only jar gPLINK.jar. Ignored, notified upstream.

src_prepare() {
	rm -rf zlib-1.2.8 || die
	sed \
		-e 's:zlib-1.2.8/zlib.h:zlib.h:g' \
		-i *.{c,h} || die

	sed \
		-e 's:g++:$(CXX):g' \
		-e 's:gcc:$(CC):g' \
		-e 's:gfortran:$(FC):g' \
		-i Makefile || die
	if ! use lapack; then
		sed -e 's/^NO_LAPACK =/NO_LAPACK = 1/' -i Makefile || die
		sed -e 's@^// #define NOLAPACK@#define NOLAPACK@' -i plink_common.h || die
	fi
	tc-export PKG_CONFIG
}

src_compile() {
	local blasflags
	use lapack && blasflags="$($(tc-getPKG_CONFIG) --libs lapack cblas)"
	emake \
		CXX=$(tc-getCXX) \
		CFLAGS="${CFLAGS}" \
		ZLIB="$($(tc-getPKG_CONFIG) --libs zlib)" \
		BLASFLAGS="$blasflags"
}

src_install() {
	newbin plink p-link
}

pkg_postinst(){
	einfo "plink binary is now renamed to p-link to avoid file collision"
}