aboutsummaryrefslogtreecommitdiffstats
path: root/testing/osl/APKBUILD
blob: dd4b77aed477e31981fc89a9a8a65dc53745707d (plain) (blame)
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
# Contributor: Damian Kurek <starfire24680@gmail.com>
# Maintainer: Damian Kurek <starfire24680@gmail.com>
pkgname=osl
pkgver=1.11.12.0
pkgrel=1
pkgdesc="Advanced shading language for production GI renderers"
options="!check" # All tests fail
url="https://opensource.imageworks.com/osl.html"
arch="all !armv7 !armhf !s390x !mips64" # openimageio
license="BSD-3-Clause"
_llvmver=11
makedepends="openexr-dev zlib-dev cmake boost-dev openimageio-dev pugixml-dev
	llvm$_llvmver-dev bison flex-dev py3-pybind11-dev clang-dev qt5-qtbase-dev
	python3-dev"
subpackages="
	$pkgname-libs
	$pkgname-dev
	$pkgname-doc
	$pkgname-python
	openimageio-plugin-osl:_osl
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/imageworks/OpenShadingLanguage/archive/Release-$pkgver.tar.gz
	"
builddir="$srcdir/OpenShadingLanguage-Release-$pkgver"

prepare() {
	default_prepare
	find . -iname CMakeLists.txt -exec sed -i -e "s/COMMAND python/COMMAND python3/" {} +
}

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_CXX_STANDARD=14 \
		-DLLVM_STATIC=OFF \
		-DPYTHON_VERSION=3 \
		-DOSL_BUILD_MATERIALX=ON \
		$CMAKE_CROSSOPTS
	cmake --build build
}

check() {
	cd build
	# Broken tests
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

python() {
	pkgdesc="Python3 bindings for OSL"
	depends=""
	amove usr/lib/python3*
}

doc() {
	default_doc
	# Example shaders
	amove usr/share/OSL/shaders/*.osl
	amove usr/share/OSL/shaders/*.oso
	amove usr/share/OSL/shaders/MaterialX/*.osl
	amove usr/share/OSL/shaders/MaterialX/*.oso
}

_osl() {
	pkgdesc="Plugin to access OSL from OpenImageIO"
	depends=""
	amove usr/lib/osl.imageio.so
}

sha512sums="83ee6a9362e87e2afa9af169f8c9a1e10c6ed57412f008305f87b1ebe0a96b051124ecccf10ceb552dbc52efbfc3692d461d2b286987e6f35df5c657d479ee7f  osl-1.11.12.0.tar.gz"