summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 875b6715ab770b8f5ab5aaafed09ddd0cf984feb (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# Maintainer: David Wells <dr wells at vt dot e d u>
# Contributor: Florian Dang <florian dot coin at gmail dot com>

pkgname=deal-ii
_realname=dealii
pkgver=8.5.0
pkgrel=1
pkgdesc="An Open Source Finite Element Differential Equations Analysis Library"
arch=("i686" "x86_64")
url="http://www.dealii.org/"
license=('LGPL')
depends=('boost')
optdepends=(
      'arpack: Fortran77 subroutines designed to solve large scale eigenvalue problems'
      'atlas-lapack: Complete LAPACK and BLAS implementation using optimized ATLAS routines'
      'bzip2: A high-quality data compression program'
      'doxygen: A documentation system for C++, C, Java, IDL, and PHP'
      'p4est-deal-ii: The parallel forest (p4est) library, built to work with deal.II'
      'gsl: A modern numerical library for C and C++ programmers'
      'hdf5-openmpi: General purpose library and file format for storing scientific data'
      'intel-tbb: High level abstract threading library'
      'lapack: Linear Algebra PACKage'
      'mathjax: An open source Javascript display engine for mathematics that works in all modern browsers.'
      'metis: partitioning graphs, finite element meshes, fill reducing orderings for sparse matrices.'
      'muparser: A fast math parser library'
      'netcdf-cxx-legacy: Legacy NetCDF C++ bindings'
      'openmpi: High performance message passing library (MPI)'
      'opencascade: Open CASCADE Technology, 3D modeling & numerical simulation'
      'petsc: Portable, extensible toolkit for scientific computation'
      'slepc: Scalable library for Eigenvalue problem computations'
      'trilinos: object-oriented software framework for the solution of large-scale, complex multi-physics engineering and scientific problems'
      'suitesparse: A collection of sparse matrix libraries'
      'zlib: Compression library implementing the deflate compression method found in gzip and PKZIP'
      )
makedepends=('cmake')
install=deal-ii.install
source=(https://github.com/dealii/dealii/releases/download/v$pkgver/${_realname}-$pkgver.tar.gz)
sha1sums=('75076beddfd4a1b590cba9fbc78eea901c7f3ddb')

build() {
  # where to install deal.II: change to something else (e.g., /opt/deal.II/)
  # if desired.
  installation_prefix=/usr

  # Since deal.II relies on a relatively large number of packages that are
  # installed in nonstandard places (i.e., the Trilinos AUR package is installed
  # in /opt/trilinos/), source their environment variable scripts in the
  # (likely) case that a user installed one of these packages without logging
  # out and logging back in
  for package in opencascade p4est-deal-ii petsc slepc trilinos
  do
      if pacman -Qs $package >/dev/null
      then
          source /etc/profile.d/$package.sh
      fi
  done

  rm -rf "${srcdir}/build"
  mkdir "${srcdir}/build"
  cd "${srcdir}/build"

  # explicitly disallow bundled packages: this disables bundled copies of boost,
  # intel-tbb, part of suitesparse, and muparser, which are all available in the
  # standard repositories
  cmake_configuration_flags=" -DDEAL_II_ALLOW_BUNDLED=OFF"

  # deal.II does not use more aggressive search paths (which we need) for MPI
  # unless we explicitly enable it, so check for MPI and then turn it on:
  if pacman -Qs openmpi >/dev/null
  then
      cmake_configuration_flags+=" -DDEAL_II_WITH_MPI=ON"
  fi

  # See if PETSc was configured to use 64 bit indices:
  if pacman -Qs petsc >/dev/null
  then
      if grep '^#define PETSC_USE_64BIT_INDICES 1' $PETSC_DIR/include/petscconf.h >/dev/null
      then
         cmake_configuration_flags+=" -DDEAL_II_WITH_64BIT_INDICES=ON"
      fi
  fi

  if pacman -Qs doxygen >/dev/null
  then
     cmake_configuration_flags+=" -DDEAL_II_COMPONENT_DOCUMENTATION=ON"
     cmake_configuration_flags+=" -DDEAL_II_SHARE_RELDIR=share/${pkgname}/"
     cmake_configuration_flags+=" -DDEAL_II_DOCHTML_RELDIR=share/doc/${pkgname}/"
     cmake_configuration_flags+=" -DDEAL_II_EXAMPLES_RELDIR=share/${pkgname}/examples/"

     if pacman -Qs mathjax >/dev/null
     then
         # deal.II does not know where we put mathjax and does not have a
         # configuration variable for its path, but does check this environment
         # variable
         export MATHJAX_ROOT=/usr/share/mathjax/
         cmake_configuration_flags+=" -DDEAL_II_DOXYGEN_USE_ONLINE_MATHJAX=OFF"
         cmake_configuration_flags+=" -DDEAL_II_DOXYGEN_USE_MATHJAX=ON"
     fi
  fi

  # deal.II does not compile with OpenMP: if we use Trilinos and some Epetra
  # headers have OpenMP pragmas enabled then skip unknown pragma warnings.
  extra_warning_flags=""
  if pacman -Qs trilinos >/dev/null
  then
      if [ -f $TRILINOS_DIR/include/Epetra_config.h ]
      then
          if grep '^#define EPETRA_HAVE_OMP$' $TRILINOS_DIR/include/Epetra_config.h >/dev/null
          then
             extra_warning_flags+=" -Wno-unknown-pragmas"
          fi
      fi
  fi

  # the deal.II GCC flags are already well-chosen for speed (and -O3 is known to
  # be slightly slower than O2), so do not use flags in /etc/makepkg.conf by
  # default. If you want to edit this file to use other flags then pass cmake
  # -DCMAKE_CXX_FLAGS=" flags-you-want".
  #
  # if you wish to disable specific optional packages, then pass (e.g., for
  # Trilinos)
  #
  #     -DDEAL_II_WITH_TRILINOS=OFF
  #
  # to cmake.
  cmake $cmake_configuration_flags -DCMAKE_INSTALL_PREFIX=$installation_prefix  \
        -DCMAKE_INSTALL_MESSAGE=NEVER -DCMAKE_CXX_FLAGS=" $extra_warning_flags" \
        ../${_realname}-$pkgver

  # if you do not have /etc/makepkg.conf configured, then add -jN (where N is
  # the number of concurrent build jobs, usually 2 * number of physical cores)
  # to this flag. deal.II needs about 2 GB/compilation process so use fewer jobs
  # if your machine does not have the memory to support the maximum number.
  # make $MAKEFLAGS
  make -j10

  # build a complete copy of the offline docs by downloading images
  if pacman -Qs doxygen >/dev/null
  then
      cd doc/doxygen/deal.II/
      bash $srcdir/${_realname}-${pkgver}/contrib/utilities/makeofflinedoc.sh
  fi

  cd "${srcdir}/build"
  echo "export DEAL_II_DIR=$installation_prefix" > ./deal-ii.sh
}

package() {
  cd "${srcdir}/build"
  make DESTDIR="${pkgdir}" install

  install -D -m755 "${srcdir}/build/deal-ii.sh" "${pkgdir}/etc/profile.d/deal-ii.sh"
  install -D -m644 "${srcdir}/${_realname}-$pkgver/LICENSE" "${pkgdir}/usr/share/licenses/${_realname}-$pkgver/LICENSE"
}