summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f0c6dbd0c55bf00aa0468cda6492ce3a52671e50 (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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Maintainer: Xavier Cho <mysticfallband@gmail.com>

pkgname=upbge-git
pkgver=100785.b04a71b330c
pkgrel=1
pkgdesc="Uchronia Project Blender Game Engine fork of Blender Game Engine"
arch=('i686' 'x86_64')
url="https://upbge.org/"
depends=('alembic' 'libgl' 'python' 'desktop-file-utils' 'hicolor-icon-theme' 'openjpeg'
		 'ffmpeg' 'fftw' 'openal' 'freetype2' 'libxi' 'openimageio' 'opencolorio'
		 'openvdb' 'opencollada' 'opensubdiv' 'openshadinglanguage' 'libtiff' 'libpng' 'python-numpy')
optdepends=('cuda: CUDA support in Cycles'
			'optix: OptiX support in Cycles'
			'openimagedenoise: Intel Open Image Denoise support in compositing')
makedepends=('git' 'cmake' 'boost' 'mesa' 'llvm')
provides=('blender')
conflicts=('blender')
license=('GPL')
install=upbge.install
# NOTE: the source array has to be kept in sync with .gitmodules
# the submodules has to be stored in path ending with git to match
# the path in .gitmodules.
# More info:
#   http://wiki.blender.org/index.php/Dev:Doc/Tools/Git
source=('git://github.com/UPBGE/upbge.git' \
	'blender-addons.git::git://github.com/UPBGE/blender-addons.git' \
	'blender-addons-contrib.git::git://git.blender.org/blender-addons-contrib.git' \
	'blender-translations.git::git://git.blender.org/blender-translations.git' \
	'blender-dev-tools.git::git://git.blender.org/blender-dev-tools.git' \
	embree.patch \
	upbge.desktop)
md5sums=(
	'SKIP' 
	'SKIP' 
	'SKIP' 
	'SKIP' 
	'SKIP' 
	'4ede42a5aa6b7237170548ae00021ceb'
	'37ce92c740691f858156511e22b40143')

# determine whether we can precompile CUDA kernels
_CUDA_PKG=`pacman -Qq cuda 2>/dev/null` || true
if [ "$_CUDA_PKG" != "" ]; then
	_EXTRAOPTS="-DWITH_CYCLES_CUDA_BINARIES=ON \
		-DCUDA_TOOLKIT_ROOT_DIR=/opt/cuda"
fi

# check for optix
_OPTIX_PKG=`pacman -Qq optix 2>/dev/null` || true
if [ "$_OPTIX_PKG" != "" ]; then
	_EXTRAOPTS="$_EXTRAOPTS \
	-DWITH_CYCLES_DEVICE_OPTIX=ON \
	-DOPTIX_ROOT_DIR=/opt/optix"
fi

# check for open image denoise
_OIDN_PKG=`pacman -Qq openimagedenoise 2>/dev/null` || true
if [ "$_OIDN_PKG" != "" ]; then
	_EXTRAOPTS="$_EXTRAOPTS \
	-DWITH_OPENIMAGEDENOISE=ON"
fi

# check for embree
_EMBREE_PKG=`pacman -Qq embree 2>/dev/null` || true
if [ "$_EMBREE_PKG" != "" ]; then
	_EXTRAOPTS="$_EXTRAOPTS \
	-DWITH_CYCLES_EMBREE=ON"
fi

pkgver() {
	cd "$srcdir/upbge"
	printf "%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
	cd "$srcdir/upbge"

	#update the submodules
	git submodule sync
	git submodule update --init --recursive --remote
	git submodule foreach git checkout master
	git submodule foreach git pull --rebase

	if [ "$_EMBREE_PKG" != "" ]; then
		git apply -v "${srcdir}"/embree.patch
	fi
}

build() {
	mkdir -p "$srcdir/blender-build"
	 _pyver=$(python -c "from sys import version_info; print(\"%d.%d\" % (version_info[0],version_info[1]))")
	  echo "python version detected: ${_pyver}"

	cd "$srcdir/blender-build"

	cmake "$srcdir/upbge" \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DWITH_INSTALL_PORTABLE=OFF \
		-DWITH_GAMEENGINE=ON \
		-DWITH_PLAYER=ON \
		-DWITH_OPENCOLORIO=ON \
		-DWITH_FFTW3=ON \
		-DWITH_SYSTEM_GLEW=ON \
		-DWITH_CODEC_FFMPEG=ON \
		-DWITH_PYTHON_INSTALL=OFF \
		-DPYTHON_VERSION="${_pyver}" \
		-DWITH_MOD_OCEANSIM=ON \
		$_EXTRAOPTS
	make
}

package() {
	cd "$srcdir/blender-build"

	make DESTDIR="$pkgdir" install

	mv "$pkgdir/usr/share/blender" "$pkgdir/usr/share/upbge"

	install -D -m644 "$srcdir"/upbge.desktop \
		"$pkgdir"/usr/share/applications/upbge.desktop
	install -D -m644 "$srcdir"/upbge/release/freedesktop/icons/scalable/apps/upbge.svg \
		"$pkgdir"/usr/share/icons/hicolor/scalable/apps/upbge,svg

	if [ -e "$pkgdir"/usr/share/upbge/*/scripts/addons/cycles/lib/ ] ; then
		# make sure the cuda kernels are not stripped
		chmod 444 "$pkgdir"/usr/share/upbge/*/scripts/addons/cycles/lib/*
	fi
}