updated on Thu Jan 19 12:17:07 UTC 2012
[aur-mirror.git] / petsc / PKGBUILD
blob62bf455b61529c264252046bd5e97bb7c74b3547
1 # Maintainer: Myles English <myles at rockhead dot biz>
2 pkgname=petsc
3 pkgver=3.1_p8
4 _config=linux-gnu-cxx-debug
5 pkgrel=1
6 pkgdesc="Portable, extensible toolkit for scientific computation"
7 arch=('any')
8 url="http://www.mcs.anl.gov/petsc/petsc-as"
9 license=('MIT compatible')
10 depends=('python2' 'gcc' 'mpich2' 'boost')
11 #conflicts=('umfpack')
12 install=(petsc.install)
13 source=(http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/${pkgname}-${pkgver/_/-}.tar.gz)
14 md5sums=('936b56152f6eeaf3322b87683d757622')
16 _build_dir=${srcdir}/${pkgname}-${pkgver/_/-}
17 _install_dir=/usr/petsc/${_config}
19 build() {
20     cd ${_build_dir}
22     unset PETSC_ARCH
23     export PETSC_DIR=${_build_dir}
25     find ${srcdir} -name "*" -type f -exec \
26         sed -i 's#\(/usr/bin/env \|/usr/bin/\)python[2-3]*#\1python2#' {} \;
28     python2 ./config/configure.py --prefix=${pkgdir}${_install_dir} \
29         --with-mpi-dir=/opt/mpich2 \
30         --with-mpi-shared=1 \
31         --with-sieve \
32         --download-umfpack=1 \
33         --with-clanguage=cxx \
34         --with-boost-dir=/usr \
35         --with-umfpack=1 --with-umfpack-dir=/usr/lib \
36         --with-shared=1
37     make
38     sed -i 's/.\/config\/install.py/python2 .\/config\/install.py/' makefile
41 package() {
42     cd ${_build_dir}
44     make PETSC_DIR=${_build_dir} PETSC_ARCH=${_config} install
46     sed -i 's#'"${pkgdir}"'##g' "${pkgdir}${_install_dir}/conf/variables"
47     sed -i 's#'"${pkgdir}"'##g' "${pkgdir}${_install_dir}/conf/petscvariables"
48     sed -i 's#'"${pkgdir}"'##g' "${pkgdir}${_install_dir}/conf/rules"
49     sed -i 's#'"${pkgdir}"'##g' "${pkgdir}${_install_dir}/include/petscconf.h"
50     sed -i 's#'"${pkgdir}"'##g' "${pkgdir}${_install_dir}/include/petscconfiginfo.h"
51     sed -i 's#'"${pkgdir}"'##g' "${pkgdir}${_install_dir}/conf/petscrules"
53     export PETSC_DIR=${_install_dir}
54     
55     # documentation
56     mkdir -p ${pkgdir}/usr/share/doc/$pkgname/
57     cp -r ${_build_dir}/docs ${pkgdir}/usr/share/doc/$pkgname/
59     # tutorials
60     mkdir -p ${pkgdir}/usr/share/doc/$pkgname/tutorials
61     cp -r ${_build_dir}/tutorials ${pkgdir}/usr/share/doc/$pkgname/tutorials
63     # install licenCe (even though there is no such word as licenSes)
64     mkdir -p ${pkgdir}/usr/share/licenses/petsc
65     cp ${_build_dir}/docs/copyright.html ${pkgdir}/usr/share/licenses/$pkgname/
67     mkdir -p ${pkgdir}/etc/profile.d
68     echo "export PETSC_DIR=${_install_dir}" > ${pkgdir}/etc/profile.d/petsc.sh
69     chmod +x ${pkgdir}/etc/profile.d/petsc.sh
71     # show where the shared libraries are
72     install -d -m755 "${pkgdir}"/etc/ld.so.conf.d/
73     echo '/usr/petsc/linux-gnu-cxx-debug/lib' > "${pkgdir}"/etc/ld.so.conf.d/petsc.conf