PKGBUILD 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. # Maintainer: Martin Diehl <aur@martin-diehl.net>
  2. # Contributor: Andreas Bilke <abilke at cosy dot sbg dot ac dot at>
  3. # Contributor: Myles English <myles at rockhead dot biz>
  4. # Contributor: Lucas H. Gabrielli <heitzmann at gmail dot com>
  5. pkgver=3.19.5
  6. pkgrel=1
  7. pkgname=petsc
  8. _config=linux-c-opt
  9. # if --with-debugging=yes is set then PETSC_ARCH is automatically set to
  10. #"linux-c-debug" for some things, so the _config should be changed too
  11. #_config=linux-c-debug
  12. pkgdesc="Portable, extensible toolkit for scientific computation"
  13. arch=('i686' 'x86_64')
  14. url="https://petsc.org"
  15. license=('BSD')
  16. options=(staticlibs)
  17. depends=('python-numpy' 'openmpi' 'boost' 'lapack')
  18. makedepends=('gcc' 'gcc-fortran' 'cmake' 'cython')
  19. provides=('petsc4py')
  20. optdepends=('trilinos: support for trilinos'
  21. 'fftw: support for the FFTW'
  22. 'hdf5: support for the HDF5'
  23. 'hypre: support for the HYPRE'
  24. 'metis: support for METIS'
  25. 'mumps: support for MUMPS'
  26. 'parmetis: support for ParMETIS'
  27. 'scalapack: support for ScaLAPACK'
  28. 'scotch: support for Scotch'
  29. 'suitesparse: support for SuiteSparse'
  30. 'superlu: support for SuperLU'
  31. 'superlu_dist: support for SuperLU_DIST',
  32. 'triangle: support for Triangle'
  33. 'trilinos: support for the ML package from Trilinos'
  34. )
  35. install=petsc.install
  36. source=("${pkgname}::git+https://gitlab.com/petsc/${pkgname}.git#tag=v${pkgver}"
  37. test_optdepends.sh)
  38. sha512sums=('SKIP'
  39. '88baf173373a19bfca53363013439a388b72587b0585777576d4de97049d7e05480ab941e2a608b2b2fba12fc39e102ecb12ba97ba8daeea26a8e0670e173c9d')
  40. _install_dir=/opt/petsc/${_config}
  41. _petsc_arch=arch-${_config}
  42. prepare(){
  43. ln -sr "${pkgname}" "${pkgname}"-"${pkgver}"
  44. }
  45. build() {
  46. _build_dir=${srcdir}/${pkgname}-${pkgver}
  47. cd ${_build_dir}
  48. export PETSC_ARCH=${_petsc_arch}
  49. export PETSC_DIR=${_build_dir}
  50. OPTFLAGS='-O3 -march=native'
  51. CONFOPTS=(
  52. --silent --enable-silent-rules
  53. --ignoreWarnings=1
  54. --CFLAGS="${generic_flags}"
  55. --CXXFLAGS="$generic_flags"
  56. --CPPFLAGS="$generic_flags"
  57. --FCFLAGS="$generic_flags"
  58. --F90FLAGS="$generic_flags"
  59. --FFLAGS="$generic_flags"
  60. --MAKEFLAGS=${MAKEFLAGS}
  61. --LDFLAGS=${LDFLAGS}
  62. --COPTFLAGS=${OPTFLAGS}
  63. --CXXOPTFLAGS=${OPTFLAGS}
  64. --FOPTFLAGS=${OPTFLAGS}
  65. --with-environment-variables=1
  66. --with-cxx-dialect=auto
  67. --with-mpi=1
  68. --with-pic=1
  69. --with-shared-libraries=1
  70. --with-zlib=1
  71. --with-petsc4py=1
  72. --with-mpi-f90module-visibility=0
  73. $(sh ${srcdir}/test_optdepends.sh))
  74. echo ${CONFOPTS[@]}
  75. python ./configure --prefix=${_install_dir} ${CONFOPTS[@]}
  76. make -s ${MAKEFLAGS} all
  77. make DESTDIR=${srcdir}/tmp install
  78. }
  79. check() {
  80. cd ${srcdir}/${pkgname}-${pkgver}
  81. if [ -z "$(ldconfig -p | grep libcuda.so.1)" ]; then
  82. export OMPI_MCA_opal_warn_on_missing_libcuda=0
  83. fi
  84. export OMPI_MCA_plm_rsh_agent=sh
  85. PYTHONPATH=${srcdir}/tmp/${_install_dir}/lib:${PYTHONPATH} make check
  86. }
  87. package() {
  88. _build_dir=${srcdir}/${pkgname}-${pkgver}
  89. mkdir -p ${pkgdir}/${_install_dir}
  90. cp -Hr ${srcdir}/tmp/* ${pkgdir}
  91. # install licence (even though there is no such word as licenses)
  92. install -Dm 644 ${_build_dir}/LICENSE ${pkgdir}/usr/share/licenses/$pkgname/LICENSE
  93. mkdir -p ${pkgdir}/etc/profile.d
  94. echo export PETSC_DIR=${_install_dir} > ${pkgdir}/etc/profile.d/petsc.sh
  95. echo export PYTHONPATH=${_install_dir}/lib:'${PYTHONPATH}' >> ${pkgdir}/etc/profile.d/petsc.sh
  96. chmod +x ${pkgdir}/etc/profile.d/petsc.sh
  97. # show where the shared libraries are
  98. install -dm 755 ${pkgdir}/etc/ld.so.conf.d/
  99. echo ${_install_dir}/lib > ${pkgdir}/etc/ld.so.conf.d/petsc.conf
  100. # install pkgconfig settings
  101. install -Dm 644 ${_build_dir}/${_petsc_arch}/lib/pkgconfig/PETSc.pc ${pkgdir}/usr/share/pkgconfig/PETSc.pc
  102. }