Diff gromacs-2019.6-r3 with a gromacs-2020.7-r1

/usr/portage/sci-chemistry/gromacs/gromacs-2020.7-r1.ebuild 2023-10-09 14:52:35.036368490 +0300
1 1
# Copyright 1999-2023 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4
EAPI=7
4
EAPI=8
5 5

  
6 6
CMAKE_MAKEFILE_GENERATOR="ninja"
7 7

  
8
inherit bash-completion-r1 cmake cuda readme.gentoo-r1 toolchain-funcs xdg-utils
8
PYTHON_COMPAT=( python3_{9..11} )
9 9

  
10
SRC_URI="
11
	https://ftp.gromacs.org/gromacs/${PN}-${PV/_/-}.tar.gz
12
	doc? ( https://ftp.gromacs.org/manual/manual-${PV/_/-}.pdf )
13
	test? ( https://ftp.gromacs.org/regressiontests/regressiontests-${PV/_/-}.tar.gz )"
14
KEYWORDS="amd64 arm ~x86 ~amd64-linux ~x86-linux ~x64-macos"
10
DISTUTILS_OPTIONAL=1
11
DISTUTILS_USE_PEP517=no
12
DISTUTILS_SINGLE_IMPL=1
13

  
14
inherit bash-completion-r1 cmake cuda distutils-r1 flag-o-matic readme.gentoo-r1 toolchain-funcs xdg-utils
15

  
16
if [[ ${PV} = *9999* ]]; then
17
	EGIT_REPO_URI="
18
		https://gitlab.com/gromacs/gromacs.git
19
		https://github.com/gromacs/gromacs.git
20
		git://git.gromacs.org/gromacs.git"
21
	[[ ${PV} = 9999 ]] && EGIT_BRANCH="master" || EGIT_BRANCH="release-${PV:0:4}"
22
	inherit git-r3
23
else
24
	SRC_URI="
25
		https://ftp.gromacs.org/gromacs/${PN}-${PV/_/-}.tar.gz
26
		doc? ( https://ftp.gromacs.org/manual/manual-${PV/_/-}.pdf )
27
		test? ( https://ftp.gromacs.org/regressiontests/regressiontests-${PV/_/-}.tar.gz )"
28
	KEYWORDS="amd64 arm ~x86 ~amd64-linux ~x86-linux ~x64-macos"
29
fi
15 30

  
16 31
ACCE_IUSE="cpu_flags_x86_sse2 cpu_flags_x86_sse4_1 cpu_flags_x86_fma4 cpu_flags_x86_avx cpu_flags_x86_avx2"
17 32

  
......
23 38
#        base,    vmd plugins, fftpack from numpy,  blas/lapck from netlib,        memtestG80 library,  mpi_thread lib
24 39
LICENSE="LGPL-2.1 UoI-NCSA !mkl? ( !fftw? ( BSD ) !blas? ( BSD ) !lapack? ( BSD ) ) cuda? ( LGPL-3 ) threads? ( BSD )"
25 40
SLOT="0/${PV}"
26
IUSE="X blas cuda +doc double-precision +fftw +gmxapi +hwloc lapack +lmfit mkl mpi +offensive opencl openmp +single-precision test +threads +tng ${ACCE_IUSE}"
41
IUSE="X blas cuda +custom-cflags +doc build-manual double-precision +fftw +gmxapi +gmxapi-legacy +hwloc lapack +lmfit mkl mpi +offensive opencl openmp +python +single-precision test +threads +tng ${ACCE_IUSE}"
27 42

  
28 43
CDEPEND="
29 44
	X? (
......
44 59
	"
45 60
BDEPEND="${CDEPEND}
46 61
	virtual/pkgconfig
47
	"
62
	build-manual? (
63
		app-doc/doxygen
64
		$(python_gen_cond_dep '
65
			dev-python/sphinx[${PYTHON_USEDEP}]
66
		')
67
		media-gfx/mscgen
68
		media-gfx/graphviz
69
		dev-texlive/texlive-latex
70
		dev-texlive/texlive-latexextra
71
		media-gfx/imagemagick
72
	)"
48 73
RDEPEND="${CDEPEND}"
49 74

  
50 75
REQUIRED_USE="
51 76
	|| ( single-precision double-precision )
77
	doc? ( !build-manual )
52 78
	cuda? ( single-precision )
53 79
	opencl? ( single-precision )
54 80
	cuda? ( !opencl )
......
59 85

  
60 86
RESTRICT="!test? ( test )"
61 87

  
62
S="${WORKDIR}/${PN}-${PV/_/-}"
88
if [[ ${PV} != *9999 ]]; then
89
	S="${WORKDIR}/${PN}-${PV/_/-}"
90
fi
63 91

  
64
PATCHES=( "${FILESDIR}/${P}-missing-include.patch" )
92
PATCHES=( "${FILESDIR}/${PN}-2020-pytest.patch" )
65 93

  
66 94
pkg_pretend() {
67 95
	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
......
69 97

  
70 98
pkg_setup() {
71 99
	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
100
	python-single-r1_pkg_setup
101
}
102

  
103
src_unpack() {
104
	if [[ ${PV} != *9999 ]]; then
105
		default
106
	else
107
		git-r3_src_unpack
108
		if use test; then
109
			EGIT_REPO_URI="git://git.gromacs.org/regressiontests.git" \
110
			EGIT_BRANCH="${EGIT_BRANCH}" \
111
			EGIT_CHECKOUT_DIR="${WORKDIR}/regressiontests"\
112
				git-r3_src_unpack
113
		fi
114
	fi
72 115
}
73 116

  
74 117
src_prepare() {
......
93 136
	fi
94 137

  
95 138
	DOC_CONTENTS="Gromacs can use sci-chemistry/vmd to read additional file formats"
139
	if use build-manual; then
140
		# try to create policy for imagemagik
141
		mkdir -p ${HOME}/.config/ImageMagick
142
		cat >> ${HOME}/.config/ImageMagick/policy.xml <<- EOF
143
		<?xml version="1.0" encoding="UTF-8"?>
144
		<!DOCTYPE policymap [
145
		<!ELEMENT policymap (policy)+>
146
		!ATTLIST policymap xmlns CDATA #FIXED ''>
147
		<!ELEMENT policy EMPTY>
148
		<!ATTLIST policy xmlns CDATA #FIXED '' domain NMTOKEN #REQUIRED
149
			name NMTOKEN #IMPLIED pattern CDATA #IMPLIED rights NMTOKEN #IMPLIED
150
			stealth NMTOKEN #IMPLIED value CDATA #IMPLIED>
151
		]>
152
		<policymap>
153
			<policy domain="coder" rights="read | write" pattern="PS" />
154
			<policy domain="coder" rights="read | write" pattern="PS2" />
155
			<policy domain="coder" rights="read | write" pattern="PS3" />
156
			<policy domain="coder" rights="read | write" pattern="EPS" />
157
			<policy domain="coder" rights="read | write" pattern="PDF" />
158
			<policy domain="coder" rights="read | write" pattern="XPS" />
159
		</policymap>
160
		EOF
161
	fi
96 162
}
97 163

  
98 164
src_configure() {
99 165
	local mycmakeargs_pre=( ) extra fft_opts=( )
100 166

  
101
	#go from slowest to fastest acceleration
102
	local acce="None"
103
	use cpu_flags_x86_sse2 && acce="SSE2"
104
	use cpu_flags_x86_sse4_1 && acce="SSE4.1"
105
	use cpu_flags_x86_fma4 && acce="AVX_128_FMA"
106
	use cpu_flags_x86_avx && acce="AVX_256"
107
	use cpu_flags_x86_avx2 && acce="AVX2_256"
167
	if use custom-cflags; then
168
		#go from slowest to fastest acceleration
169
		local acce="None"
170
		use cpu_flags_x86_sse2 && acce="SSE2"
171
		use cpu_flags_x86_sse4_1 && acce="SSE4.1"
172
		use cpu_flags_x86_fma4 && acce="AVX_128_FMA"
173
		use cpu_flags_x86_avx && acce="AVX_256"
174
		use cpu_flags_x86_avx2 && acce="AVX2_256"
175
	else
176
		strip-flags
177
	fi
108 178

  
109 179
	#to create man pages, build tree binaries are executed (bug #398437)
110 180
	[[ ${CHOST} = *-darwin* ]] && \
......
137 207
		-DGMX_OPENMP=$(usex openmp)
138 208
		-DGMX_COOL_QUOTES=$(usex offensive)
139 209
		-DGMX_USE_TNG=$(usex tng)
210
		-DGMX_BUILD_MANUAL=$(usex build-manual)
140 211
		-DGMX_HWLOC=$(usex hwloc)
141 212
		-DGMX_DEFAULT_SUFFIX=off
142 213
		-DGMX_SIMD="$acce"
......
165 236
			-DGMX_MPI=OFF
166 237
			-DGMX_THREAD_MPI=$(usex threads)
167 238
			-DGMXAPI=$(usex gmxapi)
239
			-DGMX_INSTALL_LEGACY_API=$(usex gmxapi-legacy)
168 240
			"${opencl[@]}"
169 241
			"${cuda[@]}"
170 242
			"$(use test && echo -DREGRESSIONTEST_PATH="${WORKDIR}/${P}_${x}/tests")"
171 243
			-DGMX_BINARY_SUFFIX="${suffix}"
172 244
			-DGMX_LIBS_SUFFIX="${suffix}"
245
			-DGMX_PYTHON_PACKAGE=$(usex python)
173 246
			)
174 247
		BUILD_DIR="${WORKDIR}/${P}_${x}" cmake_src_configure
175 248
		[[ ${CHOST} != *-darwin* ]] || \
......
201 274
		einfo "Compiling for ${x} precision"
202 275
		BUILD_DIR="${WORKDIR}/${P}_${x}"\
203 276
			cmake_src_compile
277
		if use python; then
278
			BUILD_DIR="${WORKDIR}/${P}_${x}"\
279
				cmake_src_compile	python_packaging/all
280
			BUILD_DIR="${WORKDIR}/${P}" \
281
				distutils-r1_src_compile
282
		fi
283
		# not 100% necessary for rel ebuilds as available from website
284
		if use build-manual; then
285
			BUILD_DIR="${WORKDIR}/${P}_${x}"\
286
				cmake_src_compile manual
287
		fi
204 288
		use mpi || continue
205 289
		einfo "Compiling for ${x} precision with mpi"
206 290
		BUILD_DIR="${WORKDIR}/${P}_${x}_mpi"\
......
219 303
	for x in ${GMX_DIRS}; do
220 304
		BUILD_DIR="${WORKDIR}/${P}_${x}" \
221 305
			cmake_src_install
306
		if use python; then
307
			BUILD_DIR="${WORKDIR}/${P}_${x}" \
308
				cmake_src_install	python_packaging/install
309
		fi
310
		if use build-manual; then
311
			newdoc "${WORKDIR}/${P}_${x}"/docs/manual/gromacs.pdf "${PN}-manual-${PV}.pdf"
312
		fi
313

  
222 314
		if use doc; then
223
			newdoc "${DISTDIR}/manual-${PV/_/-}.pdf" "${PN}-manual-${PV}.pdf"
315
			if [[ ${PV} != *9999* ]]; then
316
				newdoc "${DISTDIR}/manual-${PV}.pdf" "${PN}-manual-${PV}.pdf"
317
			fi
224 318
		fi
319

  
225 320
		use mpi || continue
226 321
		BUILD_DIR="${WORKDIR}/${P}_${x}_mpi" \
227 322
			cmake_src_install
Thank you!