summaryrefslogtreecommitdiff
path: root/pcr/openfoam3.0-git/PKGBUILD
blob: 69b7fc5d6b17179b4c482bb8508d425ffc5e3895 (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
# Original Contributor (Arch): aquavitae <aquavitae69: gmail>
# Current Maintainer (Arch): Andrew Fischer <andrew_at_ltengsoft.com>

pkgname=openfoam3.0-git

# The distributors package name
_distpkgname=OpenFOAM
_distpkgver=3.0.x
_gitname=$_distpkgname-$_distpkgver
pkgver=20160803.4b5e129
pkgrel=1.parabola1
pkgdesc="The libre CFD toolbox, without nonfree parmetis support"
arch=('i686' 'x86_64')
url="http://www.openfoam.com"
license=('GPL')
groups=()
depends=('cgal' 'paraview' 'scotch' 'boost')
makedepends=('git')
optdepends=()
replaces=()
backup=()
options=()
source=(git+https://github.com/OpenFOAM/OpenFOAM-3.0.x.git)
noextract=()
install=openfoam.install
md5sums=('SKIP')

pkgver() {
	cd "$srcdir/$_gitname"
	git log -1 --date=short --format="%cd.%h" | tr -d '-'
}


build() {
  # Setup the build environment
  export FOAM_INST_DIR=$srcdir 
  foamDotFile=$srcdir/$_gitname/etc/bashrc
  [ -f $foamDotFile ] && . $foamDotFile || return 1

  # Enter build directory
  cd "$srcdir/$_gitname" || return 1

  # Build and clean up OpenFOAM
  ./Allwmake || return 1
  wclean all || return 1
  wmakeLnIncludeAll || return 1
}
package() {
  cd "$srcdir"

  # Create destination directories
  install -d "$pkgdir/opt/$_distpkgname" "$pkgdir/etc/profile.d" || return 1

  # Move package to pkgdir
  mv "$srcdir/$_gitname" "$pkgdir/opt/$_distpkgname/$_gitname" || return 1

  mkdir -p "$pkgdir/usr/bin"

  # Add source file
  echo "export FOAM_INST_DIR=/opt/$_distpkgname" > "$pkgdir/usr/bin/ofoam-3.0" || return 1
  echo ".\$FOAM_INST_DIR/$_gitname/etc/bashrc" >> "$pkgdir/usr/bin/ofoam-3.0" || return 1

  # Add stub thirdparty directory to keep openfoam happy
  install -d "$pkgdir/opt/$_distpkgname/ThirdParty-$_distpkgver" || return 1

  # Permission fixes - for system-wide install and use
  chmod -R go+r "$pkgdir/opt"
  chmod -R 755 "$pkgdir/opt/$_distpkgname/$_gitname/bin"
  chmod -R 755 "$pkgdir/opt/$_distpkgname/$_gitname/etc"
  chmod -R 755 "$pkgdir/usr/bin/ofoam-3.0"
}