Diff petsc-3.17.1-r1 with a petsc-3.18.2

/usr/portage/sci-mathematics/petsc/petsc-3.18.2.ebuild 2023-10-09 14:52:35.120368492 +0300
3 3

  
4 4
EAPI=8
5 5

  
6
PYTHON_COMPAT=( python3_{9..10} pypy3 )
6
PYTHON_COMPAT=( python3_{9..11} pypy3 )
7 7

  
8 8
inherit flag-o-matic fortran-2 python-any-r1 toolchain-funcs
9 9

  
......
14 14
LICENSE="BSD-2"
15 15
SLOT="0"
16 16
KEYWORDS="~amd64 ~x86"
17
IUSE="afterimage boost complex-scalars debug fftw
17
IUSE="afterimage boost complex-scalars debug +examples fftw
18 18
fortran hdf5 hypre int64 mpi metis mumps scotch superlu threads X"
19 19

  
20 20
# readd sparse when suitesparse-5.6.0 is in tree
......
51 51
REQUIRED_USE="
52 52
	afterimage? ( X )
53 53
	complex-scalars? ( !hypre !superlu )
54
	fftw? ( mpi )
54 55
	hdf5? ( mpi )
55 56
	hypre? ( mpi !superlu )
56 57
	mumps? ( mpi scotch )
......
143 144
		LDFLAGS="${LDFLAGS}" \
144 145
		MAKEFLAGS="${MAKEFLAGS}" \
145 146
		RANLIB="${RANLIB}" \
146
		--prefix="${EPREFIX}/usr/$(get_libdir)/petsc" \
147
		--prefix="${EPREFIX}/usr/$(get_libdir)/petscdir/" \
147 148
		--with-blas-lapack-lib="$($(tc-getPKG_CONFIG) --libs blas lapack)" \
148 149
		--with-cmake:BOOL=1 \
149 150
		--with-gnu-compilers \
150 151
		--with-imagemagick=0 \
151
		--with-matlab=0 \
152 152
		--with-petsc-arch="${PETSC_ARCH}" \
153 153
		--with-precision=double \
154 154
		--with-python=0 \
......
181 181
src_install() {
182 182
	emake DESTDIR="${ED}" install
183 183

  
184
	#
185
	# Clean up the mess:
186
	#
187

  
188
	# put all include directories under a proper subdirectory
189
	mkdir "${ED}"/usr/include || die "mkdir failed (include)"
190
	mv "${ED}"/usr/{$(get_libdir)/petscdir/include,include/petsc} || die "mv failed (include)"
191

  
192
	# put libraries and pkconfig file into proper place
193
	mv "${ED}"/usr/$(get_libdir)/petscdir/lib/{libpetsc*,pkgconfig} \
194
		"${ED}/usr/$(get_libdir)" || die "mv failed (lib)"
195

  
196
	# move share to proper location
197
	mv "${ED}"/usr/{$(get_libdir)/petscdir/share,share} || die "mv failed (share)"
198

  
199
	# fix pc files:
200
	sed -i \
201
		-e 's#include$#include/petsc#' \
202
		-e "s#lib\$#$(get_libdir)#" \
203
		-e "s#^prefix=.*petscdir\$#prefix=${EPREFIX}/usr#" \
204
		"${ED}"/usr/$(get_libdir)/pkgconfig/*.pc || die "sed failed (pkgconfig)"
205

  
206
	# recreate a "valid" petscdir:
207
	for i in "${ED}"/usr/$(get_libdir)/*; do
208
		[ $(basename $i) = petscdir ] && continue
209
		ln -s "${EPREFIX}/usr/$(get_libdir)/$(basename $i)" \
210
			"${ED}/usr/$(get_libdir)/petscdir/lib/$(basename $i)" || die "ln failed (petscdir)"
211
	done
212
	ln -s "${EPREFIX}"/usr/include/petsc/ \
213
		"${ED}/usr/$(get_libdir)/petscdir/include" || die "ln failed (petscdir)"
214
	mkdir "${ED}/usr/$(get_libdir)/petscdir/share" || die "mkdir fialed (petscdir)"
215
	ln -s "${EPREFIX}"/usr/share/petsc/ \
216
		"${ED}/usr/$(get_libdir)/petscdir/share/petsc" || die "ln failed (petscdir)"
217

  
218
	# automatically symlink petsc matlab modules:
219
	mkdir -p "${ED}"/usr/share/octave/site/m/
220
	ln -s "${EPREFIX}"/usr/share/petsc/matlab "${ED}"/usr/share/octave/site/m/petsc || die "ln failed (matlab)"
221

  
222
	if use examples; then
223
		mkdir -p "${ED}"/usr/share/doc/${PF} || die "mkdir failed (examples)"
224
		mv "${ED}"/usr/share/petsc/examples "${ED}"/usr/share/doc/${PF} || die "mv failed (examples)"
225
		ln -s "${EPREFIX}"/usr/share/doc/${PF}/examples "${ED}"/usr/share/petsc/examples || die "ln failed (examples)"
226
		docompress -x /usr/share/doc/${PF}/examples
227
	else
228
		rm -r "${ED}"/usr/share/petsc/examples || die "rm failed (examples)"
229
	fi
230

  
184 231
	# add PETSC_DIR to environmental variables
185 232
	cat >> 99petsc <<- EOF
186
		PETSC_DIR=${EPREFIX}/usr/$(get_libdir)/petsc
187
		LDPATH=${EPREFIX}/usr/$(get_libdir)/petsc/lib
233
		PETSC_DIR=${EPREFIX}/usr/$(get_libdir)/petscdir
188 234
	EOF
189 235
	doenvd 99petsc
190 236
}
Thank you!