tInitial commit - 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 d5b93df3eee209906e2a6ed1bc7cce1187af1ca9
 (HTM) Author: Lucas Heitzmann Gabrielli <heitzmann@gmail.com>
       Date:   Tue,  5 Feb 2019 12:41:18 -0200
       
       Initial commit
       
       Diffstat:
         A .SRCINFO                            |      27 +++++++++++++++++++++++++++
         A PKGBUILD                            |     119 +++++++++++++++++++++++++++++++
         A patch.diff                          |      13 +++++++++++++
         A petsc.install                       |       9 +++++++++
       
       4 files changed, 168 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/.SRCINFO b/.SRCINFO
       t@@ -0,0 +1,27 @@
       +pkgbase = petsc-git
       +        pkgdesc = Portable, extensible toolkit for scientific computation
       +        pkgver = 20190205
       +        pkgrel = 1
       +        url = https://www.mcs.anl.gov/petsc/
       +        install = petsc.install
       +        arch = i686
       +        arch = x86_64
       +        license = BSD
       +        makedepends = gcc
       +        makedepends = gcc-fortran
       +        makedepends = cmake
       +        depends = python2
       +        depends = openmpi
       +        depends = boost
       +        depends = lapack
       +        depends = fftw
       +        depends = hdf5
       +        provides = petsc
       +        conflicts = petsc
       +        source = petsc::git+https://bitbucket.org/petsc/petsc#branch=maint
       +        source = patch.diff
       +        sha256sums = SKIP
       +        sha256sums = fdf016437dd94f33316e734e35858476aeea1ca0f3ab4d0ee36029b016498de7
       +
       +pkgname = petsc-git
       +
 (DIR) diff --git a/PKGBUILD b/PKGBUILD
       t@@ -0,0 +1,119 @@
       +# Maintainer: Lucas H. Gabrielli <heitzmann at gmail dot com>
       +
       +pkgname=petsc-git
       +pkgver=20190205
       +pkgrel=1
       +_config=linux-c-opt
       +pkgdesc="Portable, extensible toolkit for scientific computation"
       +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')
       +install=petsc.install
       +source=(petsc::git+https://bitbucket.org/petsc/petsc#branch=maint
       +        patch.diff)
       +sha256sums=('SKIP'
       +            'fdf016437dd94f33316e734e35858476aeea1ca0f3ab4d0ee36029b016498de7')
       +
       +_petsc_arch="arch-${_config}"
       +
       +
       +pkgver() {
       +  cd petsc
       +  git log --format="%cd" --date=short -1 | sed 's/-//g'
       +}
       +
       +
       +prepare() {
       +  # force using python2
       +  MATCH='\(/usr/bin/env\|/usr/bin/\)python[[:digit:].]*'
       +  while IFS= read file; do
       +    sed -i "s#$MATCH#\\1python2#" "$file"
       +  done < <( find ${srcdir} -name "*" -type f -exec grep -le "$MATCH" \{\} + )
       +
       +  cd "${srcdir}/petsc"
       +  patch -p1 < ../patch.diff
       +}
       +
       +
       +build() {
       +  cd petsc
       +
       +  CONFOPTS='--with-shared-libraries=1 --COPTFLAGS=-O3 --CXXOPTFLAGS=-O3 --with-cxx-dialect=C++11 --with-mpi=1 --with-fftw=1 --with-hdf5=1 --with-zlib=1'
       +
       +  # 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"
       +
       +  for external_pkg in amd eigen hypre metis mumps parmetis party pastix ptscotch scalapack suitesparse sundials superlu superlu_dist
       +  do
       +    CONFOPTS="${CONFOPTS} --download-${external_pkg}=1"
       +  done
       +
       +  export PETSC_DIR="${srcdir}/petsc"
       +  export PETSC_ARCH="${_petsc_arch}"
       +
       +  python2 ./configure LDFLAGS="$LDFLAGS" --prefix=/opt/petsc/${_config} ${CONFOPTS}
       +
       +  make all
       +}
       +
       +
       +package() {
       +  cd petsc
       +
       +  _build_dir="${srcdir}/petsc"
       +  _install_dir=/opt/petsc/${_config}
       +
       +  export PETSC_DIR=${_build_dir}
       +  export PETSC_ARCH="${_petsc_arch}"
       +
       +  make DESTDIR="${pkgdir}" install
       +
       +  # documentation
       +  # Note: the hyperlinks between documentation, tutorials and examples are
       +  # not perfect yet
       +  #mkdir -p ${pkgdir}/usr/share/doc/petsc/
       +  #cp -r ${_build_dir}/docs ${pkgdir}/usr/share/doc/petsc/
       +
       +  # src for tutorials
       +  #find ./src -path '*examples*' -type f -exec \
       +  #  install -Dm 644 "{}" "${pkgdir}/usr/share/doc/petsc/{}" \;
       +
       +  # html versions of header files
       +  #mkdir -p ${pkgdir}/usr/share/doc/petsc/include
       +  #cp -r ${_build_dir}/include/*.html ${pkgdir}/usr/share/doc/petsc/include/
       +
       +  # install licence (even though there is no such word as licenses)
       +  install -Dm 644 ${_build_dir}/LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
       +
       +  mkdir -p "${pkgdir}/etc/profile.d"
       +  echo "export PETSC_DIR=${_install_dir}" > "${pkgdir}/etc/profile.d/petsc.sh"
       +  chmod +x "${pkgdir}/etc/profile.d/petsc.sh"
       +
       +  # show where the shared libraries are
       +  install -dm 755 "${pkgdir}/etc/ld.so.conf.d/"
       +  echo "${_install_dir}/lib" > "${pkgdir}/etc/ld.so.conf.d/petsc.conf"
       +
       +        sed -i "s#-L${_build_dir}/${_petsc_arch}/lib ##" "${pkgdir}${_install_dir}/lib/pkgconfig/PETSc.pc"
       +  sed -i \
       +    -e "s#prefix=.*#prefix=${_install_dir}#" \
       +    -e "s#libdir=.*#libdir=\${prefix}/lib#" \
       +    -e "s#includedir=.*#includedir=\${prefix}/include#" \
       +    "${pkgdir}${_install_dir}/lib/pkgconfig/superlu.pc"
       +  sed -i \
       +    -e "s#prefix=.*#prefix=${_install_dir}#" \
       +    -e "s#libdir=.*#libdir=\${prefix}/lib#" \
       +    -e "s#includedir=.*#includedir=\${prefix}/include#" \
       +    "${pkgdir}${_install_dir}/lib/pkgconfig/superlu_dist.pc"
       +  sed -i \
       +    -e "s#prefix=.*#prefix=${_install_dir};#" \
       +    -e "s#libdir=.*#libdir=\${prefix}/lib;#" \
       +    "${pkgdir}${_install_dir}/lib/petsc/bin/sundials-config"
       +
       +  # install pkgconfig settings
       +  #install -Dm 644 "${_build_dir}/${_petsc_arch}/lib/pkgconfig/PETSc.pc" "${pkgdir}/usr/share/pkgconfig/PETSc.pc"
       +}
 (DIR) diff --git a/patch.diff b/patch.diff
       t@@ -0,0 +1,13 @@
       +diff --git a/config/BuildSystem/config/package.py b/config/BuildSystem/config/package.py
       +index d7777d623b..9dfcf66cee 100644
       +--- a/config/BuildSystem/config/package.py
       ++++ b/config/BuildSystem/config/package.py
       +@@ -60,7 +60,7 @@ class Package(config.base.Configure):
       +     self.excludedDirs           = []   # list of directory names that could be false positives, SuperLU_DIST when looking for SuperLU
       +     self.downloadonWindows      = 0  # 1 means the --download-package works on Microsoft Windows
       +     self.requirescxx11          = 0
       +-    self.publicInstall          = 1  # Installs the package in the --prefix directory if it was given. Packages that are only used
       ++    self.publicInstall          = 0  # Installs the package in the --prefix directory if it was given. Packages that are only used
       +                                      # during the configuration/installation process such as sowing, make etc should be marked as 0
       +     self.parallelMake           = 1  # 1 indicates the package supports make -j np option
       + 
 (DIR) diff --git a/petsc.install b/petsc.install
       t@@ -0,0 +1,9 @@
       +post_install() {
       +source /etc/profile.d/petsc.sh
       +}
       +
       +post_upgrade() {
       +post_install
       +}
       +
       +# vim:set ts=2 sw=2 et: