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