Gentoo Archives: gentoo-commits

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