aboutsummaryrefslogtreecommitdiffstats
path: root/testing/blender/APKBUILD
blob: d795d482b019d8d24555780558e4e8b1ba805e48 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Contributor: Mark Riedesel <mark@klowner.com>
# Contributor: Leon Marz <lmarz@cs.uni-frankfurt.de>
# Maintainer: Mark Riedesel <mark@klowner.com>
pkgname=blender
pkgver=2.91.2
_pkgver=${pkgver%.[0-9]}
pkgrel=1
pkgdesc="3D Creation/Animation/Publishing System"
url="https://www.blender.org/"
arch="x86_64" # only on x86_64, mainly because of openvdb
license="GPL-2.0-or-later"
depends="blender-shared=$pkgver-r$pkgrel"
makedepends="cmake libx11-dev libjpeg-turbo-dev libpng-dev freetype-dev python3-dev
	openimageio-dev opencolorio-dev glew-dev openal-soft-dev ffmpeg-dev blosc-dev
	fftw-dev tiff-dev libxi-dev libsndfile-dev boost-dev openexr-dev py3-numpy-dev
	opensubdiv-dev lzo-dev libxrender-dev openjpeg-dev openxr-dev libtbb-dev libtbb
	llvm10-dev eigen-dev sdl2-dev jack-dev alembic-dev osl-dev osl embree-dev
	embree-static openvdb-dev gmp-dev potrace-dev pugixml-dev"
subpackages="$pkgname-doc $pkgname-shared::noarch $pkgname-headless py3-$pkgname:python"
source="https://download.blender.org/source/blender-$pkgver.tar.xz
	0001-musl-fixes.patch
	0002-fix-linking-issue.patch
	0003-increase-thread-stack-size-for-musl.patch
	"


build() {
	# Headless
	mkdir -p "$builddir"/build-headless
	cd "$builddir"/build-headless
	_build -C../build_files/cmake/config/blender_headless.cmake

	# Full
	mkdir -p "$builddir"/build-full
	cd "$builddir"/build-full
	_build -C../build_files/cmake/config/blender_full.cmake

	# Python module
	mkdir -p "$builddir"/build-py
	cd "$builddir"/build-py
	_build -C../build_files/cmake/config/bpy_module.cmake
}

_build() {
	local _py_version=$(python3 -c 'import sys; print("%i.%i" % (sys.version_info.major, sys.version_info.minor))')

	export CFLAGS="$CFLAGS -D__MUSL__"
	export CXXFLAGS="$CXXFLAGS -D__MUSL__"

	cmake .. "$@" \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=None \
		-DWITH_PYTHON_INSTALL=OFF \
		-DWITH_INSTALL_PORTABLE=OFF \
		-DWITH_SYSTEM_LZO=ON \
		-DWITH_SYSTEM_EIGEN3=ON \
		-DWITH_SYSTEM_GLEW=ON \
		-DPYTHON_VERSION=$_py_version
	cmake --build .
}

package() {
	# Install headless files
	cd "$builddir"/build-headless
	DESTDIR="$pkgdir"/headless cmake --install .

	# Rename the headless blender to blender-headless
	mkdir -p "$pkgdir"/usr/bin
	mv "$pkgdir"/headless/usr/bin/blender "$pkgdir"/usr/bin/blender-headless
	rm -rf "$pkgdir"/headless

	# Install python module
	cd "$builddir"/build-py
	DESTDIR="$pkgdir" cmake --install .

	# Install the full package
	cd "$builddir"/build-full
	DESTDIR="$pkgdir" cmake --install .
}

shared() {
	pkgdesc="Blender shared runtime data and add-on scripts"
	mkdir -p "$subpkgdir"/usr/share/
	mv "$pkgdir"/usr/share/blender "$subpkgdir"/usr/share/
}

headless() {
	pkgdesc="$pkgdesc (headless build)"
	depends="blender-shared=$pkgver-r$pkgrel"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/blender-headless "$subpkgdir"/usr/bin/
}

python() {
	local _py_version=$(python3 -c 'import sys; print("%i.%i" % (sys.version_info.major, sys.version_info.minor))')

	pkgdesc="Blender modules for Python 3"
	mkdir -p "$subpkgdir"/usr/lib/python"$_py_version"/site-packages
	mv "$pkgdir"/usr/lib/python"$_py_version"/site-packages/bpy.so "$subpkgdir"/usr/lib/python"$_py_version"/site-packages/
	rm -rf "$pkgdir"/usr/lib

	# Symlink to the blender-shared files
	ln -s /usr/share/blender/"$_pkgver" "$subpkgdir"/usr/lib/python"$_py_version"/site-packages/"$_pkgver"
}

sha512sums="9a3bae01bd09b1d665af4882f53e8a88d85ff44678233c90788a7801ce0d551a3cc1f71026b71ea1c77d7eaedf7ab6fc8709104c22b564f4fc6cc0d5b3b76f5e  blender-2.91.2.tar.xz
a94245186e126f936f17bc75e4b202b7b9feda00f02b103f274d9d30d68269e86527fe3376dda44d0c3bd27f08b5c4254bfb1ac464e8f871dc3edf5d3e670a5b  0001-musl-fixes.patch
82ecdf920c2db1b335ce2c6184b852e3e116aaea4d4067e2f5cfa5d32645552dbf4c4619ea195ed3c7e638661745843f32b4da0dcb3bcac959e2f64832eb07c8  0002-fix-linking-issue.patch
e7d2559eda58bc355c8e8dde57fb3f9c1fdb5cd53e0ececfb81aaa0da9a84f0b271c74fda494cc023af449b2d5e5099b0546c0352739320874b3b01453bfd626  0003-increase-thread-stack-size-for-musl.patch"