Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
142 lines (114 sloc) 5.64 KB
# Maintainer: Myles English <myles at rockhead dot biz>
# Some copied from from dorsal-1.0-beta2/FEniCS/packages/petsc.package
# Try: git clone git@github.com:mylese/petsc-arch.git
pkgname=petsc
pkgver=3.4.2
pkgrel=1
_config=arch-linux2-cxx-opt
# if --with-debugging=yes is set then PETSC_ARCH is automatically set to
#"arch-linux2-cxx-debug" for some things, so the _config should be changed too
#_config=arch-linux2-cxx-debug
pkgdesc="Portable, extensible toolkit for scientific computation"
arch=('any')
url="http://www.mcs.anl.gov/petsc/petsc-as"
license=('MIT compatible')
depends=('python2' 'openmpi' 'boost' 'blas' 'lapack' 'scalapack' 'scotch_esmumps')
makedepends=('gcc' 'gcc-fortran')
install=petsc.install
source=(http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/${pkgname}-${pkgver/_/-}.tar.gz)
md5sums=('449e27f3c9a37d0bd9d7941cc79a09a9')
_install_dir=/opt/petsc/${_config}
# to avoid: "make[2]: *** No rule to make target `libptesmumps.a', needed by `main_esmumps'. Stop."
export MAKEFLAGS="-j1"
# Note: Built with these dependencies:
# extra/blas 3.4.2-1
# extra/lapack 3.4.2-1
# extra/openmpi 1.6.3-1
# aur/scalapack 2.0.2-1 blacs is also provided by scalapack
# aur/scotch_esmumps 6.0.0-1
build() {
_build_dir="${srcdir}/${pkgname}-${pkgver/_/-}"
cd ${_build_dir}
#patch -Np1 -i ${startdir}/patch_debug.diff
unset PETSC_ARCH
export PETSC_DIR=${_build_dir}
find ${srcdir} -name "*" -type f -exec \
sed -i 's#\(/usr/bin/env \|/usr/bin/\)python[2-3]*#\1python2#' {} \;
# from Dorsal ./FEniCS/packages/petsc.package
COPTFLAGS=-O2
# Note: if --with-debugging=yes is set then PETSC_ARCH is set to "arch-linux2-cxx-debug"
#CONFOPTS="--with-shared-libraries=1 --with-clanguage=cxx --with-cc=/usr/bin/mpicc --with-cxx=/usr/bin/mpic++ --with-mpi=1 --with-mumps-serial=0 "
CONFOPTS="--with-shared-libraries=1
--with-clanguage=cxx
--with-mpi=1
--with-debugging=0" # --with-debugging=yes
# when mpif.h is not found
#CONFOPTS="${CONFOPTS} --with-mpi-include=/usr/include"
#CONFOPTS="${CONFOPTS} --FFLAGS=[-I/usr/include ${FFLAGS}]"
# BLAS, LAPACK, MPI:
# let configure find these on the system
# SCALAPACK and BLACS
# blacs is included in scalapack 6.0.0
# CONFOPTS="${CONFOPTS} --with-blacs-lib=/usr/lib/libscalapack.so --with-blacs-include=/usr/include"
# CONFOPTS="${CONFOPTS} --with-scalapack-lib=/usr/lib/libscalapack.so --with-scalapack-include=/usr/include"
#
# # SCOTCH
# CONFOPTS="${CONFOPTS} --with-ptscotch-lib=[/usr/lib/libscotcherr,/usr/lib/libscotch,/usr/lib/libscotcherrexit,/usr/lib/libptscotcherr,/usr/lib/libptscotch,/usr/lib/libptscotcherrexit] --with-ptscotch-include=/usr/include"
#
# MUMPS, HYPRE, METIS, PARMETIS:
# "Downloaded scalapack could not be used.", mumps needs scalapack, so
# install from AUR. Mumps requires ptscotch, parmetis requires metis
# Mumps looks for -lmpiseq even though we are building for MPI! Disabling
# mumps. If anyone can get Mumps to install, please contribute.
for external_pkg in blacs scotch ptscotch scalapack f-blas-lapack umfpack mumps pastix hypre superlu metis parmetis; do # mumps
CONFOPTS="${CONFOPTS} --download-${external_pkg}"
done
# to maybe fix "couldn't find -lmpiseq" error. Doesn't work.
#CONFOPTS="${CONFOPTS} --with-mumps-serial=0"
# from Dorsal ./FEniCS/packages/petsc.package
if [ "${TRILINOS_DIR}" ]; then
CONFOPTS="${CONFOPTS} --with-ml=1 --with-ml-lib=${TRILINOS_DIR}/lib/libml.so --with-ml-include=${TRILINOS_DIR}/include"
fi
# Arch specific
CONFOPTS="${CONFOPTS} --with-boost-dir=/usr"
python2 ./configure \
--prefix=${pkgdir}${_install_dir} \
--PETSC_ARCH=${_config} \
${CONFOPTS}
make ${MAKEFLAGS} PETSC_DIR=${_build_dir} PETSC_ARCH=${_config} all
}
package() {
_build_dir="${srcdir}/${pkgname}-${pkgver/_/-}"
cd ${_build_dir}
echo "make ${MAKEFLAGS} PETSC_DIR=${_build_dir} PETSC_ARCH=${_config} install"
export PETSC_DIR=${_build_dir}
make ${MAKEFLAGS} PETSC_DIR=${_build_dir} PETSC_ARCH=${_config} install # > /dev/null
sed -i 's#'"${pkgdir}"'##g' "${pkgdir}${_install_dir}/conf/variables"
sed -i 's#'"${pkgdir}"'##g' "${pkgdir}${_install_dir}/conf/petscvariables"
sed -i 's#'"${pkgdir}"'##g' "${pkgdir}${_install_dir}/conf/rules"
sed -i 's#'"${pkgdir}"'##g' "${pkgdir}${_install_dir}/include/petscconf.h"
sed -i 's#'"${pkgdir}"'##g' "${pkgdir}${_install_dir}/include/petscconfiginfo.h"
sed -i 's#'"${pkgdir}"'##g' "${pkgdir}${_install_dir}/conf/petscrules"
export PETSC_DIR=${_install_dir}
# Note: the hyperlinks between documentation, tutorials and examples are
# not perfect yet
# documentation
mkdir -p ${pkgdir}/usr/share/doc/$pkgname/
cp -r ${_build_dir}/docs ${pkgdir}/usr/share/doc/$pkgname/
# tutorials
cp -r ${_build_dir}/tutorials ${pkgdir}/usr/share/doc/$pkgname/
# src for tutorials
cp -r ${_build_dir}/src ${pkgdir}/usr/share/doc/$pkgname/
# html versions of header files
mkdir -p ${pkgdir}/usr/share/doc/$pkgname/include
cp -r ${_build_dir}/include/*.html ${pkgdir}/usr/share/doc/$pkgname/include/
# install licenCe (even though there is no such word as licenSes)
mkdir -p ${pkgdir}/usr/share/licenses/petsc
cp ${_build_dir}/docs/copyright.html ${pkgdir}/usr/share/licenses/$pkgname/
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 -d -m755 "${pkgdir}"/etc/ld.so.conf.d/
echo "${_install_dir}/lib" > "${pkgdir}"/etc/ld.so.conf.d/petsc.conf
}