tFix dependencies, download external - petsc-git-PKGBUILD - build template for non-complex PETSC with petsc4py
 (HTM) git clone git://src.adamsgaard.dk/petsc-git-PKGBUILD
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) commit 4df4a1efe749f56b84f6e08107c7ac8dd43c827c
 (DIR) parent acf8ee6afcc1b738e1337c2901eeb948346c64d6
 (HTM) Author: Lucas Heitzmann Gabrielli <heitzmann@gmail.com>
       Date:   Thu, 21 May 2020 09:12:04 -0300
       
       Fix dependencies, download external
       
       Diffstat:
         M .SRCINFO                            |      34 +++++++++----------------------
         M PKGBUILD                            |     118 ++++++++++++++++++-------------
         D test_optdepends.sh                  |     139 ------------------------------
       
       3 files changed, 80 insertions(+), 211 deletions(-)
       ---
 (DIR) diff --git a/.SRCINFO b/.SRCINFO
       t@@ -1,6 +1,6 @@
        pkgbase = petsc-git
       -        pkgdesc = Portable, extensible toolkit for scientific computation with MUMPS, Hypre, FFTW, HDF5, Scalapack, Suitesparse, Metis, Scotch, Superlu, OpenBLAS, Eigen, OpenMP, HWloc, CGNS, PNG, MED and trilinos
       -        pkgver = 20200512
       +        pkgdesc = Portable, extensible toolkit for scientific computation (external downloads enabled)
       +        pkgver = 20200520
                pkgrel = 1
                url = https://www.mcs.anl.gov/petsc/
                install = petsc.install
       t@@ -11,37 +11,23 @@ pkgbase = petsc-git
                makedepends = gcc-fortran
                makedepends = cmake
                makedepends = sowing
       -        depends = python2
       +        makedepends = python2
                depends = openmpi
       -        depends = boost
                depends = lapack
                depends = fftw
                depends = hdf5
       -        optdepends = hdf5: large files
       -        optdepends = fftw: Fast-Fourier Transform
       -        optdepends = openblas: Linear algebra libraries
       -        optdepends = scalapack: Parallel memory linear algebra
       -        optdepends = mumps: Sparse solver library
       -        optdepends = hypre: Large and sparse linear with massive parallel computing
       -        optdepends = suitesparse: Sparse matrix library
       -        optdepends = metis: Partitioning library (for meshes)
       -        optdepends = scotch: Partitioning with sparse matrices
       -        optdepends = superlu: Subroutines for sparsse linear systems
       -        optdepends = eigen: Lightweight C++ template library for vector and matrix math
       -        optdepends = openmp: Parallel distributed tasks
       -        optdepends = hwloc: Portable Hardware Locality (abstraction of hierarchical architectures)
       -        optdepends = cgns: Recording and recovering computer data
       -        optdepends = png
       -        optdepends = med>=4.0: Data Modelization and Exchanges (meshes)
       -        optdepends = boost: Free peer-reviewed portable C++ source libraries
       -        optdepends = yaml: configuration files
       +        depends = suitesparse
                optdepends = opencl: GPU computing
       +        optdepends = hwloc: hardware locality
       +        optdepends = cgns: CFD data support
       +        optdepends = libpng: PNG support
       +        optdepends = libyaml: YAML configuration support
       +        optdepends = libx11: GUI tools
       +        optdepends = python: Tools, examples, tutorials
                provides = petsc
                conflicts = petsc
                source = petsc::git+https://gitlab.com/petsc/petsc.git#branch=maint
       -        source = test_optdepends.sh
                sha256sums = SKIP
       -        sha256sums = 2c21313b21b7a76ed4d39d040ef60462f8760ae3d4b76ff6aa717ebc43a2275b
        
        pkgname = petsc-git
        
 (DIR) diff --git a/PKGBUILD b/PKGBUILD
       t@@ -1,44 +1,27 @@
       -# Based on AUR petsc and petsc-git package. Adapted to my
       -# MOOSE requirements
       -
        # Maintainer: Lucas H. Gabrielli <heitzmann@gmail.com>
        
        pkgname=petsc-git
       -pkgver=20200512
       +pkgver=20200520
        pkgrel=1
        _config=linux-c-opt
       -pkgdesc="Portable, extensible toolkit for scientific computation with MUMPS, Hypre, FFTW, HDF5, Scalapack, Suitesparse, Metis, Scotch, Superlu, OpenBLAS, Eigen, OpenMP, HWloc, CGNS, PNG, MED and trilinos"
       +pkgdesc="Portable, extensible toolkit for scientific computation (external downloads enabled)"
        provides=(petsc)
        conflicts=(petsc)
        arch=('i686' 'x86_64')
        url="https://www.mcs.anl.gov/petsc/"
        license=('BSD')
       -depends=('python2' 'openmpi' 'boost' 'lapack' 'fftw' 'hdf5')
       -makedepends=('gcc' 'gcc-fortran' 'cmake' 'sowing')
       -optdepends=("hdf5: large files"
       -            "fftw: Fast-Fourier Transform"
       -            "openblas: Linear algebra libraries"
       -            "scalapack: Parallel memory linear algebra"
       -            "mumps: Sparse solver library"
       -            "hypre: Large and sparse linear with massive parallel computing"
       -            "suitesparse: Sparse matrix library"
       -            "metis: Partitioning library (for meshes)"
       -            "scotch: Partitioning with sparse matrices"
       -            "superlu: Subroutines for sparsse linear systems"
       -            "eigen: Lightweight C++ template library for vector and matrix math"
       -            "openmp: Parallel distributed tasks"
       -            "hwloc: Portable Hardware Locality (abstraction of hierarchical architectures)"
       -            "cgns: Recording and recovering computer data"
       -            "png"
       -            "med>=4.0: Data Modelization and Exchanges (meshes)"
       -            "boost: Free peer-reviewed portable C++ source libraries"
       -            "yaml: configuration files"
       -            "opencl: GPU computing")
       +depends=('openmpi' 'lapack' 'fftw' 'hdf5' 'suitesparse')
       +makedepends=('gcc' 'gcc-fortran' 'cmake' 'sowing' 'python2')
       +optdepends=("opencl: GPU computing"
       +            "hwloc: hardware locality"
       +            "cgns: CFD data support"
       +            "libpng: PNG support"
       +            "libyaml: YAML configuration support"
       +            "libx11: GUI tools"
       +            "python: Tools, examples, tutorials")
        install=petsc.install
       -source=(petsc::git+https://gitlab.com/petsc/petsc.git#branch=maint
       -        test_optdepends.sh)
       -sha256sums=('SKIP'
       -            '2c21313b21b7a76ed4d39d040ef60462f8760ae3d4b76ff6aa717ebc43a2275b')
       +source=(petsc::git+https://gitlab.com/petsc/petsc.git#branch=maint)
       +sha256sums=('SKIP')
        
        _petsc_arch="arch-${_config}"
        
       t@@ -60,16 +43,16 @@ _petsc_arch="arch-${_config}"
        generic_flags="-fPIC -fopenmp -O3 -march=x86-64 -mtune=generic"
        # generic_flags="-fPIC -fopenmp -O3 -march=amdfam10 -mtune=generic"
        
       -export   COPTFLAGS=-O3
       +export COPTFLAGS=-O3
        export CXXOPTFLAGS=-O3
       -export   FOPTFLAGS=-O3
       -export    CPPFLAGS="$generic_flags -O2 -D-FORTIFY-SOURCE=2"
       -export      CFLAGS="$generic_flags"
       -export    CXXFLAGS="$generic_flags"
       -export      FFLAGS="$generic_flags"
       -export     FCFLAGS="$generic_flags"
       -export    F90FLAGS="$generic_flags"
       -export    F77FLAGS="$generic_flags"
       +export FOPTFLAGS=-O3
       +export CPPFLAGS="$generic_flags -O2 -D-FORTIFY-SOURCE=2"
       +export CFLAGS="$generic_flags"
       +export CXXFLAGS="$generic_flags"
       +export FFLAGS="$generic_flags"
       +export FCFLAGS="$generic_flags"
       +export F90FLAGS="$generic_flags"
       +export F77FLAGS="$generic_flags"
        
        
        pkgver() {
       t@@ -86,9 +69,7 @@ prepare() {
          done < <( find ${srcdir} -name "*" -type f -exec grep -le "$MATCH" \{\} + )
        
          cd "${srcdir}/petsc"
       -  # patch -p1 < ../patch.diff
          sed -i 's-\(self.publicInstall[^=]*=[[:space:]]\)[^#]*-\10 -g' config/BuildSystem/config/package.py
       -
          sed -i "s/\(raise RuntimeError('--download-openblas libraries cannot be used')\)/#\1/" config/BuildSystem/config/packages/BlasLapack.py
        }
        
       t@@ -96,11 +77,11 @@ prepare() {
        build() {
          cd petsc
        
       -  declare -a CONFOPTS
          # Run python2 ./configure --help for the meaning of this
       +  declare -a CONFOPTS
          CONFOPTS=(
            --COPTFLAGS="$COPTFLAGS"
       -    --CXXOPTFLAGS="CXXOPTFLAGS"
       +    --CXXOPTFLAGS="$CXXOPTFLAGS"
            --CPPFLAGS="$CPPFLAGS"
            --CFLAGS="$CFLAGS"
            --CXXFLAGS="$CXXFLAGS"
       t@@ -115,18 +96,59 @@ build() {
            --with-shared-libraries=1
            --with-zlib=1
        
       +    --with-fftw=1
       +    --with-hdf5=1
       +    --with-suitesparse=1
       +
            --with-scalar-type=complex
       -    # Add this to test_optdepends.sh
       -    --with-opencl=1
       -    --with-yaml=1
       +
       +    --download-amd=1
       +    --download-eigen=1
       +    --download-hypre=1
       +    --download-metis=1
       +    --download-mumps=1
       +    --download-parmetis=1
       +    #--download-party=1  # not working
       +    --download-ptscotch=1
       +    --download-scalapack=1
       +    #--download-suitesparse=1  # not working
       +    #--download-sundials=1  # incompatible with complex
       +    --download-superlu=1
       +    --download-superlu_dist=1
          )
        
       +  CONFOPTS=( "${CONFOPTS[@]}" )
       +
       +  # Add OpenCL support
       +  OPENCL_DIR="/usr/include/CL/"
       +  if [ -f "${OPENCL_DIR}/cl.h" ]; then
       +    CONFOPTS="${CONFOPTS} --with-opencl=1"
       +  fi
       +
       +  # Add hwloc support
       +  if [ -f "/usr/lib/libhwloc.so" ]; then
       +    CONFOPTS="${CONFOPTS} --with-hwloc=1 --with-hwloc-pkg-config=/usr/lib/pkgconfig/"
       +  fi
       +
       +  # Add CGNS support
       +  if [ -f "/usr/lib/libcgns.so" ]; then
       +    CONFOPTS="${CONFOPTS} --with-cgns=1"
       +  fi
       +
       +  # Add PNG support
       +  if [ -f "/usr/lib/libpng.so" ]; then
       +    CONFOPTS="${CONFOPTS} --with-png=1 --with-png-pkg-config=/usr/lib/pkgconfig/"
       +  fi
       +
       +  # Add YAML support
       +  if [ -f "/usr/lib/libyaml.so" ]; then
       +    CONFOPTS="${CONFOPTS} --with-yaml=1 --with-yaml-pkg-config=/usr/lib/pkgconfig/"
       +  fi
       +
          # if --with-debugging=1 is set then PETSC_ARCH is automatically set to
          # "linux-c-debug" for some things, so _config should be changed to "linux-c-debug"
          #CONFOPTS="${CONFOPTS} --with-debugging=1"
        
       -  CONFOPTS=( "${CONFOPTS[@]}" $(sh "${srcdir}"/test_optdepends.sh) )
       -
          dirpkg=${srcdir}/petsc/${_petsc_arch}/externalpackages/
        
          export PETSC_DIR="${srcdir}/petsc"
 (DIR) diff --git a/test_optdepends.sh b/test_optdepends.sh
       t@@ -1,139 +0,0 @@
       -#!/bin/bash
       -
       -# 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="${CONFOPTS} --download-${external_pkg}=1"
       -# done
       -
       -# Add hypre support
       -if [ -f "/usr/lib/libHYPRE.so" ]; then
       -        CONFOPTS="${CONFOPTS} --with-hypre=1"
       -fi
       -
       -# Add mumps support
       -if [ -f "/usr/lib/libmumps_common.so" ]; then
       -        CONFOPTS="${CONFOPTS} --with-mumps=1"
       -fi
       -
       -# Add fftw support
       -if [ -f "/usr/lib/libfftw3_mpi.so" ]; then
       -        CONFOPTS="${CONFOPTS} --with-fftw=1"
       -fi
       -
       -# Add hdf5 support
       -if [[ "$(h5stat -V)" ]]; then
       -        CONFOPTS="${CONFOPTS} --with-hdf5=1"
       -fi
       -
       -# Add scalapack support
       -if [ -f "/usr/lib/pkgconfig/scalapack.pc" ]; then
       -        CONFOPTS="${CONFOPTS} --with-scalapack=1"
       -fi
       -
       -# Add suitesparse support
       -if [ -f "/usr/include/SuiteSparse_config.h" ]; then
       -        CONFOPTS="${CONFOPTS} --with-suitesparse=1"
       -fi
       -
       -# Add metis support
       -if [ -f "/usr/include/metis.h" ]; then
       -        CONFOPTS="${CONFOPTS} --with-metis=1"
       -        # Add parmetis support
       -        if [ -f "/usr/include/parmetis.h" ]; then
       -                CONFOPTS="${CONFOPTS} --with-parmetis=1"
       -        fi
       -fi
       -
       -# Add scotch support
       -SCOTCH_DIR="/usr/include/scotch"
       -if [ -d "${SCOTCH_DIR}" ]; then
       -        SCOTCH_LIBS="libesmumps.so,libptscotch.so,libptscotcherr.so,libscotch.so,libscotcherr.so"
       -        # Include bzip2 if scotch was build with bzip2 support
       -        if [ -f /usr/include/bzlib.h ];then
       -                SCOTCH_LIBS="${SCOTCH_LIBS},libbz2.so"
       -        fi
       -        SCOTCH_LIBS="[${SCOTCH_LIBS}]"
       -        CONFOPTS="${CONFOPTS} --with-ptscotch=1 --with-ptscotch-lib=${SCOTCH_LIBS} --with-ptscotch-include=${SCOTCH_DIR}"
       -fi
       -
       -# Add superlu support
       -SUPERLU_DIR="/usr/include/superlu"
       -if [ -d "${SUPERLU_DIR}" ]; then
       -        CONFOPTS="${CONFOPTS} --with-superlu=1 --with-superlu-lib=-lsuperlu --with-superlu-include=${SUPERLU_DIR}"
       -fi
       -
       -# Incompatible with complex
       -# # Add sundials support
       -# SUNDIALS_DIR="/usr/include/sundials/"
       -# if [ -d "${SUNDIALS_DIR}" ]; then
       -#         CONFOPTS="${CONFOPTS} --with-sundials=1 --with-sundials-include=${SUNDIALS_DIR}"
       -# fi
       -
       -# Add openblas support
       -if [ -f "/usr/lib/libblas.so" ]; then
       -        CONFOPTS="${CONFOPTS} --with-openblas=1"
       -fi
       -
       -# Add OpenCL support
       -OPENCL_DIR="/usr/include/CL/"
       -if [ -f "${OPENCL_DIR}/cl.h" ]; then
       -        CONFOPTS="${CONFOPTS} --with-opencl=1"
       -else
       -        CONFOPTS="${CONFOPTS} --with-opencl=0"
       -fi
       -
       -# Add eigen support
       -EIGEN_DIR="/usr/include/eigen3"
       -if [ -d "${EIGEN_DIR}" ]; then
       -        CONFOPTS="${CONFOPTS} --with-eigen=1 --with-eigen-include=${EIGEN_DIR}"
       -fi
       -
       -# Add OpenMP support
       -if [ -f "/usr/lib/libomp.so" ]; then
       -        CONFOPTS="${CONFOPTS} --with-openmp=1"
       -fi
       -
       -# Add hwloc support
       -if [ -f "/usr/lib/libhwloc.so" ]; then
       -        CONFOPTS="${CONFOPTS} --with-hwloc=1 --with-hwloc-pkg-config=/usr/lib/pkgconfig/"
       -fi
       -
       -# Add CGNS support
       -if [ -f "/usr/lib/libcgns.so" ]; then
       -        CONFOPTS="${CONFOPTS} --with-cgns=1"
       -fi
       -
       -# Add PNG support
       -if [ -f "/usr/lib/libpng.so" ]; then
       -        CONFOPTS="${CONFOPTS} --with-png=1 --with-png-pkg-config=/usr/lib/pkgconfig/"
       -fi
       -
       -# Add MED support
       -if [ -f "/usr/lib/libmed.so" ]; then
       -        CONFOPTS="${CONFOPTS} --with-med=1"
       -fi
       -
       -# # Add pastix support
       -# PASTIX_CONF=$(which pastix-conf)
       -# if [ -f "${PASTIX_CONF}" ]; then
       -#         PASTIX_DIR="$($PASTIX_CONF --incs | sed 's/-I//')"
       -#         if [ ! -d ${PASTIX_DIR} ]; then
       -#                 PASTIX_DIR="[]"
       -#         fi
       -#         #PASTIX_LIBS="$($PASTIX_CONF --libs)"
       -#         PASTIX_LIBS="[libpastix.a,librt.so,libhwloc.so,libpthread.a]"
       -#         CONFOPTS="${CONFOPTS} --with-pastix=1 --with-pastix-lib=${PASTIX_LIBS} --with-pastix-include=${PASTIX_DIR}"
       -# fi
       -
       -# Add trilinos support
       -if [ "${TRILINOS_DIR}" ]; then
       -        CONFOPTS="${CONFOPTS} --with-ml-dir=${TRILINOS_DIR}"
       -        # Add boost support (may be useful for trilinos)
       -        CONFOPTS="${CONFOPTS} --with-boost=1"
       -fi
       -
       -echo "${CONFOPTS}"