Gentoo Archives: gentoo-commits

From: Matthias Maier <tamiko@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-mathematics/petsc/
Date: Thu, 26 May 2022 01:27:06
Message-Id: 1653528413.04a3311771e0ce7d6337a0de2371d6ce5f3c9b56.tamiko@gentoo
1 commit: 04a3311771e0ce7d6337a0de2371d6ce5f3c9b56
2 Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 26 00:04:18 2022 +0000
4 Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
5 CommitDate: Thu May 26 01:26:53 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04a33117
7
8 sci-mathematics/petsc: add 3.17.1
9
10 Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
11
12 sci-mathematics/petsc/Manifest | 1 +
13 sci-mathematics/petsc/petsc-3.17.1.ebuild | 194 ++++++++++++++++++++++++++++++
14 2 files changed, 195 insertions(+)
15
16 diff --git a/sci-mathematics/petsc/Manifest b/sci-mathematics/petsc/Manifest
17 index 66543b456f86..a53a6158e9b6 100644
18 --- a/sci-mathematics/petsc/Manifest
19 +++ b/sci-mathematics/petsc/Manifest
20 @@ -3,3 +3,4 @@ DIST petsc-3.14.6.tar.gz 39719179 BLAKE2B d3047baf87c67eb64ef02c0c54d6313ea06f09
21 DIST petsc-3.15.0.tar.gz 15976488 BLAKE2B babfbeb05321c9cb2f7d70ef8ffca974a016eae73ca1a3359d9a8d38aa5aa90ff34571169a5711627d738b93f89fdee3d0a0ff1bd0e51cb7300bbb9b0a8675cb SHA512 d1565823d8a5ce5e1c2c576bbe1b4ebf467cef20bbd8e0cf6c303c6c2af2bf902b66c79468f4e125496f9242be4bd6ac162535ee30252cfb902c0d906a6f27c0
22 DIST petsc-3.16.0-fftw-without-mpi.patch.bz2 5824 BLAKE2B 59615b1bbaf8ca1da92d7d193a45a2dd434f762cd741d711d4f408183a201a276ac3c968a3e7d740d19212120271701bce52bb7b0f4e311268f40915c81f9dcb SHA512 8e07dfe56a9150ce9a3a5ab8012657875ef84e6e7daa60560bbdd9062078c876a826057f3f3eaf1697ce046a82756ee6eb6a8b819eb51245367c9d5c8a72ee8e
23 DIST petsc-3.16.0.tar.gz 16748960 BLAKE2B 87f9fdb79a9c44e5f476fa4746ad0cbe72f3eda9f6039f2e4743105626701d7c8d6c010fdb9d89becf8619288d0b7a60c8bc4e2fc0793eac5b39030b02c04fd9 SHA512 5280032fb4ec4d058733788bb0ae674e7400565e204133bd10ed88a2965230ec7adeaca2d498267ce661377ca7e6f9d948992206b1d679587606cb422c004655
24 +DIST petsc-3.17.1.tar.gz 17082265 BLAKE2B de1bfe45f93e18e32181499e59912df9225c8e24d75f52e641e552fd43e4d5be48d549d284365b173aa93e51603f5b7740eaac0557ff8c7c96b370f4683257f6 SHA512 8c81cc148b1a899a55e54a013d61519ec7b44f98f7ae30c3f8d0e83ba285b23f4b4d9e2cd483c531d337bc41887e4079b727ba73676b1b653910140291e93575
25
26 diff --git a/sci-mathematics/petsc/petsc-3.17.1.ebuild b/sci-mathematics/petsc/petsc-3.17.1.ebuild
27 new file mode 100644
28 index 000000000000..d75bccaa9f8f
29 --- /dev/null
30 +++ b/sci-mathematics/petsc/petsc-3.17.1.ebuild
31 @@ -0,0 +1,194 @@
32 +# Copyright 1999-2022 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=8
36 +
37 +PYTHON_COMPAT=( python3_{8..10} pypy3 )
38 +
39 +inherit flag-o-matic fortran-2 python-any-r1 toolchain-funcs
40 +
41 +DESCRIPTION="Portable, Extensible Toolkit for Scientific Computation"
42 +HOMEPAGE="https://www.mcs.anl.gov/petsc"
43 +SRC_URI="http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/${P}.tar.gz"
44 +
45 +LICENSE="BSD-2"
46 +SLOT="0"
47 +KEYWORDS="~amd64 ~x86"
48 +IUSE="afterimage boost complex-scalars cxx debug fftw
49 +fortran hdf5 hypre int64 mpi metis mumps scotch superlu threads X"
50 +
51 +# readd sparse when suitesparse-5.6.0 is in tree
52 +# sparse? ( >=sci-libs/suitesparse-5.6.0 >=sci-libs/cholmod-1.7.0 )
53 +# $(use_with sparse suitesparse) \
54 +RDEPEND="
55 + virtual/blas
56 + virtual/lapack
57 +
58 + afterimage? ( media-libs/libafterimage )
59 + boost? ( dev-libs/boost )
60 + fftw? ( sci-libs/fftw:3.0[mpi?] )
61 + hdf5? ( sci-libs/hdf5[mpi?] )
62 + hypre? ( >=sci-libs/hypre-2.18.0[int64?,mpi?] )
63 + metis? ( >=sci-libs/parmetis-4 )
64 + mpi? ( virtual/mpi[cxx?,fortran?] )
65 + mumps? ( sci-libs/mumps[mpi?] sci-libs/scalapack )
66 + scotch? ( sci-libs/scotch[int64?,mpi?] )
67 + superlu? ( >=sci-libs/superlu-5 )
68 + X? ( x11-libs/libX11 )
69 +"
70 +DEPEND="
71 + ${RDEPEND}
72 + ${PYTHON_DEPS}
73 +"
74 +BDEPEND="
75 + dev-util/cmake
76 + sys-apps/which
77 + virtual/pkgconfig
78 +"
79 +
80 +# hypre and superlu curretly exclude each other due to missing linking to hypre
81 +# if both are enabled
82 +REQUIRED_USE="
83 + afterimage? ( X )
84 + complex-scalars? ( !hypre !superlu )
85 + hdf5? ( mpi )
86 + hypre? ( cxx mpi !superlu )
87 + mumps? ( mpi scotch )
88 + scotch? ( mpi )
89 + superlu? ( !hypre )
90 +"
91 +PATCHES=(
92 + "${FILESDIR}/${PN}-3.7.0-disable-rpath.patch"
93 + "${FILESDIR}"/${PN}-3.16.0-fix_sandbox_violation.patch
94 +)
95 +
96 +# petsc uses --with-blah=1 and --with-blah=0 to en/disable options
97 +petsc_enable() {
98 + use "$1" && echo "--with-${2:-$1}=1" || echo "--with-${2:-$1}=0"
99 +}
100 +# add external library:
101 +# petsc_with use_flag libname libdir
102 +# petsc_with use_flag libname include linking_libs
103 +petsc_with() {
104 + local myuse p=${2:-${1}}
105 + if use ${1}; then
106 + myuse="--with-${p}=1"
107 + if [[ $# -ge 4 ]]; then
108 + myuse="${myuse} --with-${p}-include=${EPREFIX}${3}"
109 + shift 3
110 + myuse="${myuse} --with-${p}-lib=$@"
111 + else
112 + myuse="${myuse} --with-${p}-dir=${EPREFIX}${3:-/usr}"
113 + fi
114 + else
115 + myuse="--with-${p}=0"
116 + fi
117 + echo ${myuse}
118 +}
119 +
120 +# select between configure options depending on use flag
121 +petsc_select() {
122 + use "$1" && echo "--with-$2=$3" || echo "--with-$2=$4"
123 +}
124 +
125 +src_configure() {
126 + # bug 548498
127 + # PETSc runs mpi processes during configure that result in a sandbox
128 + # violation by trying to open /proc/mtrr rw. This is not easy to
129 + # mitigate because it happens in libpciaccess.so called by libhwloc.so,
130 + # which is used by libmpi.so.
131 + addpredict /proc/mtrr
132 + # if mpi is built with knem support it needs /dev/knem too
133 + addpredict /dev/knem
134 +
135 + # configureMPITypes with openmpi-2* insists on accessing the scaling
136 + # governor rw.
137 + addpredict /sys/devices/system/cpu/
138 +
139 + # bug 771711
140 + # configureMPIEXEC and configureMPITypes access /dev/nvidiactl
141 + addpredict /dev/nvidiactl
142 +
143 + # bug 810841
144 + addpredict /dev/kfd
145 +
146 + local mylang
147 + local myopt
148 +
149 + use cxx && mylang="cxx" || mylang="c"
150 + use debug && myopt="debug" || myopt="opt"
151 +
152 + # environmental variables expected by petsc during build
153 +
154 + export PETSC_DIR="${S}"
155 + export PETSC_ARCH="linux-gnu-${mylang}-${myopt}"
156 +
157 + if use debug; then
158 + strip-flags
159 + filter-flags -O*
160 + fi
161 +
162 + tc-export AR RANLIB
163 +
164 + # C Support on CXX builds is enabled if possible i.e. when not using
165 + # complex scalars (no complex type for both available at the same time)
166 +
167 + econf \
168 + scrollOutput=1 \
169 + AR="${AR}" \
170 + CFLAGS="${CFLAGS} -fPIC" \
171 + CPPFLAGS="${CPPFLAGS}" \
172 + CXXFLAGS="${CXXFLAGS} -fPIC" \
173 + CXXOPTFLAGS="${CXXFLAGS} -fPIC" \
174 + FCFLAGS="${FCFLAGS} -fPIC" \
175 + FFLAGS="${FFLAGS} -fPIC" \
176 + LDFLAGS="${LDFLAGS}" \
177 + MAKEFLAGS="${MAKEFLAGS}" \
178 + RANLIB="${RANLIB}" \
179 + --prefix="${EPREFIX}/usr/$(get_libdir)/petsc" \
180 + --with-blas-lapack-lib="$($(tc-getPKG_CONFIG) --libs blas lapack)" \
181 + --with-clanguage="${mylang}" \
182 + --with-cmake:BOOL=1 \
183 + --with-gnu-compilers \
184 + --with-imagemagick=0 \
185 + --with-matlab=0 \
186 + --with-petsc-arch="${PETSC_ARCH}" \
187 + --with-precision=double \
188 + --with-python=0 \
189 + --with-shared-libraries \
190 + --with-single-library \
191 + --with-windows-graphics=0 \
192 + $(petsc_enable debug debugging) \
193 + $(petsc_enable fortran) \
194 + $(petsc_enable mpi) \
195 + $(petsc_enable mpi mpi-compilers) \
196 + $(petsc_enable threads pthread) \
197 + $(petsc_select complex-scalars scalar-type complex real) \
198 + $(petsc_select mpi cc mpicc $(tc-getCC)) \
199 + $(petsc_select mpi cxx mpicxx $(tc-getCXX)) \
200 + $(petsc_with afterimage afterimage /usr/include/libAfterImage -lAfterImage) \
201 + $(petsc_with hypre hypre /usr/include/hypre -lHYPRE) \
202 + $(petsc_with superlu superlu /usr/include/superlu -lsuperlu) \
203 + $(petsc_with scotch ptscotch /usr/include/scotch [-lptesmumps,-lptscotch,-lptscotcherr,-lscotch,-lscotcherr]) \
204 + $(petsc_with mumps scalapack /usr/include/scalapack -lscalapack) \
205 + $(use cxx && ! use complex-scalars && echo "--with-c-support=1") \
206 + $(use fortran && echo "$(petsc_select mpi fc mpif77 $(tc-getF77))") \
207 + $(use int64 && echo "--with-index-size=64") \
208 + $(use_with boost) \
209 + $(use_with fftw) \
210 + $(use_with hdf5) \
211 + $(use_with mumps mumps /usr/include [-lcmumps,-ldmumps,-lsmumps,-lzmumps,-lmumps_common,-lpord]) \
212 + $(use_with X x) \
213 + $(use_with X x11)
214 +}
215 +
216 +src_install() {
217 + emake DESTDIR="${ED}" install
218 +
219 + # add PETSC_DIR to environmental variables
220 + cat >> 99petsc <<- EOF
221 + PETSC_DIR=${EPREFIX}/usr/$(get_libdir)/petsc
222 + LDPATH=${EPREFIX}/usr/$(get_libdir)/petsc/lib
223 + EOF
224 + doenvd 99petsc
225 +}