1 |
commit: d3626423dea598c19550b3af5e7857412e1b4bac |
2 |
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jul 9 10:21:40 2016 +0000 |
4 |
Commit: Marius Brehler <marbre <AT> linux <DOT> sungazer <DOT> de> |
5 |
CommitDate: Sat Jul 9 12:09:53 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=d3626423 |
7 |
|
8 |
sci-mathematics/petsc: version bump to 3.7.0 |
9 |
|
10 |
Package-Manager: portage-2.2.28 |
11 |
Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org> |
12 |
|
13 |
.../petsc/files/petsc-3.7.0-disable-rpath.patch | 18 ++ |
14 |
.../files/petsc-3.7.0-fix_sandbox_violation.patch | 17 ++ |
15 |
sci-mathematics/petsc/petsc-3.7.0.ebuild | 255 +++++++++++++++++++++ |
16 |
3 files changed, 290 insertions(+) |
17 |
|
18 |
diff --git a/sci-mathematics/petsc/files/petsc-3.7.0-disable-rpath.patch b/sci-mathematics/petsc/files/petsc-3.7.0-disable-rpath.patch |
19 |
new file mode 100644 |
20 |
index 0000000..8d0d993 |
21 |
--- /dev/null |
22 |
+++ b/sci-mathematics/petsc/files/petsc-3.7.0-disable-rpath.patch |
23 |
@@ -0,0 +1,18 @@ |
24 |
+diff --git a/config/BuildSystem/config/setCompilers.py b/config/BuildSystem/config/setCompilers.py |
25 |
+index 219a35b..ad2ed8c 100644 |
26 |
+--- a/config/BuildSystem/config/setCompilers.py |
27 |
++++ b/config/BuildSystem/config/setCompilers.py |
28 |
+@@ -1385,12 +1385,7 @@ class Configure(config.base.Configure): |
29 |
+ for language in languages: |
30 |
+ flag = '-L' |
31 |
+ self.pushLanguage(language) |
32 |
+- # test '-R' before '-rpath' as sun compilers [c,fortran] don't give proper errors with wrong options. |
33 |
+- if not Configure.isDarwin(self.log): |
34 |
+- testFlags = ['-Wl,-rpath,', '-R','-rpath ' , '-Wl,-R,'] |
35 |
+- else: |
36 |
+- testFlags = ['-Wl,-rpath,'] |
37 |
+- # test '-R' before '-Wl,-rpath' for SUN compilers [as cc on linux accepts -Wl,-rpath, but f90 & CC do not. |
38 |
++ testFlags = [] |
39 |
+ if self.isSun(self.framework.getCompiler(), self.log): |
40 |
+ testFlags.insert(0,'-R') |
41 |
+ for testFlag in testFlags: |
42 |
|
43 |
diff --git a/sci-mathematics/petsc/files/petsc-3.7.0-fix_sandbox_violation.patch b/sci-mathematics/petsc/files/petsc-3.7.0-fix_sandbox_violation.patch |
44 |
new file mode 100644 |
45 |
index 0000000..191ca18 |
46 |
--- /dev/null |
47 |
+++ b/sci-mathematics/petsc/files/petsc-3.7.0-fix_sandbox_violation.patch |
48 |
@@ -0,0 +1,17 @@ |
49 |
+diff --git a/config/PETSc/options/installDir.py b/config/PETSc/options/installDir.py |
50 |
+index 0e2567c..bf782b5 100644 |
51 |
+--- a/config/PETSc/options/installDir.py |
52 |
++++ b/config/PETSc/options/installDir.py |
53 |
+@@ -38,12 +38,6 @@ class Configure(config.base.Configure): |
54 |
+ self.installSudoMessage = '' |
55 |
+ if self.framework.argDB['prefix']: |
56 |
+ self.dir = os.path.abspath(os.path.expanduser(self.framework.argDB['prefix'])) |
57 |
+- try: |
58 |
+- os.makedirs(os.path.join(self.dir,'PETScTestDirectory')) |
59 |
+- os.rmdir(os.path.join(self.dir,'PETScTestDirectory')) |
60 |
+- except: |
61 |
+- self.installSudoMessage = 'You do not have write permissions to the --prefix directory '+self.dir+'\nYou will be prompted for the sudo password for any external package installs' |
62 |
+- self.installSudo = 'sudo ' |
63 |
+ else: |
64 |
+ self.dir = os.path.abspath(os.path.join(self.petscdir.dir, self.arch.arch)) |
65 |
+ self.confDir = os.path.abspath(os.path.join(self.petscdir.dir, self.arch.arch)) |
66 |
|
67 |
diff --git a/sci-mathematics/petsc/petsc-3.7.0.ebuild b/sci-mathematics/petsc/petsc-3.7.0.ebuild |
68 |
new file mode 100644 |
69 |
index 0000000..bcf8cc5 |
70 |
--- /dev/null |
71 |
+++ b/sci-mathematics/petsc/petsc-3.7.0.ebuild |
72 |
@@ -0,0 +1,255 @@ |
73 |
+# Copyright 1999-2015 Gentoo Foundation |
74 |
+# Distributed under the terms of the GNU General Public License v2 |
75 |
+# $Id$ |
76 |
+ |
77 |
+EAPI=5 |
78 |
+ |
79 |
+PYTHON_COMPAT=( python2_7 ) |
80 |
+ |
81 |
+inherit eutils flag-o-matic fortran-2 python-any-r1 toolchain-funcs versionator |
82 |
+ |
83 |
+MY_P="${PN}-$(replace_version_separator _ -)" |
84 |
+ |
85 |
+DESCRIPTION="Portable, Extensible Toolkit for Scientific Computation" |
86 |
+HOMEPAGE="http://www.mcs.anl.gov/petsc/" |
87 |
+SRC_URI="http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/${MY_P}.tar.gz" |
88 |
+ |
89 |
+LICENSE="petsc" |
90 |
+SLOT="0" |
91 |
+KEYWORDS="~x86 ~amd64" |
92 |
+IUSE="afterimage boost complex-scalars cxx debug doc fftw |
93 |
+ fortran hdf5 hypre mpi mumps scotch sparse superlu threads X" |
94 |
+# Failed: imagemagick metis |
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 |
+ hdf5? ( mpi ) |
101 |
+ hypre? ( cxx mpi ) |
102 |
+ mumps? ( mpi scotch ) |
103 |
+ scotch? ( mpi ) |
104 |
+ ^^ ( hypre superlu ) |
105 |
+" |
106 |
+# imagemagick? ( X ) |
107 |
+ |
108 |
+RDEPEND=" |
109 |
+ virtual/blas |
110 |
+ virtual/lapack |
111 |
+ afterimage? ( media-libs/libafterimage ) |
112 |
+ boost? ( dev-libs/boost ) |
113 |
+ fftw? ( sci-libs/fftw:3.0[mpi?] ) |
114 |
+ hdf5? ( sci-libs/hdf5[mpi?] ) |
115 |
+ hypre? ( >=sci-libs/hypre-2.8.0b[mpi?] ) |
116 |
+ mpi? ( virtual/mpi[cxx?,fortran?] ) |
117 |
+ mumps? ( sci-libs/mumps[mpi?] sci-libs/scalapack ) |
118 |
+ scotch? ( sci-libs/scotch[mpi?] ) |
119 |
+ sparse? ( sci-libs/suitesparse >=sci-libs/cholmod-1.7.0 ) |
120 |
+ superlu? ( sci-libs/superlu ) |
121 |
+ X? ( x11-libs/libX11 ) |
122 |
+" |
123 |
+# metis? ( sci-libs/parmetis ) |
124 |
+# imagemagick? ( media-gfx/imagemagick ) |
125 |
+ |
126 |
+DEPEND="${RDEPEND} |
127 |
+ ${PYTHON_DEPS} |
128 |
+ virtual/pkgconfig |
129 |
+ dev-util/cmake |
130 |
+" |
131 |
+# cmake is used for parallel building |
132 |
+# in some configuration setups, legacy build is used (slow) |
133 |
+ |
134 |
+# |
135 |
+# PETSc does not want its Makefiles to be invoked with anything higher than |
136 |
+# -j1. The underlying build system does automatically invoke a parallel |
137 |
+# build. This might not be what you want, but *hey* not your choice. |
138 |
+# |
139 |
+# V=1 enables verbose output with full compiler and linker invocation |
140 |
+# |
141 |
+MAKEOPTS="${MAKEOPTS} -j1 V=1" |
142 |
+ |
143 |
+S="${WORKDIR}/${MY_P}" |
144 |
+ |
145 |
+src_prepare() { |
146 |
+ epatch \ |
147 |
+ "${FILESDIR}"/${P}-disable-rpath.patch \ |
148 |
+ "${FILESDIR}"/${P}-fix_sandbox_violation.patch |
149 |
+ |
150 |
+ sed -i -e 's%/usr/bin/env python%/usr/bin/env python2%' configure || die |
151 |
+} |
152 |
+ |
153 |
+src_configure() { |
154 |
+ # bug 548498 |
155 |
+ # PETSc runs mpi processes during configure that result in a sandbox |
156 |
+ # violation by trying to open /proc/mtrr rw. This is not easy to |
157 |
+ # mitigate because it happens in libpciaccess.so called by libhwloc.so, |
158 |
+ # which is used by libmpi.so. |
159 |
+ addpredict /proc/mtrr |
160 |
+ |
161 |
+ # petsc uses --with-blah=1 and --with-blah=0 to en/disable options |
162 |
+ petsc_enable() { |
163 |
+ use "$1" && echo "--with-${2:-$1}=1" || echo "--with-${2:-$1}=0" |
164 |
+ } |
165 |
+ # add external library: |
166 |
+ # petsc_with use_flag libname libdir |
167 |
+ # petsc_with use_flag libname include linking_libs |
168 |
+ petsc_with() { |
169 |
+ local myuse p=${2:-${1}} |
170 |
+ if use ${1}; then |
171 |
+ myuse="--with-${p}=1" |
172 |
+ if [[ $# -ge 4 ]]; then |
173 |
+ myuse="${myuse} --with-${p}-include=${EPREFIX}${3}" |
174 |
+ shift 3 |
175 |
+ myuse="${myuse} --with-${p}-lib=$@" |
176 |
+ else |
177 |
+ myuse="${myuse} --with-${p}-dir=${EPREFIX}${3:-/usr}" |
178 |
+ fi |
179 |
+ else |
180 |
+ myuse="--with-${p}=0" |
181 |
+ fi |
182 |
+ echo ${myuse} |
183 |
+ } |
184 |
+ |
185 |
+ # select between configure options depending on use flag |
186 |
+ petsc_select() { |
187 |
+ use "$1" && echo "--with-$2=$3" || echo "--with-$2=$4" |
188 |
+ } |
189 |
+ |
190 |
+ local mylang |
191 |
+ local myopt |
192 |
+ |
193 |
+ use cxx && mylang="cxx" || mylang="c" |
194 |
+ use debug && myopt="debug" || myopt="opt" |
195 |
+ |
196 |
+ # environmental variables expected by petsc during build |
197 |
+ export PETSC_DIR="${S}" |
198 |
+ export PETSC_ARCH="linux-gnu-${mylang}-${myopt}" |
199 |
+ |
200 |
+ if use debug; then |
201 |
+ strip-flags |
202 |
+ filter-flags -O* |
203 |
+ fi |
204 |
+ |
205 |
+ # C Support on Cxx builds is enabled if possible |
206 |
+ # i.e. when not using complex scalars |
207 |
+ # (no complex type for both available at the same time) |
208 |
+ |
209 |
+ # run petsc configure script |
210 |
+ econf \ |
211 |
+ scrollOutput=1 \ |
212 |
+ FFLAGS="${FFLAGS} -fPIC" \ |
213 |
+ CFLAGS="${CFLAGS} -fPIC" \ |
214 |
+ CXXFLAGS="${CXXFLAGS} -fPIC" \ |
215 |
+ LDFLAGS="${LDFLAGS}" \ |
216 |
+ --with-shared-libraries \ |
217 |
+ --with-single-library \ |
218 |
+ --with-clanguage=${mylang} \ |
219 |
+ $(use cxx && ! use complex-scalars && echo "with-c-support=1") \ |
220 |
+ --with-petsc-arch=${PETSC_ARCH} \ |
221 |
+ --with-precision=double \ |
222 |
+ --with-gnu-compilers \ |
223 |
+ --with-blas-lapack-lib="$($(tc-getPKG_CONFIG) --libs lapack)" \ |
224 |
+ $(petsc_enable debug debugging) \ |
225 |
+ $(petsc_enable mpi) \ |
226 |
+ $(petsc_select mpi cc mpicc $(tc-getCC)) \ |
227 |
+ $(petsc_select mpi cxx mpicxx $(tc-getCXX)) \ |
228 |
+ $(petsc_enable fortran) \ |
229 |
+ $(use fortran && echo "$(petsc_select mpi fc mpif77 $(tc-getF77))") \ |
230 |
+ $(petsc_enable mpi mpi-compilers) \ |
231 |
+ $(petsc_select complex-scalars scalar-type complex real) \ |
232 |
+ --with-windows-graphics=0 \ |
233 |
+ --with-matlab=0 \ |
234 |
+ --with-cmake=cmake \ |
235 |
+ $(petsc_enable threads pthread) \ |
236 |
+ $(petsc_with afterimage afterimage \ |
237 |
+ /usr/include/libAfterImage -lAfterImage) \ |
238 |
+ $(petsc_with hdf5) \ |
239 |
+ $(petsc_with hypre hypre \ |
240 |
+ /usr/include/hypre -lHYPRE) \ |
241 |
+ $(petsc_with sparse suitesparse) \ |
242 |
+ $(petsc_with superlu superlu \ |
243 |
+ /usr/include/superlu -lsuperlu) \ |
244 |
+ $(petsc_with X x) \ |
245 |
+ $(petsc_with X x11) \ |
246 |
+ $(petsc_with scotch ptscotch \ |
247 |
+ /usr/include/scotch \ |
248 |
+ [-lptesmumps,-lptscotch,-lptscotcherr,-lscotch,-lscotcherr]) \ |
249 |
+ $(petsc_with mumps scalapack \ |
250 |
+ /usr/include/scalapack -lscalapack) \ |
251 |
+ $(petsc_with mumps mumps \ |
252 |
+ /usr/include \ |
253 |
+ [-lcmumps,-ldmumps,-lsmumps,-lzmumps,-lmumps_common,-lpord]) \ |
254 |
+ --with-imagemagick=0 \ |
255 |
+ --with-python=0 \ |
256 |
+ $(petsc_with boost) \ |
257 |
+ $(petsc_with fftw) |
258 |
+ |
259 |
+# not yet tested: |
260 |
+# python bindings, netcdf, fftw |
261 |
+ |
262 |
+# failed dependencies, perhaps fixed in upstream soon: |
263 |
+# $(petsc_with metis parmetis) \ # needs metis too (>=5.0.2) |
264 |
+# $(petsc_with imagemagick imagemagick \ |
265 |
+# /usr/include/ImageMagick $($(tc-getPKG_CONFIG) --libs MagickCore)) \ |
266 |
+# $(petsc_enable threads pthreadclasses) \ |
267 |
+} |
268 |
+ |
269 |
+src_install() { |
270 |
+ # petsc install structure is very different from |
271 |
+ # installing headers to /usr/include/petsc and lib to /usr/lib |
272 |
+ # it also installs many unneeded executables and scripts |
273 |
+ # so manual install is easier than cleanup after "emake install" |
274 |
+ insinto /usr/include/${PN} |
275 |
+ doins include/*.h* |
276 |
+ insinto /usr/include/${PN}/${PETSC_ARCH}/include |
277 |
+ doins ${PETSC_ARCH}/include/* |
278 |
+ if use fortran; then |
279 |
+ insinto /usr/include/${PN}/finclude |
280 |
+ doins -r include/${PN}/finclude/* |
281 |
+ fi |
282 |
+ if ! use mpi ; then |
283 |
+ insinto /usr/include/${PN}/mpiuni |
284 |
+ doins include/mpiuni/*.h |
285 |
+ fi |
286 |
+ insinto /usr/include/${PN}/conf |
287 |
+ doins lib/${PN}/conf/{variables,rules,test} |
288 |
+ insinto /usr/include/${PN}/${PETSC_ARCH}/conf |
289 |
+ doins ${PETSC_ARCH}/lib/${PN}/conf/{petscrules,petscvariables,RDict.db} |
290 |
+ insinto /usr/include/${PN}/private |
291 |
+ doins include/${PN}/private/*.h |
292 |
+ |
293 |
+ # fix configuration files: replace "${S}" by installed location |
294 |
+ sed -i \ |
295 |
+ -e "s:"${S}"::g" \ |
296 |
+ "${ED}"/usr/include/${PN}/${PETSC_ARCH}/include/petscconf.h \ |
297 |
+ "${ED}"/usr/include/${PN}/${PETSC_ARCH}/conf/petscvariables || die |
298 |
+ sed -i \ |
299 |
+ -e "s:-I/include:-I${EPREFIX}/usr/include/${PN}:g" \ |
300 |
+ -e "s:-I/linux-gnu-cxx-opt/include:-I${EPREFIX}/usr/include/${PN}/${PETSC_ARCH}/include/:g" \ |
301 |
+ "${ED}"/usr/include/${PN}/${PETSC_ARCH}/conf/petscvariables || die |
302 |
+ sed -i \ |
303 |
+ -e "s:usr/lib:usr/$(get_libdir):g" \ |
304 |
+ "${ED}"/usr/include/${PN}/${PETSC_ARCH}/include/petscconf.h || die |
305 |
+ |
306 |
+ # fix the include path of petscvariables in lib/${PN}/conf/variables |
307 |
+ # bug #559172 |
308 |
+ sed -i -e 's#lib/petsc/conf/#conf/#g' \ |
309 |
+ "${ED}"/usr/include/${PN}/conf/variables || die |
310 |
+ |
311 |
+ # add information about installation directory and |
312 |
+ # PETSC_ARCH to environmental variables |
313 |
+ cat >> 99petsc <<- EOF |
314 |
+ PETSC_ARCH=${PETSC_ARCH} |
315 |
+ PETSC_DIR=${EPREFIX}/usr/include/${PN} |
316 |
+ EOF |
317 |
+ doenvd 99petsc |
318 |
+ |
319 |
+ dolib.so ${PETSC_ARCH}/lib/*.so |
320 |
+ dolib.so ${PETSC_ARCH}/lib/*.so.* |
321 |
+ |
322 |
+ if use doc ; then |
323 |
+ einfo "installing documentation (this could take a while)" |
324 |
+ dodoc docs/manual.pdf |
325 |
+ dohtml -r docs/*.html docs/changes docs/manualpages |
326 |
+ fi |
327 |
+} |