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 |
|
PYTHON_COMPAT=( python3_{9..10} )
|
|
6 |
PYTHON_COMPAT=( python3_{9..10} pypy3 )
|
7 |
7 |
|
8 |
8 |
inherit flag-o-matic fortran-2 python-any-r1 toolchain-funcs
|
9 |
9 |
|
10 |
10 |
DESCRIPTION="Portable, Extensible Toolkit for Scientific Computation"
|
11 |
|
HOMEPAGE="https://www.mcs.anl.gov/petsc/"
|
|
11 |
HOMEPAGE="https://www.mcs.anl.gov/petsc"
|
12 |
12 |
SRC_URI="http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/${P}.tar.gz"
|
13 |
|
SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-fftw-without-mpi.patch.bz2"
|
14 |
13 |
|
15 |
14 |
LICENSE="BSD-2"
|
16 |
15 |
SLOT="0"
|
17 |
16 |
KEYWORDS="~amd64 ~x86"
|
18 |
|
IUSE="afterimage boost complex-scalars cxx debug fftw
|
19 |
|
fortran hdf5 hypre mpi metis mumps scotch sparse superlu threads X"
|
20 |
|
|
21 |
|
# hypre and superlu curretly exclude each other due to missing linking to hypre
|
22 |
|
# if both are enabled
|
23 |
|
REQUIRED_USE="
|
24 |
|
afterimage? ( X )
|
25 |
|
complex-scalars? ( !hypre !superlu )
|
26 |
|
hdf5? ( mpi )
|
27 |
|
hypre? ( cxx mpi !superlu )
|
28 |
|
mumps? ( mpi scotch )
|
29 |
|
scotch? ( mpi )
|
30 |
|
superlu? ( !hypre )
|
31 |
|
"
|
|
17 |
IUSE="afterimage boost complex-scalars debug fftw
|
|
18 |
fortran hdf5 hypre int64 mpi metis mumps scotch superlu threads X"
|
32 |
19 |
|
|
20 |
# readd sparse when suitesparse-5.6.0 is in tree
|
|
21 |
# sparse? ( >=sci-libs/suitesparse-5.6.0 >=sci-libs/cholmod-1.7.0 )
|
|
22 |
# $(use_with sparse suitesparse) \
|
33 |
23 |
RDEPEND="
|
34 |
24 |
virtual/blas
|
35 |
25 |
virtual/lapack
|
|
26 |
|
36 |
27 |
afterimage? ( media-libs/libafterimage )
|
37 |
28 |
boost? ( dev-libs/boost )
|
38 |
29 |
fftw? ( sci-libs/fftw:3.0[mpi?] )
|
39 |
30 |
hdf5? ( sci-libs/hdf5[mpi?] )
|
40 |
|
hypre? ( >=sci-libs/hypre-2.18.0[mpi?] )
|
|
31 |
hypre? ( >=sci-libs/hypre-2.18.0[int64?,mpi?] )
|
41 |
32 |
metis? ( >=sci-libs/parmetis-4 )
|
42 |
|
mpi? ( virtual/mpi[cxx?,fortran?] )
|
|
33 |
mpi? ( virtual/mpi[fortran?] )
|
43 |
34 |
mumps? ( sci-libs/mumps[mpi?] sci-libs/scalapack )
|
44 |
|
scotch? ( sci-libs/scotch[mpi?] )
|
45 |
|
sparse? ( sci-libs/suitesparse >=sci-libs/cholmod-1.7.0 )
|
|
35 |
scotch? ( sci-libs/scotch[int64?,mpi?] )
|
46 |
36 |
superlu? ( >=sci-libs/superlu-5 )
|
47 |
37 |
X? ( x11-libs/libX11 )
|
48 |
38 |
"
|
49 |
|
|
50 |
|
DEPEND="${RDEPEND}
|
|
39 |
DEPEND="
|
|
40 |
${RDEPEND}
|
51 |
41 |
${PYTHON_DEPS}
|
52 |
|
virtual/pkgconfig
|
|
42 |
"
|
|
43 |
BDEPEND="
|
53 |
44 |
dev-util/cmake
|
54 |
45 |
sys-apps/which
|
|
46 |
virtual/pkgconfig
|
55 |
47 |
"
|
56 |
48 |
|
|
49 |
# hypre and superlu curretly exclude each other due to missing linking to hypre
|
|
50 |
# if both are enabled
|
|
51 |
REQUIRED_USE="
|
|
52 |
afterimage? ( X )
|
|
53 |
complex-scalars? ( !hypre !superlu )
|
|
54 |
hdf5? ( mpi )
|
|
55 |
hypre? ( mpi !superlu )
|
|
56 |
mumps? ( mpi scotch )
|
|
57 |
scotch? ( mpi )
|
|
58 |
superlu? ( !hypre )
|
|
59 |
"
|
57 |
60 |
PATCHES=(
|
58 |
|
"${FILESDIR}"/${PN}-3.7.0-disable-rpath.patch
|
59 |
|
"${FILESDIR}"/${P}-fix_sandbox_violation.patch
|
60 |
|
"${WORKDIR}"/${P}-fftw-without-mpi.patch
|
|
61 |
"${FILESDIR}/${PN}-3.7.0-disable-rpath.patch"
|
|
62 |
"${FILESDIR}"/${PN}-3.16.0-fix_sandbox_violation.patch
|
61 |
63 |
)
|
62 |
64 |
|
63 |
65 |
# petsc uses --with-blah=1 and --with-blah=0 to en/disable options
|
... | ... | |
110 |
112 |
# bug 810841
|
111 |
113 |
addpredict /dev/kfd
|
112 |
114 |
|
113 |
|
local mylang
|
114 |
115 |
local myopt
|
115 |
116 |
|
116 |
|
use cxx && mylang="cxx" || mylang="c"
|
117 |
117 |
use debug && myopt="debug" || myopt="opt"
|
118 |
118 |
|
119 |
119 |
# environmental variables expected by petsc during build
|
120 |
120 |
|
121 |
121 |
export PETSC_DIR="${S}"
|
122 |
|
export PETSC_ARCH="linux-gnu-${mylang}-${myopt}"
|
|
122 |
export PETSC_ARCH="linux-gnu-c-${myopt}"
|
123 |
123 |
|
124 |
124 |
if use debug; then
|
125 |
125 |
strip-flags
|
126 |
126 |
filter-flags -O*
|
127 |
127 |
fi
|
128 |
128 |
|
|
129 |
tc-export AR RANLIB
|
|
130 |
|
129 |
131 |
# C Support on CXX builds is enabled if possible i.e. when not using
|
130 |
132 |
# complex scalars (no complex type for both available at the same time)
|
131 |
133 |
|
132 |
134 |
econf \
|
133 |
135 |
scrollOutput=1 \
|
134 |
|
FFLAGS="${FFLAGS} -fPIC" \
|
|
136 |
AR="${AR}" \
|
135 |
137 |
CFLAGS="${CFLAGS} -fPIC" \
|
|
138 |
CPPFLAGS="${CPPFLAGS}" \
|
136 |
139 |
CXXFLAGS="${CXXFLAGS} -fPIC" \
|
|
140 |
CXXOPTFLAGS="${CXXFLAGS} -fPIC" \
|
|
141 |
FCFLAGS="${FCFLAGS} -fPIC" \
|
|
142 |
FFLAGS="${FFLAGS} -fPIC" \
|
137 |
143 |
LDFLAGS="${LDFLAGS}" \
|
|
144 |
MAKEFLAGS="${MAKEFLAGS}" \
|
|
145 |
RANLIB="${RANLIB}" \
|
138 |
146 |
--prefix="${EPREFIX}/usr/$(get_libdir)/petsc" \
|
|
147 |
--with-blas-lapack-lib="$($(tc-getPKG_CONFIG) --libs blas lapack)" \
|
|
148 |
--with-cmake:BOOL=1 \
|
|
149 |
--with-gnu-compilers \
|
|
150 |
--with-imagemagick=0 \
|
|
151 |
--with-matlab=0 \
|
|
152 |
--with-petsc-arch="${PETSC_ARCH}" \
|
|
153 |
--with-precision=double \
|
|
154 |
--with-python=0 \
|
139 |
155 |
--with-shared-libraries \
|
140 |
156 |
--with-single-library \
|
141 |
|
--with-clanguage=${mylang} \
|
142 |
|
$(use cxx && ! use complex-scalars && echo "with-c-support=1") \
|
143 |
|
--with-petsc-arch=${PETSC_ARCH} \
|
144 |
|
--with-precision=double \
|
145 |
|
--with-gnu-compilers \
|
146 |
|
--with-blas-lapack-lib="$($(tc-getPKG_CONFIG) --libs blas lapack)" \
|
|
157 |
--with-windows-graphics=0 \
|
147 |
158 |
$(petsc_enable debug debugging) \
|
|
159 |
$(petsc_enable fortran) \
|
148 |
160 |
$(petsc_enable mpi) \
|
|
161 |
$(petsc_enable mpi mpi-compilers) \
|
|
162 |
$(petsc_enable threads pthread) \
|
|
163 |
$(petsc_select complex-scalars scalar-type complex real) \
|
149 |
164 |
$(petsc_select mpi cc mpicc $(tc-getCC)) \
|
150 |
165 |
$(petsc_select mpi cxx mpicxx $(tc-getCXX)) \
|
151 |
|
$(petsc_enable fortran) \
|
|
166 |
$(petsc_with afterimage afterimage /usr/include/libAfterImage -lAfterImage) \
|
|
167 |
$(petsc_with hypre hypre /usr/include/hypre -lHYPRE) \
|
|
168 |
$(petsc_with superlu superlu /usr/include/superlu -lsuperlu) \
|
|
169 |
$(petsc_with scotch ptscotch /usr/include/scotch [-lptesmumps,-lptscotch,-lptscotcherr,-lscotch,-lscotcherr]) \
|
|
170 |
$(petsc_with mumps scalapack /usr/include/scalapack -lscalapack) \
|
|
171 |
$(petsc_with mumps mumps /usr/include [-lcmumps,-ldmumps,-lsmumps,-lzmumps,-lmumps_common,-lpord]) \
|
152 |
172 |
$(use fortran && echo "$(petsc_select mpi fc mpif77 $(tc-getF77))") \
|
153 |
|
$(petsc_enable mpi mpi-compilers) \
|
154 |
|
$(petsc_select complex-scalars scalar-type complex real) \
|
155 |
|
--with-windows-graphics=0 \
|
156 |
|
--with-matlab=0 \
|
157 |
|
--with-cmake:BOOL=1 \
|
158 |
|
$(petsc_enable threads pthread) \
|
159 |
|
$(petsc_with afterimage afterimage \
|
160 |
|
/usr/include/libAfterImage -lAfterImage) \
|
|
173 |
$(use int64 && echo "--with-index-size=64") \
|
|
174 |
$(use_with boost) \
|
|
175 |
$(use_with fftw) \
|
161 |
176 |
$(use_with hdf5) \
|
162 |
|
$(petsc_with hypre hypre \
|
163 |
|
/usr/include/hypre -lHYPRE) \
|
164 |
|
$(use_with sparse suitesparse) \
|
165 |
|
$(petsc_with superlu superlu \
|
166 |
|
/usr/include/superlu -lsuperlu) \
|
167 |
177 |
$(use_with X x) \
|
168 |
|
$(use_with X x11) \
|
169 |
|
$(petsc_with scotch ptscotch \
|
170 |
|
/usr/include/scotch \
|
171 |
|
[-lptesmumps,-lptscotch,-lptscotcherr,-lscotch,-lscotcherr]) \
|
172 |
|
$(petsc_with mumps scalapack \
|
173 |
|
/usr/include/scalapack -lscalapack) \
|
174 |
|
$(petsc_with mumps mumps \
|
175 |
|
/usr/include \
|
176 |
|
[-lcmumps,-ldmumps,-lsmumps,-lzmumps,-lmumps_common,-lpord]) \
|
177 |
|
--with-imagemagick=0 \
|
178 |
|
--with-python=0 \
|
179 |
|
$(use_with boost) \
|
180 |
|
$(use_with fftw)
|
|
178 |
$(use_with X x11)
|
181 |
179 |
}
|
182 |
180 |
|
183 |
181 |
src_install() {
|