summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f21ba57bf95a2efa9676ae81fda6d4403c8e86d9 (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
# Maintainer: Jacopo Nespolo <$lowercase_first_name at movimento dash centrale dot it>
pkgname=mfem-glvis
_pkgname=glvis
pkgver=4.2
pkgrel=1
pkgdesc="A lightweight tool for accurate and flexible finite element visualization"
arch=("x86_64")
url="https://glvis.org"
license=('BSD-3-Clause')
depends=(mfem openmpi libglvnd sdl2 glew libpng freetype2 fontconfig gcc-libs glibc)
makedepends=(cmake glm libxi ninja tinyxxd)
_repo=https://github.com/GLVis/glvis
source=(${_pkgname}-${pkgver}.tar.gz::${repo}/archive/refs/tags/v${pkgver}.tar.gz)
md5sums=('a228c65c285e7a66e38b1ec2f2812842')

prepare() {
    # Backporting upstream commit 92bab4c 
    # "Fix installation with CMake on non-APPLE platforms"
    cd $_pkgname-$pkgver
    echo -e "318a319\n>   if (APPLE)\n339a341\n>   endif (APPLE)" | patch CMakeLists.txt
}

build() {
  cmake \
    -S "$_pkgname-$pkgver" \
    -B build \
    -D CMAKE_BUILD_TYPE:STRING=Release \
    -D CMAKE_INSTALL_PREFIX:STRING=/usr \
    -D GLVIS_USE_LIBTIFF=OFF \
    -D GLVIS_USE_LIBPNG=ON

  local N_CORES=$(grep "core id" /proc/cpuinfo | uniq | wc -l)
  cmake --build build --parallel $N_CORES
}

package() {
  ln -s build/glvis build/GLVis
  ls build
  DESTDIR="${pkgdir}" cmake --build build --target install -v

  install \
      -v \
      -Dm 644 \
      ${_pkgname}-${pkgver}/LICENSE \
      -t "${pkgdir}/usr/share/licenses/${_pkgname}"
}