summaryrefslogtreecommitdiff
path: root/libre/openshadinglanguage-parabola/PKGBUILD
blob: 630a0573c184c652a872052685b72d1654075dea (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
# Maintainer (Arch): Sven-Hendrik Haase <sh@lutzhaase.com>
# Maintainer: Márcio Silva <coadde@parabola.nu>

_pkgname=openshadinglanguage
pkgname=$_pkgname-parabola
pkgver=1.5.10
pkgrel=1
pkgdesc='Advanced shading language for production GI renderers (built for the blender-parabola package)'
arch=('i686' 'x86_64' 'mips64el')
url='https://github.com/imageworks/OpenShadingLanguage'
license=('custom')
depends=('boost-libs' 'freetype2' 'libpng' 'libtiff' 'llvm-libs' 'openexr' 'openimageio')
makedepends=('boost' 'clang' 'cmake')
provides=("$_pkgname=$pkgver")
conflicts=("$_pkgname")
replaces=("$_pkgname")
source=("https://github.com/imageworks/OpenShadingLanguage/archive/Release-$pkgver.tar.gz")
md5sums=('b828366f056e115b539ee1780883fc7d')

prepare() {
  cd OpenShadingLanguage-Release-$pkgver

  msg 'renaming wrong OS name'
  _OS=$(uname -o)
  [[ $_OS == GNU ]] &&\
    sed -i 's|linux|GNU|i;
           ' src/{cmake/platform.cmake,make/detectplatform.mk}
  [[ $_OS == GNU/Linux ]] &&\
    sed -i 's|[{]uname[}][,]linux]|{uname -o},GNU/Linux|;\|platform| s|linux|GNU/Linux|i
           ' src/{cmake/platform.cmake,make/detectplatform.mk}
  [[ $_OS == GNU/kFreeBSD ]] &&\
    sed -i '\|STREQUAL| s|FreeBSD|kFreeBSD|;\|platform| s|freebsd|GNU/kFreeBSD|i
           ' src/cmake/platform.cmake
    sed -i 's|[{]uname[}][,]linux]|{uname -o},GNU/kFreeBSD|;\|platform| s|linux|GNU/kFreeBSD|i
           ' src/make/detectplatform.mk
  sed -i 's|Linux/OSX|GNU/BSD|' src/include/OSL/export.h
}

build() {
  cd OpenShadingLanguage-Release-$pkgver

  # Fails building this file on i686
  if [[ $CARCH == i686 ]]; then
    sed -i "/src\/testshade/d" CMakeLists.txt
  fi

  cd src

  [[ -d build ]] && rm -r build
  mkdir build && cd build

  cmake ../.. \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=Release \
    -DLLVM_STATIC=OFF
  make
}

package() {
  cd OpenShadingLanguage-Release-$pkgver/src/build

  make DESTDIR=$pkgdir install

  mkdir -p $pkgdir/usr/share/OSL/
  mkdir -p $pkgdir/usr/share/licenses/$_pkgname
  mv $pkgdir/usr/{CHANGES,README.md,INSTALL} $pkgdir/usr/share/OSL
  mv $pkgdir/usr/doc                         $pkgdir/usr/share/OSL/doc
  mv $pkgdir/usr/shaders                     $pkgdir/usr/share/OSL/shaders
  mv $pkgdir/usr/LICENSE                     $pkgdir/usr/share/licenses/$_pkgname
}

# vim:set ts=2 sw=2 et: