summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3f97463e4f02450e283b7abfeac5a8609f0b25cd (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
# Maintainer: Benjamin Radel <aur@radel.tk>
# Contributor: xpt <user.xpt@gmail.com>

pkgname=liggghts-git
_execname=liggghts
pkgver=3.8.0.r81.gbbd23c85
pkgrel=3
pkgdesc="Open Source Discrete Element Method Particle Simulation Software"
arch=('x86_64')
url="https://github.com/CFDEMproject/LIGGGHTS-PUBLIC"
license=('GPL')
depends=('vtk' 'openmpi')
optdepends=('paraview') 
makedepends=('git' 'patchelf')
provides=('liggghts')
conflicts=('liggghts')
source=('liggghts-git::git+https://github.com/CFDEMproject/LIGGGHTS-PUBLIC.git')
sha256sums=('SKIP')

pkgver() {
  cd "$pkgname"
  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd $srcdir/$pkgname
  for p in "${source[@]}"; do
    if [[ "$p" =~ \.patch$ ]]; then
      echo "Applying patch ${p##*/}"
      patch -p1 -N -i "$srcdir/${p##*/}"
    fi
  done

 cp "$srcdir/$pkgname/src/MAKE/Makefile.user_default" "$srcdir/$pkgname/src/MAKE/Makefile.user"
 echo "MPI_CCFLAGS_USR=$CXXFLAGS -funroll-loops $LTOFLAGS" >> "$srcdir/$pkgname/src/MAKE/Makefile.user"
 echo "MPI_LDFLAGS_USR=$LDFLAGS $LTOFLAGS" >> "$srcdir/$pkgname/src/MAKE/Makefile.user"
}

build() {
  cd "$srcdir/$pkgname"
  cd src
  make  clean-all
  make auto || return 1
}

 package() {
  mkdir -p "$pkgdir/usr/share/$pkgname"
  mkdir -p "$pkgdir/usr/share/doc/$pkgname"
  mkdir -p "$pkgdir/usr/share/$pkgname/examples"
  mkdir -p "$pkgdir/usr/share/doc/$pkgname/PDF/"
  mkdir -p "$pkgdir/usr/bin/"
  
  cd "$srcdir/$pkgname"
  install -Dm 755 src/lmp_auto "$pkgdir/usr/bin/${_execname}"
  patchelf --remove-rpath "$pkgdir/usr/bin/${_execname}"

  cp -r --no-preserve='ownership' examples/LIGGGHTS/Tutorials_public/* "$pkgdir/usr/share/$pkgname/examples"
#   install -Dm644 examples/LIGGGHTS/Tutorials_public/ $pkgdir/usr/share/$pkgname/examples
  cp -r --no-preserve='ownership' doc/*.{html,pdf} "$pkgdir/usr/share/doc/$pkgname/"
  cp -r --no-preserve='ownership' doc/PDF/*.pdf "$pkgdir/usr/share/doc/$pkgname/PDF/"
#   install -Dm644 doc/* $pkgdir/usr/share/doc/$pkgname

  install -Dm644 "LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm644 "README" "$pkgdir/usr/share/licenses/$pkgname/README"
}