aboutsummaryrefslogtreecommitdiff
blob: ce0bbc6f779f7a1688cf066a54d401fc05ff7caa (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=5

inherit flag-o-matic fortran-2 toolchain-funcs

DESCRIPTION="System for chemical shifts based protein structure prediction using ROSETTA"
HOMEPAGE="http://spin.niddk.nih.gov/bax/software/CSROSETTA/"
SRC_URI="
	http://spin.niddk.nih.gov/bax/software/CSROSETTA/install.com -> ${P}-install.com
	http://spin.niddk.nih.gov/bax/software/CSROSETTA/CSRosetta.tar.Z -> ${P}.tar.Z
	http://spin.niddk.nih.gov/bax/software/CSROSETTA/changeLog -> ${P}-changelog"

SLOT="0"
LICENSE="all-rights-reserved"
KEYWORDS="~x86 ~amd64-linux ~x86-linux"
IUSE="custom-cflags"

RDEPEND="
	dev-lang/perl
	|| ( sci-biology/update-blastdb sci-biology/ncbi-tools++ )
	sci-biology/profphd
	sci-biology/psipred
	sci-biology/samtools
	~sci-libs/cs-rosetta-db-${PV}
	sci-chemistry/nmrpipe
	sci-chemistry/rosetta"
DEPEND=""

S="${WORKDIR}"

src_unpack() {
	unpack ${P}.tar.Z
}

src_prepare() {
	cat >> "${T}"/39${PN} <<- EOF
	rosetta3="${EPREFIX}/usr/bin/AbinitioRelax"
	rosetta3_extpdbs="${EPREFIX}/usr/bin/extract_pdbs"
	rosetta3DB="${EPREFIX}/usr/share/rosetta-db"
	csrosettaDir="${EPREFIX}/opt/${PN}"
	csrosettaCom="${EPREFIX}/opt/${PN}/com"
	PATH="${EPREFIX}/opt/${PN}/com"
	MFR="${EPREFIX}/opt/${PN}/com/mfr.tcl"
	EOF

	# needs more love
	sed \
		-e "s:CSROSETTA_DIR/src/nnmake/pNNMAKE.gnu:${EPREFIX}/opt/${PN}/src/nnmake/pNNMAKE:g" \
		-i com/make_fragments_2000.pl || die

	append-fflags -ffixed-line-length-132
}

src_compile() {
	use custom-cflags || CXXFLAGS="-pipe -ffor-scope -fno-exceptions -O3 -ffast-math -funroll-loops -finline-functions -finline-limit=20000"

	compilation() {
		if [[ -f dipolar_nn.f ]]; then
			sed \
				-e '/write/s:(i,6f6.3):(i3,6(1x,f6.3)):g' \
				-i dipolar_nn.f || die
		fi

		sed \
			-e '/LDFLAGS/s: = : ?= :g' \
			-e '/CCFLAGS/s: = : += :g' \
			-e 's:$(OBJECT) $(LDFLAGS):$(LDFLAGS) $(OBJECT) -lm -o:g' \
			-e 's:$(FFLAGS) -o:$(FFLAGS) $(LDFLAGS) -o:g' \
			-e '/make.system/d' \
			-i *akefile || die
		emake \
			CC=$(tc-getCXX) \
			CCFLAGS="${CXXFLAGS}"

		if [[ -f pNNMAKE. ]]; then
			mv pNNMAKE{.,} || die
			emake almostsuperclean
		else
			emake clean
		fi
	}

	for i in src/{mfr2rosetta,SPARTA/src,pdbrms,TALOS,rosettaFrag2csFrag,nnmake}; do
		pushd ${i} > /dev/null
			compilation
		popd > /dev/null
	done
}

src_install() {
	insinto /opt/${PN}/
	doins -r *
	chmod 755 \
		"${ED}"/opt/${PN}/com/* \
		"${ED}"/opt/${PN}/src/{mfr2rosetta/mfr2rosetta,SPARTA/src/SPARTA,pdbrms/pdbrms,TALOS/TALOS,rosettaFrag2csFrag/rosettaFrag2csFrag,nnmake/pNNMAKE} \
		 || die

	dosym make_fragments_2000.pl /opt/${PN}/com/make_fragment_2000.pl

	doenvd "${T}"/39${PN}
}