Gentoo Archives: gentoo-commits

From: Justin Lecher <jlec@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: sci-mathematics/petsc/
Date: Thu, 31 Dec 2015 08:48:47
Message-Id: 1451548941.ea635c5ba9ce7015a7f3cf0f1aa1b8341e9c0eab.jlec@gentoo
1 commit: ea635c5ba9ce7015a7f3cf0f1aa1b8341e9c0eab
2 Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 31 08:02:03 2015 +0000
4 Commit: Justin Lecher <jlec <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 31 08:02:21 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=ea635c5b
7
8 sci-mathematics/petsc: version bump to 2.6.3
9
10 Package-Manager: portage-2.2.26
11
12 sci-mathematics/petsc/ChangeLog | 5 +
13 sci-mathematics/petsc/petsc-3.6.3.ebuild | 253 +++++++++++++++++++++++++++++++
14 2 files changed, 258 insertions(+)
15
16 diff --git a/sci-mathematics/petsc/ChangeLog b/sci-mathematics/petsc/ChangeLog
17 index 861d62b..89fdf76 100644
18 --- a/sci-mathematics/petsc/ChangeLog
19 +++ b/sci-mathematics/petsc/ChangeLog
20 @@ -2,6 +2,11 @@
21 # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
22 # $Id$
23
24 +*petsc-3.6.3 (31 Dec 2015)
25 +
26 + 31 Dec 2015; Matthias Maier <tamiko@g.o> +petsc-3.6.3.ebuild:
27 + sci-mathematics/petsc: version bump
28 +
29 01 Sep 2015; Marius Brehler <marbre@××××××××××××××.de> petsc-3.5.3.ebuild,
30 petsc-3.6.0.ebuild:
31 sci-mathematics/petsc: Add subslot for fftw dependency
32
33 diff --git a/sci-mathematics/petsc/petsc-3.6.3.ebuild b/sci-mathematics/petsc/petsc-3.6.3.ebuild
34 new file mode 100644
35 index 0000000..dd3aed2
36 --- /dev/null
37 +++ b/sci-mathematics/petsc/petsc-3.6.3.ebuild
38 @@ -0,0 +1,253 @@
39 +# Copyright 1999-2015 Gentoo Foundation
40 +# Distributed under the terms of the GNU General Public License v2
41 +# $Id$
42 +
43 +EAPI=5
44 +
45 +PYTHON_COMPAT=( python2_7 )
46 +
47 +inherit eutils flag-o-matic fortran-2 python-any-r1 toolchain-funcs versionator
48 +
49 +MY_P="${PN}-$(replace_version_separator _ -)"
50 +
51 +DESCRIPTION="Portable, Extensible Toolkit for Scientific Computation"
52 +HOMEPAGE="http://www.mcs.anl.gov/petsc/"
53 +SRC_URI="http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/${MY_P}.tar.gz"
54 +
55 +LICENSE="petsc"
56 +SLOT="0"
57 +KEYWORDS="~x86 ~amd64"
58 +IUSE="afterimage boost complex-scalars cxx debug doc fftw
59 + fortran hdf5 hypre mpi mumps scotch sparse superlu threads X"
60 +# Failed: imagemagick metis
61 +
62 +# hypre and superlu curretly exclude each other due to missing linking to hypre
63 +# if both are enabled
64 +REQUIRED_USE="
65 + afterimage? ( X )
66 + hdf5? ( mpi )
67 + hypre? ( cxx mpi )
68 + mumps? ( mpi scotch )
69 + scotch? ( mpi )
70 + ^^ ( hypre superlu )
71 +"
72 +# imagemagick? ( X )
73 +
74 +RDEPEND="
75 + virtual/blas
76 + virtual/lapack
77 + afterimage? ( media-libs/libafterimage )
78 + boost? ( dev-libs/boost )
79 + fftw? ( sci-libs/fftw:3.0[mpi?] )
80 + hdf5? ( sci-libs/hdf5[mpi?] )
81 + hypre? ( >=sci-libs/hypre-2.8.0b[mpi?] )
82 + mpi? ( virtual/mpi[cxx?,fortran?] )
83 + mumps? ( sci-libs/mumps[mpi?] sci-libs/scalapack )
84 + scotch? ( sci-libs/scotch[mpi?] )
85 + sparse? ( sci-libs/suitesparse >=sci-libs/cholmod-1.7.0 )
86 + superlu? ( sci-libs/superlu )
87 + X? ( x11-libs/libX11 )
88 +"
89 +# metis? ( sci-libs/parmetis )
90 +# imagemagick? ( media-gfx/imagemagick )
91 +
92 +DEPEND="${RDEPEND}
93 + ${PYTHON_DEPS}
94 + virtual/pkgconfig
95 + dev-util/cmake
96 +"
97 +# cmake is used for parallel building
98 +# in some configuration setups, legacy build is used (slow)
99 +
100 +#
101 +# PETSc does not want its Makefiles to be invoked with anything higher than
102 +# -j1. The underlying build system does automatically invoke a parallel
103 +# build. This might not be what you want, but *hey* not your choice.
104 +#
105 +MAKEOPTS="${MAKEOPTS} -j1"
106 +
107 +S="${WORKDIR}/${MY_P}"
108 +
109 +src_prepare() {
110 + epatch \
111 + "${FILESDIR}"/${PN}-3.6.0-disable-rpath.patch \
112 + "${FILESDIR}"/${PN}-3.6.0-fix_sandbox_violation.patch
113 +
114 + sed -i -e 's%/usr/bin/env python%/usr/bin/env python2%' configure || die
115 +}
116 +
117 +src_configure() {
118 + # bug 548498
119 + # PETSc runs mpi processes during configure that result in a sandbox
120 + # violation by trying to open /proc/mtrr rw. This is not easy to
121 + # mitigate because it happens in libpciaccess.so called by libhwloc.so,
122 + # which is used by libmpi.so.
123 + addpredict /proc/mtrr
124 +
125 + # petsc uses --with-blah=1 and --with-blah=0 to en/disable options
126 + petsc_enable() {
127 + use "$1" && echo "--with-${2:-$1}=1" || echo "--with-${2:-$1}=0"
128 + }
129 + # add external library:
130 + # petsc_with use_flag libname libdir
131 + # petsc_with use_flag libname include linking_libs
132 + petsc_with() {
133 + local myuse p=${2:-${1}}
134 + if use ${1}; then
135 + myuse="--with-${p}=1"
136 + if [[ $# -ge 4 ]]; then
137 + myuse="${myuse} --with-${p}-include=${EPREFIX}${3}"
138 + shift 3
139 + myuse="${myuse} --with-${p}-lib=$@"
140 + else
141 + myuse="${myuse} --with-${p}-dir=${EPREFIX}${3:-/usr}"
142 + fi
143 + else
144 + myuse="--with-${p}=0"
145 + fi
146 + echo ${myuse}
147 + }
148 +
149 + # select between configure options depending on use flag
150 + petsc_select() {
151 + use "$1" && echo "--with-$2=$3" || echo "--with-$2=$4"
152 + }
153 +
154 + local mylang
155 + local myopt
156 +
157 + use cxx && mylang="cxx" || mylang="c"
158 + use debug && myopt="debug" || myopt="opt"
159 +
160 + # environmental variables expected by petsc during build
161 + export PETSC_DIR="${S}"
162 + export PETSC_ARCH="linux-gnu-${mylang}-${myopt}"
163 +
164 + if use debug; then
165 + strip-flags
166 + filter-flags -O*
167 + fi
168 +
169 + # C Support on Cxx builds is enabled if possible
170 + # i.e. when not using complex scalars
171 + # (no complex type for both available at the same time)
172 +
173 + # run petsc configure script
174 + econf \
175 + scrollOutput=1 \
176 + CFLAGS="${CFLAGS}" \
177 + CXXFLAGS="${CXXFLAGS}" \
178 + LDFLAGS="${LDFLAGS}" \
179 + --with-shared-libraries \
180 + --with-single-library \
181 + --with-clanguage=${mylang} \
182 + $(use cxx && ! use complex-scalars && echo "with-c-support=1") \
183 + --with-petsc-arch=${PETSC_ARCH} \
184 + --with-precision=double \
185 + --with-gnu-compilers \
186 + --with-blas-lapack-lib="$($(tc-getPKG_CONFIG) --libs lapack)" \
187 + $(petsc_enable debug debugging) \
188 + $(petsc_enable mpi) \
189 + $(petsc_select mpi cc mpicc $(tc-getCC)) \
190 + $(petsc_select mpi cxx mpicxx $(tc-getCXX)) \
191 + $(petsc_enable fortran) \
192 + $(use fortran && echo "$(petsc_select mpi fc mpif77 $(tc-getF77))") \
193 + $(petsc_enable mpi mpi-compilers) \
194 + $(petsc_select complex-scalars scalar-type complex real) \
195 + --with-windows-graphics=0 \
196 + --with-matlab=0 \
197 + --with-cmake=cmake \
198 + $(petsc_enable threads pthread) \
199 + $(petsc_with afterimage afterimage \
200 + /usr/include/libAfterImage -lAfterImage) \
201 + $(petsc_with hdf5) \
202 + $(petsc_with hypre hypre \
203 + /usr/include/hypre -lHYPRE) \
204 + $(petsc_with sparse suitesparse) \
205 + $(petsc_with superlu superlu \
206 + /usr/include/superlu -lsuperlu) \
207 + $(petsc_with X x) \
208 + $(petsc_with X x11) \
209 + $(petsc_with scotch ptscotch \
210 + /usr/include/scotch \
211 + [-lptesmumps,-lptscotch,-lptscotcherr,-lscotch,-lscotcherr]) \
212 + $(petsc_with mumps scalapack \
213 + /usr/include/scalapack -lscalapack) \
214 + $(petsc_with mumps mumps \
215 + /usr/include \
216 + [-lcmumps,-ldmumps,-lsmumps,-lzmumps,-lmumps_common,-lpord]) \
217 + --with-imagemagick=0 \
218 + --with-python=0 \
219 + $(petsc_with boost) \
220 + $(petsc_with fftw)
221 +
222 +# not yet tested:
223 +# python bindings, netcdf, fftw
224 +
225 +# failed dependencies, perhaps fixed in upstream soon:
226 +# $(petsc_with metis parmetis) \ # needs metis too (>=5.0.2)
227 +# $(petsc_with imagemagick imagemagick \
228 +# /usr/include/ImageMagick $($(tc-getPKG_CONFIG) --libs MagickCore)) \
229 +# $(petsc_enable threads pthreadclasses) \
230 +}
231 +
232 +src_install() {
233 + # petsc install structure is very different from
234 + # installing headers to /usr/include/petsc and lib to /usr/lib
235 + # it also installs many unneeded executables and scripts
236 + # so manual install is easier than cleanup after "emake install"
237 + insinto /usr/include/${PN}
238 + doins include/*.h*
239 + insinto /usr/include/${PN}/${PETSC_ARCH}/include
240 + doins ${PETSC_ARCH}/include/*
241 + if use fortran; then
242 + insinto /usr/include/${PN}/finclude
243 + doins -r include/${PN}/finclude/*
244 + fi
245 + if ! use mpi ; then
246 + insinto /usr/include/${PN}/mpiuni
247 + doins include/mpiuni/*.h
248 + fi
249 + insinto /usr/include/${PN}/conf
250 + doins lib/${PN}/conf/{variables,rules,test}
251 + insinto /usr/include/${PN}/${PETSC_ARCH}/conf
252 + doins ${PETSC_ARCH}/lib/${PN}/conf/{petscrules,petscvariables,RDict.db}
253 + insinto /usr/include/${PN}/private
254 + doins include/${PN}/private/*.h
255 +
256 + # fix configuration files: replace "${S}" by installed location
257 + sed -i \
258 + -e "s:"${S}"::g" \
259 + "${ED}"/usr/include/${PN}/${PETSC_ARCH}/include/petscconf.h \
260 + "${ED}"/usr/include/${PN}/${PETSC_ARCH}/conf/petscvariables || die
261 + sed -i \
262 + -e "s:-I/include:-I${EPREFIX}/usr/include/${PN}:g" \
263 + -e "s:-I/linux-gnu-cxx-opt/include:-I${EPREFIX}/usr/include/${PN}/${PETSC_ARCH}/include/:g" \
264 + "${ED}"/usr/include/${PN}/${PETSC_ARCH}/conf/petscvariables || die
265 + sed -i \
266 + -e "s:usr/lib:usr/$(get_libdir):g" \
267 + "${ED}"/usr/include/${PN}/${PETSC_ARCH}/include/petscconf.h || die
268 +
269 + # add information about installation directory and
270 + # PETSC_ARCH to environmental variables
271 + cat >> 99petsc <<- EOF
272 + PETSC_ARCH=${PETSC_ARCH}
273 + PETSC_DIR=${EPREFIX}/usr/include/${PN}
274 + EOF
275 + doenvd 99petsc
276 +
277 + dolib.so ${PETSC_ARCH}/lib/*.so
278 + dolib.so ${PETSC_ARCH}/lib/*.so.*
279 +
280 + if use doc ; then
281 + einfo "installing documentation (this could take a while)"
282 + dodoc docs/manual.pdf
283 + dohtml -r docs/*.html docs/changes docs/manualpages
284 + fi
285 +}
286 +
287 +pkg_postinst() {
288 + elog "The petsc ebuild is still under development."
289 + elog "Help us improve the ebuild in:"
290 + elog "http://bugs.gentoo.org/show_bug.cgi?id=53386"
291 +}