petsc-git-PKGBUILD

build template for non-complex PETSC with petsc4py
git clone git://src.adamsgaard.dk/petsc-git-PKGBUILD # fast
git clone https://src.adamsgaard.dk/petsc-git-PKGBUILD.git # slow
Log | Files | Refs Back to index

commit e87f7eb14461b0f0ebda9a18ac29d34040b4a8c4
parent 9e588e9dcb2f1284e64a72619878342e58951ff1
Author: Lucas Heitzmann Gabrielli <heitzmann@gmail.com>
Date:   Wed,  3 Feb 2021 17:03:02 -0300

Fix petsc4py build

Diffstat:
M.SRCINFO | 4+++-
MPKGBUILD | 63+++++++++++++++++++++++++++++++++++----------------------------
Apetsc4py.patch | 11+++++++++++
3 files changed, 49 insertions(+), 29 deletions(-)

diff --git a/.SRCINFO b/.SRCINFO @@ -1,7 +1,7 @@ pkgbase = petsc-git pkgdesc = Portable, extensible toolkit for scientific computation (external downloads enabled) pkgver = 20210203 - pkgrel = 1 + pkgrel = 2 url = https://gitlab.com/petsc/petsc install = petsc.install arch = i686 @@ -34,7 +34,9 @@ pkgbase = petsc-git provides = petsc conflicts = petsc source = petsc::git+https://gitlab.com/petsc/petsc.git#branch=release + source = petsc4py.patch sha256sums = SKIP + sha256sums = b0f4a9d33e9c3ba3f51b81808f04ec66091b0a29cf99cac6392e97232edec768 pkgname = petsc-git diff --git a/PKGBUILD b/PKGBUILD @@ -2,7 +2,7 @@ pkgname=petsc-git pkgver=20210203 -pkgrel=1 +pkgrel=2 _config=linux-c-opt pkgdesc="Portable, extensible toolkit for scientific computation (external downloads enabled)" provides=(petsc) @@ -19,10 +19,14 @@ optdepends=("opencl: GPU computing" "libyaml: YAML configuration support" "libx11: GUI tools") install=petsc.install -source=(petsc::git+https://gitlab.com/petsc/petsc.git#branch=release) -sha256sums=('SKIP') +source=(petsc::git+https://gitlab.com/petsc/petsc.git#branch=release + petsc4py.patch) +sha256sums=('SKIP' + 'b0f4a9d33e9c3ba3f51b81808f04ec66091b0a29cf99cac6392e97232edec768') _petsc_arch="arch-${_config}" +_petsc_dir='/usr/local/petsc' +_install_dir="${_petsc_dir}/${_config}" generic_flags="-fPIC -fopenmp -O3 -march=x86-64 -mtune=generic" # generic_flags="-fPIC -fopenmp -O3 -march=amdfam10 -mtune=generic" @@ -48,6 +52,7 @@ pkgver() { prepare() { cd "${srcdir}/petsc" sed -i 's-\(self.publicInstall[^=]*=[[:space:]]\)[^#]*-\10 -g' config/BuildSystem/config/package.py + patch -p1 < ../petsc4py.patch } @@ -126,13 +131,11 @@ build() { # "linux-c-debug" for some things, so _config should be changed to "linux-c-debug" #CONFOPTS="${CONFOPTS} --with-debugging=1" - dirpkg=${srcdir}/petsc/${_petsc_arch}/externalpackages/ - export PETSC_DIR="${srcdir}/petsc" export PETSC_ARCH="${_petsc_arch}" python ./configure LDFLAGS="$LDFLAGS" \ - --prefix=/usr/petsc/${_config} \ + --prefix="${_petsc_dir}/${_config}" \ --MAKEFLAGS="$MAKEFLAGS" \ $(for (( i=1; i<=${#CONFOPTS[@]}; i++)); do echo "${CONFOPTS[$i]}"; done) make clean @@ -143,13 +146,15 @@ package() { cd petsc _build_dir="${srcdir}/petsc" - _install_dir=/usr/petsc/${_config} export PETSC_DIR=${_build_dir} export PETSC_ARCH="${_petsc_arch}" make DESTDIR="${pkgdir}" install + # Fix petsc4py runpath + chrpath -r "${_install_dir}/lib:/usr/lib/openmpi" ${_build_dir}/${_petsc_arch}/lib/petsc4py/lib/${_petsc_arch}/PETSc.cpython-39-x86_64-linux-gnu.so + # install license install -Dm 644 ${_build_dir}/LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE @@ -169,28 +174,30 @@ package() { sed -i "s#${_rem_dir}#${_install_dir}#g" "${pkgdir}${_install_dir}/lib/petsc/conf/pkg.conf.mumps" sed -i "s#${_rem_dir}#${_install_dir}#g" "${pkgdir}${_install_dir}/lib/petsc/conf/pkg.conf.hypre" sed -i "s#${_rem_dir}#${_install_dir}#g" "${pkgdir}${_install_dir}/lib/petsc/conf/petscvariables" + sed -i "s#${_rem_dir}#${_install_dir}#g" "${pkgdir}${_install_dir}/lib/petsc/conf/petscrules" + sed -i "s#${_build_dir}#${_petsc_dir}#g" "${_rem_dir}/lib/petsc4py/lib/petsc.cfg" # install petsc4py _python_package="${pkgdir}/usr/lib/python3.9/site-packages" - install -Dm 644 "${_rem_dir}/lib/petsc4py-3.14.1-py3.9.egg-info/PKG-INFO" "${_python_package}/petsc4py-3.14.1-py3.9.egg-info/PKG-INFO" - install -Dm 644 "${_rem_dir}/lib/petsc4py-3.14.1-py3.9.egg-info/SOURCES.txt" "${_python_package}/petsc4py-3.14.1-py3.9.egg-info/SOURCES.txt" - install -Dm 644 "${_rem_dir}/lib/petsc4py-3.14.1-py3.9.egg-info/dependency_links.txt" "${_python_package}/petsc4py-3.14.1-py3.9.egg-info/dependency_links.txt" - install -Dm 644 "${_rem_dir}/lib/petsc4py-3.14.1-py3.9.egg-info/not-zip-safe" "${_python_package}/petsc4py-3.14.1-py3.9.egg-info/not-zip-safe" - install -Dm 644 "${_rem_dir}/lib/petsc4py-3.14.1-py3.9.egg-info/requires.txt" "${_python_package}/petsc4py-3.14.1-py3.9.egg-info/requires.txt" - install -Dm 644 "${_rem_dir}/lib/petsc4py-3.14.1-py3.9.egg-info/top_level.txt" "${_python_package}/petsc4py-3.14.1-py3.9.egg-info/top_level.txt" - install -Dm 644 "${_rem_dir}/lib/petsc4py/__init__.py" "${_python_package}/petsc4py/__init__.py" - install -Dm 644 "${_rem_dir}/lib/petsc4py/__main__.py" "${_python_package}/petsc4py/__main__.py" - install -Dm 644 "${_rem_dir}/lib/petsc4py/PETSc.pxd" "${_python_package}/petsc4py/PETSc.pxd" - install -Dm 644 "${_rem_dir}/lib/petsc4py/PETSc.py" "${_python_package}/petsc4py/PETSc.py" - install -Dm 644 "${_rem_dir}/lib/petsc4py/include/petsc4py/__init__.pxd" "${_python_package}/petsc4py/include/petsc4py/__init__.pxd" - install -Dm 644 "${_rem_dir}/lib/petsc4py/include/petsc4py/__init__.pyx" "${_python_package}/petsc4py/include/petsc4py/__init__.pyx" - install -Dm 644 "${_rem_dir}/lib/petsc4py/include/petsc4py/numpy.h" "${_python_package}/petsc4py/include/petsc4py/numpy.h" - install -Dm 644 "${_rem_dir}/lib/petsc4py/include/petsc4py/petsc4py.h" "${_python_package}/petsc4py/include/petsc4py/petsc4py.h" - install -Dm 644 "${_rem_dir}/lib/petsc4py/include/petsc4py/petsc4py.i" "${_python_package}/petsc4py/include/petsc4py/petsc4py.i" - install -Dm 644 "${_rem_dir}/lib/petsc4py/include/petsc4py/petsc4py.PETSc_api.h" "${_python_package}/petsc4py/include/petsc4py/petsc4py.PETSc_api.h" - install -Dm 644 "${_rem_dir}/lib/petsc4py/include/petsc4py/petsc4py.PETSc.h" "${_python_package}/petsc4py/include/petsc4py/petsc4py.PETSc.h" - install -Dm 644 "${_rem_dir}/lib/petsc4py/include/petsc4py/PETSc.pxd" "${_python_package}/petsc4py/include/petsc4py/PETSc.pxd" - install -Dm 644 "${_rem_dir}/lib/petsc4py/lib/__init__.py" "${_python_package}/petsc4py/lib/__init__.py" - install -Dm 644 "${_rem_dir}/lib/petsc4py/lib/petsc.cfg" "${_python_package}/petsc4py/lib/petsc.cfg" - install -Dm 755 "${_rem_dir}/lib/petsc4py/lib/PETSc.cpython-39-x86_64-linux-gnu.so" "${_python_package}/petsc4py/lib/PETSc.cpython-39-x86_64-linux-gnu.so" + install -Dm 644 "${_rem_dir}/lib/petsc4py-3.14.1-py3.9.egg-info/PKG-INFO" "${_python_package}/petsc4py-3.14.1-py3.9.egg-info/PKG-INFO" + install -Dm 644 "${_rem_dir}/lib/petsc4py-3.14.1-py3.9.egg-info/SOURCES.txt" "${_python_package}/petsc4py-3.14.1-py3.9.egg-info/SOURCES.txt" + install -Dm 644 "${_rem_dir}/lib/petsc4py-3.14.1-py3.9.egg-info/dependency_links.txt" "${_python_package}/petsc4py-3.14.1-py3.9.egg-info/dependency_links.txt" + install -Dm 644 "${_rem_dir}/lib/petsc4py-3.14.1-py3.9.egg-info/not-zip-safe" "${_python_package}/petsc4py-3.14.1-py3.9.egg-info/not-zip-safe" + install -Dm 644 "${_rem_dir}/lib/petsc4py-3.14.1-py3.9.egg-info/requires.txt" "${_python_package}/petsc4py-3.14.1-py3.9.egg-info/requires.txt" + install -Dm 644 "${_rem_dir}/lib/petsc4py-3.14.1-py3.9.egg-info/top_level.txt" "${_python_package}/petsc4py-3.14.1-py3.9.egg-info/top_level.txt" + install -Dm 644 "${_rem_dir}/lib/petsc4py/__init__.py" "${_python_package}/petsc4py/__init__.py" + install -Dm 644 "${_rem_dir}/lib/petsc4py/__main__.py" "${_python_package}/petsc4py/__main__.py" + install -Dm 644 "${_rem_dir}/lib/petsc4py/PETSc.pxd" "${_python_package}/petsc4py/PETSc.pxd" + install -Dm 644 "${_rem_dir}/lib/petsc4py/PETSc.py" "${_python_package}/petsc4py/PETSc.py" + install -Dm 644 "${_rem_dir}/lib/petsc4py/include/petsc4py/__init__.pxd" "${_python_package}/petsc4py/include/petsc4py/__init__.pxd" + install -Dm 644 "${_rem_dir}/lib/petsc4py/include/petsc4py/__init__.pyx" "${_python_package}/petsc4py/include/petsc4py/__init__.pyx" + install -Dm 644 "${_rem_dir}/lib/petsc4py/include/petsc4py/numpy.h" "${_python_package}/petsc4py/include/petsc4py/numpy.h" + install -Dm 644 "${_rem_dir}/lib/petsc4py/include/petsc4py/petsc4py.h" "${_python_package}/petsc4py/include/petsc4py/petsc4py.h" + install -Dm 644 "${_rem_dir}/lib/petsc4py/include/petsc4py/petsc4py.i" "${_python_package}/petsc4py/include/petsc4py/petsc4py.i" + install -Dm 644 "${_rem_dir}/lib/petsc4py/include/petsc4py/petsc4py.PETSc_api.h" "${_python_package}/petsc4py/include/petsc4py/petsc4py.PETSc_api.h" + install -Dm 644 "${_rem_dir}/lib/petsc4py/include/petsc4py/petsc4py.PETSc.h" "${_python_package}/petsc4py/include/petsc4py/petsc4py.PETSc.h" + install -Dm 644 "${_rem_dir}/lib/petsc4py/include/petsc4py/PETSc.pxd" "${_python_package}/petsc4py/include/petsc4py/PETSc.pxd" + install -Dm 644 "${_rem_dir}/lib/petsc4py/lib/__init__.py" "${_python_package}/petsc4py/lib/__init__.py" + install -Dm 644 "${_rem_dir}/lib/petsc4py/lib/petsc.cfg" "${_python_package}/petsc4py/lib/petsc.cfg" + install -Dm 755 "${_rem_dir}/lib/petsc4py/lib/${_petsc_arch}/PETSc.cpython-39-x86_64-linux-gnu.so" "${_python_package}/petsc4py/lib/PETSc.cpython-39-x86_64-linux-gnu.so" } diff --git a/petsc4py.patch b/petsc4py.patch @@ -0,0 +1,11 @@ +--- a/config/BuildSystem/config/packages/petsc4py.py ++++ b/config/BuildSystem/config/packages/petsc4py.py +@@ -46,7 +46,7 @@ + + # if installing prefix location then need to set new value for PETSC_DIR/PETSC_ARCH + if self.argDB['prefix'] and not 'package-prefix-hash' in self.argDB: +- newdir = 'PETSC_DIR='+os.path.abspath(os.path.expanduser(self.argDB['prefix']))+' '+'PETSC_ARCH= MPICC=${PCC} ' ++ newdir = 'MPICC=${PCC} ' + else: + newdir = 'MPICC=${PCC} ' +