Lines 1-35
Link Here
|
1 |
# Copyright 1999-2009 Gentoo Foundation |
1 |
# Copyright 1999-2009 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/sci-chemistry/gromacs/gromacs-4.0.3.ebuild,v 1.2 2009/03/08 19:50:46 maekke Exp $ |
3 |
# $Header: $ |
4 |
|
4 |
|
5 |
EAPI="1" |
5 |
EAPI="1" |
6 |
|
6 |
|
7 |
LIBTOOLIZE="true" |
7 |
LIBTOOLIZE="true" |
8 |
|
8 |
|
9 |
inherit autotools eutils flag-o-matic fortran multilib |
9 |
inherit autotools bash-completion eutils fortran multilib |
10 |
|
10 |
|
11 |
DESCRIPTION="The ultimate molecular dynamics simulation package" |
11 |
DESCRIPTION="The ultimate molecular dynamics simulation package" |
12 |
HOMEPAGE="http://www.gromacs.org/" |
12 |
HOMEPAGE="http://www.gromacs.org/" |
13 |
SRC_URI="ftp://ftp.gromacs.org/pub/${PN}/${P}.tar.gz" |
13 |
SRC_URI="ftp://ftp.gromacs.org/pub/${PN}/${P}.tar.gz |
|
|
14 |
test? ( ftp://ftp.gromacs.org/pub/tests/gmxtest-${PV}.tgz ) |
15 |
doc? ( ftp://ftp.gromacs.org/pub/manual/manual-4.0.pdf )" |
14 |
|
16 |
|
15 |
LICENSE="GPL-2" |
17 |
LICENSE="GPL-2" |
16 |
SLOT="0" |
18 |
SLOT="0" |
17 |
KEYWORDS="~alpha amd64 ~ppc64 ~sparc x86" |
19 |
KEYWORDS="~alpha ~amd64 ~ppc64 ~sparc ~x86" |
18 |
IUSE="3dnow X altivec blas double-precision gsl lapack mpi +single-precision sse sse2 static xml" |
20 |
IUSE="X blas dmalloc doc -double-precision fftw fkernels gsl lapack mpi +single-precision static test +xml zsh-completion" |
19 |
|
21 |
|
20 |
# mopac7 qm/mm is broken until we can get files from |
22 |
DEPEND="app-shells/tcsh |
21 |
# http://md.chem.rug.nl/~groenhof/qmmm.html |
23 |
X? ( x11-libs/libX11 ) |
22 |
# or somewhere else... |
24 |
dmalloc? ( dev-libs/dmalloc ) |
23 |
|
|
|
24 |
DEPEND=">=sci-libs/fftw-3.0.1 |
25 |
app-shells/tcsh |
26 |
X? ( x11-libs/libX11 |
27 |
x11-libs/libXt |
28 |
x11-libs/libXp |
29 |
x11-libs/libXext |
30 |
x11-proto/xproto |
31 |
x11-libs/openmotif ) |
32 |
blas? ( virtual/blas ) |
25 |
blas? ( virtual/blas ) |
|
|
26 |
fftw? ( >=sci-libs/fftw-3.0.1 ) |
33 |
gsl? ( sci-libs/gsl ) |
27 |
gsl? ( sci-libs/gsl ) |
34 |
lapack? ( virtual/lapack ) |
28 |
lapack? ( virtual/lapack ) |
35 |
mpi? ( virtual/mpi ) |
29 |
mpi? ( virtual/mpi ) |
Lines 37-46
Link Here
|
37 |
|
31 |
|
38 |
RDEPEND="${DEPEND}" |
32 |
RDEPEND="${DEPEND}" |
39 |
|
33 |
|
40 |
FORTRAN="g77 gfortran ifc" |
|
|
41 |
|
42 |
src_unpack() { |
34 |
src_unpack() { |
43 |
|
|
|
44 |
unpack ${A} |
35 |
unpack ${A} |
45 |
cd "${S}" |
36 |
cd "${S}" |
46 |
# Fix typos in a couple of files. |
37 |
# Fix typos in a couple of files. |
Lines 64-69
Link Here
|
64 |
-i src/tools/Makefile.am \ |
55 |
-i src/tools/Makefile.am \ |
65 |
|| die "sed tools/Makefile.am failed" |
56 |
|| die "sed tools/Makefile.am failed" |
66 |
|
57 |
|
|
|
58 |
use fkernels && epatch "${FILESDIR}/${P}-configure-gfortran.patch" |
59 |
|
67 |
eautoreconf |
60 |
eautoreconf |
68 |
|
61 |
|
69 |
cd "${WORKDIR}" |
62 |
cd "${WORKDIR}" |
Lines 75-148
Link Here
|
75 |
} |
68 |
} |
76 |
|
69 |
|
77 |
src_compile() { |
70 |
src_compile() { |
78 |
|
|
|
79 |
# static should work but something's broken. |
80 |
# gcc spec file may be screwed up. |
81 |
# Static linking should try -lgcc instead of -lgcc_s. |
82 |
# For more info: |
83 |
# http://lists.debian.org/debian-gcc/2002/debian-gcc-200201/msg00150.html |
84 |
|
85 |
# We will compile single precision by default, and suffix double-precision with _d. |
86 |
# Sparc is the only arch I can test on that needs to use fortran. |
87 |
local myconf ; |
71 |
local myconf ; |
88 |
local myconf_s ; |
72 |
local myconf_s ; |
89 |
local myconf_d ; |
73 |
local myconf_d ; |
|
|
74 |
local suffix_d ; |
90 |
|
75 |
|
91 |
case "${ARCH}" in |
76 |
#leave all assembly options enabled mdrun is smart enough to deside itself |
92 |
|
77 |
#there so no gentoo on bluegene! |
93 |
x86) |
78 |
myconf="${myconf} --disable-bluegene" |
94 |
if ( use sse || use sse2 ) ; then |
79 |
|
95 |
myconf="${myconf} --enable-ia32-sse" |
80 |
#from gromacs configure |
96 |
fi |
81 |
if ! use fftw; then |
97 |
myconf="$myconf $(use_enable 3dnow ia32-3dnow)" |
82 |
ewarn "WARNING: The built-in FFTPACK routines are slow." |
98 |
|
83 |
ewarn "Are you sure you don\'t want to use FFTW?" |
99 |
if ( ! use sse && ! use sse2 && ! use 3dnow ) ; then |
84 |
ewarn "It is free and much faster..." |
100 |
if ! has_version "=sys-devel/gcc-3*" ; then |
85 |
fi |
101 |
die "If you must run gromacs without sse (not recommended) gfortran will not work." |
86 |
|
102 |
else |
87 |
if [[ $(gcc-version) == "4.1" ]]; then |
103 |
myconf="${myconf} --enable-fortran" && fortran_pkg_setup |
88 |
ewarn "gcc 4.1 is not supported by gromacs" |
104 |
fi |
89 |
ewarn "please run test suite" |
105 |
else |
90 |
fi |
106 |
myconf="${myconf} --disable-fortran" |
91 |
|
107 |
fi |
92 |
#fortran will gone in gromacs 4.1 anyway |
108 |
;; |
93 |
#note for gentoo-PREFIX on aix, fortran (xlf) is still much faster |
109 |
|
94 |
if use fkernels; then |
110 |
amd64) |
95 |
ewarn "Fortran kernels are usually not faster than C kernels and assembly" |
111 |
myconf="$myconf --enable-x86-64-sse --disable-fortran" |
96 |
ewarn "I hope, you know what are you doing..." |
112 |
;; |
97 |
FORTRAN="g77 gfortran ifc" |
113 |
|
98 |
myconf="${myconf} --enable-fortran" && fortran_pkg_setup |
114 |
ppc*) |
99 |
else |
115 |
if use altivec ; then |
100 |
myconf="${myconf} --disable-fortran" |
116 |
myconf="${myconf} --enable-ppc-altivec --disable-fortran" |
101 |
fi |
117 |
else |
|
|
118 |
if ! has_version "=sys-devel/gcc-3*" ; then |
119 |
die "If you must run gromacs without sse (not recommended) gfortran will not work." |
120 |
else |
121 |
myconf="${myconf} --enable-fortran" && fortran_pkg_setup |
122 |
fi |
123 |
fi |
124 |
;; |
125 |
|
126 |
ia64) |
127 |
myconf="$myconf --enable-ia64-asm --disable-fortran" |
128 |
;; |
129 |
|
130 |
alpha) |
131 |
if ! has_version "=sys-devel/gcc-3*" ; then |
132 |
die "If you must run gromacs without sse (not recommended) gfortran will not work." |
133 |
else |
134 |
myconf="$myconf --enable-fortran" && fortran_pkg_setup |
135 |
fi |
136 |
;; |
137 |
|
138 |
sparc) |
139 |
if ! has_version "=sys-devel/gcc-3*" ; then |
140 |
die "If you must run gromacs without sse (not recommended) gfortran will not work." |
141 |
else |
142 |
myconf="${myconf} --enable-fortran" && fortran_pkg_setup |
143 |
fi |
144 |
;; |
145 |
esac |
146 |
|
102 |
|
147 |
# if we need external blas |
103 |
# if we need external blas |
148 |
if use blas; then |
104 |
if use blas; then |
Lines 159-165
Link Here
|
159 |
myconf="--datadir=/usr/share \ |
115 |
myconf="--datadir=/usr/share \ |
160 |
--bindir=/usr/bin \ |
116 |
--bindir=/usr/bin \ |
161 |
--libdir=/usr/$(get_libdir) \ |
117 |
--libdir=/usr/$(get_libdir) \ |
162 |
--with-fft=fftw3 \ |
118 |
$(use_with dmalloc) \ |
|
|
119 |
$(use_with fftw fft fftw3) \ |
163 |
$(use_with gsl) \ |
120 |
$(use_with gsl) \ |
164 |
$(use_enable mpi) \ |
121 |
$(use_enable mpi) \ |
165 |
$(use_with X x) \ |
122 |
$(use_with X x) \ |
Lines 167-201
Link Here
|
167 |
$(use_enable static all-static) \ |
124 |
$(use_enable static all-static) \ |
168 |
${myconf}" |
125 |
${myconf}" |
169 |
|
126 |
|
|
|
127 |
#if we build both double is suffixed |
170 |
if ( use double-precision && use single-precision ); then |
128 |
if ( use double-precision && use single-precision ); then |
171 |
einfo "Building Single Precison Gromacs" |
129 |
suffix_d="_d" |
172 |
cd "${WORKDIR}"/"${P}"-single |
130 |
else |
173 |
myconf_s="${myconf} --enable-float --disable-double --program-suffix=''" |
131 |
suffix_d="" |
174 |
econf ${myconf_s} || die "Single Precision econf failed" |
132 |
fi |
175 |
emake || die "Single Precision emake failed" |
|
|
176 |
|
177 |
einfo "Building Double Precision Gromacs" |
178 |
cd "${WORKDIR}"/"${P}"-double |
179 |
myconf_d="${myconf} --enable-double --disable-float --program-suffix=_d" |
180 |
econf ${myconf_d} || die "Double Precision econf failed" |
181 |
emake || die "Double Precision emake failed" |
182 |
|
133 |
|
183 |
elif use double-precision ; then |
134 |
if use double-precision ; then |
|
|
135 |
#from gromacs manual |
136 |
elog |
137 |
elog For most simulations single precision is accurate enough. In some |
138 |
elog cases double precision is required to get reasonable results: |
139 |
elog |
140 |
elog -normal mode analysis, for the conjugate gradient or l-bfgs minimization |
141 |
elog and the calculation and diagonalization of the Hessian |
142 |
elog -calculation of the constraint force between two large groups of atoms |
143 |
elog -energy conservation: this can only be done without temperature coupling and |
144 |
elog without cutoffs |
145 |
elog |
184 |
einfo "Building Double Precison Gromacs" |
146 |
einfo "Building Double Precison Gromacs" |
185 |
cd "${WORKDIR}"/"${P}"-double |
147 |
cd "${WORKDIR}"/"${P}"-double |
186 |
myconf_d="${myconf} --enable-double --disable-float --program-suffix=''" |
148 |
myconf_d="${myconf} --enable-double --program-suffix='${suffix_d}'" |
187 |
econf ${myconf_d} || die "Double Precision econf failed" |
149 |
econf ${myconf_d} || die "Double Precision econf failed" |
188 |
emake || die "Double Precision emake failed" |
150 |
emake || die "Double Precision emake failed" |
|
|
151 |
fi |
189 |
|
152 |
|
190 |
elif use single-precision ; then |
153 |
if use single-precision ; then |
191 |
einfo "Building Single Precison Gromacs" |
154 |
einfo "Building Single Precison Gromacs" |
192 |
cd "${WORKDIR}"/"${P}"-single |
155 |
cd "${WORKDIR}"/"${P}"-single |
193 |
myconf_s="${myconf} --enable-float --disable-double --program-suffix=''" |
156 |
myconf_s="${myconf} --enable-float --program-suffix=''" |
194 |
econf ${myconf_s} || die "configure failed" |
157 |
econf ${myconf_s} || die "configure failed" |
195 |
emake || die "Single Precision emake failed" |
158 |
emake || die "Single Precision emake failed" |
196 |
fi |
159 |
fi |
197 |
} |
160 |
} |
198 |
|
161 |
|
|
|
162 |
src_test() { |
163 |
if use single-precision ; then |
164 |
export PATH="${WORKDIR}/${P}-single/src/kernel:${WORKDIR}/${P}-single/src/tools:$PATH" |
165 |
cd "${WORKDIR}/gmxtest" |
166 |
#test is broken, only do simple tests |
167 |
./gmxtest.pl simple || die "Single Precision test failed" |
168 |
fi |
169 |
|
170 |
if use double-precision ; then |
171 |
export PATH="${WORKDIR}/${P}-double/src/kernel:${WORKDIR}/${P}-double/src/tools:$PATH" |
172 |
cd "${WORKDIR}/gmxtest" |
173 |
use single-precision && ./gmxtest.pl clean |
174 |
#test is broken, only do simple tests |
175 |
./gmxtest.pl -double simple || die "Double Precision test failed" |
176 |
fi |
177 |
} |
178 |
|
199 |
src_install() { |
179 |
src_install() { |
200 |
if use single-precision ; then |
180 |
if use single-precision ; then |
201 |
einfo "Installing Single Precision" |
181 |
einfo "Installing Single Precision" |
Lines 208-215
Link Here
|
208 |
cd "${WORKDIR}"/"${P}"-double |
188 |
cd "${WORKDIR}"/"${P}"-double |
209 |
emake DESTDIR="${D}" install || die "Installing Double Precision failed" |
189 |
emake DESTDIR="${D}" install || die "Installing Double Precision failed" |
210 |
fi |
190 |
fi |
|
|
191 |
|
192 |
sed -n -e '/^GMXBIN/,/^GMXDATA/p' ${D}/usr/bin/GMXRC.bash > "${T}/80gromacs" |
193 |
doenvd "${T}/80gromacs" |
194 |
rm -f ${D}/usr/bin/GMXRC* |
195 |
|
196 |
dobashcompletion ${D}/usr/bin/completion.bash ${PN} |
197 |
if use zsh-completion ; then |
198 |
insinto /usr/share/zsh/site-functions |
199 |
newins ${D}/usr/bin/completion.zsh _${PN} |
200 |
fi |
201 |
rm -r ${D}/usr/bin/completion.* |
211 |
|
202 |
|
212 |
dodoc AUTHORS INSTALL README |
203 |
dodoc AUTHORS INSTALL README |
213 |
# Move html and leave examples and templates under /usr/share/gromacs. |
204 |
if use doc; then |
214 |
mv "${D}"/usr/share/"${PN}"/html "${D}"/usr/share/doc/"${PF}"/ |
205 |
# Move html and leave examples and templates under /usr/share/gromacs. |
|
|
206 |
mv "${D}"/usr/share/"${PN}"/html "${D}"/usr/share/doc/"${PF}"/ |
207 |
dodoc "${DISTDIR}"/manual-4.0.pdf |
208 |
fi |
209 |
} |
210 |
|
211 |
pkg_postinst() { |
212 |
env-update && source /etc/profile |
213 |
elog |
214 |
elog Please read and cite: |
215 |
elog Gromacs 4, J. Chem. Theory Comput. 4, 435 \(2008\). |
216 |
elog http://dx.doi.org/10.1021/ct700301q |
217 |
elog |
218 |
bash-completion_pkg_postinst |
219 |
elog |
220 |
elog $(luck) |
221 |
elog For more Gromacs cool quotes \(gcq\) add luck to your .bashrc |
222 |
elog |
215 |
} |
223 |
} |