blob: 6b91053dbf0a2b7822af1ef7cf4473d585ddb4cc (
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-chemistry/tinker/tinker-4.2-r1.ebuild,v 1.6 2009/12/14 13:55:26 flameeyes Exp $
inherit fortran toolchain-funcs
FORTRAN="g77 gfortran ifc"
DESCRIPTION="TINKER is a molecular modeling package that includes force fields for handing large molecules and large systems, such as AMBER and CHARMM. A Java based visualization front end is included."
HOMEPAGE="http://dasher.wustl.edu/tinker/"
SRC_URI="ftp://dasher.wustl.edu/pub/tinker.tar.gz"
IUSE="X"
LICENSE="Tinker"
SLOT="0"
KEYWORDS="~x86"
# file collision, bug #279018
DEPEND="!dev-util/diffuse
X? ( dev-java/sun-java3d-bin )"
S=${WORKDIR}/tinker/source
src_compile() {
if use X; then
COMPGUI="./compgui.make"
LINK="./linkgui.make"
cp ../jar/linux/sockets.c .
else
LINK="./link.make"
fi
COMPILE="./compile.make"
LIBRARY="./library.make"
# Need to make sure all of the appropriate config files are in place
# for the build.
# This should be easily customizable for other Fortran compilers, e.g. pg77.
if [[ ${FORTRANC} == "ifc" ]]; then
cp ../linux/intel/* .
else
cp ../linux/gnu/* .
fi
cp ../make/* .
# Prep build scripts
if use X; then
sed -i \
-e "s:-O3:${CFLAGS}:" \
-e "s:gcc:$(tc-getCC):" \
${COMPGUI}
local JAVA_HOME=$(java-config --jdk-home)
local JAVA_LIB_PATH="${JAVA_HOME}/jre/lib/i386/client"
ln -s ${JAVA_LIB_PATH}/libjvm.so
sed -i -e "s:/local/java/j2sdk1.4.2_05:${JAVA_HOME}:g" ${COMPGUI}
sed -i -e "s:g77:${FORTRANC}:g" ${LINK}
fi
# Default to -O2 if FFLAGS is unset
sed -i -e "s:-O3 -ffast-math:${FFLAGS:- -O2}:" ${COMPILE}
sed -i -e "s:g77:${FORTRANC}:g" ${COMPILE}
# Prep executable script - the one packaged with the distro is b0rked
if use X; then
echo 'java -Djava.library.path=$(java-config -i sun-java3d-bin) -cp $(java-config -p sun-java3d-bin):/usr/lib/tinker/ffe.jar ffe.Main' > tinker
fi
einfo "Compiling ..."
if use X; then
${COMPGUI} || die "GUI compile failed"
fi
${COMPILE} || die "compile failed"
einfo "Building libraries ..."
${LIBRARY} || die "library creation failed"
einfo "Linking ..."
${LINK} || die "link failed"
}
src_install() {
exeinto /usr/bin
dodoc \
${WORKDIR}/tinker/doc/*.txt \
${WORKDIR}/tinker/doc/release-4.2 \
${WORKDIR}/tinker/doc/*.pdf
if use X; then
dolib.so ${WORKDIR}/tinker/jar/linux/libffe.so || die
fi
dolib.a libtinker.a || die
insinto /usr/lib/tinker
if use X; then
doins ${WORKDIR}/tinker/jar/ffe.jar || die
fi
for EXE in *.x; do
newexe ${EXE} ${EXE%.x} || die
done
if use X; then
doexe tinker || die
fi
docinto example
dodoc ${WORKDIR}/tinker/example/*
docinto test
dodoc ${WORKDIR}/tinker/test/*
doexe ${WORKDIR}/tinker/perl/mdavg || die
insinto /usr/share/tinker/params
doins ${WORKDIR}/tinker/params/* || die
}
pkg_postinst() {
einfo "Tinker binaries installed to ${ROOT}usr/bin."
einfo "Parameter files installed to ${ROOT}usr/share/tinker/params."
einfo "Call the Java X front-end, Force-Field Explorer, with 'tinker.'"
einfo "It doesn't seem to detect installed Java3D yet, fixes welcome."
einfo "You must edit ${ROOT}usr/bin/tinker if you aren't using Blackdown."
}
|