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 3923f5328d1e9c3782719b8b5de2b301dbe9d2c9
parent be7082fe0cede6fb19cb5079e156144a7c3954ce
Author: eDgar <eDgar_|at|_openmail.cc>
Date:   Thu, 23 Sep 2021 10:01:48 -0500

fix LAPACK_SO typo, use sh (POSIX) syntax--(thanks Anders Damsgaard); functions to find .so and .pc

Diffstat:
M.SRCINFO | 2+-
MPKGBUILD | 2+-
Mtest_optdepends.sh | 247+++++++++++++++++++++++++++++++++++++++++--------------------------------------
3 files changed, 131 insertions(+), 120 deletions(-)

diff --git a/.SRCINFO b/.SRCINFO @@ -30,7 +30,7 @@ pkgbase = petsc-git source = test_optdepends.sh sha512sums = SKIP sha512sums = b6a1d48aab1c2639a4c1cbd8b313ace253f1c36eedaa3de3508ffbd6060e1def99e2f516ed9bb509307f614b41791d09342e2c2280c0b2c25dda1092b0e569d2 - sha512sums = 1ca6bd5ea78af63d29fc70c3a4e6ac34abddd8d8cf3a08b4b2767823443f0447156fc5a2359e38e7f62d95dd548e5de11d61e1e3a223cc7f83e6438706029dea + sha512sums = 26145ebce4c3c2a418488e1412579ea56744e9da07f0f6ebc9e457a14ca8679d207135b36a351e5e49efa5083ea6506516f6bfb2aef978d3986fcde7ebe8d4c0 pkgname = petsc-git optdepends = boost: Free peer-reviewed portable C++ source libraries diff --git a/PKGBUILD b/PKGBUILD @@ -22,7 +22,7 @@ source=(git+${url}.git#branch=release test_optdepends.sh) sha512sums=('SKIP' 'b6a1d48aab1c2639a4c1cbd8b313ace253f1c36eedaa3de3508ffbd6060e1def99e2f516ed9bb509307f614b41791d09342e2c2280c0b2c25dda1092b0e569d2' - '1ca6bd5ea78af63d29fc70c3a4e6ac34abddd8d8cf3a08b4b2767823443f0447156fc5a2359e38e7f62d95dd548e5de11d61e1e3a223cc7f83e6438706029dea') + '26145ebce4c3c2a418488e1412579ea56744e9da07f0f6ebc9e457a14ca8679d207135b36a351e5e49efa5083ea6506516f6bfb2aef978d3986fcde7ebe8d4c0') _config=linux-c-opt _install_dir="/usr" diff --git a/test_optdepends.sh b/test_optdepends.sh @@ -1,143 +1,147 @@ -#!/bin/bash +#!/bin/sh # Test if external packages for PETSC are installed -# CONFOPTS="" - -# # External downloads -# for external_pkg in hypre fblaslapack metis parmetis superlu_dist mumps scalapack; do -# CONFOPTS+=" --download-${external_pkg}=1" -# done - -type mpicc >/dev/null && CONFOPTS+=" --with-cc=mpicc" -type mpicxx >/dev/null && CONFOPTS+=" --with-cxx=mpicxx" -type mpifort >/dev/null && CONFOPTS+=" --with-fc=mpifort" +# Find a shared object (library; .so extension) +# example: find_so libboost_mpi +find_so () { + whereis -b "$1" | cut -d' ' -f2 +} + +# Find directory where a pkg-config file is +# example: find_pc glut +find_pc () { + $(dirname "$(pkgconf --path "$1")") +} + +type mpicc >/dev/null && \ + CONFOPTS="${CONFOPTS} --with-cc=mpicc" +type mpicxx >/dev/null && \ + CONFOPTS="${CONFOPTS} --with-cxx=mpicxx" +type mpifort >/dev/null && \ + CONFOPTS="${CONFOPTS} --with-fc=mpifort" # BOOST: Free peer-reviewed portable C++ source libraries -if [ -f "$(whereis -b libboost_mpi.so | cut -d' ' -f2)" ]; then - CONFOPTS+=" --with-boost=1" +if [ -f "$(find_so libboost_mpi.so)" ]; then + CONFOPTS="${CONFOPTS} --with-boost=1" fi; # CGNS: Recording and recovering computer data -if [ -f "$(whereis -b libcgns.so | cut -d' ' -f2)" ]; then - CONFOPTS+=" --with-cgns=1" +if [ -f "$(find_so libcgns.so)" ]; then + CONFOPTS="${CONFOPTS} --with-cgns=1" fi -# eigen: Lightweight C++ template library for vector and matrix math +# eigen: Lightweight C++ template library for vector and +# matrix math EIGEN_DIR="$(pkgconf --cflags-only-I eigen3)" EIGEN_DIR="${EIGEN_DIR##-I}" if [ -d "${EIGEN_DIR}" ]; then - CONFOPTS+=" --with-eigen=1 --with-eigen-include=${EIGEN_DIR}" + CONFOPTS="${CONFOPTS} --with-eigen=1" + CONFOPTS="${CONFOPTS} --with-eigen-include=${EIGEN_DIR}" fi # fftw: Fast-Fourier Transform -if [ -f "$(whereis -b libfftw3_mpi.so | cut -d' ' -f2)" ]; then - CONFOPTS+=" --with-fftw=1" +if [ -f "$(find_so libfftw3_mpi.so)" ]; then + CONFOPTS="${CONFOPTS} --with-fftw=1" fi # GDB: GNU debugger -if [ -f "$(whereis -b gdb | cut -d' ' -f2)" ]; then - CONFOPTS+=" --with-debugger=gdb" +if [ -f "$(find_so gdb)" ]; then + CONFOPTS="${CONFOPTS} --with-debugger=gdb" fi # # GLUT (requires OpenGL) -# if [ -f "$(whereis -b libglut.so | cut -d' ' -f2)" ]; then -# CONFOPTS+=" --with-glut=1" -# CONFOPTS+=" --with-glut-pkg-config=" -# CONFOPTS+="$(dirname $(pkgconf --path glut))" +# if [ -f "$(find_so libglut.so)" ]; then +# CONFOPTS="${CONFOPTS} --with-glut=1" +# CONFOPTS="${CONFOPTS} --with-glut-pkg-config=" +# CONFOPTS="${CONFOPTS} $(find_pc glut)" # fi # HDF5: large files if [[ "$(h5stat -V)" ]]; then - CONFOPTS+=" --with-hdf5=1" + CONFOPTS="${CONFOPTS} --with-hdf5=1" fi # hwloc: abstraction of hierarchical architectures -if [ -f "$(whereis -b libhwloc.so | cut -d' ' -f2)" ]; then - CONFOPTS+=" --with-hwloc=1" - CONFOPTS+=" --with-hwloc-pkg-config=" - CONFOPTS+="$(dirname $(pkgconf --path hwloc))" +if [ -f "$(find_so libhwloc.so)" ]; then + CONFOPTS="${CONFOPTS} --with-hwloc=1" + CONFOPTS="${CONFOPTS} --with-hwloc-pkg-config=" + CONFOPTS="${CONFOPTS} $(find_pc hwloc)" fi -# Hypre: Large and sparse linear with massive parallel computing -if [ -f "$(whereis -b libHYPRE.so | cut -d' ' -f2)" ]; then - CONFOPTS+=" --with-hypre=1" - CONFOPTS+=" --with-hypre-lib=[/usr/lib/libHYPRE.so]" - CONFOPTS+=" --with-hypre-include=/usr/include" +# Hypre: Large and sparse linear with massive parallel +# computing +HYPRE_SO="$(find_so libHYPRE.so)" +if [ -f "${HYPRE_SO}" ]; then + CONFOPTS="${CONFOPTS} --with-hypre=1" + CONFOPTS="${CONFOPTS} --with-hypre-lib=${HYPRE_SO}" + CONFOPTS="${CONFOPTS} --with-hypre-include=/usr/include" fi # MED: Data Modelization and Exchanges (meshes) -if [ -f "$(whereis -b libmed.so | cut -d' ' -f2)" ]; then - CONFOPTS+=" --with-med=1" +if [ -f "$(find_so libmed.so)" ]; then + CONFOPTS="${CONFOPTS} --with-med=1" fi # METIS: Automatic meshing partitioning -if [ -f "$(whereis -b libmetis.so | cut -d' ' -f2)" ]; then - CONFOPTS+=" --with-metis=1" +if [ -f "$(find_so libmetis.so)" ]; then + CONFOPTS="${CONFOPTS} --with-metis=1" # parmetis support if [ -f "/usr/include/parmetis.h" ]; then - CONFOPTS+=" --with-parmetis=1" + CONFOPTS="${CONFOPTS} --with-parmetis=1" fi fi # # MPI4Py # if [ -n "$(pacman -Qsq mpi4py)" ]; then # mpi4py_inc="$(pacman -Ql python-mpi4py | awk '/mpi4py.h$/{print $NF}')" -# CONFOPTS+=" --with-mpi4py=1" -# CONFOPTS+=" --with-mpi4py-include=" -# CONFOPTS+="$(dirname $mpi4py_inc)" -# CONFOPTS+=" --with-mpi4py-lib=" -# CONFOPTS+="$(pacman -Ql python-mpi4py | awk '/.*\.so$/{print $NF}' | tr ' \n' ',')" +# CONFOPTS="${CONFOPTS} --with-mpi4py=1" +# CONFOPTS="${CONFOPTS} --with-mpi4py-include=" +# CONFOPTS="${CONFOPTS} $(dirname "${mpi4py_inc}")" +# CONFOPTS="${CONFOPTS} --with-mpi4py-lib=" +# CONFOPTS="${CONFOPTS} $(pacman -Ql python-mpi4py | awk '/.*\.so$/{print $NF}' | tr ' \n' ',')" # fi # MUMPS: Sparse solver library -if [ -f "$(whereis -b libmumps_common.so | cut -d' ' -f2)" ]; then - CONFOPTS+=" --with-mumps=1" - # MUMPS_LIBS="[/usr/lib/libcmumps.so," - # MUMPS_LIBS+="/usr/lib/libdmumps.so," - # MUMPS_LIBS+="/usr/lib/libsmumps.so," - # MUMPS_LIBS+="/usr/lib/libzmumps.so," - # MUMPS_LIBS+="/usr/lib/libmumps_common.so," - # MUMPS_LIBS+="/usr/lib/libpord.so]" - # CONFOPTS+=" --with-mumps-lib=${MUMPS_LIBS}" - # CONFOPTS+=" --with-mumps-include=/usr/include" - # CONFOPTS+=" --with-mumps-dir=/usr/" +if [ -f "$(find_so libmumps_common.so)" ]; then + CONFOPTS="${CONFOPTS} --with-mumps=1" fi # NetCDF -if [ -f "$(whereis -b libnetcdf.so | cut -d' ' -f2)" ]; then - CONFOPTS+=" --with-netcdf=1" - CONFOPTS+=" --with-netcdf-pkg-config=" - CONFOPTS+="$(dirname $(pkgconf --path netcdf))" +if [ -f "$(find_so libnetcdf.so)" ]; then + CONFOPTS="${CONFOPTS} --with-netcdf=1" + CONFOPTS="${CONFOPTS} --with-netcdf-pkg-config=" + CONFOPTS="${CONFOPTS} $(find_pc netcdf)" fi # PNG -if [ -f "$(whereis -b libpng.so | cut -d' ' -f2)" ]; then - CONFOPTS+=" --with-png=1" - CONFOPTS+=" --with-png-pkg-config=" - CONFOPTS+="$(dirname $(pkgconf --path libpng))" +if [ -f "$(find_so libpng.so)" ]; then + CONFOPTS="${CONFOPTS} --with-png=1" + CONFOPTS="${CONFOPTS} --with-png-pkg-config=" + CONFOPTS="${CONFOPTS} $(find_pc libpng)" fi # PNetCDF -if [ -f "$(whereis -b libpnetcdf.so | cut -d' ' -f2)" ]; then - CONFOPTS+=" --with-pnetcdf=1" - CONFOPTS+=" --with-pnetcdf-pkg-config=" - CONFOPTS+="$(dirname $(pkgconf --path pnetcdf))" +if [ -f "$(find_so libpnetcdf.so)" ]; then + CONFOPTS="${CONFOPTS} --with-pnetcdf=1" + CONFOPTS="${CONFOPTS} --with-pnetcdf-pkg-config=" + CONFOPTS="${CONFOPTS} $(find_pc pnetcdf)" fi # OpenBLAS: Linear algebra libraries -BLAS_SO="$(whereis -b libblas.so | cut -d' ' -f2)" -OPENBLAS_SO="$(whereis -b libopenblas.so | cut -d' ' -f2)" -LAPACK_SO="$(whereis -b liblapack.so | cut -d' ' -f2)" +BLAS_SO="$(find_so libblas.so)" +OPENBLAS_SO="$(find_so libopenblas.so)" +LAPACK_SO="$(find_so liblapack.so)" if [ -f "${BLAS_SO}" && \-f "${OPENBLAS_SO}" && \ - -f "${LAPACK_SO}"]; then - CONFOPTS+=" --with-openblas=1" - CONFOPTS+=" --with-openblas-lib=${OPENBLAS_SO}" - CONFOPTS+=" --with-openblas-include=/usr/include" + -f "${LAPACK_SO}" ]; then + OPENBLAS_INC="$(pkgconf -keep-system-cflags -cflags openblas)" + CONFOPTS="${CONFOPTS} --with-openblas=1" + CONFOPTS="${CONFOPTS} --with-openblas-lib=${OPENBLAS_SO}" + CONFOPTS="${CONFOPTS} --with-openblas-include=${OPENBLAS_INC}" # With help from Satish Balay # @ 3.15.4.33.g0bac13e0fe9 2021-09-21 # nm -AoD /usr/lib64/libopenblas.so | grep dgetrs_ - CONFOPTS+=" --with-blaslapack-lib=${LAPACK_SO},${BLAS_SO}" + CONFOPTS="${CONFOPTS} --with-blaslapack-lib=${LAPACK_SO},${BLAS_SO}" fi # OpenCL: GPU computing @@ -145,9 +149,9 @@ fi # (from opencl-headers package; how to do this in a consistent way?) OPENCL_INC="/usr/include/CL/cl.h" # Check library (find libOpenCL.so) -OPENCL_SO="$(whereis -b libOpenCL.so | cut -d' ' -f2)" +OPENCL_SO="$(find_so libOpenCL.so)" if [ -f "${OPENCL_SO}" ] && [ -f "${OPENCL_INC}" ]; then - CONFOPTS+=" --with-opencl=1" + CONFOPTS="${CONFOPTS} --with-opencl=1" fi # # OpenGL (mesa) @@ -160,37 +164,37 @@ fi # # # # OPENGL_opengl_LIBRARY: /lib64/libOpenGL.so # # OPENGL_glx_LIBRARY: /lib64/libGLX.so -# OPENGLIB="$(whereis -b libOpenGL.so | cut -d' ' -f2)" +# OPENGLIB="$(find_so libOpenGL.so)" # if [ -f "${OPENGLIB}" ]; then -# # OPENGLIB+=",$(whereis -b libGL | cut -d' ' -f2)," -# # OPENGLIB+=",$(whereis -b libGLX | cut -d' ' -f2)" -# # OPENGLIB+=",$(whereis -b libGLX | cut -d' ' -f2)" +# # OPENGLIB+=",$(find_so libGL)," +# # OPENGLIB+=",$(find_so libGLX)" +# # OPENGLIB+=",$(find_so libGLX)" # # # OPENGLIB+="$(pacman -Ql mesa | awk '/\.so$/{print $NF}' | tr ' \n' ',')" -# # CONFOPTS+=" --with-opengl=1" -# # CONFOPTS+=" --with-opengl-lib=[${OPENGLIB}]" -# # CONFOPTS+=" --with-opengl-include=[/usr/include/GL/glew.h]" -# CONFOPTS+=" --with-opengl=1" -# CONFOPTS+=" --with-opengl-pkg-config=" -# CONFOPTS+="$(dirname $(pkgconf --path opengl))" -# # CONFOPTS+="$(pacman -Ql mesa | awk '/\/include\/[^/]*\/$/{print $NF}' | tr ' \n' ',')]" +# # CONFOPTS="${CONFOPTS} --with-opengl=1" +# # CONFOPTS="${CONFOPTS} --with-opengl-lib=[${OPENGLIB}]" +# # CONFOPTS="${CONFOPTS} --with-opengl-include=[/usr/include/GL/glew.h]" +# CONFOPTS="${CONFOPTS} --with-opengl=1" +# CONFOPTS="${CONFOPTS} --with-opengl-pkg-config=" +# CONFOPTS="${CONFOPTS} $(dirname $(pkgconf --path opengl))" +# # CONFOPTS="${CONFOPTS} $(pacman -Ql mesa | awk '/\/include\/[^/]*\/$/{print $NF}' | tr ' \n' ',')]" # fi # OpenMP: 64 bits blas and lapack, multi-threaded -if [ -f "$(whereis -b libomp.so | cut -d' ' -f2)" ]; then - CONFOPTS+=" --with-openmp=1" +if [ -f "$(find_so libomp.so)" ]; then + CONFOPTS="${CONFOPTS} --with-openmp=1" fi # # OpenMPI (dependency; should be found by pacman) # MPILIBDIR=$(dirname "$(pacman -Qlq openmpi | grep 'libmpi.so$')") # MPIINC="$(pacman -Qlq openmpi | grep 'mpi.h$')" # if [ -d "${MPILIBDIR}" ]; then -# CONFOPTS+=" --with-mpi=1" -# CONFOPTS+=" --with-mpi-dir=/usr/" +# CONFOPTS="${CONFOPTS} --with-mpi=1" +# CONFOPTS="${CONFOPTS} --with-mpi-dir=/usr/" # fi # Scalapack: Parallel memory linear algebra -if [ -f "$(whereis -b libscalapack.so | cut -d' ' -f2)" ]; then - CONFOPTS+=" --with-scalapack=1" +if [ -f "$(find_so libscalapack.so)" ]; then + CONFOPTS="${CONFOPTS} --with-scalapack=1" fi # Scotch: Partitioning with sparse matrices @@ -198,70 +202,75 @@ fi SCOTCH_DIR="/usr/include/scotch" if [ -d "${SCOTCH_DIR}" ]; then # SCOTCH_LIBS="$(ldconfig -p | awk '/scotch/{printf("'"${SCOTCH_DIR}"'/%s,", $1)}')" - SCOTCH_LIBS="libesmumps.so,libptscotch.so,libptscotcherr.so,libscotch.so,libscotcherr.so" + SCOTCH_LIBS="libesmumps.so,libptscotch.so" + SCOTCH_LIBS="${SCOTCH_LIBS},libptscotcherr.so,libscotch.so" + SCOTCH_LIBS="${SCOTCH_LIBS},libscotcherr.so" # Include bzip2 if scotch was built with bzip2 support - if [ -f "$(whereis -b libbz2.so | cut -d' ' -f2)" ]; then - SCOTCH_LIBS+=",${SCOTCH_DIR}/libbz2.so" + if [ -f "$(find_so libbz2.so)" ]; then + SCOTCH_LIBS="${SCOTCH_LIBS},${SCOTCH_DIR}/libbz2.so" fi # Add [], remove trailing , SCOTCH_LIBS="[${SCOTCH_LIBS}]" - CONFOPTS+=" --with-ptscotch=1" - CONFOPTS+=" --with-ptscotch-lib=${SCOTCH_LIBS}" - CONFOPTS+=" --with-ptscotch-include=${SCOTCH_DIR}" + CONFOPTS="${CONFOPTS} --with-ptscotch=1" + CONFOPTS="${CONFOPTS} --with-ptscotch-lib=${SCOTCH_LIBS}" + CONFOPTS="${CONFOPTS} --with-ptscotch-include=${SCOTCH_DIR}" fi # SuiteSparse: Sparse matrix library -if [ -f "$(whereis -b libsuitesparseconfig.so | cut -d' ' -f2)" ]; then - CONFOPTS+=" --with-suitesparse=1" +if [ -f "$(find_so libsuitesparseconfig.so)" ]; then + CONFOPTS="${CONFOPTS} --with-suitesparse=1" fi # SuperLU: Subroutines for sparsse linear systems # TODO: programatic way SUPERLU_DIR="/usr/include/superlu" if [ -d "${SUPERLU_DIR}" ]; then - CONFOPTS+=" --with-superlu=1 --with-superlu-lib=-lsuperlu --with-superlu-include=${SUPERLU_DIR}" + CONFOPTS="${CONFOPTS} --with-superlu=1" + CONFOPTS="${CONFOPTS} --with-superlu-lib=-lsuperlu" + CONFOPTS="${CONFOPTS} --with-superlu-include=${SUPERLU_DIR}" fi # YAML: configuration files # Check library (find libyaml.so) -OPENCL_SO="$(whereis -b libyaml.so | cut -d' ' -f2)" +OPENCL_SO="$(find_so libyaml.so)" if [ -f "${OPENCL_SO}" ]; then - CONFOPTS+=" --with-yaml=1" + CONFOPTS="${CONFOPTS} --with-yaml=1" fi # X: to enable ksp_xmonitor -LIBX11="$(whereis -b libX11.so | cut -d' ' -f2)" +LIBX11="$(find_so libX11.so)" LIBX11_DIR="$(dirname ${LIBX11})" if [ -f "${LIBX11}" ]; then LIBX11_INC="--keep-system-cflags --cflags-only-I"; LIBX11_INC="$(pkgconf ${LIBX11_INC} x11)"; - CONFOPTS+=" --with-x-lib=[${LIBX11_DIR}/"; + CONFOPTS="${CONFOPTS} --with-x-lib=[${LIBX11_DIR}/"; # As per X11.pc, it seems that xcb.so is needed - CONFOPTS+="libX11-xcb.so,${LIBX11}]" - CONFOPTS+=" --with-x-include=${LIBX11_INC//-I/}" + CONFOPTS="${CONFOPTS}libX11-xcb.so,${LIBX11}]" + CONFOPTS="${CONFOPTS} --with-x-include=${LIBX11_INC//-I/}" fi # ZLIB -if [ -f "$(whereis -b libzlib.so | cut -d' ' -f2)" ]; then - CONFOPTS+=" --with-zlib=1" - CONFOPTS+=" --with-zlib-pkg-config=" - CONFOPTS+="$(dirname $(pkgconf --path zlib))" +if [ -f "$(find_so libzlib.so)" ]; then + CONFOPTS="${CONFOPTS} --with-zlib=1" + CONFOPTS="${CONFOPTS} --with-zlib-pkg-config=" + CONFOPTS="${CONFOPTS} $(find_pc zlib)" fi # # trilinos support # # if [ "${TRILINOS_DIR}" ]; then -# CONFOPTS+=" --with-ml-dir=${TRILINOS_DIR}" +# CONFOPTS="${CONFOPTS} --with-ml-dir=${TRILINOS_DIR}" # # boost support (may be useful for trilinos) -# CONFOPTS+=" --with-boost=1" +# CONFOPTS="${CONFOPTS} --with-boost=1" # fi # Incompatible with complex # # sundials support # SUNDIALS_DIR="/usr/include/sundials/" # if [ -d "${SUNDIALS_DIR}" ]; then -# CONFOPTS+=" --with-sundials=1 --with-sundials-include=${SUNDIALS_DIR}" +# CONFOPTS="${CONFOPTS} --with-sundials=1" +# CONFOPTS="${CONFOPTS} --with-sundials-include=${SUNDIALS_DIR}" # fi # # pastix support (non-free) @@ -273,7 +282,9 @@ fi # fi # #PASTIX_LIBS="$($PASTIX_CONF --libs)" # PASTIX_LIBS="[libpastix.a,librt.so,libhwloc.so,libpthread.a]" -# CONFOPTS+=" --with-pastix=1 --with-pastix-lib=${PASTIX_LIBS} --with-pastix-include=${PASTIX_DIR}" +# CONFOPTS="${CONFOPTS} --with-pastix=1" +# CONFOPTS="${CONFOPTS} --with-pastix-lib=${PASTIX_LIBS}" +# CONFOPTS="${CONFOPTS} --with-pastix-include=${PASTIX_DIR}" # fi echo "${CONFOPTS}"