summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6936264581052556859302996cde3e765fcdc26b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Maintainer: Carlos Aznarán <caznaranl@uni.pe>
# Contributor: Michel Zou <xantares09@hotmail.com>
# Contributor: Sigvald Marholm <marholm@marebakken.com>
# Contributor: G S Voelker <voelker@mailbox.org>
# Contributor: Andreas Bilke <abilke@cosy.sbg.ac.at>
# Contributor: Myles English <mylesenglish@gmail.com>
# Contributor: Felix Schindler <aur dot felixschindler dot net>
# Contributor: Lucas H. Gabrielli <heitzmann@gmail.com>
pkgname=slepc
pkgver=3.22.1
pkgrel=1
pkgdesc="Scalable library for Eigenvalue problem computations"
arch=(x86_64)
url="https://${pkgname}.upv.es"
license=(BSD-2-Clause)
options=(staticlibs)
depends=("petsc>=${pkgver::4}")
makedepends=(gcc-fortran cython python-setuptools)
provides=('slepc4py')
install=${pkgname}.install
source=(${url}/download/distrib/${pkgname}-${pkgver/_/-}.tar.gz)
md5sums=('214e68784b8ac36c9c22afc1d1f79650')

build() {
  # get SLEPC_DIR
  source /etc/profile.d/petsc.sh # gets PETSC_DIR

  _build_dir=${srcdir}/${pkgname}-${pkgver/_/-}
  _install_dir=/opt/slepc/$(basename ${PETSC_DIR})

  cd ${_build_dir}

  unset PETSC_ARCH
  export SLEPC_DIR=${_build_dir}

  CONFOPTS="--with-clean \
            --with-slepc4py=1"

  echo ${CONFOPTS}

  python ./configure --prefix=${pkgdir}${_install_dir} ${CONFOPTS}
  make ${MAKEFLAGS} all
  make DESTDIR=${srcdir}/tmp install
}

check() {
  cd ${srcdir}/${pkgname}-${pkgver}
  if [ -z "$(ldconfig -p | grep libcuda.so.1)" ]; then
    export OMPI_MCA_opal_warn_on_missing_libcuda=0
  fi
  PYTHONPATH=${srcdir}/tmp/${_install_dir}/lib:${PYTHONPATH} make check
}

package() {
  # get SLEPC_DIR
  source /etc/profile.d/petsc.sh # gets PETSC_DIR

  _build_dir=${srcdir}/${pkgname}-${pkgver/_/-}
  _install_dir=/opt/slepc/$(basename ${PETSC_DIR})
  _dest_dir=${pkgdir}${_install_dir}

  cd ${_build_dir}
  export SLEPC_DIR=${_build_dir}
  source /etc/profile.d/petsc.sh # sets PETSC_DIR

  make install >/dev/null # redirect in order to suppress confusing messages

  export SLEPC_DIR=${_install_dir}
  unset PETSC_ARCH

  sed -i "s#${pkgdir}##g" "${_dest_dir}/include/slepcconf.h"
  sed -i "s#${pkgdir}##g" "${_dest_dir}/lib/pkgconfig/SLEPc.pc"
  sed -i "s#${pkgdir}##g" "${_dest_dir}/lib/slepc/conf/modules/${pkgname}/${pkgver}"
  sed -i "s#${pkgdir}##g" "${_dest_dir}/lib/slepc/conf/configure-hash"
  sed -i "s#${pkgdir}##g" "${_dest_dir}/lib/slepc/conf/slepc_rules"
  sed -i "s#${pkgdir}##g" "${_dest_dir}/lib/slepc/conf/slepc_rules_doc.mk"
  sed -i "s#${pkgdir}##g" "${_dest_dir}/lib/slepc/conf/slepc_rules_util.mk"
  sed -i "s#${pkgdir}##g" "${_dest_dir}/lib/slepc/conf/slepc_variables"
  sed -i "s#${pkgdir}##g" "${_dest_dir}/lib/slepc/conf/slepcrules"
  sed -i "s#${pkgdir}##g" "${_dest_dir}/lib/slepc/conf/slepcvariables"
  sed -i "s#${pkgdir}##g" "${_dest_dir}/lib/slepc/conf/uninstall.py"
  sed -i "s#${pkgdir}##g" "${_dest_dir}/lib/slepc4py/lib/slepc.cfg"
  sed -i "s#${_build_dir}#${_install_dir}#g" "${_dest_dir}/lib/slepc/conf/uninstall.py"

  # remove logs containing references to the build dir
  rm -f "${_dest_dir}/lib/slepc/conf/configure.log"
  rm -f "${_dest_dir}/lib/slepc/conf/make.log"

  # install licence (even though there is no such word as licenses)
  mkdir -p ${pkgdir}/usr/share/licenses/$pkgname
  cp ${_build_dir}/LICENSE.md ${pkgdir}/usr/share/licenses/$pkgname/

  mkdir -p ${pkgdir}/etc/profile.d
  echo "export SLEPC_DIR=${_install_dir}" >${pkgdir}/etc/profile.d/slepc.sh
  echo export PYTHONPATH=${_install_dir}/lib:'${PYTHONPATH}' >>${pkgdir}/etc/profile.d/slepc.sh
  chmod +x ${pkgdir}/etc/profile.d/slepc.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/slepc.conf
}