From ff23c78bba644348820ac41f322a2ed7f5ab0a18 Mon Sep 17 00:00:00 2001 From: Antonio T Date: Sun, 13 Dec 2020 11:33:12 +0100 Subject: [PATCH] Obsolete the stand-alone petsc4py packages| This package now provides petsc4py/python-petsc rpms --- petsc.spec | 387 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 287 insertions(+), 100 deletions(-) diff --git a/petsc.spec b/petsc.spec index d2cc332..0b1023b 100644 --- a/petsc.spec +++ b/petsc.spec @@ -1,5 +1,13 @@ -# Testing ? +# Testing libpetsc ? %bcond_without check +# + +# Python binding and its testing +%bcond_without python +%bcond_without pycheck +%global pymodule_name petsc4py +%global pymodule_version 3.14.0 +# ## Debug builds ? %bcond_with debug @@ -35,7 +43,7 @@ ## PETSC looks incompatible with serial MUMPS %bcond_without mumps_serial # -## Sundials needs mpi ?? +## Sundials needs mpi ? %bcond_with sundials_serial # %bcond_without superlu @@ -73,7 +81,7 @@ %endif # -# 'scalapack' is required by 'mumps' +# 'scalapack' is required by 'MUMPS' %if %{with openmpi} %bcond_without mpi # PETSC-3.* is incompatible with Sundials 3+ @@ -127,6 +135,8 @@ --with-mkl_sparse_optimize=0 \\\ --with-mkl_cpardiso=0 \\\ --with-mkl_pardiso=0 \\\ + --with-python=0 \\\ + --DATAFILESPATH=share/petsc/datafiles \\\ %if 0%{?fedora} \ --with-cxxlib-autodetect=0 \\\ %endif \ @@ -184,7 +194,6 @@ --with-cc=${MPI_BIN}/mpicc \\\ --with-cxx=${MPI_BIN}/mpicxx \\\ --with-fc=${MPI_BIN}/mpif90 \\\ - --with-mpiexec="${MPI_BIN}/mpiexec -n `getconf _NPROCESSORS_ONLN` --mca btl_base_warn_component_unused 0" \\\ --with-shared-ld=ld \\\ --with-pic=1 \\\ --with-clib-autodetect=0 \\\ @@ -193,14 +202,22 @@ --with-mkl_sparse_optimize=0 \\\ --with-mkl_cpardiso=0 \\\ --with-mkl_pardiso=0 \\\ + --DATAFILESPATH=share/petsc/datafiles \\\ + %if %{with python} \ + --with-python=1 \\\ + --with-python-exec=%{__python3} \\\ + --download-petsc4py=1 \\\ + %endif \ %if 0%{?fedora} \ --with-cxxlib-autodetect=0 \\\ %endif \ --with-threadsafety=0 --with-log=1 \\\ %if %{with debug} \ --with-debugging=1 \\\ + --with-mpiexec="${MPI_BIN}/mpiexec -n `getconf _NPROCESSORS_ONLN` --mca btl_base_warn_component_unused 0 --mca orte_base_help_aggregate 0" \\\ %else \ --with-debugging=0 \\\ + --with-mpiexec="${MPI_BIN}/mpiexec -n `getconf _NPROCESSORS_ONLN` --mca btl_base_warn_component_unused 0" \\\ %endif \ %if %{with scalapack} \ --with-scalapack=1 \\\ @@ -260,7 +277,7 @@ Name: petsc Summary: Portable Extensible Toolkit for Scientific Computation Version: %{releasever}.2 -Release: 1%{?dist} +Release: 3%{?dist} License: BSD URL: https://www.mcs.anl.gov/petsc Source0: https://www.mcs.anl.gov/petsc/mirror/release-snapshots/petsc-%{version}.tar.gz @@ -427,6 +444,62 @@ Requires: openmpi-devel%{?_isa} %description openmpi-devel Portable Extensible Toolkit for Scientific Computation (developer files). %endif + +%if %{with python} +%package -n python%{python3_pkgversion}-%{name}-openmpi +Summary: Python3 bindings for OpenMPI PETSc +%{?python_provide:%python_provide python%{python3_pkgversion}-%{name}-openmpi} + +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-setuptools +BuildRequires: hdf5-openmpi-devel +BuildRequires: scalapack-openmpi-devel +BuildRequires: ptscotch-openmpi-devel +BuildRequires: python%{python3_pkgversion}-numpy, python%{python3_pkgversion}-Cython +Requires: petsc-openmpi%{?_isa} +Requires: hdf5-openmpi%{?_isa} +Requires: scalapack-openmpi%{?_isa} +Requires: ptscotch-openmpi%{?_isa} +Requires: openmpi%{?_isa} +Requires: MUMPS-openmpi%{?_isa} + +Obsoletes: %{pymodule_name}-openmpi < 0:3.14.0-3 +Obsoletes: python%{python3_pkgversion}-%{pymodule_name}-openmpi < 0:3.14.0-3 +Provides: python%{python3_pkgversion}-%{pymodule_name}-openmpi = 0:%{pymodule_version}-%{release} +Provides: python-%{pymodule_name}-openmpi = 0:%{pymodule_version}-%{release} +Provides: %{pymodule_name}-openmpi = 0:%{pymodule_version}-%{release} + +%description -n python%{python3_pkgversion}-%{name}-openmpi +This package provides Python3 bindings for OpenMPI PETSc, +the Portable, Extensible Toolkit for Scientific Computation. + +%package -n python%{python3_pkgversion}-%{name}-mpich +Summary: Python3 bindings for MPICH PETSc +%{?python_provide:%python_provide python%{python3_pkgversion}-%{name}-mpich} + +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-setuptools +BuildRequires: hdf5-mpich-devel +BuildRequires: scalapack-mpich-devel +BuildRequires: ptscotch-mpich-devel +BuildRequires: python%{python3_pkgversion}-numpy, python%{python3_pkgversion}-Cython +Requires: petsc-mpich%{?_isa} +Requires: hdf5-mpich%{?_isa} +Requires: scalapack-openmpi%{?_isa} +Requires: ptscotch-mpich%{?_isa} +Requires: mpich%{?_isa} +Requires: MUMPS-mpich%{?_isa} + +Obsoletes: %{pymodule_name}-mpich < 0:3.14.0-3 +Obsoletes: python%{python3_pkgversion}-%{pymodule_name}-mpich < 0:3.14.0-3 +Provides: python%{python3_pkgversion}-%{pymodule_name}-mpich = 0:%{pymodule_version}-%{release} +Provides: python-%{pymodule_name}-mpich = 0:%{pymodule_version}-%{release} +Provides: %{pymodule_name}-mpich = 0:%{pymodule_version}-%{release} + +%description -n python%{python3_pkgversion}-%{name}-mpich +This package provides Python3 bindings for MPICH PETSc, +the Portable, Extensible Toolkit for Scientific Computation. +%endif ###### ############################################################################### ###### @@ -622,6 +695,17 @@ pushd buildopenmpi_dir RPM_BUILD_NCPUS="`%{_bindir}/getconf _NPROCESSORS_ONLN`" make \ V=1 MAKE_NP=$RPM_BUILD_NCPUS PETSC_DIR=%{_builddir}/%{name}-%{version}/buildopenmpi_dir PETSC_ARCH=%{_arch} all + +%if %{with python} +cd %{_arch}/externalpackages/petsc4py +export PETSC_ARCH=%{_arch} +export PETSC_DIR=../../../ +%py3_build +unset PETSC_ARCH +unset PETSC_DIR +cd ../../.. +%endif + %{_openmpi_unload} popd %endif @@ -651,99 +735,129 @@ pushd buildmpich_dir RPM_BUILD_NCPUS="`%{_bindir}/getconf _NPROCESSORS_ONLN`" make \ V=1 MAKE_NP=$RPM_BUILD_NCPUS PETSC_DIR=%{_builddir}/%{name}-%{version}/buildmpich_dir PETSC_ARCH=%{_arch} all + +%if %{with python} +cd %{_arch}/externalpackages/petsc4py +export PETSC_ARCH=%{_arch} +export PETSC_DIR=../../../ +%py3_build +unset PETSC_ARCH +unset PETSC_DIR +cd ../../.. +%endif + %{_mpich_unload} popd %endif %install pushd %{name}-%{version} -mkdir -p $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT%{_includedir}/%{name} -mkdir -p $RPM_BUILD_ROOT%{_fmoddir}/%{name} -mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{name}/conf +mkdir -p %{buildroot}%{_libdir} %{buildroot}%{_includedir}/%{name} +mkdir -p %{buildroot}%{_fmoddir}/%{name} +mkdir -p %{buildroot}%{_libdir}/%{name}/conf -install -pm 755 %{_arch}/lib/libpetsc.* $RPM_BUILD_ROOT%{_libdir} -ln -sf libpetsc.so.%{version} $RPM_BUILD_ROOT%{_libdir}/libpetsc.so -ln -sf libpetsc.so.%{version} $RPM_BUILD_ROOT%{_libdir}/libpetsc.so.%{releasever} +install -pm 755 %{_arch}/lib/libpetsc.* %{buildroot}%{_libdir} +ln -sf libpetsc.so.%{version} %{buildroot}%{_libdir}/libpetsc.so +ln -sf libpetsc.so.%{version} %{buildroot}%{_libdir}/libpetsc.so.%{releasever} -install -pm 644 %{_arch}/include/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}/ -install -pm 644 %{_arch}/include/*.mod $RPM_BUILD_ROOT%{_fmoddir}/%{name}/ -cp -a include/* $RPM_BUILD_ROOT%{_includedir}/%{name}/ +install -pm 644 %{_arch}/include/*.h %{buildroot}%{_includedir}/%{name}/ +install -pm 644 %{_arch}/include/*.mod %{buildroot}%{_fmoddir}/%{name}/ +cp -a include/* %{buildroot}%{_includedir}/%{name}/ -cp -a %{_arch}/lib/pkgconfig $RPM_BUILD_ROOT%{_libdir}/ +cp -a %{_arch}/lib/pkgconfig %{buildroot}%{_libdir}/ -install -pm 644 %{_arch}/lib/petsc/conf/petscrules $RPM_BUILD_ROOT%{_libdir}/%{name}/conf/ -install -pm 644 %{_arch}/lib/petsc/conf/petscvariables $RPM_BUILD_ROOT%{_libdir}/%{name}/conf/ -install -pm 644 lib/petsc/conf/rules $RPM_BUILD_ROOT%{_libdir}/%{name}/conf/ -install -pm 644 lib/petsc/conf/variables $RPM_BUILD_ROOT%{_libdir}/%{name}/conf/ -sed -e 's|%{_builddir}/%{name}-%{version}/%{name}-%{version}|%{_prefix}|g' -i $RPM_BUILD_ROOT%{_libdir}/%{name}/conf/petscvariables -sed -e 's|%{_builddir}/%{name}-%{version}/%{name}-%{version}/%{_arch}/|%{_prefix}|g' -i $RPM_BUILD_ROOT%{_libdir}/%{name}/conf/petscvariables -sed -e 's|-L%{_prefix}/%{_arch}/lib|-L%{_libdir}|g' -i $RPM_BUILD_ROOT%{_libdir}/%{name}/conf/petscvariables -sed -e 's|-I%{_prefix}/%{_arch}/include|-I%{_includedir}/%{name} -I%{_fmoddir}/%{name}|g' -i $RPM_BUILD_ROOT%{_libdir}/%{name}/conf/petscvariables -sed -e 's|${PETSC_DIR}/${PETSC_ARCH}/lib|${PETSC_DIR}/%{_lib}|g' -i $RPM_BUILD_ROOT%{_libdir}/%{name}/conf/variables -sed -e 's|${PETSC_DIR}/${PETSC_ARCH}/lib|${PETSC_DIR}/%{_lib}|g' -i $RPM_BUILD_ROOT%{_libdir}/%{name}/conf/rules +install -pm 644 %{_arch}/lib/petsc/conf/petscrules %{buildroot}%{_libdir}/%{name}/conf/ +install -pm 644 %{_arch}/lib/petsc/conf/petscvariables %{buildroot}%{_libdir}/%{name}/conf/ +install -pm 644 lib/petsc/conf/rules %{buildroot}%{_libdir}/%{name}/conf/ +install -pm 644 lib/petsc/conf/variables %{buildroot}%{_libdir}/%{name}/conf/ +sed -e 's|%{_builddir}/%{name}-%{version}/%{name}-%{version}|%{_prefix}|g' -i %{buildroot}%{_libdir}/%{name}/conf/petscvariables +sed -e 's|%{_builddir}/%{name}-%{version}/%{name}-%{version}/%{_arch}/|%{_prefix}|g' -i %{buildroot}%{_libdir}/%{name}/conf/petscvariables +sed -e 's|-L%{_prefix}/%{_arch}/lib|-L%{_libdir}|g' -i %{buildroot}%{_libdir}/%{name}/conf/petscvariables +sed -e 's|-I%{_prefix}/%{_arch}/include|-I%{_includedir}/%{name} -I%{_fmoddir}/%{name}|g' -i %{buildroot}%{_libdir}/%{name}/conf/petscvariables +sed -e 's|${PETSC_DIR}/${PETSC_ARCH}/lib|${PETSC_DIR}/%{_lib}|g' -i %{buildroot}%{_libdir}/%{name}/conf/variables +sed -e 's|${PETSC_DIR}/${PETSC_ARCH}/lib|${PETSC_DIR}/%{_lib}|g' -i %{buildroot}%{_libdir}/%{name}/conf/rules popd %if %{with arch64} pushd build64 -mkdir -p $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT%{_includedir}/%{name}64 -mkdir -p $RPM_BUILD_ROOT%{_fmoddir}/%{name}64 -mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{name}64/conf -mkdir -p $RPM_BUILD_ROOT%{_libdir}/pkgconfig +mkdir -p %{buildroot}%{_libdir} %{buildroot}%{_includedir}/%{name}64 +mkdir -p %{buildroot}%{_fmoddir}/%{name}64 +mkdir -p %{buildroot}%{_libdir}/%{name}64/conf +mkdir -p %{buildroot}%{_libdir}/pkgconfig -install -pm 755 %{_arch}/lib/libpetsc64.* $RPM_BUILD_ROOT%{_libdir} -ln -sf libpetsc64.so.%{version} $RPM_BUILD_ROOT%{_libdir}/libpetsc64.so -ln -sf libpetsc64.so.%{version} $RPM_BUILD_ROOT%{_libdir}/libpetsc64.so.%{releasever} +install -pm 755 %{_arch}/lib/libpetsc64.* %{buildroot}%{_libdir} +ln -sf libpetsc64.so.%{version} %{buildroot}%{_libdir}/libpetsc64.so +ln -sf libpetsc64.so.%{version} %{buildroot}%{_libdir}/libpetsc64.so.%{releasever} -install -pm 644 %{_arch}/include/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}64/ -install -pm 644 %{_arch}/include/*.mod $RPM_BUILD_ROOT%{_fmoddir}/%{name}64/ -cp -a include/* $RPM_BUILD_ROOT%{_includedir}/%{name}64/ +install -pm 644 %{_arch}/include/*.h %{buildroot}%{_includedir}/%{name}64/ +install -pm 644 %{_arch}/include/*.mod %{buildroot}%{_fmoddir}/%{name}64/ +cp -a include/* %{buildroot}%{_includedir}/%{name}64/ -cp -p %{_arch}/lib/pkgconfig/PETSc.pc $RPM_BUILD_ROOT%{_libdir}/pkgconfig/PETSc64.pc -cp -p %{_arch}/lib/pkgconfig/PETSc.pc $RPM_BUILD_ROOT%{_libdir}/pkgconfig/petsc64.pc +cp -p %{_arch}/lib/pkgconfig/PETSc.pc %{buildroot}%{_libdir}/pkgconfig/PETSc64.pc +cp -p %{_arch}/lib/pkgconfig/PETSc.pc %{buildroot}%{_libdir}/pkgconfig/petsc64.pc -install -pm 644 %{_arch}/lib/petsc/conf/petscrules $RPM_BUILD_ROOT%{_libdir}/%{name}64/conf/ -install -pm 644 %{_arch}/lib/petsc/conf/petscvariables $RPM_BUILD_ROOT%{_libdir}/%{name}64/conf/ -install -pm 644 lib/petsc/conf/rules $RPM_BUILD_ROOT%{_libdir}/%{name}64/conf/ -install -pm 644 lib/petsc/conf/variables $RPM_BUILD_ROOT%{_libdir}/%{name}64/conf/ -sed -e 's|%{_builddir}/%{name}-%{version}/build64|%{_prefix}|g' -i $RPM_BUILD_ROOT%{_libdir}/%{name}64/conf/petscvariables -sed -e 's|%{_builddir}/%{name}-%{version}/build64/%{_arch}/|%{_prefix}|g' -i $RPM_BUILD_ROOT%{_libdir}/%{name}64/conf/petscvariables -sed -e 's|-L%{_prefix}/%{_arch}/lib|-L%{_libdir}|g' -i $RPM_BUILD_ROOT%{_libdir}/%{name}64/conf/petscvariables -sed -e 's|-I%{_prefix}/%{_arch}/include/|-I%{_includedir}/%{name}64 -I%{_fmoddir}/%{name}64|g' -i $RPM_BUILD_ROOT%{_libdir}/%{name}64/conf/petscvariables -sed -e 's|${PETSC_DIR}/${PETSC_ARCH}/lib|${PETSC_DIR}/%{_lib}|g' -i $RPM_BUILD_ROOT%{_libdir}/%{name}64/conf/variables -sed -e 's|${PETSC_DIR}/${PETSC_ARCH}/lib|${PETSC_DIR}/%{_lib}|g' -i $RPM_BUILD_ROOT%{_libdir}/%{name}64/conf/rules +install -pm 644 %{_arch}/lib/petsc/conf/petscrules %{buildroot}%{_libdir}/%{name}64/conf/ +install -pm 644 %{_arch}/lib/petsc/conf/petscvariables %{buildroot}%{_libdir}/%{name}64/conf/ +install -pm 644 lib/petsc/conf/rules %{buildroot}%{_libdir}/%{name}64/conf/ +install -pm 644 lib/petsc/conf/variables %{buildroot}%{_libdir}/%{name}64/conf/ +sed -e 's|%{_builddir}/%{name}-%{version}/build64|%{_prefix}|g' -i %{buildroot}%{_libdir}/%{name}64/conf/petscvariables +sed -e 's|%{_builddir}/%{name}-%{version}/build64/%{_arch}/|%{_prefix}|g' -i %{buildroot}%{_libdir}/%{name}64/conf/petscvariables +sed -e 's|-L%{_prefix}/%{_arch}/lib|-L%{_libdir}|g' -i %{buildroot}%{_libdir}/%{name}64/conf/petscvariables +sed -e 's|-I%{_prefix}/%{_arch}/include/|-I%{_includedir}/%{name}64 -I%{_fmoddir}/%{name}64|g' -i %{buildroot}%{_libdir}/%{name}64/conf/petscvariables +sed -e 's|${PETSC_DIR}/${PETSC_ARCH}/lib|${PETSC_DIR}/%{_lib}|g' -i %{buildroot}%{_libdir}/%{name}64/conf/variables +sed -e 's|${PETSC_DIR}/${PETSC_ARCH}/lib|${PETSC_DIR}/%{_lib}|g' -i %{buildroot}%{_libdir}/%{name}64/conf/rules popd %endif %if %{with openmpi} pushd buildopenmpi_dir %{_openmpi_load} -mkdir -p $RPM_BUILD_ROOT$MPI_LIB $RPM_BUILD_ROOT$MPI_INCLUDE/%{name} -mkdir -p $RPM_BUILD_ROOT$MPI_FORTRAN_MOD_DIR/%{name} -mkdir -p $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf +mkdir -p %{buildroot}$MPI_LIB %{buildroot}$MPI_INCLUDE/%{name} +mkdir -p %{buildroot}$MPI_FORTRAN_MOD_DIR/%{name} +mkdir -p %{buildroot}$MPI_LIB/%{name}/conf -install -pm 755 %{_arch}/lib/libpetsc.* $RPM_BUILD_ROOT$MPI_LIB -ln -sf libpetsc.so.%{version} $RPM_BUILD_ROOT$MPI_LIB/libpetsc.so -ln -sf libpetsc.so.%{version} $RPM_BUILD_ROOT$MPI_LIB/libpetsc.so.%{releasever} +install -pm 755 %{_arch}/lib/libpetsc.* %{buildroot}$MPI_LIB +ln -sf libpetsc.so.%{version} %{buildroot}$MPI_LIB/libpetsc.so +ln -sf libpetsc.so.%{version} %{buildroot}$MPI_LIB/libpetsc.so.%{releasever} -install -pm 644 %{_arch}/include/*.h $RPM_BUILD_ROOT$MPI_INCLUDE/%{name}/ -install -pm 644 %{_arch}/include/*.mod $RPM_BUILD_ROOT$MPI_FORTRAN_MOD_DIR/%{name}/ -cp -a include/* $RPM_BUILD_ROOT$MPI_INCLUDE/%{name}/ +install -pm 644 %{_arch}/include/*.h %{buildroot}$MPI_INCLUDE/%{name}/ +install -pm 644 %{_arch}/include/*.mod %{buildroot}$MPI_FORTRAN_MOD_DIR/%{name}/ +cp -a include/* %{buildroot}$MPI_INCLUDE/%{name}/ -cp -a %{_arch}/lib/pkgconfig $RPM_BUILD_ROOT$MPI_LIB/ -sed -e 's|-I${includedir}/petsc|-I%{_includedir}/openmpi-%{_arch}/petsc|g' -i $RPM_BUILD_ROOT$MPI_LIB/pkgconfig/PETSc.pc -sed -e 's|-L${libdir}|-L%{_libdir}/openmpi/lib|g' -i $RPM_BUILD_ROOT$MPI_LIB/pkgconfig/PETSc.pc -sed -e 's|ldflag_rpath=-L|ldflag_rpath=-L%{_libdir}/openmpi/lib|g' -i $RPM_BUILD_ROOT$MPI_LIB/pkgconfig/PETSc.pc +cp -a %{_arch}/lib/pkgconfig %{buildroot}$MPI_LIB/ +sed -e 's|-I${includedir}/petsc|-I%{_includedir}/openmpi-%{_arch}/petsc|g' -i %{buildroot}$MPI_LIB/pkgconfig/PETSc.pc +sed -e 's|-L${libdir}|-L%{_libdir}/openmpi/lib|g' -i %{buildroot}$MPI_LIB/pkgconfig/PETSc.pc +sed -e 's|ldflag_rpath=-L|ldflag_rpath=-L%{_libdir}/openmpi/lib|g' -i %{buildroot}$MPI_LIB/pkgconfig/PETSc.pc -install -pm 644 %{_arch}/lib/petsc/conf/petscrules $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/ -install -pm 644 %{_arch}/lib/petsc/conf/petscvariables $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/ -install -pm 644 lib/petsc/conf/rules $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/ -install -pm 644 lib/petsc/conf/variables $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/ -sed -e 's|%{_builddir}/%{name}-%{version}/buildopenmpi_dir|%{_prefix}|g' -i $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/petscvariables -sed -e 's|%{_builddir}/%{name}-%{version}/buildopenmpi_dir/%{_arch}/|%{_prefix}|g' -i $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/petscvariables -sed -e 's|-L%{_prefix}/%{_arch}/lib|-L%{_libdir}/openmpi/lib|g' -i $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/petscvariables -sed -e 's|-I%{_prefix}/%{_arch}/include|-I%{_includedir}/openmpi-%{_arch}/%{name} -I%{_fmoddir}/openmpi/%{name}|g' -i $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/petscvariables -sed -e 's|${PETSC_DIR}/${PETSC_ARCH}/lib|${PETSC_DIR}/%{_lib}/openmpi/lib|g' -i $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/variables -sed -e 's|${PETSC_DIR}/${PETSC_ARCH}/lib|${PETSC_DIR}/%{_lib}/openmpi/lib|g' -i $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/rules +install -pm 644 %{_arch}/lib/petsc/conf/petscrules %{buildroot}$MPI_LIB/%{name}/conf/ +install -pm 644 %{_arch}/lib/petsc/conf/petscvariables %{buildroot}$MPI_LIB/%{name}/conf/ +install -pm 644 lib/petsc/conf/rules %{buildroot}$MPI_LIB/%{name}/conf/ +install -pm 644 lib/petsc/conf/variables %{buildroot}$MPI_LIB/%{name}/conf/ +sed -e 's|%{_builddir}/%{name}-%{version}/buildopenmpi_dir|%{_prefix}|g' -i %{buildroot}$MPI_LIB/%{name}/conf/petscvariables +sed -e 's|%{_builddir}/%{name}-%{version}/buildopenmpi_dir/%{_arch}/|%{_prefix}|g' -i %{buildroot}$MPI_LIB/%{name}/conf/petscvariables +sed -e 's|-L%{_prefix}/%{_arch}/lib|-L%{_libdir}/openmpi/lib|g' -i %{buildroot}$MPI_LIB/%{name}/conf/petscvariables +sed -e 's|-I%{_prefix}/%{_arch}/include|-I%{_includedir}/openmpi-%{_arch}/%{name} -I%{_fmoddir}/openmpi/%{name}|g' -i %{buildroot}$MPI_LIB/%{name}/conf/petscvariables +sed -e 's|${PETSC_DIR}/${PETSC_ARCH}/lib|${PETSC_DIR}/%{_lib}/openmpi/lib|g' -i %{buildroot}$MPI_LIB/%{name}/conf/variables +sed -e 's|${PETSC_DIR}/${PETSC_ARCH}/lib|${PETSC_DIR}/%{_lib}/openmpi/lib|g' -i %{buildroot}$MPI_LIB/%{name}/conf/rules + +%if %{with python} +pushd %{_arch}/externalpackages/petsc4py +export PETSC_ARCH=%{_arch} +export PETSC_DIR=../../../ +%py3_install +popd + +# Install petsc4py files into MPI directories +%if 0%{?rhel} +MPI_PYTHON3_SITEARCH=%{python3_sitearch}/openmpi +%endif + +mkdir -p %{buildroot}$MPI_PYTHON3_SITEARCH +cp -a %{buildroot}%{python3_sitearch}/%{pymodule_name} %{buildroot}$MPI_PYTHON3_SITEARCH/ +rm -rf %{buildroot}%{python3_sitearch}/%{pymodule_name} +cp -a %{buildroot}%{python3_sitearch}/%{pymodule_name}-%{pymodule_version}-py%{python3_version}.egg-info %{buildroot}$MPI_PYTHON3_SITEARCH/ +rm -rf %{buildroot}%{python3_sitearch}/%{pymodule_name}-%{pymodule_version}-py%{python3_version}.egg-info +%endif %{_openmpi_unload} popd %endif @@ -751,52 +865,70 @@ popd %if %{with mpich} pushd buildmpich_dir %{_mpich_load} -mkdir -p $RPM_BUILD_ROOT$MPI_LIB $RPM_BUILD_ROOT$MPI_INCLUDE/%{name} -mkdir -p $RPM_BUILD_ROOT$MPI_FORTRAN_MOD_DIR/%{name} -mkdir -p $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf +mkdir -p %{buildroot}$MPI_LIB %{buildroot}$MPI_INCLUDE/%{name} +mkdir -p %{buildroot}$MPI_FORTRAN_MOD_DIR/%{name} +mkdir -p %{buildroot}$MPI_LIB/%{name}/conf -install -pm 755 %{_arch}/lib/libpetsc.* $RPM_BUILD_ROOT$MPI_LIB -ln -sf libpetsc.so.%{version} $RPM_BUILD_ROOT$MPI_LIB/libpetsc.so -ln -sf libpetsc.so.%{version} $RPM_BUILD_ROOT$MPI_LIB/libpetsc.so.%{releasever} +install -pm 755 %{_arch}/lib/libpetsc.* %{buildroot}$MPI_LIB +ln -sf libpetsc.so.%{version} %{buildroot}$MPI_LIB/libpetsc.so +ln -sf libpetsc.so.%{version} %{buildroot}$MPI_LIB/libpetsc.so.%{releasever} -install -pm 644 %{_arch}/include/*.h $RPM_BUILD_ROOT$MPI_INCLUDE/%{name}/ -install -pm 644 %{_arch}/include/*.mod $RPM_BUILD_ROOT$MPI_FORTRAN_MOD_DIR/%{name}/ -cp -a include/* $RPM_BUILD_ROOT$MPI_INCLUDE/%{name}/ +install -pm 644 %{_arch}/include/*.h %{buildroot}$MPI_INCLUDE/%{name}/ +install -pm 644 %{_arch}/include/*.mod %{buildroot}$MPI_FORTRAN_MOD_DIR/%{name}/ +cp -a include/* %{buildroot}$MPI_INCLUDE/%{name}/ -cp -a %{_arch}/lib/pkgconfig $RPM_BUILD_ROOT$MPI_LIB/ -sed -e 's|-I${includedir}/petsc|-I%{_includedir}/mpich-%{_arch}/petsc|g' -i $RPM_BUILD_ROOT$MPI_LIB/pkgconfig/PETSc.pc -sed -e 's|-L${libdir}|-L%{_libdir}/mpich/lib|g' -i $RPM_BUILD_ROOT$MPI_LIB/pkgconfig/PETSc.pc -sed -e 's|ldflag_rpath=-L|ldflag_rpath=-L%{_libdir}/mpich/lib|g' -i $RPM_BUILD_ROOT$MPI_LIB/pkgconfig/PETSc.pc -pushd $RPM_BUILD_ROOT$MPI_LIB/pkgconfig +cp -a %{_arch}/lib/pkgconfig %{buildroot}$MPI_LIB/ +sed -e 's|-I${includedir}/petsc|-I%{_includedir}/mpich-%{_arch}/petsc|g' -i %{buildroot}$MPI_LIB/pkgconfig/PETSc.pc +sed -e 's|-L${libdir}|-L%{_libdir}/mpich/lib|g' -i %{buildroot}$MPI_LIB/pkgconfig/PETSc.pc +sed -e 's|ldflag_rpath=-L|ldflag_rpath=-L%{_libdir}/mpich/lib|g' -i %{buildroot}$MPI_LIB/pkgconfig/PETSc.pc +pushd %{buildroot}$MPI_LIB/pkgconfig #ln -fs PETSc.pc petsc.pc popd -install -pm 644 %{_arch}/lib/petsc/conf/petscrules $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/ -install -pm 644 %{_arch}/lib/petsc/conf/petscvariables $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/ -install -pm 644 lib/petsc/conf/rules $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/ -install -pm 644 lib/petsc/conf/variables $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/ -sed -e 's|%{_builddir}/%{name}-%{version}/buildmpich_dir|%{_prefix}|g' -i $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/petscvariables -sed -e 's|%{_builddir}/%{name}-%{version}/buildmpich_dir/%{_arch}/|%{_prefix}|g' -i $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/petscvariables -sed -e 's|-L%{_prefix}/%{_arch}/lib|-L%{_libdir}/mpich/lib|g' -i $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/petscvariables -sed -e 's|-I%{_prefix}/%{_arch}/include|-I%{_includedir}/mpich-%{_arch}/%{name} -I%{_fmoddir}/mpich/%{name}|g' -i $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/petscvariables -sed -e 's|${PETSC_DIR}/${PETSC_ARCH}/lib|${PETSC_DIR}/%{_lib}/mpich/lib|g' -i $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/variables -sed -e 's|${PETSC_DIR}/${PETSC_ARCH}/lib|${PETSC_DIR}/%{_lib}/mpich/lib|g' -i $RPM_BUILD_ROOT$MPI_LIB/%{name}/conf/rules +install -pm 644 %{_arch}/lib/petsc/conf/petscrules %{buildroot}$MPI_LIB/%{name}/conf/ +install -pm 644 %{_arch}/lib/petsc/conf/petscvariables %{buildroot}$MPI_LIB/%{name}/conf/ +install -pm 644 lib/petsc/conf/rules %{buildroot}$MPI_LIB/%{name}/conf/ +install -pm 644 lib/petsc/conf/variables %{buildroot}$MPI_LIB/%{name}/conf/ +sed -e 's|%{_builddir}/%{name}-%{version}/buildmpich_dir|%{_prefix}|g' -i %{buildroot}$MPI_LIB/%{name}/conf/petscvariables +sed -e 's|%{_builddir}/%{name}-%{version}/buildmpich_dir/%{_arch}/|%{_prefix}|g' -i %{buildroot}$MPI_LIB/%{name}/conf/petscvariables +sed -e 's|-L%{_prefix}/%{_arch}/lib|-L%{_libdir}/mpich/lib|g' -i %{buildroot}$MPI_LIB/%{name}/conf/petscvariables +sed -e 's|-I%{_prefix}/%{_arch}/include|-I%{_includedir}/mpich-%{_arch}/%{name} -I%{_fmoddir}/mpich/%{name}|g' -i %{buildroot}$MPI_LIB/%{name}/conf/petscvariables +sed -e 's|${PETSC_DIR}/${PETSC_ARCH}/lib|${PETSC_DIR}/%{_lib}/mpich/lib|g' -i %{buildroot}$MPI_LIB/%{name}/conf/variables +sed -e 's|${PETSC_DIR}/${PETSC_ARCH}/lib|${PETSC_DIR}/%{_lib}/mpich/lib|g' -i %{buildroot}$MPI_LIB/%{name}/conf/rules + +%if %{with python} +pushd %{_arch}/externalpackages/petsc4py +export PETSC_ARCH=%{_arch} +export PETSC_DIR=../../../ +%py3_install +popd +# Install petsc4py files into MPI directories +%if 0%{?rhel} +MPI_PYTHON3_SITEARCH=%{python3_sitearch}/mpich +%endif + +mkdir -p %{buildroot}$MPI_PYTHON3_SITEARCH +cp -a %{buildroot}%{python3_sitearch}/%{pymodule_name} %{buildroot}$MPI_PYTHON3_SITEARCH/ +rm -rf %{buildroot}%{python3_sitearch}/%{pymodule_name} +cp -a %{buildroot}%{python3_sitearch}/%{pymodule_name}-%{pymodule_version}-py%{python3_version}.egg-info %{buildroot}$MPI_PYTHON3_SITEARCH/ +rm -rf %{buildroot}%{python3_sitearch}/%{pymodule_name}-%{pymodule_version}-py%{python3_version}.egg-info +%endif %{_mpich_unload} popd %endif # Move html documentation in _pkgdocdir -pushd $RPM_BUILD_ROOT%{_includedir} -mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/headers +pushd %{buildroot}%{_includedir} +mkdir -p %{buildroot}%{_pkgdocdir}/headers for i in `find . -name "*.h.html" -type f -print`; do - mv $i $RPM_BUILD_ROOT%{_pkgdocdir}/headers + mv $i %{buildroot}%{_pkgdocdir}/headers done for i in `find . -name "*.html" -type f -print`; do - mv $i $RPM_BUILD_ROOT%{_pkgdocdir}/headers + mv $i %{buildroot}%{_pkgdocdir}/headers done find . -name "Makefile" -type f -print | xargs /bin/rm -f popd -cp -a %{name}-%{version}/docs/* $RPM_BUILD_ROOT%{_pkgdocdir} +cp -a %{name}-%{version}/docs/* %{buildroot}%{_pkgdocdir} # %ldconfig_scriptlets @@ -805,11 +937,11 @@ cp -a %{name}-%{version}/docs/* $RPM_BUILD_ROOT%{_pkgdocdir} %ldconfig_scriptlets -n petsc64 %endif -%if %{with check} %check %if %{with openmpi} %{_openmpi_load} +%if %{with check} export LD_LIBRARY_PATH=%{_builddir}/%{name}-%{version}/buildopenmpi_dir/%{_arch}/lib export PETSC_DIR=%{_builddir}/%{name}-%{version}/buildopenmpi_dir export PETSC_ARCH=%{_arch} @@ -824,11 +956,29 @@ xvfb-run -a make all test -C buildopenmpi_dir V=1 MPIEXEC='%{_builddir}/%{name}- %else xvfb-run -a make all test -C buildopenmpi_dir V=1 %endif +%endif + +%if %{with python} +%if %{with pycheck} +pushd buildopenmpi_dir/%{_arch}/externalpackages/petsc4py +export PETSC_ARCH=%{_arch} +export PETSC_DIR=../../../ +%if 0%{?rhel} +MPI_PYTHON3_SITEARCH=%{python3_sitearch}/openmpi +%endif +export PYTHONPATH=$RPM_BUILD_ROOT$MPI_PYTHON3_SITEARCH +%{__python3} setup.py test +unset PETSC_ARCH +unset PETSC_DIR +popd +%endif +%endif %{_openmpi_unload} %endif %if %{with mpich} %{_mpich_load} +%if %{with check} export LD_LIBRARY_PATH=%{_builddir}/%{name}-%{version}/buildmpich_dir/%{_arch}/lib export PETSC_DIR=%{_builddir}/%{name}-%{version}/buildmpich_dir export PETSC_ARCH=%{_arch} @@ -843,9 +993,27 @@ xvfb-run -a make all test -C buildmpich_dir V=1 MPIEXEC='%{_builddir}/%{name}-%{ %else xvfb-run -a make all test -C buildmpich_dir V=1 %endif +%endif + +%if %{with python} +%if %{with pycheck} +pushd buildmpich_dir/%{_arch}/externalpackages/petsc4py +export PETSC_ARCH=%{_arch} +export PETSC_DIR=../../../ +%if 0%{?rhel} +MPI_PYTHON3_SITEARCH=%{python3_sitearch}/mpich +%endif +export PYTHONPATH=$RPM_BUILD_ROOT$MPI_PYTHON3_SITEARCH +%{__python3} setup.py test +unset PETSC_ARCH +unset PETSC_DIR +popd +%endif +%endif %{_mpich_unload} %endif +%if %{with check} export LD_LIBRARY_PATH=%{_libdir}:%{_builddir}/%{name}-%{version}/%{name}-%{version}/%{_arch}/lib export PETSC_DIR=%{_builddir}/%{name}-%{version}/%{name}-%{version} export PETSC_ARCH=%{_arch} @@ -927,6 +1095,12 @@ xvfb-run -a make all test -C build64 V=1 MPIEXEC='%{_builddir}/%{name}-%{version %else %{_fmoddir}/openmpi/%{name}/ %endif + +%if %{with python} +%files -n python%{python3_pkgversion}-%{name}-openmpi +%{python3_sitearch}/openmpi/%{pymodule_name}/ +%{python3_sitearch}/openmpi/%{pymodule_name}-%{pymodule_version}-py%{python3_version}.egg-info +%endif %endif %if %{with mpich} @@ -945,9 +1119,22 @@ xvfb-run -a make all test -C build64 V=1 MPIEXEC='%{_builddir}/%{name}-%{version %else %{_fmoddir}/mpich/%{name}/ %endif + +%if %{with python} +%files -n python%{python3_pkgversion}-%{name}-mpich +%{python3_sitearch}/mpich/%{pymodule_name}/ +%{python3_sitearch}/mpich/%{pymodule_name}-%{pymodule_version}-py%{python3_version}.egg-info +%endif %endif %changelog +* Sun Dec 13 2020 Antonio Trande - 3.14.2-3 +- Obsolete the stand-alone petsc4py packages +- This package now provides petsc4py/python-petsc rpms + +* Wed Dec 09 2020 Antonio Trande - 3.14.2-2 +- Compile petsc4py code inside + * Sat Dec 05 2020 Antonio Trande - 3.14.2-1 - Release 3.14.2