summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO75
-rw-r--r--Cleanup-use-PyImport_GetModuleDict.patch131
-rw-r--r--PKGBUILD223
-rw-r--r--SelectCudaComputeArch.patch9
-rw-r--r--addon_path.patch64
-rw-r--r--blender-fracture_modifier.desktop14
-rw-r--r--blender.install14
-rw-r--r--gcc9.patch53
-rw-r--r--oiio-2.0.patch298
-rw-r--r--opencolorio1.patch48
-rw-r--r--openexr3.patch57
-rw-r--r--openvdb7.patch29
-rw-r--r--openvdb8.patch16
-rw-r--r--osl19x.patch399
-rw-r--r--python3.8.patch73
-rw-r--r--python3.9.patch141
-rw-r--r--python3.9_2.patch23
-rw-r--r--version.patch17
18 files changed, 1515 insertions, 169 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 1c8096709317..a82c80910234 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,31 +1,29 @@
pkgbase = blender-fracture_modifier-git
pkgdesc = Development version of Blenders fracture_modifier branch
- pkgver = v2.79b.r2154.gc8d6bba3cce
+ pkgver = 2.79.r70679.g32fef3040fe
pkgrel = 1
- url = http://blender.org/
- install = blender.install
+ url = https://blender.org/
arch = i686
arch = x86_64
license = GPL
+ makedepends = ninja
makedepends = git
makedepends = cmake
makedepends = boost
makedepends = mesa
makedepends = llvm
depends = alembic
- depends = openjpeg
- depends = python-numpy
depends = libgl
depends = python
- depends = desktop-file-utils
- depends = hicolor-icon-theme
+ depends = python-numpy
+ depends = openjpeg2
depends = ffmpeg
depends = fftw
depends = openal
depends = freetype2
depends = libxi
depends = openimageio
- depends = opencolorio
+ depends = opencolorio1
depends = openvdb
depends = opencollada
depends = opensubdiv
@@ -35,32 +33,51 @@ pkgbase = blender-fracture_modifier-git
optdepends = cuda: CUDA support in Cycles
provides = blender-fracture_modifier
conflicts = blender-fracture_modifier
- source = git://git.blender.org/blender.git#branch=fracture_modifier
- source = blender-addons.git::git://git.blender.org/blender-addons.git
- source = blender-addons-contrib.git::git://git.blender.org/blender-addons-contrib.git
- source = blender-translations.git::git://git.blender.org/blender-translations.git
- source = blender-dev-tools.git::git://git.blender.org/blender-dev-tools.git
+ source = blender::git+https://github.com/blender/blender#branch=fracture_modifier
+ source = blender-addons::git+https://github.com/blender/blender-addons
+ source = blender-addons-contrib::git+https://github.com/blender/blender-addons-contrib
+ source = blender-translations::git+https://github.com/blender/blender-translations
+ source = blender-dev-tools::git+https://github.com/blender/blender-dev-tools
source = git+https://github.com/scorpion81/blender-fracture-helper.git
- source = blender-fracture_modifier.desktop
source = SelectCudaComputeArch.patch
source = gcc8.patch
- source = version.patch
+ source = gcc9.patch
source = ffmpeg.patch
source = openvdb.patch
source = collada1668.patch
- md5sums = SKIP
- md5sums = SKIP
- md5sums = SKIP
- md5sums = SKIP
- md5sums = SKIP
- md5sums = SKIP
- md5sums = 0a4847775c9eec16a76ec7d3a03a678d
- md5sums = 9454ff7e994f72ead5027356e227cbd2
- md5sums = df6f12c3327678b0a05f9e48e9ace67c
- md5sums = 975cef0e17c77517ed8727701abc8a0c
- md5sums = bb325c8c879d677ad1f1c54797268716
- md5sums = fe709e616e52c1acc47c1cc0f77c2694
- md5sums = 4e4423315f07bc724c7703c57c4481d7
+ source = oiio-2.0.patch
+ source = Cleanup-use-PyImport_GetModuleDict.patch
+ source = python3.8.patch
+ source = addon_path.patch
+ source = python3.9.patch
+ source = python3.9_2.patch
+ source = openvdb7.patch
+ source = openvdb8.patch
+ source = openexr3.patch
+ source = opencolorio1.patch
+ source = osl19x.patch
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = 39ab45862044a838e49720c93ef5d246c3192e1438bf3ceca169e3ed0439ea18
+ sha256sums = 6093024b0a27f1fd144f5f8a25121939f74f41bcc164d8b8b58f33d3c364e456
+ sha256sums = ec95ba11ef9f41ca3123b330f25ab767f7916531f39943b4f92f28f36e1e0725
+ sha256sums = 450a3ec68360981e47503e734e8229a4ad06554ad009664b4abfb6bf317962d9
+ sha256sums = e22d5908877165958991161c6800dac9f8810e2d92fb18c6fe09fe1a24e5d18c
+ sha256sums = ba390c37ea5a63e603c97350f9401fe1794c54406243a48f860195cc0c6085ab
+ sha256sums = 5ff48d0e35025f21ee45274b56d1788b2e1768fa4d86b5032a40941057695176
+ sha256sums = f4fea95b9d27fb5c30a13cd57ae22d8f3091d456719377e28572091793e941c2
+ sha256sums = 229853b98bb62e1dec835aea6b2eab4c3dabbc8be591206573a3c1b85f10be59
+ sha256sums = 350063cd4f234565bd928a356b4e5f65cf37fc1377904a08bf60f7010c88740b
+ sha256sums = d106248d55045f5ef913bf6243ad74a76f6282264d9ee4c9b87ec4a3d2e2064b
+ sha256sums = b2a2bc5de8d3b730e49d1f50cb025c1dfdbcb66c58ead573322585b6a887d3a7
+ sha256sums = c4079c4c142516d9cd476f5a3cafddf4068f0950c3c11ea4da9cf999c5ccc1f9
+ sha256sums = edfd784f8497417660c0b9fdc97893fd0d77764d0bc10f4cb92a9082f41bae75
+ sha256sums = 8e28b28679c67ce589558468d5d912321b345dbbe46c80b359a1a38417ba2ed2
+ sha256sums = b998efa375b868e3beeba54fe070fa73256663f23a86668a04f34ceb626c65ac
+ sha256sums = 1f5f9cfc3e19c5a2e358a8de1c690e1d94dc24b63eecd76fa156f69e6cdd2edd
pkgname = blender-fracture_modifier-git
-
diff --git a/Cleanup-use-PyImport_GetModuleDict.patch b/Cleanup-use-PyImport_GetModuleDict.patch
new file mode 100644
index 000000000000..3a4bee890eb6
--- /dev/null
+++ b/Cleanup-use-PyImport_GetModuleDict.patch
@@ -0,0 +1,131 @@
+From 44f719b63238503ef8f933f55383c6d4798995cc Mon Sep 17 00:00:00 2001
+From: Campbell Barton <ideasman42@gmail.com>
+Date: Thu, 13 Sep 2018 17:06:07 +1000
+Subject: [PATCH] Cleanup: use PyImport_GetModuleDict
+
+Replace direct access using PyThreadState_GET
+---
+ source/blender/python/bmesh/bmesh_py_api.c | 2 +-
+ source/blender/python/generic/idprop_py_api.c | 2 +-
+ source/blender/python/intern/bpy_interface.c | 2 +-
+ source/blender/python/intern/gpu.c | 4 ++--
+ source/blender/python/mathutils/mathutils.c | 2 +-
+ source/blender/python/mathutils/mathutils_noise.c | 5 +++--
+ source/gameengine/Ketsji/KX_PythonInit.cpp | 2 +-
+ 7 files changed, 10 insertions(+), 9 deletions(-)
+
+diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c
+index d5973baeadb..d7324eabb6c 100644
+--- a/source/blender/python/bmesh/bmesh_py_api.c
++++ b/source/blender/python/bmesh/bmesh_py_api.c
+@@ -196,7 +196,7 @@ PyObject *BPyInit_bmesh(void)
+ {
+ PyObject *mod;
+ PyObject *submodule;
+- PyObject *sys_modules = PyThreadState_GET()->interp->modules;
++ PyObject *sys_modules = PyImport_GetModuleDict();
+
+ BPy_BM_init_types();
+ BPy_BM_init_types_select();
+diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
+index 4d4d5232800..8bed0f28cba 100644
+--- a/source/blender/python/generic/idprop_py_api.c
++++ b/source/blender/python/generic/idprop_py_api.c
+@@ -1795,7 +1795,7 @@ PyObject *BPyInit_idprop(void)
+ {
+ PyObject *mod;
+ PyObject *submodule;
+- PyObject *sys_modules = PyThreadState_GET()->interp->modules;
++ PyObject *sys_modules = PyImport_GetModuleDict();
+
+ mod = PyModule_Create(&IDProp_module_def);
+
+diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
+index 7ca087e4993..123c938b921 100644
+--- a/source/blender/python/intern/bpy_interface.c
++++ b/source/blender/python/intern/bpy_interface.c
+@@ -537,7 +537,7 @@ static bool python_script_exec(
+
+ if (py_dict) {
+ #ifdef PYMODULE_CLEAR_WORKAROUND
+- PyModuleObject *mmod = (PyModuleObject *)PyDict_GetItemString(PyThreadState_GET()->interp->modules, "__main__");
++ PyModuleObject *mmod = (PyModuleObject *)PyDict_GetItemString(PyImport_GetModuleDict(), "__main__");
+ PyObject *dict_back = mmod->md_dict;
+ /* freeing the module will clear the namespace,
+ * gives problems running classes defined in this namespace being used later. */
+diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c
+index 43796dc9474..d902b6838f4 100644
+--- a/source/blender/python/intern/gpu.c
++++ b/source/blender/python/intern/gpu.c
+@@ -326,7 +326,7 @@ PyObject *GPU_initPython(void)
+ {
+ PyObject *module;
+ PyObject *submodule;
+- PyObject *sys_modules = PyThreadState_GET()->interp->modules;
++ PyObject *sys_modules = PyImport_GetModuleDict();
+
+ module = PyInit_gpu();
+
+@@ -337,6 +337,6 @@ PyObject *GPU_initPython(void)
+ PyDict_SetItem(sys_modules, PyModule_GetNameObject(submodule), submodule);
+ Py_INCREF(submodule);
+
+- PyDict_SetItem(PyImport_GetModuleDict(), PyModule_GetNameObject(module), module);
++ PyDict_SetItem(sys_modules, PyModule_GetNameObject(module), module);
+ return module;
+ }
+diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
+index a3a4e7f313b..f021d456b3a 100644
+--- a/source/blender/python/mathutils/mathutils.c
++++ b/source/blender/python/mathutils/mathutils.c
+@@ -615,7 +615,7 @@ PyMODINIT_FUNC PyInit_mathutils(void)
+ {
+ PyObject *mod;
+ PyObject *submodule;
+- PyObject *sys_modules = PyThreadState_GET()->interp->modules;
++ PyObject *sys_modules = PyImport_GetModuleDict();
+
+ if (PyType_Ready(&vector_Type) < 0)
+ return NULL;
+diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c
+index 839d1ffc588..834322c0aed 100644
+--- a/source/blender/python/mathutils/mathutils_noise.c
++++ b/source/blender/python/mathutils/mathutils_noise.c
+@@ -845,6 +845,7 @@ static struct PyModuleDef M_Noise_module_def = {
+ /*----------------------------MODULE INIT-------------------------*/
+ PyMODINIT_FUNC PyInit_mathutils_noise(void)
+ {
++ PyObject *sys_modules = PyImport_GetModuleDict();
+ PyObject *submodule = PyModule_Create(&M_Noise_module_def);
+ PyObject *item_types, *item_metrics;
+
+@@ -852,11 +853,11 @@ PyMODINIT_FUNC PyInit_mathutils_noise(void)
+ setRndSeed(0);
+
+ PyModule_AddObject(submodule, "types", (item_types = PyInit_mathutils_noise_types()));
+- PyDict_SetItemString(PyThreadState_GET()->interp->modules, "noise.types", item_types);
++ PyDict_SetItemString(sys_modules, "noise.types", item_types);
+ Py_INCREF(item_types);
+
+ PyModule_AddObject(submodule, "distance_metrics", (item_metrics = PyInit_mathutils_noise_metrics()));
+- PyDict_SetItemString(PyThreadState_GET()->interp->modules, "noise.distance_metrics", item_metrics);
++ PyDict_SetItemString(sys_modules, "noise.distance_metrics", item_metrics);
+ Py_INCREF(item_metrics);
+
+ return submodule;
+diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
+index 251273cf7a8..9611a4ea49b 100644
+--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
++++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
+@@ -2234,7 +2234,7 @@ PyMODINIT_FUNC initBGE(void)
+ {
+ PyObject *mod;
+ PyObject *submodule;
+- PyObject *sys_modules = PyThreadState_GET()->interp->modules;
++ PyObject *sys_modules = PyImport_GetModuleDict();
+ const char *mod_full;
+
+ mod = PyModule_Create(&BGE_module_def);
+--
+2.25.0
+
diff --git a/PKGBUILD b/PKGBUILD
index c067184b1ff8..507a6c95bf90 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,96 +1,132 @@
# Maintainer : bartus <arch-user-repoᘓbartus.33mail.com>
+# shellcheck disable=SC2034,SC2154 # allow unused/unset variables
+# shellcheck disable=SC2191 # preserve current _CMAKE_FLAGS initialization.
+# Configuration.
_branch="fracture_modifier"
-_sufix=${_branch}
-_blenver=2.81
-_fragment="#branch=${_branch}"
-pkgname=blender-${_sufix}-git
-pkgver=v2.79b.r2154.gc8d6bba3cce
+_fragment=${FRAGMENT:-#branch=${_branch}}
+[[ -v CUDA_ARCH ]] && _cuda_capability=${CUDA_ARCH}
+_suffix=${_branch}
+
+#some extra, unofficially supported stuff goes here:
+((TRAVIS)) && _cuda_capability+=(sm_50 sm_52 sm_60 sm_61 sm_70 sm_75) # Travis memory limit is not enough to build for arch 3.x.
+((DISABLE_NINJA)) || makedepends+=('ninja')
+#shellcheck disable=SC2015
+((DISABLE_CUDA)) && optdepends+=('cuda: CUDA support in Cycles') || makedepends+=('cuda')
+
+pkgname=blender-${_suffix}-git
+pkgver=2.79.r70679.g32fef3040fe
+_blenver=${pkgver:0:4}
pkgrel=1
pkgdesc="Development version of Blenders ${_branch} branch"
arch=('i686' 'x86_64')
-url="http://blender.org/"
-depends=('alembic' 'openjpeg' 'python-numpy' 'libgl' 'python' 'desktop-file-utils' 'hicolor-icon-theme'
- 'ffmpeg' 'fftw' 'openal' 'freetype2' 'libxi' 'openimageio' 'opencolorio'
+url="https://blender.org/"
+depends+=('alembic' 'libgl' 'python' 'python-numpy' 'openjpeg2'
+ 'ffmpeg' 'fftw' 'openal' 'freetype2' 'libxi' 'openimageio' 'opencolorio1'
'openvdb' 'opencollada' 'opensubdiv' 'openshadinglanguage' 'libtiff' 'libpng')
-optdepends=('cuda: CUDA support in Cycles')
-makedepends=('git' 'cmake' 'boost' 'mesa' 'llvm')
-provides=('blender-fracture_modifier')
-conflicts=('blender-fracture_modifier')
-#options=(!makeflags)
+makedepends+=('git' 'cmake' 'boost' 'mesa' 'llvm')
+provides=("blender-${_suffix}")
+conflicts=("blender-${_suffix}")
license=('GPL')
-install=blender.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://git.blender.org/blender.git${_fragment}" \
- 'blender-addons.git::git://git.blender.org/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' \
- 'git+https://github.com/scorpion81/blender-fracture-helper.git' \
- blender-fracture_modifier.desktop \
- SelectCudaComputeArch.patch \
- gcc8.patch \
- version.patch \
- ffmpeg.patch \
- openvdb.patch \
- collada1668.patch \
+source=("blender::git+https://github.com/blender/blender${_fragment}"
+ 'blender-addons::git+https://github.com/blender/blender-addons'
+ 'blender-addons-contrib::git+https://github.com/blender/blender-addons-contrib'
+ 'blender-translations::git+https://github.com/blender/blender-translations'
+ 'blender-dev-tools::git+https://github.com/blender/blender-dev-tools'
+ 'git+https://github.com/scorpion81/blender-fracture-helper.git'
+ SelectCudaComputeArch.patch
+ gcc8.patch
+ gcc9.patch
+ ffmpeg.patch
+ openvdb.patch
+ collada1668.patch
+ oiio-2.0.patch
+ Cleanup-use-PyImport_GetModuleDict.patch
+ python3.8.patch
+ addon_path.patch
+ 'python3.9.patch' # ::https://git.blender.org/gitweb/gitweb.cgi/blender.git/patch/56d0df51a36fdce7ec2d1fbb7b47b1d95b591b5f
+ 'python3.9_2.patch' # ::https://git.blender.org/gitweb/gitweb.cgi/blender.git/patch/5edba9b42f684bf8b99894bb6988e7f46180e12c
+ openvdb7.patch
+ openvdb8.patch # ::https://git.blender.org/gitweb/gitweb.cgi/blender.git/patch/37889011070ff2ec52159690f652238d2b325185
+ openexr3.patch
+ opencolorio1.patch
+ osl19x.patch
)
-md5sums=('SKIP'
- 'SKIP'
- 'SKIP'
- 'SKIP'
- 'SKIP'
- 'SKIP'
- '0a4847775c9eec16a76ec7d3a03a678d'
- '9454ff7e994f72ead5027356e227cbd2'
- 'df6f12c3327678b0a05f9e48e9ace67c'
- '975cef0e17c77517ed8727701abc8a0c'
- 'bb325c8c879d677ad1f1c54797268716'
- 'fe709e616e52c1acc47c1cc0f77c2694'
- '4e4423315f07bc724c7703c57c4481d7')
-
-# 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
+sha256sums=('SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ '39ab45862044a838e49720c93ef5d246c3192e1438bf3ceca169e3ed0439ea18'
+ '6093024b0a27f1fd144f5f8a25121939f74f41bcc164d8b8b58f33d3c364e456'
+ 'ec95ba11ef9f41ca3123b330f25ab767f7916531f39943b4f92f28f36e1e0725'
+ '450a3ec68360981e47503e734e8229a4ad06554ad009664b4abfb6bf317962d9'
+ 'e22d5908877165958991161c6800dac9f8810e2d92fb18c6fe09fe1a24e5d18c'
+ 'ba390c37ea5a63e603c97350f9401fe1794c54406243a48f860195cc0c6085ab'
+ '5ff48d0e35025f21ee45274b56d1788b2e1768fa4d86b5032a40941057695176'
+ 'f4fea95b9d27fb5c30a13cd57ae22d8f3091d456719377e28572091793e941c2'
+ '229853b98bb62e1dec835aea6b2eab4c3dabbc8be591206573a3c1b85f10be59'
+ '350063cd4f234565bd928a356b4e5f65cf37fc1377904a08bf60f7010c88740b'
+ 'd106248d55045f5ef913bf6243ad74a76f6282264d9ee4c9b87ec4a3d2e2064b'
+ 'b2a2bc5de8d3b730e49d1f50cb025c1dfdbcb66c58ead573322585b6a887d3a7'
+ 'c4079c4c142516d9cd476f5a3cafddf4068f0950c3c11ea4da9cf999c5ccc1f9'
+ 'edfd784f8497417660c0b9fdc97893fd0d77764d0bc10f4cb92a9082f41bae75'
+ '8e28b28679c67ce589558468d5d912321b345dbbe46c80b359a1a38417ba2ed2'
+ 'b998efa375b868e3beeba54fe070fa73256663f23a86668a04f34ceb626c65ac'
+ '1f5f9cfc3e19c5a2e358a8de1c690e1d94dc24b63eecd76fa156f69e6cdd2edd')
pkgver() {
- cd "$srcdir/blender"
- git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
+ blender_version=$(grep -Po "BLENDER_VERSION\s+\K[0-9]{3}" "$srcdir"/blender/source/blender/blenkernel/BKE_blender_version.h)
+ printf "%d.%d.r%s.g%s" \
+ $((blender_version/100)) \
+ $((blender_version%100)) \
+ "$(git -C "$srcdir/blender" rev-list --count HEAD)" \
+ "$(git -C "$srcdir/blender" rev-parse --short HEAD)"
}
prepare() {
cd "$srcdir/blender"
# update the submodules
- git submodule update --init --recursive --remote
-# git submodule foreach git checkout master
-# git submodule foreach git pull --rebase origin master
- git apply -v ${srcdir}/SelectCudaComputeArch.patch
- git apply -v ${srcdir}/gcc8.patch
- git apply -v ${srcdir}/ffmpeg.patch
- git apply -v ${srcdir}/openvdb.patch
- git apply -v ${srcdir}/version.patch
- git apply -v ${srcdir}/collada1668.patch
+ git -C "$srcdir/blender" -c protocol.file.allow=always submodule update --init --recursive --remote
+ if [ ! -v _cuda_capability ] && grep -q nvidia <(lsmod); then
+ git -C "$srcdir/blender" apply -v "${srcdir}"/SelectCudaComputeArch.patch
+ fi
+ if [[ -v _suffix ]]; then
+ git apply -v <(sed "s/@@_suffix@@/${_suffix}/g" "${srcdir}/addon_path.patch")
+ fi
+ git -C "$srcdir/blender" apply -v "${srcdir}"/{gcc{8,9},ffmpeg,openvdb{,7,8},collada1668,oiio-2.0,Cleanup-use-PyImport_GetModuleDict,open{exr3,colorio1},osl19x}.patch
+ git -C "$srcdir/blender" apply -v "${srcdir}"/python3.{8,9,9_2}.patch
}
build() {
- mkdir -p "$srcdir/blender-build"
- cd "$srcdir/blender-build"
-
_pyver=$(python -c "from sys import version_info; print(\"%d.%d\" % (version_info[0],version_info[1]))")
msg "python version detected: ${_pyver}"
- export CFLAGS="${CFLAGS} -DOPENVDB_3_ABI_COMPATIBLE"
- export CXXFLAGS="${CXXFLAGS} -DOPENVDB_3_ABI_COMPATIBLE"
+ # determine whether we can precompile CUDA kernels
+ _CUDA_PKG=$(pacman -Qq cuda 2>/dev/null) || true
+ if [ "$_CUDA_PKG" != "" ] && ! ((DISABLE_CUDA)) ; then
+ _CMAKE_FLAGS+=( -DWITH_CYCLES_CUDA_BINARIES=ON
+ -DCUDA_TOOLKIT_ROOT_DIR=/opt/cuda )
+ if [[ -v _cuda_capability ]]; then
+ _CMAKE_FLAGS+=( -DCYCLES_CUDA_BINARIES_ARCH="$(IFS=';'; echo "${_cuda_capability[*]}";)" )
+ fi
+ [ -f "/usr/lib/ccache/bin/nvcc-ccache" ] && _CMAKE_FLAGS+=( -DCUDA_NVCC_EXECUTABLE=/usr/lib/ccache/bin/nvcc-ccache )
+ if _cuda_gcc=$(basename "$(readlink /opt/cuda/bin/gcc)") ; then
+ [ -L "/usr/lib/ccache/bin/$_cuda_gcc" ] && _CMAKE_FLAGS+=( -DCUDA_HOST_COMPILER=/usr/lib/ccache/bin/"$_cuda_gcc" )
+ fi
+ fi
- cmake "$srcdir/blender" \
+ ((DISABLE_NINJA)) && generator="Unix Makefiles" || generator="Ninja"
+ cmake -G "$generator" -S "$srcdir/blender" -B "$srcdir/build" \
+ -C "${srcdir}/blender/build_files/cmake/config/blender_release.cmake" \
-DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_BUILD_TYPE=Release \
-DWITH_INSTALL_PORTABLE=OFF \
-DWITH_PLAYER=OFF \
-DWITH_ALEMBIC=ON \
@@ -99,7 +135,7 @@ build() {
-DWITH_SYSTEM_GLEW=ON \
-DWITH_CODEC_FFMPEG=ON \
-DWITH_PYTHON_INSTALL=OFF \
- -DPYTHON_VERSION=${_pyver} \
+ -DPYTHON_VERSION="${_pyver}" \
-DWITH_MOD_OCEANSIM=ON \
-DWITH_CYCLES_OPENSUBDIV=ON \
-DWITH_CYCLES_OSL=ON \
@@ -109,42 +145,47 @@ build() {
-DWITH_OPENVDB=ON \
-DWITH_OPENVDB_BLOSC=ON \
-DWITH_OPENCOLLADA=ON \
- $_EXTRAOPTS
- make
+ "${_CMAKE_FLAGS[@]}"
+ export NINJA_STATUS="[%p | %f<%r<%u | %cbps ] "
+# shellcheck disable=SC2086 # allow MAKEFLAGS to split when multiple flags provided.
+ if ((DISABLE_NINJA)); then make -C "$srcdir/build" ; else ninja -C "$srcdir/build" ${MAKEFLAGS:--j1}; fi
}
package() {
- cd "$srcdir/blender-build"
- make DESTDIR="$pkgdir" install
+ export DESTDIR="$pkgdir"
+ if ((DISABLE_NINJA)); then make -C "$srcdir/build" install; else ninja -C "$srcdir/build" install; fi
+ msg "install fracture-helper addon"
+ install -Dm644 "${srcdir}"/blender-fracture-helper/*.py "${pkgdir}/usr/share/blender/${_blenver}_${_suffix}/scripts/addons/"
- msg "install fracture-helper addon"
- install ${srcdir}/blender-fracture-helper/*.py ${pkgdir}/usr/share/blender/${_blenver}/scripts/addons/
+ if [[ -v _suffix ]]; then
+ msg "add -${_suffix} suffix to desktop shortcut"
+ sed -i "s/=blender/=blender-${_suffix}/g" "${pkgdir}/usr/share/applications/blender.desktop"
+ sed -i "s/=Blender/=Blender-${_suffix}/g" "${pkgdir}/usr/share/applications/blender.desktop"
+ mv "${pkgdir}/usr/share/applications/blender.desktop" "${pkgdir}/usr/share/applications/blender-${_suffix}.desktop"
- msg "add -${_sufix} sufix to desktop shortcut"
- sed -i "s/=blender/=blender-${_sufix}/g" ${pkgdir}/usr/share/applications/blender.desktop
- sed -i "s/=Blender/=Blender-${_sufix}/g" ${pkgdir}/usr/share/applications/blender.desktop
- mv ${pkgdir}/usr/share/applications/blender.desktop ${pkgdir}/usr/share/applications/blender-${_sufix}.desktop
+ msg "add -${_suffix} suffix to binaries"
+ mv "${pkgdir}/usr/bin/blender" "${pkgdir}/usr/bin/blender-${_suffix}"
+ mv "${pkgdir}/usr/bin/blender-thumbnailer.py" "${pkgdir}/usr/bin/blender-${_suffix}-thumbnailer.py"
- msg "add -${_sufix} sufix to binaries"
- mv ${pkgdir}/usr/bin/blender ${pkgdir}/usr/bin/blender-${_sufix}
- mv ${pkgdir}/usr/bin/blender-thumbnailer.py ${pkgdir}/usr/bin/blender-${_sufix}-thumbnailer.py
-# mv ${pkgdir}/usr/bin/blenderplayer ${pkgdir}/usr/bin/blenderplayer-${_sufix}
+ msg "mv doc/blender to doc/blender-${_suffix}"
+ mv "${pkgdir}/usr/share/doc/blender" "${pkgdir}/usr/share/doc/blender-${_suffix}"
- msg "mv doc/blender to doc/blender-${_sufix}"
- mv ${pkgdir}/usr/share/doc/blender ${pkgdir}/usr/share/doc/blender-${_sufix}
+ msg "add -${_suffix} suffix to man page"
+ mv "${pkgdir}/usr/share/man/man1/blender.1" "${pkgdir}/usr/share/man/man1/blender-${_suffix}.1"
- msg "add -${_sufix} sufix to all icons"
- for icon in `find ${pkgdir}/usr/share/icons -type f`
- do
- # ${filename##/*.} extra extenssion from path
- # ${filename%.*} extract filename form path
- # look at bash "manipulatin string"
- mv $icon ${icon%.*}-${_sufix}.${icon##/*.}
- done
+ msg "add -${_suffix} suffix to all icons"
+ while read -r icon
+ do
+ # ${filename##/*.} extra extenssion from path
+ # ${filename%.*} extract filename form path
+ # look at bash "manipulatin string"
+ mv "$icon" "${icon%.*}-${_suffix}.${icon##/*.}"
+ done < <(find "${pkgdir}/usr/share/icons" -type f)
+ fi
- if [ -e "$pkgdir"/usr/share/blender/*/scripts/addons/cycles/lib/ ] ; then
+ if [[ -e "$pkgdir/usr/share/blender/${_blenver}${_suffix:+_$_suffix}/scripts/addons/cycles/lib/" ]] ; then
# make sure the cuda kernels are not stripped
- chmod 444 "$pkgdir"/usr/share/blender/*/scripts/addons/cycles/lib/*
+ chmod 444 "$pkgdir"/usr/share/blender/${_blenver}${_suffix:+_$_suffix}/scripts/addons/cycles/lib/*
fi
}
# vim:set sw=2 ts=2 et:
diff --git a/SelectCudaComputeArch.patch b/SelectCudaComputeArch.patch
index 540d50f0bcc3..229e6bc7e2c9 100644
--- a/SelectCudaComputeArch.patch
+++ b/SelectCudaComputeArch.patch
@@ -1,15 +1,16 @@
diff --git a/intern/cycles/cmake/external_libs.cmake b/intern/cycles/cmake/external_libs.cmake
-index 8d04025e6fd..a6949c99f60 100644
+index 5bf681792ca..b975fb5db14 100644
--- a/intern/cycles/cmake/external_libs.cmake
+++ b/intern/cycles/cmake/external_libs.cmake
-@@ -41,6 +41,10 @@ if(WITH_CYCLES_CUDA_BINARIES OR NOT WITH_CUDA_DYNLOAD)
+@@ -41,6 +41,11 @@ if(WITH_CYCLES_CUDA_BINARIES OR NOT WITH_CUDA_DYNLOAD)
find_package(CUDA) # Try to auto locate CUDA toolkit
if(CUDA_FOUND)
message(STATUS "CUDA nvcc = ${CUDA_NVCC_EXECUTABLE}")
+ CUDA_SELECT_NVCC_ARCH_FLAGS(CUDA_ARCH_FLAGS Auto)
-+ set(CYCLES_CUDA_BINARIES_ARCH "${CUDA_ARCH_FLAGS_readable}")
++ string(REGEX REPLACE " compute_[0-9]+" "" CYCLES_CUDA_BINARIES_ARCH "${CUDA_ARCH_FLAGS_readable}")
++ string(REGEX REPLACE " " ";" CYCLES_CUDA_BINARIES_ARCH "${CYCLES_CUDA_BINARIES_ARCH}")
+ message(STATUS "Enabling CUDA support (version: ${CUDA_VERSION_STRING},"
-+ " archs: ${CUDA_ARCH_FLAGS_readable})")
++ " archs: ${CYCLES_CUDA_BINARIES_ARCH})")
else()
message(STATUS "CUDA compiler not found, disabling WITH_CYCLES_CUDA_BINARIES")
set(WITH_CYCLES_CUDA_BINARIES OFF)
diff --git a/addon_path.patch b/addon_path.patch
new file mode 100644
index 000000000000..65df639ffaa1
--- /dev/null
+++ b/addon_path.patch
@@ -0,0 +1,64 @@
+diff --git a/intern/ghost/intern/GHOST_SystemPathsUnix.cpp b/intern/ghost/intern/GHOST_SystemPathsUnix.cpp
+index 8fd6aee28da..99d61882451 100644
+--- a/intern/ghost/intern/GHOST_SystemPathsUnix.cpp
++++ b/intern/ghost/intern/GHOST_SystemPathsUnix.cpp
+@@ -56,7 +56,7 @@ const GHOST_TUns8 *GHOST_SystemPathsUnix::getSystemDir(int, const char *versions
+ {
+ /* no prefix assumes a portable build which only uses bundled scripts */
+ if (static_path) {
+- static string system_path = string(static_path) + "/blender/" + versionstr;
++ static string system_path = string(static_path) + "/blender/" + versionstr + "_@@_suffix@@";
+ return (GHOST_TUns8 *)system_path.c_str();
+ }
+
+@@ -77,7 +77,7 @@ const GHOST_TUns8 *GHOST_SystemPathsUnix::getUserDir(int version, const char *ve
+ last_version = version;
+
+ if (home) {
+- user_path = string(home) + "/.blender/" + versionstr;
++ user_path = string(home) + "/.blender/" + versionstr + "_@@_suffix@@";
+ }
+ else {
+ return NULL;
+@@ -92,7 +92,7 @@ const GHOST_TUns8 *GHOST_SystemPathsUnix::getUserDir(int version, const char *ve
+ last_version = version;
+
+ if (home) {
+- user_path = string(home) + "/blender/" + versionstr;
++ user_path = string(home) + "/blender/" + versionstr + "_@@_suffix@@";
+ }
+ else {
+ home = getenv("HOME");
+@@ -100,7 +100,7 @@ const GHOST_TUns8 *GHOST_SystemPathsUnix::getUserDir(int version, const char *ve
+ if (home == NULL)
+ home = getpwuid(getuid())->pw_dir;
+
+- user_path = string(home) + "/.config/blender/" + versionstr;
++ user_path = string(home) + "/.config/blender/" + versionstr + "_@@_suffix@@";
+ }
+ }
+
+diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
+index 8fb04c320a0..3102752ec97 100644
+--- a/source/creator/CMakeLists.txt
++++ b/source/creator/CMakeLists.txt
+@@ -303,15 +303,15 @@ endif()
+ if(UNIX AND NOT APPLE)
+ if(WITH_PYTHON_MODULE)
+ if(WITH_INSTALL_PORTABLE)
+- set(TARGETDIR_VER ${BLENDER_VERSION})
++ set(TARGETDIR_VER ${BLENDER_VERSION}_@@_suffix@@)
+ else()
+- set(TARGETDIR_VER ${PYTHON_SITE_PACKAGES}/${BLENDER_VERSION})
++ set(TARGETDIR_VER ${PYTHON_SITE_PACKAGES}/${BLENDER_VERSION}_@@_suffix@@)
+ endif()
+ else()
+ if(WITH_INSTALL_PORTABLE)
+- set(TARGETDIR_VER ${BLENDER_VERSION})
++ set(TARGETDIR_VER ${BLENDER_VERSION}_@@_suffix@@)
+ else()
+- set(TARGETDIR_VER share/blender/${BLENDER_VERSION})
++ set(TARGETDIR_VER share/blender/${BLENDER_VERSION}_@@_suffix@@)
+ endif()
+ endif()
+
diff --git a/blender-fracture_modifier.desktop b/blender-fracture_modifier.desktop
deleted file mode 100644
index 4a5bf6b3d9d0..000000000000
--- a/blender-fracture_modifier.desktop
+++ /dev/null
@@ -1,14 +0,0 @@
-[Desktop Entry]
-Name=Blender-fracture_modifier
-Comment=A 3D program
-Comment[cs]=Program pro 3D modeling a animaci
-Comment[es]=Un programa de 3D
-Comment[no]=Et 3d-program
-Comment[da]=Et program til 3d-modelering
-Exec=blender-fracture_modifier
-Icon=blender-fracture_modifier
-Terminal=false
-X-MultipleArgs=false
-Type=Application
-Categories=Graphics;3DGraphics;
-MimeType=application/blender;application/x-blender;
diff --git a/blender.install b/blender.install
deleted file mode 100644
index d061748130f3..000000000000
--- a/blender.install
+++ /dev/null
@@ -1,14 +0,0 @@
-
-post_install() {
- update-desktop-database -q
- gtk-update-icon-cache -qf /usr/share/icons/hicolor/
-}
-
-post_upgrade() {
- post_install $1
-}
-
-post_remove() {
- post_install $1
-}
-
diff --git a/gcc9.patch b/gcc9.patch
new file mode 100644
index 000000000000..d538a026205f
--- /dev/null
+++ b/gcc9.patch
@@ -0,0 +1,53 @@
+commit e6d803fd4a383cecf8c643095f093a31c944b785
+Author: Robert-André Mauchin <zebob.m@gmail.com>
+Date: Wed Apr 3 01:36:52 2019 +0200
+
+ Fix for GCC9 new OpenMP data sharing
+
+ GCC 9 started implementing the OpenMP 4.0 and later behavior. When not using
+ default clause or when using default(shared), this makes no difference, but
+ if using default(none), previously the choice was not specify the const
+ qualified variables on the construct at all, or specify in firstprivate
+ clause. In GCC 9 as well as for OpenMP 4.0 compliance, those variables need
+ to be specified on constructs in which they are used, either in shared or
+ in firstprivate clause. Specifying them in firstprivate clause is one way to
+ achieve compatibility with both older GCC versions and GCC 9,
+ another option is to drop the default(none) clause.
+
+ This patch thus drops the default(none) clause.
+
+ See https://gcc.gnu.org/gcc-9/porting_to.html#ompdatasharing
+
+ Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>
+
+diff --git a/intern/elbeem/intern/solver_main.cpp b/intern/elbeem/intern/solver_main.cpp
+index 68f7c04cd54..514087b6130 100644
+--- a/intern/elbeem/intern/solver_main.cpp
++++ b/intern/elbeem/intern/solver_main.cpp
+@@ -381,7 +381,7 @@ LbmFsgrSolver::mainLoop(const int lev)
+ GRID_REGION_INIT();
+ #if PARALLEL==1
+ const int gDebugLevel = ::gDebugLevel;
+-#pragma omp parallel default(none) num_threads(mNumOMPThreads) \
++#pragma omp parallel num_threads(mNumOMPThreads) \
+ reduction(+: \
+ calcCurrentMass,calcCurrentVolume, \
+ calcCellsFilled,calcCellsEmptied, \
+@@ -1126,7 +1126,7 @@ LbmFsgrSolver::preinitGrids()
+ GRID_REGION_INIT();
+ #if PARALLEL==1
+ const int gDebugLevel = ::gDebugLevel;
+-#pragma omp parallel default(none) num_threads(mNumOMPThreads) \
++#pragma omp parallel num_threads(mNumOMPThreads) \
+ reduction(+: \
+ calcCurrentMass,calcCurrentVolume, \
+ calcCellsFilled,calcCellsEmptied, \
+@@ -1164,7 +1164,7 @@ LbmFsgrSolver::standingFluidPreinit()
+ GRID_REGION_INIT();
+ #if PARALLEL==1
+ const int gDebugLevel = ::gDebugLevel;
+-#pragma omp parallel default(none) num_threads(mNumOMPThreads) \
++#pragma omp parallel num_threads(mNumOMPThreads) \
+ reduction(+: \
+ calcCurrentMass,calcCurrentVolume, \
+ calcCellsFilled,calcCellsEmptied, \
diff --git a/oiio-2.0.patch b/oiio-2.0.patch
new file mode 100644
index 000000000000..361ed3164e40
--- /dev/null
+++ b/oiio-2.0.patch
@@ -0,0 +1,298 @@
+From 66d8bfb85c61aafe3bad2edf0e7b4d9d694ee2e7 Mon Sep 17 00:00:00 2001
+From: Sergey Sharybin <sergey.vfx@gmail.com>
+Date: Tue, 11 Dec 2018 12:17:26 +0100
+Subject: [PATCH] Update code to be compatible with OIIO 2.0
+
+There are some changes in API of OpenImageIO, but those are quite
+simple to keep working with older and newer library versions.
+
+Reviewers: brecht
+
+Reviewed By: brecht
+
+Differential Revision: https://developer.blender.org/D4064
+
+Reinstated for fractur_modifer branch by: bartoszek
+---
+ intern/cycles/blender/blender_python.cpp | 2 +-
+ intern/cycles/graph/node_xml.cpp | 2 +-
+ intern/cycles/render/buffers.cpp | 4 +--
+ intern/cycles/render/image.cpp | 15 ++++------
+ intern/cycles/render/image.h | 3 +-
+ intern/cycles/util/util_unique_ptr.h | 28 +++++++++++++++++++
+ .../imbuf/intern/oiio/openimageio_api.cpp | 19 ++++++-------
+ 7 files changed, 48 insertions(+), 25 deletions(-)
+ create mode 100644 intern/cycles/util/util_unique_ptr.h
+
+diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp
+index 54973fd1b7f..bee6dd17812 100644
+--- a/intern/cycles/blender/blender_python.cpp
++++ b/intern/cycles/blender/blender_python.cpp
+@@ -493,7 +493,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
+ socket_type = "NodeSocketString";
+ data_type = BL::NodeSocket::type_STRING;
+ if(param->validdefault)
+- default_string = param->sdefault[0];
++ default_string = param->sdefault[0].string();
+ }
+ else
+ continue;
+diff --git a/intern/cycles/graph/node_xml.cpp b/intern/cycles/graph/node_xml.cpp
+index d26b3b2c2c8..2a2410453ce 100644
+--- a/intern/cycles/graph/node_xml.cpp
++++ b/intern/cycles/graph/node_xml.cpp
+@@ -250,7 +250,7 @@ void xml_read_node(XMLReader& reader, Node *node, xml_node xml_node)
+ }
+ }
+
+- if(node->name)
++ if(!node->name.empty())
+ reader.node_map[node->name] = node;
+ }
+
+diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp
+index cf402c3f214..c96746ba211 100644
+--- a/intern/cycles/render/buffers.cpp
++++ b/intern/cycles/render/buffers.cpp
+@@ -27,6 +27,7 @@
+ #include "util/util_opengl.h"
+ #include "util/util_time.h"
+ #include "util/util_types.h"
++#include "util/util_unique_ptr.h"
+
+ CCL_NAMESPACE_BEGIN
+
+@@ -453,7 +454,7 @@ void DisplayBuffer::write(Device *device, const string& filename)
+ device->pixels_copy_from(rgba, 0, w, h);
+
+ /* write image */
+- ImageOutput *out = ImageOutput::create(filename);
++ unique_ptr<ImageOutput> out(ImageOutput::create(filename));
+ ImageSpec spec(w, h, 4, TypeDesc::UINT8);
+ int scanlinesize = w*4*sizeof(uchar);
+
+@@ -468,7 +469,6 @@ void DisplayBuffer::write(Device *device, const string& filename)
+
+ out->close();
+
+- delete out;
+ }
+
+ device_memory& DisplayBuffer::rgba_data()
+diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
+index 595eb46319a..a143b025194 100644
+--- a/intern/cycles/render/image.cpp
++++ b/intern/cycles/render/image.cpp
+@@ -23,6 +23,7 @@
+ #include "util/util_path.h"
+ #include "util/util_progress.h"
+ #include "util/util_texture.h"
++#include "util/util_unique_ptr.h"
+
+ #ifdef WITH_OSL
+ #include <OSL/oslexec.h>
+@@ -148,7 +149,7 @@ ImageDataType ImageManager::get_image_metadata(const string& filename,
+ return IMAGE_DATA_TYPE_BYTE4;
+ }
+
+- ImageInput *in = ImageInput::create(filename);
++ unique_ptr<ImageInput> in(ImageInput::create(filename));
+
+ if(in) {
+ ImageSpec spec;
+@@ -194,7 +195,6 @@ ImageDataType ImageManager::get_image_metadata(const string& filename,
+ in->close();
+ }
+
+- delete in;
+ }
+
+ if(is_half) {
+@@ -449,7 +449,7 @@ void ImageManager::tag_reload_image(const string& filename,
+ }
+
+ bool ImageManager::file_load_image_generic(Image *img,
+- ImageInput **in,
++ unique_ptr<ImageInput> *in,
+ int &width,
+ int &height,
+ int &depth,
+@@ -465,7 +465,7 @@ bool ImageManager::file_load_image_generic(Image *img,
+ }
+
+ /* load image from file through OIIO */
+- *in = ImageInput::create(img->filename);
++ *in = unique_ptr<ImageInput>(ImageInput::create(img->filename));
+
+ if(!*in)
+ return false;
+@@ -477,8 +477,6 @@ bool ImageManager::file_load_image_generic(Image *img,
+ config.attribute("oiio:UnassociatedAlpha", 1);
+
+ if(!(*in)->open(img->filename, spec, config)) {
+- delete *in;
+- *in = NULL;
+ return false;
+ }
+
+@@ -500,8 +498,6 @@ bool ImageManager::file_load_image_generic(Image *img,
+ if(!(components >= 1 && components <= 4)) {
+ if(*in) {
+ (*in)->close();
+- delete *in;
+- *in = NULL;
+ }
+
+ return false;
+@@ -519,7 +515,7 @@ bool ImageManager::file_load_image(Image *img,
+ device_vector<DeviceType>& tex_img)
+ {
+ const StorageType alpha_one = (FileFormat == TypeDesc::UINT8)? 255 : 1;
+- ImageInput *in = NULL;
++ unique_ptr<ImageInput> in = NULL;
+ int width, height, depth, components;
+ if(!file_load_image_generic(img, &in, width, height, depth, components)) {
+ return false;
+@@ -575,7 +571,6 @@ bool ImageManager::file_load_image(Image *img,
+ }
+ cmyk = strcmp(in->format_name(), "jpeg") == 0 && components == 4;
+ in->close();
+- delete in;
+ }
+ else {
+ if(FileFormat == TypeDesc::FLOAT) {
+diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h
+index db7e28a5e44..f4a14f40aab 100644
+--- a/intern/cycles/render/image.h
++++ b/intern/cycles/render/image.h
+@@ -23,6 +23,7 @@
+ #include "util/util_image.h"
+ #include "util/util_string.h"
+ #include "util/util_thread.h"
++#include "util/util_unique_ptr.h"
+ #include "util/util_vector.h"
+
+ CCL_NAMESPACE_BEGIN
+@@ -133,7 +134,7 @@ private:
+ bool pack_images;
+
+ bool file_load_image_generic(Image *img,
+- ImageInput **in,
++ unique_ptr<ImageInput> *in,
+ int &width,
+ int &height,
+ int &depth,
+diff --git a/intern/cycles/util/util_unique_ptr.h b/intern/cycles/util/util_unique_ptr.h
+new file mode 100644
+index 00000000000..1ceae73172e
+--- /dev/null
++++ b/intern/cycles/util/util_unique_ptr.h
+@@ -0,0 +1,28 @@
++/*
++ * Copyright 2011-2013 Blender Foundation
++ *
++ * Licensed under the Apache License, Version 2.0 (the "License");
++ * you may not use this file except in compliance with the License.
++ * You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++#ifndef __UTIL_UNIQUE_PTR_H__
++#define __UTIL_UNIQUE_PTR_H__
++
++#include <memory>
++
++CCL_NAMESPACE_BEGIN
++
++using std::unique_ptr;
++
++CCL_NAMESPACE_END
++
++#endif /* __UTIL_UNIQUE_PTR_H__ */
+diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
+index b123d508f99..7f2fac9d796 100644
+--- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp
++++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
+@@ -35,6 +35,11 @@
+ #include "utfconv.h"
+ #endif
+
++// NOTE: Keep first, BLI_path_util conflicts with OIIO's format.
++#include <memory>
++#include <openimageio_api.h>
++#include <OpenImageIO/imageio.h>
++
+ extern "C"
+ {
+ #include "MEM_guardedalloc.h"
+@@ -48,12 +53,10 @@ extern "C"
+ #include "IMB_colormanagement_intern.h"
+ }
+
+-#include <openimageio_api.h>
+-#include <OpenImageIO/imageio.h>
+-
+ OIIO_NAMESPACE_USING
+
+ using std::string;
++using std::unique_ptr;
+
+ typedef unsigned char uchar;
+
+@@ -197,7 +200,6 @@ int imb_save_photoshop(struct ImBuf *ibuf, const char * /*name*/, int flags)
+
+ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspace[IM_MAX_SPACE])
+ {
+- ImageInput *in = NULL;
+ struct ImBuf *ibuf = NULL;
+ int width, height, components;
+ bool is_float, is_alpha;
+@@ -210,7 +212,7 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac
+
+ colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_BYTE);
+
+- in = ImageInput::create(filename);
++ unique_ptr<ImageInput> in(ImageInput::create(filename));
+ if (!in) {
+ std::cerr << __func__ << ": ImageInput::create() failed:" << std::endl
+ << OIIO_NAMESPACE::geterror() << std::endl;
+@@ -223,7 +225,6 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac
+ if (!in->open(filename, spec, config)) {
+ std::cerr << __func__ << ": ImageInput::open() failed:" << std::endl
+ << in->geterror() << std::endl;
+- delete in;
+ return NULL;
+ }
+
+@@ -249,19 +250,17 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac
+ if (!(components >= 1 && components <= 4)) {
+ if (in) {
+ in->close();
+- delete in;
+ }
+ return NULL;
+ }
+
+ if (is_float)
+- ibuf = imb_oiio_load_image_float(in, width, height, components, flags, is_alpha);
++ ibuf = imb_oiio_load_image_float(in.get(), width, height, components, flags, is_alpha);
+ else
+- ibuf = imb_oiio_load_image(in, width, height, components, flags, is_alpha);
++ ibuf = imb_oiio_load_image(in.get(), width, height, components, flags, is_alpha);
+
+ if (in) {
+ in->close();
+- delete in;
+ }
+
+ if (!ibuf)
+--
+2.22.0
+
diff --git a/opencolorio1.patch b/opencolorio1.patch
new file mode 100644
index 000000000000..676f531b10a4
--- /dev/null
+++ b/opencolorio1.patch
@@ -0,0 +1,48 @@
+diff --git a/build_files/cmake/Modules/FindOpenColorIO.cmake b/build_files/cmake/Modules/FindOpenColorIO.cmake
+index 090032e06ec..f5db181d73d 100644
+--- a/build_files/cmake/Modules/FindOpenColorIO.cmake
++++ b/build_files/cmake/Modules/FindOpenColorIO.cmake
+@@ -28,7 +28,7 @@ IF(NOT OPENCOLORIO_ROOT_DIR AND NOT $ENV{OPENCOLORIO_ROOT_DIR} STREQUAL "")
+ ENDIF()
+
+ SET(_opencolorio_FIND_COMPONENTS
+- OpenColorIO
++ OpenColorIO1
+ yaml-cpp
+ tinyxml
+ )
+@@ -40,7 +40,7 @@ SET(_opencolorio_SEARCH_DIRS
+
+ FIND_PATH(OPENCOLORIO_INCLUDE_DIR
+ NAMES
+- OpenColorIO/OpenColorIO.h
++ OpenColorIO1/OpenColorIO.h
+ HINTS
+ ${_opencolorio_SEARCH_DIRS}
+ PATH_SUFFIXES
+diff --git a/intern/opencolorio/ocio_impl.cc b/intern/opencolorio/ocio_impl.cc
+index 0e25c89f5d7..f1f99de4bd8 100644
+--- a/intern/opencolorio/ocio_impl.cc
++++ b/intern/opencolorio/ocio_impl.cc
+@@ -26,7 +26,7 @@
+ # pragma warning(push)
+ # pragma warning(disable : 4251 4275)
+ #endif
+-#include <OpenColorIO/OpenColorIO.h>
++#include <OpenColorIO1/OpenColorIO.h>
+ #ifdef _MSC_VER
+ # pragma warning(pop)
+ #endif
+diff --git a/intern/opencolorio/ocio_impl_glsl.cc b/intern/opencolorio/ocio_impl_glsl.cc
+index df6adc8f34b..24d1ec8a871 100644
+--- a/intern/opencolorio/ocio_impl_glsl.cc
++++ b/intern/opencolorio/ocio_impl_glsl.cc
+@@ -40,7 +40,7 @@
+ # pragma warning(push)
+ # pragma warning(disable : 4251 4275)
+ #endif
+-#include <OpenColorIO/OpenColorIO.h>
++#include <OpenColorIO1/OpenColorIO.h>
+ #ifdef _MSC_VER
+ # pragma warning(pop)
+ #endif
diff --git a/openexr3.patch b/openexr3.patch
new file mode 100644
index 000000000000..11cf422ef55e
--- /dev/null
+++ b/openexr3.patch
@@ -0,0 +1,57 @@
+diff --git a/build_files/cmake/Modules/FindOpenEXR.cmake b/build_files/cmake/Modules/FindOpenEXR.cmake
+index 090f80b8df7..a2f7b4c622b 100644
+--- a/build_files/cmake/Modules/FindOpenEXR.cmake
++++ b/build_files/cmake/Modules/FindOpenEXR.cmake
+@@ -34,11 +34,10 @@ ENDIF()
+ SET(_openexr_libs_ver_init "2.0")
+
+ SET(_openexr_FIND_COMPONENTS
+- Half
+ Iex
+- IlmImf
+- IlmThread
+ Imath
++ OpenEXR
++ IlmThread
+ )
+
+ SET(_openexr_SEARCH_DIRS
+@@ -120,7 +119,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenEXR DEFAULT_MSG
+ IF(OPENEXR_FOUND)
+ SET(OPENEXR_LIBRARIES ${_openexr_LIBRARIES})
+ # Both include paths are needed because of dummy OSL headers mixing #include <OpenEXR/foo.h> and #include <foo.h> :(
+- SET(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR_INCLUDE_DIR}/OpenEXR)
++ SET(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR_INCLUDE_DIR}/OpenEXR ${OPENEXR_INCLUDE_DIR}/Imath)
+ ENDIF()
+
+ MARK_AS_ADVANCED(
+diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
+index b6e93a5111b..7d88edb43fd 100644
+--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
++++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
+@@ -45,10 +45,12 @@
+ #include <ImfVersion.h>
+ #include <ImathBox.h>
+ #include <ImfArray.h>
++#include <ImfFrameBuffer.h>
+ #include <ImfIO.h>
+ #include <ImfChannelList.h>
+ #include <ImfPixelType.h>
+ #include <ImfInputFile.h>
++#include <ImfInt64.h>
+ #include <ImfOutputFile.h>
+ #include <ImfCompression.h>
+ #include <ImfCompressionAttribute.h>
+diff --git a/source/blender/alembic/intern/abc_transform.cc b/source/blender/alembic/intern/abc_transform.cc
+index 5392387663f..9dc3200e723 100644
+--- a/source/blender/alembic/intern/abc_transform.cc
++++ b/source/blender/alembic/intern/abc_transform.cc
+@@ -22,7 +22,7 @@
+
+ #include "abc_transform.h"
+
+-#include <OpenEXR/ImathBoxAlgo.h>
++#include <Imath/ImathBoxAlgo.h>
+
+ #include "abc_util.h"
+
diff --git a/openvdb7.patch b/openvdb7.patch
new file mode 100644
index 000000000000..630605a6c353
--- /dev/null
+++ b/openvdb7.patch
@@ -0,0 +1,29 @@
+diff --git a/intern/openvdb/CMakeLists.txt b/intern/openvdb/CMakeLists.txt
+index 9ac0817903b..e60d45b7f64 100644
+--- a/intern/openvdb/CMakeLists.txt
++++ b/intern/openvdb/CMakeLists.txt
+@@ -23,6 +23,8 @@
+ #
+ # ***** END GPL LICENSE BLOCK *****
+
++set (CMAKE_CXX_STANDARD 14)
++
+ set(INC
+ .
+ intern
+diff --git a/intern/openvdb/intern/openvdb_writer.cc b/intern/openvdb/intern/openvdb_writer.cc
+index 900c5371682..f209ec758b6 100644
+--- a/intern/openvdb/intern/openvdb_writer.cc
++++ b/intern/openvdb/intern/openvdb_writer.cc
+@@ -39,11 +39,7 @@ void OpenVDBWriter::insert(const openvdb::GridBase::Ptr &grid)
+
+ void OpenVDBWriter::insert(const openvdb::GridBase &grid)
+ {
+-#if (OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER <= 3) || defined(OPENVDB_3_ABI_COMPATIBLE)
+- m_grids->push_back(grid.copyGrid());
+-#else
+ m_grids->push_back(grid.copyGridWithNewTree());
+-#endif
+ }
+
+ void OpenVDBWriter::insertFloatMeta(const openvdb::Name &name, const float value)
diff --git a/openvdb8.patch b/openvdb8.patch
new file mode 100644
index 000000000000..bb44c7946cdf
--- /dev/null
+++ b/openvdb8.patch
@@ -0,0 +1,16 @@
+diff --git a/intern/openvdb/openvdb_util.cc b/intern/openvdb/openvdb_util.cc
+index a221a537851..899b41ff09b 100644
+--- a/intern/openvdb/openvdb_util.cc
++++ b/intern/openvdb/openvdb_util.cc
+@@ -27,5 +27,10 @@ ScopeTimer::ScopeTimer(const std::string &message) : m_message(message), m_timer
+
+ ScopeTimer::~ScopeTimer()
+ {
+- std::printf("%s: %fms\n", m_message.c_str(), m_timer.delta());
++#if OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER >= 7
++ double delta = m_timer.milliseconds();
++#else
++ double delta = m_timer.delta(); /* Deprecated in OpenVDB 7. */
++#endif
++ std::printf("%s: %fms\n", m_message.c_str(), delta);
+ }
diff --git a/osl19x.patch b/osl19x.patch
new file mode 100644
index 000000000000..63697938b19e
--- /dev/null
+++ b/osl19x.patch
@@ -0,0 +1,399 @@
+From 56aa72bc1922652dba8539f5a305a175619d68aa Mon Sep 17 00:00:00 2001
+From: Brecht Van Lommel <brechtvanlommel@gmail.com>
+Date: Fri, 26 Oct 2018 19:26:06 +0200
+Subject: [PATCH 1/4] Fix T57393: Cycles OSL bevel and AO not working after OSL
+ upgrade.
+
+---
+ intern/cycles/kernel/osl/osl_services.cpp | 28 +++++++++++++++++++++--
+ intern/cycles/kernel/osl/osl_services.h | 7 +++++-
+ 2 files changed, 32 insertions(+), 3 deletions(-)
+
+diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp
+index 1535496c73d..f54d18d5e38 100644
+--- a/intern/cycles/kernel/osl/osl_services.cpp
++++ b/intern/cycles/kernel/osl/osl_services.cpp
+@@ -900,6 +900,23 @@ bool OSLRenderServices::has_userdata(ustring name, TypeDesc type, OSL::ShaderGlo
+ return false; /* never called by OSL */
+ }
+
++TextureSystem::TextureHandle *OSLRenderServices::get_texture_handle(ustring filename)
++{
++ if (filename.length() && filename[0] == '@') {
++ /* Dummy, we don't use texture handles for builtin textures but need
++ * to tell the OSL runtime optimizer that this is a valid texture. */
++ return NULL;
++ }
++ else {
++ return texturesys()->get_texture_handle(filename);
++ }
++}
++
++bool OSLRenderServices::good(TextureSystem::TextureHandle *texture_handle)
++{
++ return texturesys()->good(texture_handle);
++}
++
+ bool OSLRenderServices::texture(ustring filename,
+ TextureHandle *texture_handle,
+ TexturePerthread *texture_thread_info,
+@@ -910,7 +927,8 @@ bool OSLRenderServices::texture(ustring filename,
+ int nchannels,
+ float *result,
+ float *dresultds,
+- float *dresultdt)
++ float *dresultdt,
++ ustring *errormessage)
+ {
+ OSL::TextureSystem *ts = osl_ts;
+ ShaderData *sd = (ShaderData *)(sg->renderstate);
+@@ -1131,7 +1149,13 @@ bool OSLRenderServices::get_texture_info(OSL::ShaderGlobals *sg, ustring filenam
+ TypeDesc datatype, void *data)
+ {
+ OSL::TextureSystem *ts = osl_ts;
+- return ts->get_texture_info(filename, subimage, dataname, datatype, data);
++ if (filename.length() && filename[0] == '@') {
++ /* Special builtin textures. */
++ return false;
++ }
++ else {
++ return ts->get_texture_info(filename, subimage, dataname, datatype, data);
++ }
+ }
+
+ int OSLRenderServices::pointcloud_search(OSL::ShaderGlobals *sg, ustring filename, const OSL::Vec3 &center,
+diff --git a/intern/cycles/kernel/osl/osl_services.h b/intern/cycles/kernel/osl/osl_services.h
+index ec34ca77115..8b47342c9d3 100644
+--- a/intern/cycles/kernel/osl/osl_services.h
++++ b/intern/cycles/kernel/osl/osl_services.h
+@@ -93,6 +93,10 @@ public:
+ bool getmessage(OSL::ShaderGlobals *sg, ustring source, ustring name,
+ TypeDesc type, void *val, bool derivatives);
+
++ TextureSystem::TextureHandle *get_texture_handle(ustring filename);
++
++ bool good(TextureSystem::TextureHandle *texture_handle);
++
+ bool texture(ustring filename,
+ TextureSystem::TextureHandle *texture_handle,
+ TexturePerthread *texture_thread_info,
+@@ -103,7 +107,8 @@ public:
+ int nchannels,
+ float *result,
+ float *dresultds,
+- float *dresultdt);
++ float *dresultdt,
++ ustring *errormessage);
+
+ bool texture3d(ustring filename,
+ TextureHandle *texture_handle,
+--
+2.32.0
+
+
+From 4f6171e877777306f9394e239c1e6edea72af93d Mon Sep 17 00:00:00 2001
+From: Sergey Sharybin <sergey.vfx@gmail.com>
+Date: Fri, 9 Nov 2018 12:08:51 +0100
+Subject: [PATCH 2/4] Cycles: Cleanup, space after (void)
+
+It was used in like 95% of places.
+---
+ intern/cycles/kernel/osl/osl_services.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp
+index f54d18d5e38..a1aa6c6b978 100644
+--- a/intern/cycles/kernel/osl/osl_services.cpp
++++ b/intern/cycles/kernel/osl/osl_services.cpp
+@@ -1028,7 +1028,7 @@ bool OSLRenderServices::texture(ustring filename,
+ * other nasty stuff happening.
+ */
+ string err = ts->geterror();
+- (void)err;
++ (void) err;
+ }
+
+ return status;
+@@ -1107,7 +1107,7 @@ bool OSLRenderServices::texture3d(ustring filename,
+ * other nasty stuff happening.
+ */
+ string err = ts->geterror();
+- (void)err;
++ (void) err;
+ }
+
+ return status;
+--
+2.32.0
+
+
+From cbcfbd8bb23f5ef6636dc94668ee6cfa5b3f11cb Mon Sep 17 00:00:00 2001
+From: Sergey Sharybin <sergey.vfx@gmail.com>
+Date: Thu, 15 Nov 2018 17:16:40 +0100
+Subject: [PATCH 3/4] Cycles: Cleanup, code style
+
+---
+ intern/cycles/kernel/osl/osl_services.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp
+index a1aa6c6b978..c35f240837f 100644
+--- a/intern/cycles/kernel/osl/osl_services.cpp
++++ b/intern/cycles/kernel/osl/osl_services.cpp
+@@ -902,7 +902,7 @@ bool OSLRenderServices::has_userdata(ustring name, TypeDesc type, OSL::ShaderGlo
+
+ TextureSystem::TextureHandle *OSLRenderServices::get_texture_handle(ustring filename)
+ {
+- if (filename.length() && filename[0] == '@') {
++ if(filename.length() && filename[0] == '@') {
+ /* Dummy, we don't use texture handles for builtin textures but need
+ * to tell the OSL runtime optimizer that this is a valid texture. */
+ return NULL;
+@@ -1149,7 +1149,7 @@ bool OSLRenderServices::get_texture_info(OSL::ShaderGlobals *sg, ustring filenam
+ TypeDesc datatype, void *data)
+ {
+ OSL::TextureSystem *ts = osl_ts;
+- if (filename.length() && filename[0] == '@') {
++ if(filename.length() && filename[0] == '@') {
+ /* Special builtin textures. */
+ return false;
+ }
+--
+2.32.0
+
+
+From ba0ff934b30a9f89a2827fcfb60e5f2eca5f7f72 Mon Sep 17 00:00:00 2001
+From: Brecht Van Lommel <brechtvanlommel@gmail.com>
+Date: Wed, 2 Jan 2019 19:55:26 +0100
+Subject: [PATCH 4/4] Fix T60061: Cycles OSL point density not working.
+
+Add override keywords so we can detect when the function definitions change.
+---
+ intern/cycles/kernel/osl/osl_services.cpp | 50 +++++++++------
+ intern/cycles/kernel/osl/osl_services.h | 77 ++++++++++++++---------
+ 2 files changed, 78 insertions(+), 49 deletions(-)
+
+diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp
+index c35f240837f..51938d330d5 100644
+--- a/intern/cycles/kernel/osl/osl_services.cpp
++++ b/intern/cycles/kernel/osl/osl_services.cpp
+@@ -895,11 +895,6 @@ bool OSLRenderServices::get_userdata(bool derivatives, ustring name, TypeDesc ty
+ return false; /* disabled by lockgeom */
+ }
+
+-bool OSLRenderServices::has_userdata(ustring name, TypeDesc type, OSL::ShaderGlobals *sg)
+-{
+- return false; /* never called by OSL */
+-}
+-
+ TextureSystem::TextureHandle *OSLRenderServices::get_texture_handle(ustring filename)
+ {
+ if(filename.length() && filename[0] == '@') {
+@@ -1047,7 +1042,8 @@ bool OSLRenderServices::texture3d(ustring filename,
+ float *result,
+ float *dresultds,
+ float *dresultdt,
+- float *dresultdr)
++ float *dresultdr,
++ ustring *errormessage)
+ {
+ OSL::TextureSystem *ts = osl_ts;
+ ShaderData *sd = (ShaderData *)(sg->renderstate);
+@@ -1113,22 +1109,36 @@ bool OSLRenderServices::texture3d(ustring filename,
+ return status;
+ }
+
+-bool OSLRenderServices::environment(ustring filename, TextureOpt &options,
+- OSL::ShaderGlobals *sg, const OSL::Vec3 &R,
+- const OSL::Vec3 &dRdx, const OSL::Vec3 &dRdy,
+- int nchannels, float *result)
++bool OSLRenderServices::environment(ustring filename,
++ TextureHandle *th,
++ TexturePerthread *thread_info,
++ TextureOpt &options,
++ OSL::ShaderGlobals *sg,
++ const OSL::Vec3 &R,
++ const OSL::Vec3 &dRdx,
++ const OSL::Vec3 &dRdy,
++ int nchannels,
++ float *result,
++ float *dresultds,
++ float *dresultdt,
++ ustring *errormessage)
+ {
+ OSL::TextureSystem *ts = osl_ts;
+- ShaderData *sd = (ShaderData *)(sg->renderstate);
+- KernelGlobals *kg = sd->osl_globals;
+- OSLThreadData *tdata = kg->osl_tdata;
+- OIIO::TextureSystem::Perthread *thread_info = tdata->oiio_thread_info;
+
+- OIIO::TextureSystem::TextureHandle *th = ts->get_texture_handle(filename, thread_info);
++ if (thread_info == NULL) {
++ ShaderData *sd = (ShaderData *)(sg->renderstate);
++ KernelGlobals *kg = sd->osl_globals;
++ OSLThreadData *tdata = kg->osl_tdata;
++ thread_info = tdata->oiio_thread_info;
++ }
++
++ if (th == NULL) {
++ th = ts->get_texture_handle(filename, thread_info);
++ }
+
+ bool status = ts->environment(th, thread_info,
+ options, R, dRdx, dRdy,
+- nchannels, result);
++ nchannels, result, dresultds, dresultdt);
+
+ if(!status) {
+ if(nchannels == 3 || nchannels == 4) {
+@@ -1144,9 +1154,13 @@ bool OSLRenderServices::environment(ustring filename, TextureOpt &options,
+ return status;
+ }
+
+-bool OSLRenderServices::get_texture_info(OSL::ShaderGlobals *sg, ustring filename, int subimage,
++bool OSLRenderServices::get_texture_info(OSL::ShaderGlobals *sg,
++ ustring filename,
++ TextureHandle *th,
++ int subimage,
+ ustring dataname,
+- TypeDesc datatype, void *data)
++ TypeDesc datatype,
++ void *data)
+ {
+ OSL::TextureSystem *ts = osl_ts;
+ if(filename.length() && filename[0] == '@') {
+diff --git a/intern/cycles/kernel/osl/osl_services.h b/intern/cycles/kernel/osl/osl_services.h
+index 8b47342c9d3..9e58a1c5c45 100644
+--- a/intern/cycles/kernel/osl/osl_services.h
++++ b/intern/cycles/kernel/osl/osl_services.h
+@@ -45,57 +45,57 @@ class OSLRenderServices : public OSL::RendererServices
+ public:
+ OSLRenderServices();
+ ~OSLRenderServices();
+-
++
+ void thread_init(KernelGlobals *kernel_globals, OSL::TextureSystem *ts);
+
+- bool get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform, float time);
+- bool get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform, float time);
+-
+- bool get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, ustring from, float time);
+- bool get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, ustring to, float time);
+-
+- bool get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform);
+- bool get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform);
+-
+- bool get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, ustring from);
+- bool get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, ustring from);
++ bool get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform, float time) override;
++ bool get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform, float time) override;
++
++ bool get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, ustring from, float time) override;
++ bool get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, ustring to, float time) override;
++
++ bool get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform) override;
++ bool get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform) override;
++
++ bool get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, ustring from) override;
++ bool get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, ustring from) override;
+
+ bool get_array_attribute(OSL::ShaderGlobals *sg, bool derivatives,
+ ustring object, TypeDesc type, ustring name,
+- int index, void *val);
++ int index, void *val) override;
+ bool get_attribute(OSL::ShaderGlobals *sg, bool derivatives, ustring object,
+- TypeDesc type, ustring name, void *val);
++ TypeDesc type, ustring name, void *val) override;
+ bool get_attribute(ShaderData *sd, bool derivatives, ustring object_name,
+ TypeDesc type, ustring name, void *val);
+
+ bool get_userdata(bool derivatives, ustring name, TypeDesc type,
+- OSL::ShaderGlobals *sg, void *val);
++ OSL::ShaderGlobals *sg, void *val) override;
+ bool has_userdata(ustring name, TypeDesc type, OSL::ShaderGlobals *sg);
+
+ int pointcloud_search(OSL::ShaderGlobals *sg, ustring filename, const OSL::Vec3 &center,
+ float radius, int max_points, bool sort, size_t *out_indices,
+- float *out_distances, int derivs_offset);
++ float *out_distances, int derivs_offset) override;
+
+ int pointcloud_get(OSL::ShaderGlobals *sg, ustring filename, size_t *indices, int count,
+- ustring attr_name, TypeDesc attr_type, void *out_data);
++ ustring attr_name, TypeDesc attr_type, void *out_data) override;
+
+ bool pointcloud_write(OSL::ShaderGlobals *sg,
+ ustring filename, const OSL::Vec3 &pos,
+ int nattribs, const ustring *names,
+ const TypeDesc *types,
+- const void **data);
++ const void **data) override;
+
+ bool trace(TraceOpt &options, OSL::ShaderGlobals *sg,
+ const OSL::Vec3 &P, const OSL::Vec3 &dPdx,
+ const OSL::Vec3 &dPdy, const OSL::Vec3 &R,
+- const OSL::Vec3 &dRdx, const OSL::Vec3 &dRdy);
++ const OSL::Vec3 &dRdx, const OSL::Vec3 &dRdy) override;
+
+ bool getmessage(OSL::ShaderGlobals *sg, ustring source, ustring name,
+- TypeDesc type, void *val, bool derivatives);
++ TypeDesc type, void *val, bool derivatives) override;
+
+ TextureSystem::TextureHandle *get_texture_handle(ustring filename);
+
+- bool good(TextureSystem::TextureHandle *texture_handle);
++ bool good(TextureSystem::TextureHandle *texture_handle) override;
+
+ bool texture(ustring filename,
+ TextureSystem::TextureHandle *texture_handle,
+@@ -108,7 +108,7 @@ public:
+ float *result,
+ float *dresultds,
+ float *dresultdt,
+- ustring *errormessage);
++ ustring *errormessage) override;
+
+ bool texture3d(ustring filename,
+ TextureHandle *texture_handle,
+@@ -123,15 +123,30 @@ public:
+ float *result,
+ float *dresultds,
+ float *dresultdt,
+- float *dresultdr);
+-
+- bool environment(ustring filename, TextureOpt &options,
+- OSL::ShaderGlobals *sg, const OSL::Vec3 &R,
+- const OSL::Vec3 &dRdx, const OSL::Vec3 &dRdy,
+- int nchannels, float *result);
+-
+- bool get_texture_info(OSL::ShaderGlobals *sg, ustring filename, int subimage,
+- ustring dataname, TypeDesc datatype, void *data);
++ float *dresultdr,
++ ustring *errormessage) override;
++
++ bool environment(ustring filename,
++ TextureHandle *texture_handle,
++ TexturePerthread *texture_thread_info,
++ TextureOpt &options,
++ OSL::ShaderGlobals *sg,
++ const OSL::Vec3 &R,
++ const OSL::Vec3 &dRdx,
++ const OSL::Vec3 &dRdy,
++ int nchannels,
++ float *result,
++ float *dresultds,
++ float *dresultdt,
++ ustring *errormessage) override;
++
++ bool get_texture_info(OSL::ShaderGlobals *sg,
++ ustring filename,
++ TextureHandle *texture_handle,
++ int subimage,
++ ustring dataname,
++ TypeDesc datatype,
++ void *data);
+
+ static bool get_background_attribute(KernelGlobals *kg, ShaderData *sd, ustring name,
+ TypeDesc type, bool derivatives, void *val);
+--
+2.32.0
+
diff --git a/python3.8.patch b/python3.8.patch
new file mode 100644
index 000000000000..ffaa3e2a914b
--- /dev/null
+++ b/python3.8.patch
@@ -0,0 +1,73 @@
+From 4b663ecf264020b1d7003a137ce84b06d7ec4ce6 Mon Sep 17 00:00:00 2001
+From: bartus <szczepaniak.bartek+github@gmail.com>
+Date: Sat, 16 Nov 2019 20:29:30 +0100
+Subject: [PATCH] Add python 3.8 support.
+
+---
+ source/blender/python/generic/py_capi_utils.c | 27 +++++++++++++++----
+ 1 file changed, 22 insertions(+), 5 deletions(-)
+
+diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
+index 545e0506f84..a7eab70600b 100644
+--- a/source/blender/python/generic/py_capi_utils.c
++++ b/source/blender/python/generic/py_capi_utils.c
+@@ -696,9 +696,16 @@ PyObject *PyC_UnicodeFromByte(const char *str)
+ ****************************************************************************/
+ PyObject *PyC_DefaultNameSpace(const char *filename)
+ {
++ #if PY_VERSION_HEX >= 0x03080000
++ PyObject *modules = PyImport_GetModuleDict();
++ PyObject *builtins = PyEval_GetBuiltins();
++ #else
+ PyInterpreterState *interp = PyThreadState_GET()->interp;
++ PyObject *modules = interp->modules;
++ PyObject *builtins = interp->builtins;
++ #endif
+ PyObject *mod_main = PyModule_New("__main__");
+- PyDict_SetItemString(interp->modules, "__main__", mod_main);
++ PyDict_SetItemString(modules, "__main__", mod_main);
+ Py_DECREF(mod_main); /* sys.modules owns now */
+ PyModule_AddStringConstant(mod_main, "__name__", "__main__");
+ if (filename) {
+@@ -706,8 +713,8 @@ PyObject *PyC_DefaultNameSpace(const char *filename)
+ * note: this wont map to a real file when executing text-blocks and buttons. */
+ PyModule_AddObject(mod_main, "__file__", PyC_UnicodeFromByte(filename));
+ }
+- PyModule_AddObject(mod_main, "__builtins__", interp->builtins);
+- Py_INCREF(interp->builtins); /* AddObject steals a reference */
++ PyModule_AddObject(mod_main, "__builtins__", builtins);
++ Py_INCREF(builtins); /* AddObject steals a reference */
+ return PyModule_GetDict(mod_main);
+ }
+
+@@ -734,15 +741,25 @@ bool PyC_NameSpace_ImportArray(PyObject *py_dict, const char *imports[])
+ /* restore MUST be called after this */
+ void PyC_MainModule_Backup(PyObject **main_mod)
+ {
++ #if PY_VERSION_HEX >= 0x03080000
++ PyObject *modules = PyImport_GetModuleDict();
++ #else
+ PyInterpreterState *interp = PyThreadState_GET()->interp;
+- *main_mod = PyDict_GetItemString(interp->modules, "__main__");
++ PyObject *modules = interp->modules;
++ #endif
++ *main_mod = PyDict_GetItemString(modules, "__main__");
+ Py_XINCREF(*main_mod); /* don't free */
+ }
+
+ void PyC_MainModule_Restore(PyObject *main_mod)
+ {
++ #if PY_VERSION_HEX >= 0x03080000
++ PyObject *modules = PyImport_GetModuleDict();
++ #else
+ PyInterpreterState *interp = PyThreadState_GET()->interp;
+- PyDict_SetItemString(interp->modules, "__main__", main_mod);
++ PyObject *modules = interp->modules;
++ #endif
++ PyDict_SetItemString(modules, "__main__", main_mod);
+ Py_XDECREF(main_mod);
+ }
+
+--
+2.24.0
+
diff --git a/python3.9.patch b/python3.9.patch
new file mode 100644
index 000000000000..f4d7869d09f3
--- /dev/null
+++ b/python3.9.patch
@@ -0,0 +1,141 @@
+diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
+index 19fc05e66ea..5e10baa43ac 100644
+--- a/source/blender/python/mathutils/mathutils_Matrix.c
++++ b/source/blender/python/mathutils/mathutils_Matrix.c
+@@ -43,7 +43,8 @@ static PyObject *Matrix_copy_notest(MatrixObject *self, const float *matrix);
+ static PyObject *Matrix_copy(MatrixObject *self);
+ static PyObject *Matrix_deepcopy(MatrixObject *self, PyObject *args);
+ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *value);
+-static PyObject *matrix__apply_to_copy(PyNoArgsFunction matrix_func, MatrixObject *self);
++static PyObject *matrix__apply_to_copy(PyObject *(*matrix_func)(MatrixObject *),
++ MatrixObject *self);
+ static PyObject *MatrixAccess_CreatePyObject(MatrixObject *matrix, const eMatrixAccess_t type);
+
+ static int matrix_row_vector_check(MatrixObject *mat, VectorObject *vec, int row)
+@@ -380,14 +381,15 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+ return NULL;
+ }
+
+-static PyObject *matrix__apply_to_copy(PyNoArgsFunction matrix_func, MatrixObject *self)
++static PyObject *matrix__apply_to_copy(PyObject *(*matrix_func)(MatrixObject *),
++ MatrixObject *self)
+ {
+ PyObject *ret = Matrix_copy(self);
+ if (ret) {
+- PyObject *ret_dummy = matrix_func(ret);
++ PyObject *ret_dummy = matrix_func((MatrixObject *)ret);
+ if (ret_dummy) {
+ Py_DECREF(ret_dummy);
+- return (PyObject *)ret;
++ return ret;
+ }
+ else { /* error */
+ Py_DECREF(ret);
+@@ -1593,7 +1595,7 @@ PyDoc_STRVAR(Matrix_adjugated_doc,
+ );
+ static PyObject *Matrix_adjugated(MatrixObject *self)
+ {
+- return matrix__apply_to_copy((PyNoArgsFunction)Matrix_adjugate, self);
++ return matrix__apply_to_copy(Matrix_adjugate, self);
+ }
+
+ PyDoc_STRVAR(Matrix_rotate_doc,
+@@ -1799,7 +1801,7 @@ PyDoc_STRVAR(Matrix_transposed_doc,
+ );
+ static PyObject *Matrix_transposed(MatrixObject *self)
+ {
+- return matrix__apply_to_copy((PyNoArgsFunction)Matrix_transpose, self);
++ return matrix__apply_to_copy(Matrix_transpose, self);
+ }
+
+ /*---------------------------matrix.normalize() ------------------*/
+@@ -1846,7 +1848,7 @@ PyDoc_STRVAR(Matrix_normalized_doc,
+ );
+ static PyObject *Matrix_normalized(MatrixObject *self)
+ {
+- return matrix__apply_to_copy((PyNoArgsFunction)Matrix_normalize, self);
++ return matrix__apply_to_copy(Matrix_normalize, self);
+ }
+
+ /*---------------------------matrix.zero() -----------------------*/
+diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c
+index 7255c0028d7..89c448d6413 100644
+--- a/source/blender/python/mathutils/mathutils_Quaternion.c
++++ b/source/blender/python/mathutils/mathutils_Quaternion.c
+@@ -35,7 +35,8 @@
+
+ #define QUAT_SIZE 4
+
+-static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObject *self);
++static PyObject *quat__apply_to_copy(PyObject *(*quat_func)(QuaternionObject *),
++ QuaternionObject *self);
+ static void quat__axis_angle_sanitize(float axis[3], float *angle);
+ static PyObject *Quaternion_copy(QuaternionObject *self);
+ static PyObject *Quaternion_deepcopy(QuaternionObject *self, PyObject *args);
+@@ -376,7 +377,7 @@ PyDoc_STRVAR(Quaternion_normalized_doc,
+ );
+ static PyObject *Quaternion_normalized(QuaternionObject *self)
+ {
+- return quat__apply_to_copy((PyNoArgsFunction)Quaternion_normalize, self);
++ return quat__apply_to_copy(Quaternion_normalize, self);
+ }
+
+ PyDoc_STRVAR(Quaternion_invert_doc,
+@@ -404,7 +405,7 @@ PyDoc_STRVAR(Quaternion_inverted_doc,
+ );
+ static PyObject *Quaternion_inverted(QuaternionObject *self)
+ {
+- return quat__apply_to_copy((PyNoArgsFunction)Quaternion_invert, self);
++ return quat__apply_to_copy(Quaternion_invert, self);
+ }
+
+ PyDoc_STRVAR(Quaternion_identity_doc,
+@@ -468,7 +469,7 @@ PyDoc_STRVAR(Quaternion_conjugated_doc,
+ );
+ static PyObject *Quaternion_conjugated(QuaternionObject *self)
+ {
+- return quat__apply_to_copy((PyNoArgsFunction)Quaternion_conjugate, self);
++ return quat__apply_to_copy(Quaternion_conjugate, self);
+ }
+
+ PyDoc_STRVAR(Quaternion_copy_doc,
+@@ -1143,10 +1144,11 @@ static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kw
+ return Quaternion_CreatePyObject(quat, type);
+ }
+
+-static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObject *self)
++static PyObject *quat__apply_to_copy(PyObject *(*quat_func)(QuaternionObject *),
++ QuaternionObject *self)
+ {
+ PyObject *ret = Quaternion_copy(self);
+- PyObject *ret_dummy = quat_func(ret);
++ PyObject *ret_dummy = quat_func((QuaternionObject *)ret);
+ if (ret_dummy) {
+ Py_DECREF(ret_dummy);
+ return ret;
+diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
+index b3bba79280d..626eaa6505f 100644
+--- a/source/blender/python/mathutils/mathutils_Vector.c
++++ b/source/blender/python/mathutils/mathutils_Vector.c
+@@ -94,10 +94,10 @@ static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+ return Vector_CreatePyObject_alloc(vec, size, type);
+ }
+
+-static PyObject *vec__apply_to_copy(PyNoArgsFunction vec_func, VectorObject *self)
++static PyObject *vec__apply_to_copy(PyObject *(*vec_func)(VectorObject *), VectorObject *self)
+ {
+ PyObject *ret = Vector_copy(self);
+- PyObject *ret_dummy = vec_func(ret);
++ PyObject *ret_dummy = vec_func((VectorObject *)ret);
+ if (ret_dummy) {
+ Py_DECREF(ret_dummy);
+ return (PyObject *)ret;
+@@ -380,7 +380,7 @@ PyDoc_STRVAR(Vector_normalized_doc,
+ );
+ static PyObject *Vector_normalized(VectorObject *self)
+ {
+- return vec__apply_to_copy((PyNoArgsFunction)Vector_normalize, self);
++ return vec__apply_to_copy(Vector_normalize, self);
+ }
+
+ PyDoc_STRVAR(Vector_resize_doc,
diff --git a/python3.9_2.patch b/python3.9_2.patch
new file mode 100644
index 000000000000..a1de7b401485
--- /dev/null
+++ b/python3.9_2.patch
@@ -0,0 +1,23 @@
+diff --git a/source/blender/python/generic/bpy_threads.c b/source/blender/python/generic/bpy_threads.c
+index 5507aa73183..4807c1f5071 100644
+--- a/source/blender/python/generic/bpy_threads.c
++++ b/source/blender/python/generic/bpy_threads.c
+@@ -29,14 +29,11 @@
+ /* analogue of PyEval_SaveThread() */
+ BPy_ThreadStatePtr BPY_thread_save(void)
+ {
+- PyThreadState *tstate = PyThreadState_Swap(NULL);
+- /* note: tstate can be NULL when quitting Blender */
+-
+- if (tstate && PyEval_ThreadsInitialized()) {
+- PyEval_ReleaseLock();
++ /* The thread-state can be NULL when quitting Blender. */
++ if (_PyThreadState_UncheckedGet()) {
++ return (BPy_ThreadStatePtr)PyEval_SaveThread();
+ }
+-
+- return (BPy_ThreadStatePtr)tstate;
++ return NULL;
+ }
+
+ /* analogue of PyEval_RestoreThread() */
diff --git a/version.patch b/version.patch
deleted file mode 100644
index 1c819513060e..000000000000
--- a/version.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
-index 7139c00edf6..5ac0c705c52 100644
---- a/source/blender/blenkernel/BKE_blender_version.h
-+++ b/source/blender/blenkernel/BKE_blender_version.h
-@@ -27,10 +27,10 @@
- /* these lines are grep'd, watch out for our not-so-awesome regex
- * and keep comment above the defines.
- * Use STRINGIFY() rather than defining with quotes */
--#define BLENDER_VERSION 279
-+#define BLENDER_VERSION 281
- #define BLENDER_SUBVERSION 0
- /* Several breakages with 270, e.g. constraint deg vs rad */
--#define BLENDER_MINVERSION 270
-+#define BLENDER_MINVERSION 281
- #define BLENDER_MINSUBVERSION 6
-
- /* used by packaging tools */