1 |
commit: 2cdfa60bdd271c43984a8dca85fa2192b6d6216b |
2 |
Author: Christoph Junghans <junghans <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Nov 7 18:04:51 2021 +0000 |
4 |
Commit: Christoph Junghans <junghans <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Nov 7 20:12:26 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2cdfa60b |
7 |
|
8 |
sci-chemistry/gromacs: fix v2019 build on newer glibc |
9 |
|
10 |
Package-Manager: Portage-3.0.28, Repoman-3.0.3 |
11 |
Signed-off-by: Christoph Junghans <junghans <AT> gentoo.org> |
12 |
|
13 |
.../files/gromacs-2019.6-missing-include.patch | 38 +++ |
14 |
sci-chemistry/gromacs/gromacs-2019.6-r2.ebuild | 255 +++++++++++++++++++++ |
15 |
2 files changed, 293 insertions(+) |
16 |
|
17 |
diff --git a/sci-chemistry/gromacs/files/gromacs-2019.6-missing-include.patch b/sci-chemistry/gromacs/files/gromacs-2019.6-missing-include.patch |
18 |
new file mode 100644 |
19 |
index 00000000000..cf478d52cb6 |
20 |
--- /dev/null |
21 |
+++ b/sci-chemistry/gromacs/files/gromacs-2019.6-missing-include.patch |
22 |
@@ -0,0 +1,38 @@ |
23 |
+From 053286ff0bfb88db5c158f5f68017c4bb5d9496a Mon Sep 17 00:00:00 2001 |
24 |
+From: Christoph Junghans <junghans@×××××.org> |
25 |
+Date: Wed, 28 Apr 2021 19:44:09 -0600 |
26 |
+Subject: [PATCH] fix build on F34 |
27 |
+ |
28 |
+see https://gitlab.com/gromacs/gromacs/-/merge_requests/1524 |
29 |
+--- |
30 |
+ src/gromacs/awh/biasparams.cpp | 1 + |
31 |
+ src/gromacs/mdrun/minimize.cpp | 1 + |
32 |
+ 2 files changed, 2 insertions(+) |
33 |
+ |
34 |
+diff --git a/src/gromacs/awh/biasparams.cpp b/src/gromacs/awh/biasparams.cpp |
35 |
+index f4db497002..e762ea084a 100644 |
36 |
+--- a/src/gromacs/awh/biasparams.cpp |
37 |
++++ b/src/gromacs/awh/biasparams.cpp |
38 |
+@@ -49,6 +49,7 @@ |
39 |
+ #include <cmath> |
40 |
+ |
41 |
+ #include <algorithm> |
42 |
++#include <limits> |
43 |
+ |
44 |
+ #include "gromacs/math/functions.h" |
45 |
+ #include "gromacs/mdtypes/awh-params.h" |
46 |
+diff --git a/src/gromacs/mdrun/minimize.cpp b/src/gromacs/mdrun/minimize.cpp |
47 |
+index 8550271325..495bcfdda0 100644 |
48 |
+--- a/src/gromacs/mdrun/minimize.cpp |
49 |
++++ b/src/gromacs/mdrun/minimize.cpp |
50 |
+@@ -51,6 +51,7 @@ |
51 |
+ #include <ctime> |
52 |
+ |
53 |
+ #include <algorithm> |
54 |
++#include <limits> |
55 |
+ #include <vector> |
56 |
+ |
57 |
+ #include "gromacs/commandline/filenm.h" |
58 |
+-- |
59 |
+GitLab |
60 |
+ |
61 |
|
62 |
diff --git a/sci-chemistry/gromacs/gromacs-2019.6-r2.ebuild b/sci-chemistry/gromacs/gromacs-2019.6-r2.ebuild |
63 |
new file mode 100644 |
64 |
index 00000000000..35bbc972de6 |
65 |
--- /dev/null |
66 |
+++ b/sci-chemistry/gromacs/gromacs-2019.6-r2.ebuild |
67 |
@@ -0,0 +1,255 @@ |
68 |
+# Copyright 1999-2021 Gentoo Authors |
69 |
+# Distributed under the terms of the GNU General Public License v2 |
70 |
+ |
71 |
+EAPI=7 |
72 |
+ |
73 |
+CMAKE_MAKEFILE_GENERATOR="ninja" |
74 |
+ |
75 |
+inherit bash-completion-r1 cmake cuda multilib readme.gentoo-r1 toolchain-funcs xdg-utils |
76 |
+ |
77 |
+SRC_URI=" |
78 |
+ http://ftp.gromacs.org/gromacs/${PN}-${PV/_/-}.tar.gz |
79 |
+ doc? ( http://ftp.gromacs.org/manual/manual-${PV/_/-}.pdf ) |
80 |
+ test? ( http://ftp.gromacs.org/regressiontests/regressiontests-${PV/_/-}.tar.gz )" |
81 |
+KEYWORDS="~amd64 ~arm ~x86 ~amd64-linux ~x86-linux ~x64-macos" |
82 |
+ |
83 |
+ACCE_IUSE="cpu_flags_x86_sse2 cpu_flags_x86_sse4_1 cpu_flags_x86_fma4 cpu_flags_x86_avx cpu_flags_x86_avx2" |
84 |
+ |
85 |
+DESCRIPTION="The ultimate molecular dynamics simulation package" |
86 |
+HOMEPAGE="http://www.gromacs.org/" |
87 |
+ |
88 |
+# see COPYING for details |
89 |
+# https://repo.or.cz/w/gromacs.git/blob/HEAD:/COPYING |
90 |
+# base, vmd plugins, fftpack from numpy, blas/lapck from netlib, memtestG80 library, mpi_thread lib |
91 |
+LICENSE="LGPL-2.1 UoI-NCSA !mkl? ( !fftw? ( BSD ) !blas? ( BSD ) !lapack? ( BSD ) ) cuda? ( LGPL-3 ) threads? ( BSD )" |
92 |
+SLOT="0/${PV}" |
93 |
+IUSE="X blas cuda +doc double-precision +fftw +gmxapi +hwloc lapack +lmfit mkl mpi +offensive opencl openmp +single-precision test +threads +tng ${ACCE_IUSE}" |
94 |
+ |
95 |
+CDEPEND=" |
96 |
+ X? ( |
97 |
+ x11-libs/libX11 |
98 |
+ x11-libs/libSM |
99 |
+ x11-libs/libICE |
100 |
+ ) |
101 |
+ blas? ( virtual/blas ) |
102 |
+ cuda? ( >=dev-util/nvidia-cuda-toolkit-6.5.14 ) |
103 |
+ opencl? ( virtual/opencl ) |
104 |
+ fftw? ( sci-libs/fftw:3.0= ) |
105 |
+ hwloc? ( sys-apps/hwloc:= ) |
106 |
+ lapack? ( virtual/lapack ) |
107 |
+ lmfit? ( sci-libs/lmfit:= ) |
108 |
+ mkl? ( sci-libs/mkl ) |
109 |
+ mpi? ( virtual/mpi ) |
110 |
+ ${PYTHON_DEPS} |
111 |
+ " |
112 |
+BDEPEND="${CDEPEND} |
113 |
+ virtual/pkgconfig |
114 |
+ " |
115 |
+RDEPEND="${CDEPEND}" |
116 |
+ |
117 |
+REQUIRED_USE=" |
118 |
+ || ( single-precision double-precision ) |
119 |
+ cuda? ( single-precision ) |
120 |
+ cuda? ( !opencl ) |
121 |
+ mkl? ( !blas !fftw !lapack ) |
122 |
+ ${PYTHON_REQUIRED_USE}" |
123 |
+ |
124 |
+DOCS=( AUTHORS README ) |
125 |
+ |
126 |
+RESTRICT="!test? ( test )" |
127 |
+ |
128 |
+S="${WORKDIR}/${PN}-${PV/_/-}" |
129 |
+ |
130 |
+PATCHES=( "${FILESDIR}/${P}-missing-include.patch" ) |
131 |
+ |
132 |
+pkg_pretend() { |
133 |
+ [[ $(gcc-version) == "4.1" ]] && die "gcc 4.1 is not supported by gromacs" |
134 |
+ use openmp && ! tc-has-openmp && \ |
135 |
+ die "Please switch to an openmp compatible compiler" |
136 |
+} |
137 |
+ |
138 |
+src_prepare() { |
139 |
+ #notes/todos |
140 |
+ # -on apple: there is framework support |
141 |
+ |
142 |
+ xdg_environment_reset #591952 |
143 |
+ |
144 |
+ cmake_src_prepare |
145 |
+ |
146 |
+ use cuda && cuda_src_prepare |
147 |
+ |
148 |
+ GMX_DIRS="" |
149 |
+ use single-precision && GMX_DIRS+=" float" |
150 |
+ use double-precision && GMX_DIRS+=" double" |
151 |
+ |
152 |
+ if use test; then |
153 |
+ for x in ${GMX_DIRS}; do |
154 |
+ mkdir -p "${WORKDIR}/${P}_${x}" || die |
155 |
+ cp -al "${WORKDIR}/regressiontests"* "${WORKDIR}/${P}_${x}/tests" || die |
156 |
+ done |
157 |
+ fi |
158 |
+ |
159 |
+ DOC_CONTENTS="Gromacs can use sci-chemistry/vmd to read additional file formats" |
160 |
+} |
161 |
+ |
162 |
+src_configure() { |
163 |
+ local mycmakeargs_pre=( ) extra fft_opts=( ) |
164 |
+ |
165 |
+ #go from slowest to fastest acceleration |
166 |
+ local acce="None" |
167 |
+ use cpu_flags_x86_sse2 && acce="SSE2" |
168 |
+ use cpu_flags_x86_sse4_1 && acce="SSE4.1" |
169 |
+ use cpu_flags_x86_fma4 && acce="AVX_128_FMA" |
170 |
+ use cpu_flags_x86_avx && acce="AVX_256" |
171 |
+ use cpu_flags_x86_avx2 && acce="AVX2_256" |
172 |
+ |
173 |
+ #to create man pages, build tree binaries are executed (bug #398437) |
174 |
+ [[ ${CHOST} = *-darwin* ]] && \ |
175 |
+ extra+=" -DCMAKE_BUILD_WITH_INSTALL_RPATH=OFF" |
176 |
+ |
177 |
+ if use fftw; then |
178 |
+ fft_opts=( -DGMX_FFT_LIBRARY=fftw3 ) |
179 |
+ elif use mkl && has_version "=sci-libs/mkl-10*"; then |
180 |
+ fft_opts=( -DGMX_FFT_LIBRARY=mkl |
181 |
+ -DMKL_INCLUDE_DIR="${MKLROOT}/include" |
182 |
+ -DMKL_LIBRARIES="$(echo /opt/intel/mkl/10.0.5.025/lib/*/libmkl.so);$(echo /opt/intel/mkl/10.0.5.025/lib/*/libiomp*.so)" |
183 |
+ ) |
184 |
+ elif use mkl; then |
185 |
+ local bits=$(get_libdir) |
186 |
+ fft_opts=( -DGMX_FFT_LIBRARY=mkl |
187 |
+ -DMKL_INCLUDE_DIR="$(echo /opt/intel/*/mkl/include)" |
188 |
+ -DMKL_LIBRARIES="$(echo /opt/intel/*/mkl/lib/*${bits/lib}/libmkl_rt.so)" |
189 |
+ ) |
190 |
+ else |
191 |
+ fft_opts=( -DGMX_FFT_LIBRARY=fftpack ) |
192 |
+ fi |
193 |
+ |
194 |
+ if use lmfit; then |
195 |
+ local lmfit_opts=( -DGMX_USE_LMFIT=EXTERNAL ) |
196 |
+ else |
197 |
+ local lmfit_opts=( -DGMX_USE_LMFIT=INTERNAL ) |
198 |
+ fi |
199 |
+ |
200 |
+ mycmakeargs_pre+=( |
201 |
+ "${fft_opts[@]}" |
202 |
+ "${lmfit_opts[@]}" |
203 |
+ -DGMX_X11=$(usex X) |
204 |
+ -DGMX_EXTERNAL_BLAS=$(usex blas) |
205 |
+ -DGMX_EXTERNAL_LAPACK=$(usex lapack) |
206 |
+ -DGMX_OPENMP=$(usex openmp) |
207 |
+ -DGMX_COOL_QUOTES=$(usex offensive) |
208 |
+ -DGMX_USE_TNG=$(usex tng) |
209 |
+ -DGMX_HWLOC=$(usex hwloc) |
210 |
+ -DGMX_DEFAULT_SUFFIX=off |
211 |
+ -DGMX_SIMD="$acce" |
212 |
+ -DGMX_VMD_PLUGIN_PATH="${EPREFIX}/usr/$(get_libdir)/vmd/plugins/*/molfile/" |
213 |
+ -DBUILD_TESTING=$(usex test) |
214 |
+ -DGMX_BUILD_UNITTESTS=$(usex test) |
215 |
+ -DPYTHON_EXECUTABLE="${EPREFIX}/usr/bin/${EPYTHON}" |
216 |
+ ${extra} |
217 |
+ ) |
218 |
+ |
219 |
+ for x in ${GMX_DIRS}; do |
220 |
+ einfo "Configuring for ${x} precision" |
221 |
+ local suffix="" |
222 |
+ #if we build single and double - double is suffixed |
223 |
+ use double-precision && use single-precision && \ |
224 |
+ [[ ${x} = "double" ]] && suffix="_d" |
225 |
+ local p |
226 |
+ [[ ${x} = "double" ]] && p="-DGMX_DOUBLE=ON" || p="-DGMX_DOUBLE=OFF" |
227 |
+ local cuda=( "-DGMX_GPU=OFF" ) |
228 |
+ [[ ${x} = "float" ]] && use cuda && \ |
229 |
+ cuda=( "-DGMX_GPU=ON" ) |
230 |
+ local opencl=( "-DGMX_USE_OPENCL=OFF" ) |
231 |
+ use opencl && opencl=( "-DGMX_USE_OPENCL=ON" ) cuda=( "-DGMX_GPU=ON" ) |
232 |
+ mycmakeargs=( |
233 |
+ ${mycmakeargs_pre[@]} ${p} |
234 |
+ -DGMX_MPI=OFF |
235 |
+ -DGMX_THREAD_MPI=$(usex threads) |
236 |
+ -DGMXAPI=$(usex gmxapi) |
237 |
+ "${opencl[@]}" |
238 |
+ "${cuda[@]}" |
239 |
+ "$(use test && echo -DREGRESSIONTEST_PATH="${WORKDIR}/${P}_${x}/tests")" |
240 |
+ -DGMX_BINARY_SUFFIX="${suffix}" |
241 |
+ -DGMX_LIBS_SUFFIX="${suffix}" |
242 |
+ ) |
243 |
+ BUILD_DIR="${WORKDIR}/${P}_${x}" cmake_src_configure |
244 |
+ [[ ${CHOST} != *-darwin* ]] || \ |
245 |
+ sed -i '/SET(CMAKE_INSTALL_NAME_DIR/s/^/#/' "${WORKDIR}/${P}_${x}/gentoo_rules.cmake" || die |
246 |
+ use mpi || continue |
247 |
+ einfo "Configuring for ${x} precision with mpi" |
248 |
+ mycmakeargs=( |
249 |
+ ${mycmakeargs_pre[@]} ${p} |
250 |
+ -DGMX_THREAD_MPI=OFF |
251 |
+ -DGMX_MPI=ON |
252 |
+ -DGMX_OPENMM=OFF |
253 |
+ -DGMXAPI=OFF |
254 |
+ "${opencl[@]}" |
255 |
+ "${cuda[@]}" |
256 |
+ -DGMX_BUILD_MDRUN_ONLY=ON |
257 |
+ -DBUILD_SHARED_LIBS=OFF |
258 |
+ -DGMX_BUILD_MANUAL=OFF |
259 |
+ -DGMX_BINARY_SUFFIX="_mpi${suffix}" |
260 |
+ -DGMX_LIBS_SUFFIX="_mpi${suffix}" |
261 |
+ ) |
262 |
+ BUILD_DIR="${WORKDIR}/${P}_${x}_mpi" CC="mpicc" cmake_src_configure |
263 |
+ [[ ${CHOST} != *-darwin* ]] || \ |
264 |
+ sed -i '/SET(CMAKE_INSTALL_NAME_DIR/s/^/#/' "${WORKDIR}/${P}_${x}_mpi/gentoo_rules.cmake" || die |
265 |
+ done |
266 |
+} |
267 |
+ |
268 |
+src_compile() { |
269 |
+ for x in ${GMX_DIRS}; do |
270 |
+ einfo "Compiling for ${x} precision" |
271 |
+ BUILD_DIR="${WORKDIR}/${P}_${x}"\ |
272 |
+ cmake_src_compile |
273 |
+ use mpi || continue |
274 |
+ einfo "Compiling for ${x} precision with mpi" |
275 |
+ BUILD_DIR="${WORKDIR}/${P}_${x}_mpi"\ |
276 |
+ cmake_src_compile |
277 |
+ done |
278 |
+} |
279 |
+ |
280 |
+src_test() { |
281 |
+ for x in ${GMX_DIRS}; do |
282 |
+ BUILD_DIR="${WORKDIR}/${P}_${x}"\ |
283 |
+ cmake_src_compile check |
284 |
+ done |
285 |
+} |
286 |
+ |
287 |
+src_install() { |
288 |
+ for x in ${GMX_DIRS}; do |
289 |
+ BUILD_DIR="${WORKDIR}/${P}_${x}" \ |
290 |
+ cmake_src_install |
291 |
+ if use doc; then |
292 |
+ newdoc "${DISTDIR}/manual-${PV/_/-}.pdf" "${PN}-manual-${PV}.pdf" |
293 |
+ fi |
294 |
+ use mpi || continue |
295 |
+ BUILD_DIR="${WORKDIR}/${P}_${x}_mpi" \ |
296 |
+ cmake_src_install |
297 |
+ done |
298 |
+ |
299 |
+ if use tng; then |
300 |
+ insinto /usr/include/tng |
301 |
+ doins src/external/tng_io/include/tng/*h |
302 |
+ fi |
303 |
+ # drop unneeded stuff |
304 |
+ rm "${ED}"/usr/bin/GMXRC* || die |
305 |
+ for x in "${ED}"/usr/bin/gmx-completion-*.bash ; do |
306 |
+ local n=${x##*/gmx-completion-} |
307 |
+ n="${n%.bash}" |
308 |
+ cat "${ED}"/usr/bin/gmx-completion.bash "$x" > "${T}/${n}" || die |
309 |
+ newbashcomp "${T}"/"${n}" "${n}" |
310 |
+ done |
311 |
+ rm "${ED}"/usr/bin/gmx-completion*.bash || die |
312 |
+ readme.gentoo_create_doc |
313 |
+} |
314 |
+ |
315 |
+pkg_postinst() { |
316 |
+ einfo |
317 |
+ einfo "Please read and cite:" |
318 |
+ einfo "Gromacs 4, J. Chem. Theory Comput. 4, 435 (2008). " |
319 |
+ einfo "https://dx.doi.org/10.1021/ct700301q" |
320 |
+ einfo |
321 |
+ readme.gentoo_print_elog |
322 |
+} |