public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: media-gfx/blender/files/, media-gfx/blender/
Date: Thu, 10 Jun 2021 00:51:39 +0000 (UTC)	[thread overview]
Message-ID: <1623284361.61c7536f66bd3a6a3347800226cd8dc969671116.sam@gentoo> (raw)

commit:     61c7536f66bd3a6a3347800226cd8dc969671116
Author:     Sebastian Parborg <darkdefende <AT> gmail <DOT> com>
AuthorDate: Wed Apr 28 01:08:31 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun 10 00:19:21 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=61c7536f

media-gfx/blender: Slot, bump to 2.93.0, and add live ebuild

Closes: https://bugs.gentoo.org/795003
Closes: https://bugs.gentoo.org/778008
Closes: https://bugs.gentoo.org/774372
Closes: https://bugs.gentoo.org/673422
Closes: https://bugs.gentoo.org/737388
Signed-off-by: Sebastian Parborg <darkdefende <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/20565
Signed-off-by: Sam James <sam <AT> gentoo.org>

 media-gfx/blender/Manifest                         |   4 +-
 ...ender-2.83.12.ebuild => blender-2.83.15.ebuild} | 192 +++++++++++-------
 ...blender-2.91.2.ebuild => blender-2.93.0.ebuild} | 211 ++++++++++++--------
 ...{blender-2.83.12.ebuild => blender-9999.ebuild} | 203 ++++++++++++-------
 .../blender/files/blender-2.83.13-ffmpeg-4_4.patch |  27 +++
 .../files/blender-2.83.6-constraints_test.patch    |  13 ++
 .../files/blender-2.83.6-fix_opevdb_abi.patch      |  21 ++
 .../blender-2.83.6-libmv_eigen_alignment.patch     | 219 +++++++++++++++++++++
 media-gfx/blender/metadata.xml                     |  23 +--
 9 files changed, 675 insertions(+), 238 deletions(-)

diff --git a/media-gfx/blender/Manifest b/media-gfx/blender/Manifest
index 46f37a28858..a0063395f2e 100644
--- a/media-gfx/blender/Manifest
+++ b/media-gfx/blender/Manifest
@@ -1,2 +1,2 @@
-DIST blender-2.83.12.tar.xz 39132904 BLAKE2B 175e8c5ab9324421f23357bc367b2e70ee8c391130d376d6d53eefbf90529d09921395cd11e7b1709aaa4d24ec6f8df64050869e41bbe211229126db08f22089 SHA512 f313c92e311e852742e74934504fcd3ccd296bcea2499f605cef568e3c615ececd9d70dec5025e4d4ff19f03803c148a8b03a4b68b7ca978554f5b1122c9890b
-DIST blender-2.91.2.tar.xz 42057100 BLAKE2B f10f838ad6d56135fddf9e9171473e1e589f511a38112845d650436a1eb4da94ea0777571dffc6446f4217dce647b087cf5a18841d7dde2086d187bb8f7d3654 SHA512 9a3bae01bd09b1d665af4882f53e8a88d85ff44678233c90788a7801ce0d551a3cc1f71026b71ea1c77d7eaedf7ab6fc8709104c22b564f4fc6cc0d5b3b76f5e
+DIST blender-2.83.15.tar.xz 39125740 BLAKE2B 687097b45b76b474b1c172c9b8ccf5da1bfc24539d0db894d04c7837572b16c1f552757fd1482219d58afa56c573229878fb43bbecd95e3d61314f2ab05efafa SHA512 2836533691bae0a7942197e67232b396b892cd95c0f07ab561f7de8458b354fe4045453855585484dd533ae76588ea3888f880763b042a264fb813a43933fc25
+DIST blender-2.93.0.tar.xz 42967016 BLAKE2B 1e7b54f08415de8a8908a285ae35c1e18558bf7cab42c5c135323d10ac9a73ec69aa0addd536355a4d19262438a615e03f09dc123b697cbab484e33350bb5ee3 SHA512 660962e5368c8ff52ed095aba97d63c22aa8e2fdcb2042b1299b6d6edeb7eb1f702a9ee95ee7e47824681f9f48b971d2e32ec32cc6264165a4196b5f36c4a66d

diff --git a/media-gfx/blender/blender-2.83.12.ebuild b/media-gfx/blender/blender-2.83.15.ebuild
similarity index 57%
copy from media-gfx/blender/blender-2.83.12.ebuild
copy to media-gfx/blender/blender-2.83.15.ebuild
index 44b4b4f8849..e9a3def3b11 100644
--- a/media-gfx/blender/blender-2.83.12.ebuild
+++ b/media-gfx/blender/blender-2.83.15.ebuild
@@ -3,25 +3,27 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{7,8} )
+PYTHON_COMPAT=( python3_{7,8,9} )
 
-inherit check-reqs cmake flag-o-matic pax-utils python-single-r1 \
+inherit check-reqs cmake flag-o-matic pax-utils python-single-r1 subversion \
 	toolchain-funcs xdg-utils
 
 DESCRIPTION="3D Creation/Animation/Publishing System"
 HOMEPAGE="https://www.blender.org"
-SRC_URI="https://download.blender.org/source/${P}.tar.xz"
-
-# Blender can have letters in the version string,
-# so strip off the letter if it exists.
-MY_PV="$(ver_cut 1-2)"
-
-SLOT="0"
-LICENSE="|| ( GPL-2 BL )"
-KEYWORDS="amd64 ~x86"
-IUSE="+bullet +dds +elbeem +openexr +system-python +system-numpy +tbb \
-	abi6-compat abi7-compat alembic collada color-management cuda cycles \
-	debug doc ffmpeg fftw headless jack jemalloc jpeg2k llvm \
+
+if [[ ${PV} = *9999* ]] ; then
+	inherit git-r3
+	EGIT_REPO_URI="https://git.blender.org/blender.git"
+else
+	SRC_URI="https://download.blender.org/source/${P}.tar.xz"
+	KEYWORDS="~amd64 ~x86"
+fi
+
+SLOT="${PV%.*}"
+LICENSE="|| ( GPL-3 BL )"
+IUSE="+bullet +dds +fluid +openexr +system-python +system-numpy +tbb \
+	alembic collada +color-management cuda cycles \
+	debug doc ffmpeg fftw headless jack jemalloc jpeg2k \
 	man ndof nls openal opencl openimageio openmp opensubdiv \
 	openvdb osl sdl sndfile standalone test tiff valgrind"
 RESTRICT="!test? ( test )"
@@ -30,15 +32,15 @@ REQUIRED_USE="${PYTHON_REQUIRED_USE}
 	alembic? ( openexr )
 	cuda? ( cycles )
 	cycles? ( openexr tiff openimageio )
-	elbeem? ( tbb )
+	fluid? ( tbb )
 	opencl? ( cycles )
-	openvdb? (
-		^^ ( abi6-compat abi7-compat )
-		tbb
-	)
-	osl? ( cycles llvm )
-	standalone? ( cycles )"
+	openvdb? ( tbb )
+	osl? ( cycles )
+	standalone? ( cycles )
+	test? ( color-management osl )"
 
+# Library versions for official builds can be found in the blender source directory in:
+# build_files/build_environment/install_deps.sh
 RDEPEND="${PYTHON_DEPS}
 	dev-libs/boost:=[nls?,threads(+)]
 	dev-libs/lzo:2=
@@ -57,9 +59,9 @@ RDEPEND="${PYTHON_DEPS}
 	virtual/opengl
 	alembic? ( >=media-gfx/alembic-1.7.12[boost(+),hdf(+)] )
 	collada? ( >=media-libs/opencollada-1.6.68 )
-	color-management? ( media-libs/opencolorio )
+	color-management? ( <media-libs/opencolorio-2.0.0 )
 	cuda? ( dev-util/nvidia-cuda-toolkit:= )
-	ffmpeg? ( media-video/ffmpeg:=[x264,mp3,encode,theora,jpeg2k?] )
+	ffmpeg? ( media-video/ffmpeg:=[x264,mp3,encode,theora,jpeg2k,vpx,vorbis,opus,xvid] )
 	fftw? ( sci-libs/fftw:3.0= )
 	!headless? (
 		x11-libs/libX11
@@ -69,7 +71,6 @@ RDEPEND="${PYTHON_DEPS}
 	jack? ( virtual/jack )
 	jemalloc? ( dev-libs/jemalloc:= )
 	jpeg2k? ( media-libs/openjpeg:2= )
-	llvm? ( sys-devel/llvm:= )
 	ndof? (
 		app-misc/spacenavd
 		dev-libs/libspnav
@@ -84,13 +85,14 @@ RDEPEND="${PYTHON_DEPS}
 	)
 	opensubdiv? ( >=media-libs/opensubdiv-3.4.0[cuda=,opencl=] )
 	openvdb? (
-		~media-gfx/openvdb-7.0.0[abi6-compat(-)?,abi7-compat(-)?]
+		>=media-gfx/openvdb-7.0.0
 		dev-libs/c-blosc:=
 	)
-	osl? ( media-libs/osl:= )
+	osl? ( <media-libs/osl-1.11.0 )
 	sdl? ( media-libs/libsdl2[sound,joystick] )
 	sndfile? ( media-libs/libsndfile )
 	tbb? ( dev-cpp/tbb )
+	test? ( dev-vcs/subversion )
 	tiff? ( media-libs/tiff )
 	valgrind? ( dev-util/valgrind )
 "
@@ -113,7 +115,12 @@ BDEPEND="
 	nls? ( sys-devel/gettext )
 "
 
-CMAKE_BUILD_TYPE="Release"
+PATCHES=(
+	"${FILESDIR}/blender-2.83.6-libmv_eigen_alignment.patch"
+	"${FILESDIR}/blender-2.83.6-constraints_test.patch"
+	"${FILESDIR}/blender-2.83.6-fix_opevdb_abi.patch"
+	"${FILESDIR}/blender-2.83.13-ffmpeg-4_4.patch"
+)
 
 blender_check_requirements() {
 	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
@@ -123,6 +130,13 @@ blender_check_requirements() {
 	fi
 }
 
+blender_get_version() {
+	# Get blender version from blender itself.
+	BV=$(grep "BLENDER_VERSION " source/blender/blenkernel/BKE_blender_version.h | cut -d " " -f 3; assert)
+	# Add period.
+	BV=${BV:0:1}.${BV:1}
+}
+
 pkg_pretend() {
 	blender_check_requirements
 }
@@ -132,41 +146,60 @@ pkg_setup() {
 	python-single-r1_pkg_setup
 }
 
+src_unpack() {
+	if [[ ${PV} = *9999* ]] ; then
+		TESTS_SVN_URL=https://svn.blender.org/svnroot/bf-blender/trunk/lib/tests
+		git-r3_src_unpack
+	else
+		default
+		TESTS_SVN_URL=https://svn.blender.org/svnroot/bf-blender/tags/blender-${SLOT}-release/lib/tests
+	fi
+
+	if use test; then
+		subversion_fetch ${TESTS_SVN_URL} ../lib/tests
+	fi
+}
+
 src_prepare() {
 	cmake_src_prepare
 
-	# we don't want static glew, but it's scattered across
-	# multiple files that differ from version to version
-	# !!!CHECK THIS SED ON EVERY VERSION BUMP!!!
-	local file
-	while IFS="" read -d $'\0' -r file ; do
-		sed -i -e '/-DGLEW_STATIC/d' "${file}" || die
-	done < <(find . -type f -name "CMakeLists.txt")
+	blender_get_version
 
 	# Disable MS Windows help generation. The variable doesn't do what it
 	# it sounds like.
 	sed -e "s|GENERATE_HTMLHELP      = YES|GENERATE_HTMLHELP      = NO|" \
 		-i doc/doxygen/Doxyfile || die
+
+	# Prepare icons and .desktop files for slotting.
+	sed -e "s|blender.svg|blender-${BV}.svg|" -i source/creator/CMakeLists.txt || die
+	sed -e "s|blender-symbolic.svg|blender-${BV}-symbolic.svg|" -i source/creator/CMakeLists.txt || die
+	sed -e "s|blender.desktop|blender-${BV}.desktop|" -i source/creator/CMakeLists.txt || die
+	sed -e "s|blender-thumbnailer.py|blender-${BV}-thumbnailer.py|" -i source/creator/CMakeLists.txt || die
+
+	sed -e "s|Name=Blender|Name=Blender ${PV}|" -i release/freedesktop/blender.desktop || die
+	sed -e "s|Exec=blender|Exec=blender-${BV}|" -i release/freedesktop/blender.desktop || die
+	sed -e "s|Icon=blender|Icon=blender-${BV}|" -i release/freedesktop/blender.desktop || die
+
+	mv release/freedesktop/icons/scalable/apps/blender.svg release/freedesktop/icons/scalable/apps/blender-${BV}.svg || die
+	mv release/freedesktop/icons/symbolic/apps/blender-symbolic.svg release/freedesktop/icons/symbolic/apps/blender-${BV}-symbolic.svg || die
+	mv release/freedesktop/blender.desktop release/freedesktop/blender-${BV}.desktop || die
+	mv release/bin/blender-thumbnailer.py release/bin/blender-${BV}-thumbnailer.py || die
+
+	if use test; then
+		# Without this the tests will try to use /usr/bin/blender and /usr/share/blender/ to run the tests.
+		sed -e "s|string(REPLACE.*|set(TEST_INSTALL_DIR ${ED}/usr/)|g" -i tests/CMakeLists.txt || die
+		sed -e "s|string(REPLACE.*|set(TEST_INSTALL_DIR ${ED}/usr/)|g" -i build_files/cmake/Modules/GTestTesting.cmake || die
+	fi
 }
 
 src_configure() {
-	# FIX: forcing '-funsigned-char' fixes an anti-aliasing issue with menu
-	# shadows, see bug #276338 for reference
-	append-flags -funsigned-char
+	# Without this the floating point math will differ when for example
+	# "-march=native" is set. This will make automated tests fail and we will
+	# not match the behaviour of some operators/modifiers with the official
+	# builds.
+	append-flags -ffp-contract=off
 	append-lfs-flags
 
-	if use openvdb; then
-		local version
-		if use abi6-compat; then
-			version=6;
-		elif use abi7-compat; then
-			version=7;
-		else
-			die "Openvdb abi version not compatible"
-		fi
-		append-cppflags -DOPENVDB_ABI_VERSION_NUMBER=${version}
-	fi
-
 	local mycmakeargs=(
 		-DBUILD_SHARED_LIBS=OFF
 		-DPYTHON_INCLUDE_DIR="$(python_get_includedir)"
@@ -197,11 +230,10 @@ src_configure() {
 		-DWITH_INPUT_NDOF=$(usex ndof)
 		-DWITH_INTERNATIONAL=$(usex nls)
 		-DWITH_JACK=$(usex jack)
-		-DWITH_LLVM=$(usex llvm)
 		-DWITH_MEM_JEMALLOC=$(usex jemalloc)
 		-DWITH_MEM_VALGRIND=$(usex valgrind)
-		-DWITH_MOD_FLUID=$(usex elbeem)
-		-DWITH_MOD_OCEANSIM=$(usex fftw)
+		-DWITH_MOD_FLUID=$(usex fluid)
+		-DWITH_MOD_OCEANSIM=ON
 		-DWITH_OPENAL=$(usex openal)
 		-DWITH_OPENCOLLADA=$(usex collada)
 		-DWITH_OPENCOLORIO=$(usex color-management)
@@ -218,8 +250,13 @@ src_configure() {
 		-DWITH_SYSTEM_GLEW=ON
 		-DWITH_SYSTEM_LZO=ON
 		-DWITH_TBB=$(usex tbb)
-		-DWITH_X11=$(usex !headless)
+		-DWITH_USD=OFF
 	)
+	if ! use debug ; then
+		append-flags  -DNDEBUG
+	else
+		append-flags  -DDEBUG
+	fi
 	cmake_src_configure
 }
 
@@ -247,17 +284,27 @@ src_compile() {
 }
 
 src_test() {
-	if use test; then
-		einfo "Running Blender Unit Tests ..."
-		cd "${BUILD_DIR}"/bin/tests || die
-		local f
-		for f in *_test; do
-			./"${f}" || die
-		done
-	fi
+	# A lot of tests needs to have access to the installed data files.
+	# So install them into the image directory now.
+	cmake_src_install
+
+	blender_get_version
+	# Define custom blender data/script file paths not be able to find them otherwise during testing.
+	# (Because the data is in the image directory and it will default to look in /usr/share)
+	export BLENDER_SYSTEM_SCRIPTS=${ED}/usr/share/blender/${BV}/scripts
+	export BLENDER_SYSTEM_DATAFILES=${ED}/usr/share/blender/${BV}/datafiles
+
+	# NOTE: The 'modifiers' test will fail if opensubdiv was compiled with -march=native
+	# This this is fixed in blender version 2.92 and up."
+	cmake_src_test
+
+	# Clean up the image directory for src_install
+	rm -fr ${ED}/* || die
 }
 
 src_install() {
+	blender_get_version
+
 	# Pax mark blender for hardened support.
 	pax-mark m "${BUILD_DIR}"/bin/blender
 
@@ -280,8 +327,10 @@ src_install() {
 	dodoc "${CMAKE_USE_DIR}"/release/text/readme.html
 	rm -r "${ED}"/usr/share/doc/blender || die
 
-	python_fix_shebang "${ED}/usr/bin/blender-thumbnailer.py"
-	python_optimize "${ED}/usr/share/blender/${MY_PV}/scripts"
+	python_fix_shebang "${ED}/usr/bin/blender-${BV}-thumbnailer.py"
+	python_optimize "${ED}/usr/share/blender/${BV}/scripts"
+
+	mv "${ED}/usr/bin/blender" "${ED}/usr/bin/blender-${BV}"
 }
 
 pkg_postinst() {
@@ -292,7 +341,7 @@ pkg_postinst() {
 	elog "It is recommended to change your blender temp directory"
 	elog "from /tmp to /home/user/tmp or another tmp file under your"
 	elog "home directory. This can be done by starting blender, then"
-	elog "dragging the main menu down do display all paths."
+	elog "changing the 'Temporary Files' directory in Blender preferences."
 	elog
 	ewarn
 	ewarn "This ebuild does not unbundle the massive amount of 3rd party"
@@ -302,13 +351,12 @@ pkg_postinst() {
 	ewarn "  https://developer.blender.org/"
 	ewarn
 
-	if use python_single_target_python3_8; then
-		elog "You've enabled python-3.8 support for blender, which is still experimental."
-		elog "If you experience breakages with e.g. plugins, please switch to"
-		elog "python_single_target_python3_7 instead."
-		elog "Bug: https://bugs.gentoo.org/737388"
-		elog
-	fi
+	elog "You are building Blender with a newer python version than"
+	elog "supported by this version upstream."
+	elog "If you experience breakages with e.g. plugins, please download"
+	elog "the official Blender LTS binary release instead."
+	elog "Bug: https://bugs.gentoo.org/737388"
+	elog
 
 	xdg_icon_cache_update
 	xdg_mimeinfo_database_update
@@ -322,7 +370,7 @@ pkg_postrm() {
 
 	ewarn ""
 	ewarn "You may want to remove the following directory."
-	ewarn "~/.config/${PN}/${MY_PV}/cache/"
+	ewarn "~/.config/${PN}/<blender version>/cache/"
 	ewarn "It may contain extra render kernels not tracked by portage"
 	ewarn ""
 }

diff --git a/media-gfx/blender/blender-2.91.2.ebuild b/media-gfx/blender/blender-2.93.0.ebuild
similarity index 56%
rename from media-gfx/blender/blender-2.91.2.ebuild
rename to media-gfx/blender/blender-2.93.0.ebuild
index 6faddf5b016..1cbc831157b 100644
--- a/media-gfx/blender/blender-2.91.2.ebuild
+++ b/media-gfx/blender/blender-2.93.0.ebuild
@@ -3,53 +3,51 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{7,8} )
+PYTHON_COMPAT=( python3_9 )
 
-inherit check-reqs cmake flag-o-matic pax-utils python-single-r1 \
+inherit check-reqs cmake flag-o-matic pax-utils python-single-r1 subversion \
 	toolchain-funcs xdg-utils
 
 DESCRIPTION="3D Creation/Animation/Publishing System"
 HOMEPAGE="https://www.blender.org"
-SRC_URI="https://download.blender.org/source/${P}.tar.xz"
-
-# Blender can have letters in the version string,
-# so strip off the letter if it exists.
-MY_PV="$(ver_cut 1-2)"
-
-SLOT="0"
-LICENSE="|| ( GPL-2 BL )"
-KEYWORDS="~amd64 ~arm ~arm64 ~x86"
-IUSE="+bullet +dds +elbeem +openexr +system-python +system-numpy +tbb \
-	abi6-compat abi7-compat alembic collada color-management cuda cycles \
-	debug doc ffmpeg fftw headless jack jemalloc jpeg2k llvm \
-	man ndof nls openal opencl openimageio openmp opensubdiv \
-	openvdb osl sdl sndfile standalone test tiff valgrind"
+
+if [[ ${PV} = *9999* ]] ; then
+	inherit git-r3
+	EGIT_REPO_URI="https://git.blender.org/blender.git"
+else
+	SRC_URI="https://download.blender.org/source/${P}.tar.xz"
+	KEYWORDS="~amd64"
+fi
+
+SLOT="${PV%.*}"
+LICENSE="|| ( GPL-3 BL )"
+IUSE="+bullet +dds +fluid +openexr +system-python +system-numpy +tbb \
+	alembic collada +color-management cuda +cycles \
+	debug doc +embree +ffmpeg +fftw +gmp headless jack jemalloc jpeg2k \
+	man ndof nls openal opencl +oidn +openimageio +openmp +opensubdiv \
+	+openvdb +osl +pdf +potrace +pugixml pulseaudio sdl +sndfile standalone test +tiff valgrind"
 RESTRICT="!test? ( test )"
 
 REQUIRED_USE="${PYTHON_REQUIRED_USE}
 	alembic? ( openexr )
 	cuda? ( cycles )
-	cycles? ( openexr tbb tiff openimageio )
-	elbeem? ( tbb )
+	cycles? ( openexr tiff openimageio )
+	fluid? ( tbb )
 	opencl? ( cycles )
-	openvdb? (
-		^^ ( abi6-compat abi7-compat )
-		tbb
-	)
-	osl? ( cycles llvm )
-	standalone? ( cycles )"
+	openvdb? ( tbb )
+	osl? ( cycles )
+	standalone? ( cycles )
+	test? ( color-management )"
 
+# Library versions for official builds can be found in the blender source directory in:
+# build_files/build_environment/install_deps.sh
 RDEPEND="${PYTHON_DEPS}
 	dev-libs/boost:=[nls?,threads(+)]
-	dev-libs/gmp
-	dev-libs/pugixml
 	dev-libs/lzo:2=
 	$(python_gen_cond_dep '
 		dev-python/numpy[${PYTHON_USEDEP}]
 		dev-python/requests[${PYTHON_USEDEP}]
 	')
-	media-gfx/potrace
-	media-libs/fontconfig:=
 	media-libs/freetype:=
 	media-libs/glew:*
 	media-libs/libpng:=
@@ -61,11 +59,12 @@ RDEPEND="${PYTHON_DEPS}
 	virtual/opengl
 	alembic? ( >=media-gfx/alembic-1.7.12[boost(+),hdf(+)] )
 	collada? ( >=media-libs/opencollada-1.6.68 )
-	color-management? ( media-libs/opencolorio )
+	color-management? ( >=media-libs/opencolorio-2.0.0 )
 	cuda? ( dev-util/nvidia-cuda-toolkit:= )
-	cycles? ( media-libs/freeglut )
-	ffmpeg? ( media-video/ffmpeg:=[x264,mp3,encode,theora,jpeg2k?] )
+	embree? ( >=media-libs/embree-3.10.0[raymask] )
+	ffmpeg? ( media-video/ffmpeg:=[x264,mp3,encode,theora,jpeg2k,vpx,vorbis,opus,xvid] )
 	fftw? ( sci-libs/fftw:3.0= )
+	gmp? ( dev-libs/gmp )
 	!headless? (
 		x11-libs/libX11
 		x11-libs/libXi
@@ -74,7 +73,6 @@ RDEPEND="${PYTHON_DEPS}
 	jack? ( virtual/jack )
 	jemalloc? ( dev-libs/jemalloc:= )
 	jpeg2k? ( media-libs/openjpeg:2= )
-	llvm? ( sys-devel/llvm:= )
 	ndof? (
 		app-misc/spacenavd
 		dev-libs/libspnav
@@ -82,6 +80,7 @@ RDEPEND="${PYTHON_DEPS}
 	nls? ( virtual/libiconv )
 	openal? ( media-libs/openal )
 	opencl? ( virtual/opencl )
+	oidn? ( >=media-libs/oidn-1.3.0 )
 	openimageio? ( >=media-libs/openimageio-2.2.13.1:= )
 	openexr? (
 		media-libs/ilmbase:=
@@ -89,13 +88,18 @@ RDEPEND="${PYTHON_DEPS}
 	)
 	opensubdiv? ( >=media-libs/opensubdiv-3.4.0[cuda=,opencl=] )
 	openvdb? (
-		~media-gfx/openvdb-7.0.0[abi6-compat(-)?,abi7-compat(-)?]
+		>=media-gfx/openvdb-7.1.0
 		dev-libs/c-blosc:=
 	)
-	osl? ( media-libs/osl:= )
+	osl? ( >=media-libs/osl-1.11.10.0 )
+	pdf? ( media-libs/libharu )
+	potrace? ( media-gfx/potrace )
+	pugixml? ( dev-libs/pugixml )
+	pulseaudio? ( media-sound/pulseaudio )
 	sdl? ( media-libs/libsdl2[sound,joystick] )
 	sndfile? ( media-libs/libsndfile )
 	tbb? ( dev-cpp/tbb )
+	test? ( dev-vcs/subversion )
 	tiff? ( media-libs/tiff )
 	valgrind? ( dev-util/valgrind )
 "
@@ -118,8 +122,6 @@ BDEPEND="
 	nls? ( sys-devel/gettext )
 "
 
-CMAKE_BUILD_TYPE="Release"
-
 blender_check_requirements() {
 	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
 
@@ -128,6 +130,18 @@ blender_check_requirements() {
 	fi
 }
 
+blender_get_version() {
+	# Get blender version from blender itself.
+	BV=$(grep "BLENDER_VERSION " source/blender/blenkernel/BKE_blender_version.h | cut -d " " -f 3; assert)
+	if ((${BV:0:1} < 3)) ; then
+		# Add period (290 -> 2.90).
+		BV=${BV:0:1}.${BV:1}
+	else
+		# Add period and strip last number (300 -> 3.0)
+		BV=${BV:0:1}.${BV:1:1}
+	fi
+}
+
 pkg_pretend() {
 	blender_check_requirements
 }
@@ -137,41 +151,55 @@ pkg_setup() {
 	python-single-r1_pkg_setup
 }
 
+src_unpack() {
+	if [[ ${PV} = *9999* ]] ; then
+		TESTS_SVN_URL=https://svn.blender.org/svnroot/bf-blender/trunk/lib/tests
+		git-r3_src_unpack
+	else
+		default
+		TESTS_SVN_URL=https://svn.blender.org/svnroot/bf-blender/tags/blender-${SLOT}-release/lib/tests
+	fi
+
+	if use test; then
+		subversion_fetch ${TESTS_SVN_URL} ../lib/tests
+	fi
+}
+
 src_prepare() {
 	cmake_src_prepare
 
-	# we don't want static glew, but it's scattered across
-	# multiple files that differ from version to version
-	# !!!CHECK THIS SED ON EVERY VERSION BUMP!!!
-	local file
-	while IFS="" read -d $'\0' -r file ; do
-		sed -i -e '/-DGLEW_STATIC/d' "${file}" || die
-	done < <(find . -type f -name "CMakeLists.txt")
+	blender_get_version
 
 	# Disable MS Windows help generation. The variable doesn't do what it
 	# it sounds like.
 	sed -e "s|GENERATE_HTMLHELP      = YES|GENERATE_HTMLHELP      = NO|" \
 		-i doc/doxygen/Doxyfile || die
+
+	# Prepare icons and .desktop files for slotting.
+	sed -e "s|blender.svg|blender-${BV}.svg|" -i source/creator/CMakeLists.txt || die
+	sed -e "s|blender-symbolic.svg|blender-${BV}-symbolic.svg|" -i source/creator/CMakeLists.txt || die
+	sed -e "s|blender.desktop|blender-${BV}.desktop|" -i source/creator/CMakeLists.txt || die
+	sed -e "s|blender-thumbnailer.py|blender-${BV}-thumbnailer.py|" -i source/creator/CMakeLists.txt || die
+
+	sed -e "s|Name=Blender|Name=Blender ${PV}|" -i release/freedesktop/blender.desktop || die
+	sed -e "s|Exec=blender|Exec=blender-${BV}|" -i release/freedesktop/blender.desktop || die
+	sed -e "s|Icon=blender|Icon=blender-${BV}|" -i release/freedesktop/blender.desktop || die
+
+	mv release/freedesktop/icons/scalable/apps/blender.svg release/freedesktop/icons/scalable/apps/blender-${BV}.svg || die
+	mv release/freedesktop/icons/symbolic/apps/blender-symbolic.svg release/freedesktop/icons/symbolic/apps/blender-${BV}-symbolic.svg || die
+	mv release/freedesktop/blender.desktop release/freedesktop/blender-${BV}.desktop || die
+	mv release/bin/blender-thumbnailer.py release/bin/blender-${BV}-thumbnailer.py || die
+
+	if use test; then
+		# Without this the tests will try to use /usr/bin/blender and /usr/share/blender/ to run the tests.
+		sed -e "s|string(REPLACE.*|set(TEST_INSTALL_DIR ${ED}/usr/)|g" -i tests/CMakeLists.txt || die
+		sed -e "s|string(REPLACE.*|set(TEST_INSTALL_DIR ${ED}/usr/)|g" -i build_files/cmake/Modules/GTestTesting.cmake || die
+	fi
 }
 
 src_configure() {
-	# FIX: forcing '-funsigned-char' fixes an anti-aliasing issue with menu
-	# shadows, see bug #276338 for reference
-	append-flags -funsigned-char
 	append-lfs-flags
 
-	if use openvdb; then
-		local version
-		if use abi6-compat; then
-			version=6;
-		elif use abi7-compat; then
-			version=7;
-		else
-			die "Openvdb abi version not compatible"
-		fi
-		append-cppflags -DOPENVDB_ABI_VERSION_NUMBER=${version}
-	fi
-
 	local mycmakeargs=(
 		-DBUILD_SHARED_LIBS=OFF
 		-DPYTHON_INCLUDE_DIR="$(python_get_includedir)"
@@ -184,17 +212,18 @@ src_configure() {
 		-DWITH_CODEC_FFMPEG=$(usex ffmpeg)
 		-DWITH_CODEC_SNDFILE=$(usex sndfile)
 		-DWITH_CXX_GUARDEDALLOC=$(usex debug)
-		-DWITH_CYCLES_DEVICE_CUDA=$(usex cuda TRUE FALSE)
 		-DWITH_CYCLES=$(usex cycles)
+		-DWITH_CYCLES_DEVICE_CUDA=$(usex cuda TRUE FALSE)
 		-DWITH_CYCLES_DEVICE_OPENCL=$(usex opencl)
-		-DWITH_CYCLES_EMBREE=OFF
+		-DWITH_CYCLES_EMBREE=$(usex embree)
+		-DWITH_CYCLES_OSL=$(usex osl)
 		-DWITH_CYCLES_STANDALONE=$(usex standalone)
 		-DWITH_CYCLES_STANDALONE_GUI=$(usex standalone)
-		-DWITH_CYCLES_OSL=$(usex osl)
 		-DWITH_DOC_MANPAGE=$(usex man)
 		-DWITH_FFTW3=$(usex fftw)
-		-DWITH_GHOST_X11=$(usex !headless)
+		-DWITH_GMP=$(usex gmp)
 		-DWITH_GTESTS=$(usex test)
+		-DWITH_HARU=$(usex pdf)
 		-DWITH_HEADLESS=$(usex headless)
 		-DWITH_INSTALL_PORTABLE=OFF
 		-DWITH_IMAGE_DDS=$(usex dds)
@@ -204,19 +233,23 @@ src_configure() {
 		-DWITH_INPUT_NDOF=$(usex ndof)
 		-DWITH_INTERNATIONAL=$(usex nls)
 		-DWITH_JACK=$(usex jack)
-		-DWITH_LLVM=$(usex llvm)
 		-DWITH_MEM_JEMALLOC=$(usex jemalloc)
 		-DWITH_MEM_VALGRIND=$(usex valgrind)
-		-DWITH_MOD_FLUID=$(usex elbeem)
-		-DWITH_MOD_OCEANSIM=$(usex fftw)
+		-DWITH_MOD_FLUID=$(usex fluid)
+		-DWITH_MOD_OCEANSIM=ON
+		-DWITH_NANOVDB=OFF
 		-DWITH_OPENAL=$(usex openal)
 		-DWITH_OPENCOLLADA=$(usex collada)
 		-DWITH_OPENCOLORIO=$(usex color-management)
+		-DWITH_OPENIMAGEDENOISE=$(usex oidn)
 		-DWITH_OPENIMAGEIO=$(usex openimageio)
 		-DWITH_OPENMP=$(usex openmp)
 		-DWITH_OPENSUBDIV=$(usex opensubdiv)
 		-DWITH_OPENVDB=$(usex openvdb)
 		-DWITH_OPENVDB_BLOSC=$(usex openvdb)
+		-DWITH_POTRACE=$(usex potrace)
+		-DWITH_PUGIXML=$(usex pugixml)
+		-DWITH_PULSEAUDIO=$(usex pulseaudio)
 		-DWITH_PYTHON_INSTALL=$(usex system-python OFF ON)
 		-DWITH_PYTHON_INSTALL_NUMPY=$(usex system-numpy OFF ON)
 		-DWITH_SDL=$(usex sdl)
@@ -225,7 +258,14 @@ src_configure() {
 		-DWITH_SYSTEM_GLEW=ON
 		-DWITH_SYSTEM_LZO=ON
 		-DWITH_TBB=$(usex tbb)
+		-DWITH_USD=OFF
+		-DWITH_XR_OPENXR=OFF
 	)
+	if ! use debug ; then
+		append-flags  -DNDEBUG
+	else
+		append-flags  -DDEBUG
+	fi
 	cmake_src_configure
 }
 
@@ -253,17 +293,25 @@ src_compile() {
 }
 
 src_test() {
-	if use test; then
-		einfo "Running Blender Unit Tests ..."
-		cd "${BUILD_DIR}"/bin/tests || die
-		local f
-		for f in *_test; do
-			./"${f}" || die
-		done
-	fi
+	# A lot of tests needs to have access to the installed data files.
+	# So install them into the image directory now.
+	cmake_src_install
+
+	blender_get_version
+	# Define custom blender data/script file paths not be able to find them otherwise during testing.
+	# (Because the data is in the image directory and it will default to look in /usr/share)
+	export BLENDER_SYSTEM_SCRIPTS=${ED}/usr/share/blender/${BV}/scripts
+	export BLENDER_SYSTEM_DATAFILES=${ED}/usr/share/blender/${BV}/datafiles
+
+	cmake_src_test
+
+	# Clean up the image directory for src_install
+	rm -fr ${ED}/* || die
 }
 
 src_install() {
+	blender_get_version
+
 	# Pax mark blender for hardened support.
 	pax-mark m "${BUILD_DIR}"/bin/blender
 
@@ -286,8 +334,10 @@ src_install() {
 	dodoc "${CMAKE_USE_DIR}"/release/text/readme.html
 	rm -r "${ED}"/usr/share/doc/blender || die
 
-	python_fix_shebang "${ED}/usr/bin/blender-thumbnailer.py"
-	python_optimize "${ED}/usr/share/blender/${MY_PV}/scripts"
+	python_fix_shebang "${ED}/usr/bin/blender-${BV}-thumbnailer.py"
+	python_optimize "${ED}/usr/share/blender/${BV}/scripts"
+
+	mv "${ED}/usr/bin/blender" "${ED}/usr/bin/blender-${BV}"
 }
 
 pkg_postinst() {
@@ -298,7 +348,7 @@ pkg_postinst() {
 	elog "It is recommended to change your blender temp directory"
 	elog "from /tmp to /home/user/tmp or another tmp file under your"
 	elog "home directory. This can be done by starting blender, then"
-	elog "dragging the main menu down do display all paths."
+	elog "changing the 'Temporary Files' directory in Blender preferences."
 	elog
 	ewarn
 	ewarn "This ebuild does not unbundle the massive amount of 3rd party"
@@ -308,10 +358,11 @@ pkg_postinst() {
 	ewarn "  https://developer.blender.org/"
 	ewarn
 
-	if use python_single_target_python3_8; then
-		elog "You've enabled python-3.8 support for blender, which is still experimental."
+	if ! use python_single_target_python3_9; then
+		elog "You are building Blender with a newer python version than"
+		elog "supported by this version upstream."
 		elog "If you experience breakages with e.g. plugins, please switch to"
-		elog "python_single_target_python3_7 instead."
+		elog "python_single_target_python3_9 instead."
 		elog "Bug: https://bugs.gentoo.org/737388"
 		elog
 	fi
@@ -328,7 +379,7 @@ pkg_postrm() {
 
 	ewarn ""
 	ewarn "You may want to remove the following directory."
-	ewarn "~/.config/${PN}/${MY_PV}/cache/"
+	ewarn "~/.config/${PN}/<blender version>/cache/"
 	ewarn "It may contain extra render kernels not tracked by portage"
 	ewarn ""
 }

diff --git a/media-gfx/blender/blender-2.83.12.ebuild b/media-gfx/blender/blender-9999.ebuild
similarity index 56%
rename from media-gfx/blender/blender-2.83.12.ebuild
rename to media-gfx/blender/blender-9999.ebuild
index 44b4b4f8849..a94519d2777 100644
--- a/media-gfx/blender/blender-2.83.12.ebuild
+++ b/media-gfx/blender/blender-9999.ebuild
@@ -3,42 +3,44 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{7,8} )
+PYTHON_COMPAT=( python3_9 )
 
-inherit check-reqs cmake flag-o-matic pax-utils python-single-r1 \
+inherit check-reqs cmake flag-o-matic pax-utils python-single-r1 subversion \
 	toolchain-funcs xdg-utils
 
 DESCRIPTION="3D Creation/Animation/Publishing System"
 HOMEPAGE="https://www.blender.org"
-SRC_URI="https://download.blender.org/source/${P}.tar.xz"
-
-# Blender can have letters in the version string,
-# so strip off the letter if it exists.
-MY_PV="$(ver_cut 1-2)"
-
-SLOT="0"
-LICENSE="|| ( GPL-2 BL )"
-KEYWORDS="amd64 ~x86"
-IUSE="+bullet +dds +elbeem +openexr +system-python +system-numpy +tbb \
-	abi6-compat abi7-compat alembic collada color-management cuda cycles \
-	debug doc ffmpeg fftw headless jack jemalloc jpeg2k llvm \
-	man ndof nls openal opencl openimageio openmp opensubdiv \
-	openvdb osl sdl sndfile standalone test tiff valgrind"
+
+if [[ ${PV} = *9999* ]] ; then
+	inherit git-r3
+	EGIT_REPO_URI="https://git.blender.org/blender.git"
+else
+	SRC_URI="https://download.blender.org/source/${P}.tar.xz"
+	KEYWORDS="~amd64 ~x86"
+fi
+
+SLOT="${PV%.*}"
+LICENSE="|| ( GPL-3 BL )"
+IUSE="+bullet +dds +fluid +openexr +system-python +system-numpy +tbb \
+	alembic collada +color-management cuda +cycles \
+	debug doc +embree +ffmpeg +fftw +gmp headless jack jemalloc jpeg2k \
+	man ndof nls openal opencl +oidn +openimageio +openmp +opensubdiv \
+	+openvdb +osl +pdf +potrace +pugixml pulseaudio sdl +sndfile standalone test +tiff valgrind"
 RESTRICT="!test? ( test )"
 
 REQUIRED_USE="${PYTHON_REQUIRED_USE}
 	alembic? ( openexr )
 	cuda? ( cycles )
 	cycles? ( openexr tiff openimageio )
-	elbeem? ( tbb )
+	fluid? ( tbb )
 	opencl? ( cycles )
-	openvdb? (
-		^^ ( abi6-compat abi7-compat )
-		tbb
-	)
-	osl? ( cycles llvm )
-	standalone? ( cycles )"
+	openvdb? ( tbb )
+	osl? ( cycles )
+	standalone? ( cycles )
+	test? ( color-management )"
 
+# Library versions for official builds can be found in the blender source directory in:
+# build_files/build_environment/install_deps.sh
 RDEPEND="${PYTHON_DEPS}
 	dev-libs/boost:=[nls?,threads(+)]
 	dev-libs/lzo:2=
@@ -57,10 +59,12 @@ RDEPEND="${PYTHON_DEPS}
 	virtual/opengl
 	alembic? ( >=media-gfx/alembic-1.7.12[boost(+),hdf(+)] )
 	collada? ( >=media-libs/opencollada-1.6.68 )
-	color-management? ( media-libs/opencolorio )
+	color-management? ( >=media-libs/opencolorio-2.0.0 )
 	cuda? ( dev-util/nvidia-cuda-toolkit:= )
-	ffmpeg? ( media-video/ffmpeg:=[x264,mp3,encode,theora,jpeg2k?] )
+	embree? ( >=media-libs/embree-3.10.0[raymask] )
+	ffmpeg? ( media-video/ffmpeg:=[x264,mp3,encode,theora,jpeg2k,vpx,vorbis,opus,xvid] )
 	fftw? ( sci-libs/fftw:3.0= )
+	gmp? ( dev-libs/gmp )
 	!headless? (
 		x11-libs/libX11
 		x11-libs/libXi
@@ -69,7 +73,6 @@ RDEPEND="${PYTHON_DEPS}
 	jack? ( virtual/jack )
 	jemalloc? ( dev-libs/jemalloc:= )
 	jpeg2k? ( media-libs/openjpeg:2= )
-	llvm? ( sys-devel/llvm:= )
 	ndof? (
 		app-misc/spacenavd
 		dev-libs/libspnav
@@ -77,6 +80,7 @@ RDEPEND="${PYTHON_DEPS}
 	nls? ( virtual/libiconv )
 	openal? ( media-libs/openal )
 	opencl? ( virtual/opencl )
+	oidn? ( >=media-libs/oidn-1.3.0 )
 	openimageio? ( >=media-libs/openimageio-2.2.13.1:= )
 	openexr? (
 		media-libs/ilmbase:=
@@ -84,13 +88,18 @@ RDEPEND="${PYTHON_DEPS}
 	)
 	opensubdiv? ( >=media-libs/opensubdiv-3.4.0[cuda=,opencl=] )
 	openvdb? (
-		~media-gfx/openvdb-7.0.0[abi6-compat(-)?,abi7-compat(-)?]
+		>=media-gfx/openvdb-7.1.0
 		dev-libs/c-blosc:=
 	)
-	osl? ( media-libs/osl:= )
+	osl? ( >=media-libs/osl-1.11.10.0 )
+	pdf? ( media-libs/libharu )
+	potrace? ( media-gfx/potrace )
+	pugixml? ( dev-libs/pugixml )
+	pulseaudio? ( media-sound/pulseaudio )
 	sdl? ( media-libs/libsdl2[sound,joystick] )
 	sndfile? ( media-libs/libsndfile )
 	tbb? ( dev-cpp/tbb )
+	test? ( dev-vcs/subversion )
 	tiff? ( media-libs/tiff )
 	valgrind? ( dev-util/valgrind )
 "
@@ -113,8 +122,6 @@ BDEPEND="
 	nls? ( sys-devel/gettext )
 "
 
-CMAKE_BUILD_TYPE="Release"
-
 blender_check_requirements() {
 	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
 
@@ -123,6 +130,18 @@ blender_check_requirements() {
 	fi
 }
 
+blender_get_version() {
+	# Get blender version from blender itself.
+	BV=$(grep "BLENDER_VERSION " source/blender/blenkernel/BKE_blender_version.h | cut -d " " -f 3; assert)
+	if ((${BV:0:1} < 3)) ; then
+		# Add period (290 -> 2.90).
+		BV=${BV:0:1}.${BV:1}
+	else
+		# Add period and strip last number (300 -> 3.0)
+		BV=${BV:0:1}.${BV:1:1}
+	fi
+}
+
 pkg_pretend() {
 	blender_check_requirements
 }
@@ -132,41 +151,55 @@ pkg_setup() {
 	python-single-r1_pkg_setup
 }
 
+src_unpack() {
+	if [[ ${PV} = *9999* ]] ; then
+		TESTS_SVN_URL=https://svn.blender.org/svnroot/bf-blender/trunk/lib/tests
+		git-r3_src_unpack
+	else
+		default
+		TESTS_SVN_URL=https://svn.blender.org/svnroot/bf-blender/tags/blender-${SLOT}-release/lib/tests
+	fi
+
+	if use test; then
+		subversion_fetch ${TESTS_SVN_URL} ../lib/tests
+	fi
+}
+
 src_prepare() {
 	cmake_src_prepare
 
-	# we don't want static glew, but it's scattered across
-	# multiple files that differ from version to version
-	# !!!CHECK THIS SED ON EVERY VERSION BUMP!!!
-	local file
-	while IFS="" read -d $'\0' -r file ; do
-		sed -i -e '/-DGLEW_STATIC/d' "${file}" || die
-	done < <(find . -type f -name "CMakeLists.txt")
+	blender_get_version
 
 	# Disable MS Windows help generation. The variable doesn't do what it
 	# it sounds like.
 	sed -e "s|GENERATE_HTMLHELP      = YES|GENERATE_HTMLHELP      = NO|" \
 		-i doc/doxygen/Doxyfile || die
+
+	# Prepare icons and .desktop files for slotting.
+	sed -e "s|blender.svg|blender-${BV}.svg|" -i source/creator/CMakeLists.txt || die
+	sed -e "s|blender-symbolic.svg|blender-${BV}-symbolic.svg|" -i source/creator/CMakeLists.txt || die
+	sed -e "s|blender.desktop|blender-${BV}.desktop|" -i source/creator/CMakeLists.txt || die
+	sed -e "s|blender-thumbnailer.py|blender-${BV}-thumbnailer.py|" -i source/creator/CMakeLists.txt || die
+
+	sed -e "s|Name=Blender|Name=Blender ${PV}|" -i release/freedesktop/blender.desktop || die
+	sed -e "s|Exec=blender|Exec=blender-${BV}|" -i release/freedesktop/blender.desktop || die
+	sed -e "s|Icon=blender|Icon=blender-${BV}|" -i release/freedesktop/blender.desktop || die
+
+	mv release/freedesktop/icons/scalable/apps/blender.svg release/freedesktop/icons/scalable/apps/blender-${BV}.svg || die
+	mv release/freedesktop/icons/symbolic/apps/blender-symbolic.svg release/freedesktop/icons/symbolic/apps/blender-${BV}-symbolic.svg || die
+	mv release/freedesktop/blender.desktop release/freedesktop/blender-${BV}.desktop || die
+	mv release/bin/blender-thumbnailer.py release/bin/blender-${BV}-thumbnailer.py || die
+
+	if use test; then
+		# Without this the tests will try to use /usr/bin/blender and /usr/share/blender/ to run the tests.
+		sed -e "s|string(REPLACE.*|set(TEST_INSTALL_DIR ${ED}/usr/)|g" -i tests/CMakeLists.txt || die
+		sed -e "s|string(REPLACE.*|set(TEST_INSTALL_DIR ${ED}/usr/)|g" -i build_files/cmake/Modules/GTestTesting.cmake || die
+	fi
 }
 
 src_configure() {
-	# FIX: forcing '-funsigned-char' fixes an anti-aliasing issue with menu
-	# shadows, see bug #276338 for reference
-	append-flags -funsigned-char
 	append-lfs-flags
 
-	if use openvdb; then
-		local version
-		if use abi6-compat; then
-			version=6;
-		elif use abi7-compat; then
-			version=7;
-		else
-			die "Openvdb abi version not compatible"
-		fi
-		append-cppflags -DOPENVDB_ABI_VERSION_NUMBER=${version}
-	fi
-
 	local mycmakeargs=(
 		-DBUILD_SHARED_LIBS=OFF
 		-DPYTHON_INCLUDE_DIR="$(python_get_includedir)"
@@ -179,15 +212,18 @@ src_configure() {
 		-DWITH_CODEC_FFMPEG=$(usex ffmpeg)
 		-DWITH_CODEC_SNDFILE=$(usex sndfile)
 		-DWITH_CXX_GUARDEDALLOC=$(usex debug)
-		-DWITH_CYCLES_DEVICE_CUDA=$(usex cuda TRUE FALSE)
 		-DWITH_CYCLES=$(usex cycles)
+		-DWITH_CYCLES_DEVICE_CUDA=$(usex cuda TRUE FALSE)
 		-DWITH_CYCLES_DEVICE_OPENCL=$(usex opencl)
+		-DWITH_CYCLES_EMBREE=$(usex embree)
+		-DWITH_CYCLES_OSL=$(usex osl)
 		-DWITH_CYCLES_STANDALONE=$(usex standalone)
 		-DWITH_CYCLES_STANDALONE_GUI=$(usex standalone)
-		-DWITH_CYCLES_OSL=$(usex osl)
 		-DWITH_DOC_MANPAGE=$(usex man)
 		-DWITH_FFTW3=$(usex fftw)
+		-DWITH_GMP=$(usex gmp)
 		-DWITH_GTESTS=$(usex test)
+		-DWITH_HARU=$(usex pdf)
 		-DWITH_HEADLESS=$(usex headless)
 		-DWITH_INSTALL_PORTABLE=OFF
 		-DWITH_IMAGE_DDS=$(usex dds)
@@ -197,19 +233,23 @@ src_configure() {
 		-DWITH_INPUT_NDOF=$(usex ndof)
 		-DWITH_INTERNATIONAL=$(usex nls)
 		-DWITH_JACK=$(usex jack)
-		-DWITH_LLVM=$(usex llvm)
 		-DWITH_MEM_JEMALLOC=$(usex jemalloc)
 		-DWITH_MEM_VALGRIND=$(usex valgrind)
-		-DWITH_MOD_FLUID=$(usex elbeem)
-		-DWITH_MOD_OCEANSIM=$(usex fftw)
+		-DWITH_MOD_FLUID=$(usex fluid)
+		-DWITH_MOD_OCEANSIM=ON
+		-DWITH_NANOVDB=OFF
 		-DWITH_OPENAL=$(usex openal)
 		-DWITH_OPENCOLLADA=$(usex collada)
 		-DWITH_OPENCOLORIO=$(usex color-management)
+		-DWITH_OPENIMAGEDENOISE=$(usex oidn)
 		-DWITH_OPENIMAGEIO=$(usex openimageio)
 		-DWITH_OPENMP=$(usex openmp)
 		-DWITH_OPENSUBDIV=$(usex opensubdiv)
 		-DWITH_OPENVDB=$(usex openvdb)
 		-DWITH_OPENVDB_BLOSC=$(usex openvdb)
+		-DWITH_POTRACE=$(usex potrace)
+		-DWITH_PUGIXML=$(usex pugixml)
+		-DWITH_PULSEAUDIO=$(usex pulseaudio)
 		-DWITH_PYTHON_INSTALL=$(usex system-python OFF ON)
 		-DWITH_PYTHON_INSTALL_NUMPY=$(usex system-numpy OFF ON)
 		-DWITH_SDL=$(usex sdl)
@@ -218,8 +258,14 @@ src_configure() {
 		-DWITH_SYSTEM_GLEW=ON
 		-DWITH_SYSTEM_LZO=ON
 		-DWITH_TBB=$(usex tbb)
-		-DWITH_X11=$(usex !headless)
+		-DWITH_USD=OFF
+		-DWITH_XR_OPENXR=OFF
 	)
+	if ! use debug ; then
+		append-flags  -DNDEBUG
+	else
+		append-flags  -DDEBUG
+	fi
 	cmake_src_configure
 }
 
@@ -247,17 +293,25 @@ src_compile() {
 }
 
 src_test() {
-	if use test; then
-		einfo "Running Blender Unit Tests ..."
-		cd "${BUILD_DIR}"/bin/tests || die
-		local f
-		for f in *_test; do
-			./"${f}" || die
-		done
-	fi
+	# A lot of tests needs to have access to the installed data files.
+	# So install them into the image directory now.
+	cmake_src_install
+
+	blender_get_version
+	# Define custom blender data/script file paths not be able to find them otherwise during testing.
+	# (Because the data is in the image directory and it will default to look in /usr/share)
+	export BLENDER_SYSTEM_SCRIPTS=${ED}/usr/share/blender/${BV}/scripts
+	export BLENDER_SYSTEM_DATAFILES=${ED}/usr/share/blender/${BV}/datafiles
+
+	cmake_src_test
+
+	# Clean up the image directory for src_install
+	rm -fr ${ED}/* || die
 }
 
 src_install() {
+	blender_get_version
+
 	# Pax mark blender for hardened support.
 	pax-mark m "${BUILD_DIR}"/bin/blender
 
@@ -280,8 +334,10 @@ src_install() {
 	dodoc "${CMAKE_USE_DIR}"/release/text/readme.html
 	rm -r "${ED}"/usr/share/doc/blender || die
 
-	python_fix_shebang "${ED}/usr/bin/blender-thumbnailer.py"
-	python_optimize "${ED}/usr/share/blender/${MY_PV}/scripts"
+	python_fix_shebang "${ED}/usr/bin/blender-${BV}-thumbnailer.py"
+	python_optimize "${ED}/usr/share/blender/${BV}/scripts"
+
+	mv "${ED}/usr/bin/blender" "${ED}/usr/bin/blender-${BV}"
 }
 
 pkg_postinst() {
@@ -292,7 +348,7 @@ pkg_postinst() {
 	elog "It is recommended to change your blender temp directory"
 	elog "from /tmp to /home/user/tmp or another tmp file under your"
 	elog "home directory. This can be done by starting blender, then"
-	elog "dragging the main menu down do display all paths."
+	elog "changing the 'Temporary Files' directory in Blender preferences."
 	elog
 	ewarn
 	ewarn "This ebuild does not unbundle the massive amount of 3rd party"
@@ -302,10 +358,11 @@ pkg_postinst() {
 	ewarn "  https://developer.blender.org/"
 	ewarn
 
-	if use python_single_target_python3_8; then
-		elog "You've enabled python-3.8 support for blender, which is still experimental."
+	if ! use python_single_target_python3_9; then
+		elog "You are building Blender with a newer python version than"
+		elog "supported by this version upstream."
 		elog "If you experience breakages with e.g. plugins, please switch to"
-		elog "python_single_target_python3_7 instead."
+		elog "python_single_target_python3_9 instead."
 		elog "Bug: https://bugs.gentoo.org/737388"
 		elog
 	fi
@@ -322,7 +379,7 @@ pkg_postrm() {
 
 	ewarn ""
 	ewarn "You may want to remove the following directory."
-	ewarn "~/.config/${PN}/${MY_PV}/cache/"
+	ewarn "~/.config/${PN}/<blender version>/cache/"
 	ewarn "It may contain extra render kernels not tracked by portage"
 	ewarn ""
 }

diff --git a/media-gfx/blender/files/blender-2.83.13-ffmpeg-4_4.patch b/media-gfx/blender/files/blender-2.83.13-ffmpeg-4_4.patch
new file mode 100644
index 00000000000..bf857967588
--- /dev/null
+++ b/media-gfx/blender/files/blender-2.83.13-ffmpeg-4_4.patch
@@ -0,0 +1,27 @@
+From 9cdf11676ecd753fd86c3d8057c2375174ef0a70 Mon Sep 17 00:00:00 2001
+From: Sebastian Parborg <darkdefende@gmail.com>
+Date: Fri, 7 May 2021 16:51:28 +0200
+Subject: [PATCH] Fix: No sound is exported with ffmpeg 4.4
+
+We were not assigning the amount of sound channels to the output frames.
+Newer ffmpeg releases has sanity checks in place and doesn't fall back
+to two channels anymore.
+---
+ source/blender/blenkernel/intern/writeffmpeg.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
+index 7fc9e8cc0ef..e5550cee124 100644
+--- a/source/blender/blenkernel/intern/writeffmpeg.c
++++ b/source/blender/blenkernel/intern/writeffmpeg.c
+@@ -164,6 +164,7 @@ static int write_audio_frame(FFMpegContext *context)
+   frame->pts = context->audio_time / av_q2d(c->time_base);
+   frame->nb_samples = context->audio_input_samples;
+   frame->format = c->sample_fmt;
++  frame->channels = c->channels;
+ #      ifdef FFMPEG_HAVE_FRAME_CHANNEL_LAYOUT
+   frame->channel_layout = c->channel_layout;
+ #      endif
+-- 
+2.26.3
+

diff --git a/media-gfx/blender/files/blender-2.83.6-constraints_test.patch b/media-gfx/blender/files/blender-2.83.6-constraints_test.patch
new file mode 100644
index 00000000000..ab1e9a6d2d4
--- /dev/null
+++ b/media-gfx/blender/files/blender-2.83.6-constraints_test.patch
@@ -0,0 +1,13 @@
+diff --git a/tests/python/bl_constraints.py b/tests/python/bl_constraints.py
+index 323dd874ac0..7cbc46d680a 100644
+--- a/tests/python/bl_constraints.py
++++ b/tests/python/bl_constraints.py
+@@ -44,7 +44,7 @@ class AbstractConstraintTests(unittest.TestCase):
+             collection = top_collection.children[self.layer_collection]
+             collection.exclude = False
+ 
+-    def assert_matrix(self, actual_matrix, expect_matrix, object_name: str, places=6, delta=None):
++    def assert_matrix(self, actual_matrix, expect_matrix, object_name: str, places=None, delta=1e-6):
+         """Asserts that the matrices almost equal."""
+         self.assertEqual(len(actual_matrix), 4, 'Expected a 4x4 matrix')
+ 

diff --git a/media-gfx/blender/files/blender-2.83.6-fix_opevdb_abi.patch b/media-gfx/blender/files/blender-2.83.6-fix_opevdb_abi.patch
new file mode 100644
index 00000000000..b7537f97fc0
--- /dev/null
+++ b/media-gfx/blender/files/blender-2.83.6-fix_opevdb_abi.patch
@@ -0,0 +1,21 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1552,7 +1552,7 @@
+   CMAKE_C_COMPILER_ID MATCHES "Intel"
+ )
+   # TODO(sergey): Do we want c++11 or gnu-c++11 here?
+-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
++  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
+ else()
+   message(FATAL_ERROR "Unknown compiler ${CMAKE_C_COMPILER_ID}, can't enable C++11 build")
+ endif()
+--- a/extern/mantaflow/CMakeLists.txt
++++ b/extern/mantaflow/CMakeLists.txt
+@@ -51,7 +51,6 @@
+
+ if(WITH_OPENVDB)
+   add_definitions(-DOPENVDB=1)
+-  add_definitions(-DOPENVDB_STATICLIB)
+ endif()
+
+ if(WIN32

diff --git a/media-gfx/blender/files/blender-2.83.6-libmv_eigen_alignment.patch b/media-gfx/blender/files/blender-2.83.6-libmv_eigen_alignment.patch
new file mode 100644
index 00000000000..1392510a23a
--- /dev/null
+++ b/media-gfx/blender/files/blender-2.83.6-libmv_eigen_alignment.patch
@@ -0,0 +1,219 @@
+diff --git a/intern/libmv/libmv/base/vector.h b/intern/libmv/libmv/base/vector.h
+index bdc4392155c..300291c5679 100644
+--- a/intern/libmv/libmv/base/vector.h
++++ b/intern/libmv/libmv/base/vector.h
+@@ -25,151 +25,18 @@
+ #ifndef LIBMV_BASE_VECTOR_H
+ #define LIBMV_BASE_VECTOR_H
+ 
+-#include <cstring>
+-#include <new>
++#include <vector>
+ 
+ #include <Eigen/Core>
+ 
+ namespace libmv {
+ 
+-// A simple container class, which guarantees 16 byte alignment needed for most
+-// vectorization. Don't use this container for classes that cannot be copied
+-// via memcpy.
+-// FIXME: this class has some issues:
+-// - doesn't support iterators.
+-// - impede compatibility with code using STL.
+-// - the STL already provide support for custom allocators
+-// it could be replaced with a simple
+-// template <T> class vector : std::vector<T, aligned_allocator> {} declaration
+-// provided it doesn't break code relying on libmv::vector specific behavior
+-template <typename T,
+-          typename Allocator = Eigen::aligned_allocator<T> >
+-class vector {
+- public:
+-  ~vector()                        { clear();                 }
++// A simple container class, which guarantees the correct memory alignment
++// needed for most eigen vectorization. Don't use this container for classes
++// that cannot be copied via memcpy.
+ 
+-  vector()                         { init();                  }
+-  vector(int size)                 { init(); resize(size);    }
+-  vector(int size, const T & val)  {
+-    init();
+-    resize(size);
+-    std::fill(data_, data_+size_, val); }
+-
+-  // Copy constructor and assignment.
+-  vector(const vector<T, Allocator> &rhs) {
+-    init();
+-    copy(rhs);
+-  }
+-  vector<T, Allocator> &operator=(const vector<T, Allocator> &rhs) {
+-    if (&rhs != this) {
+-      copy(rhs);
+-    }
+-    return *this;
+-  }
+-
+-  /// Swaps the contents of two vectors in constant time.
+-  void swap(vector<T, Allocator> &other) {
+-    std::swap(allocator_, other.allocator_);
+-    std::swap(size_, other.size_);
+-    std::swap(capacity_, other.capacity_);
+-    std::swap(data_, other.data_);
+-  }
+-
+-        T *data()            const { return data_;            }
+-  int      size()            const { return size_;            }
+-  int      capacity()        const { return capacity_;        }
+-  const T& back()            const { return data_[size_ - 1]; }
+-        T& back()                  { return data_[size_ - 1]; }
+-  const T& front()           const { return data_[0];         }
+-        T& front()                 { return data_[0];         }
+-  const T& operator[](int n) const { return data_[n];         }
+-        T& operator[](int n)       { return data_[n];         }
+-  const T& at(int n)         const { return data_[n];         }
+-        T& at(int n)               { return data_[n];         }
+-  const T * begin()          const { return data_;            }
+-  const T * end()            const { return data_+size_;      }
+-        T * begin()                { return data_;            }
+-        T * end()                  { return data_+size_;      }
+-
+-  void resize(size_t size) {
+-    reserve(size);
+-    if (size > size_) {
+-      construct(size_, size);
+-    } else if (size < size_) {
+-      destruct(size, size_);
+-    }
+-    size_ = size;
+-  }
+-
+-  void push_back(const T &value) {
+-    if (size_ == capacity_) {
+-      reserve(size_ ? 2 * size_ : 1);
+-    }
+-    new (&data_[size_++]) T(value);
+-  }
+-
+-  void pop_back() {
+-    resize(size_ - 1);
+-  }
+-
+-  void clear() {
+-    destruct(0, size_);
+-    deallocate();
+-    init();
+-  }
+-
+-  void reserve(unsigned int size) {
+-    if (size > size_) {
+-      T *data = static_cast<T *>(allocate(size));
+-      memcpy(static_cast<void *>(data), data_, sizeof(*data)*size_);
+-      allocator_.deallocate(data_, capacity_);
+-      data_ = data;
+-      capacity_ = size;
+-    }
+-  }
+-
+-  bool empty() {
+-    return size_ == 0;
+-  }
+-
+- private:
+-  void construct(int start, int end) {
+-    for (int i = start; i < end; ++i) {
+-      new (&data_[i]) T;
+-    }
+-  }
+-  void destruct(int start, int end) {
+-    for (int i = start; i < end; ++i) {
+-      data_[i].~T();
+-    }
+-  }
+-  void init() {
+-    size_ = 0;
+-    data_ = 0;
+-    capacity_ = 0;
+-  }
+-
+-  void *allocate(int size) {
+-    return size ? allocator_.allocate(size) : 0;
+-  }
+-
+-  void deallocate() {
+-    allocator_.deallocate(data_, size_);
+-    data_ = 0;
+-  }
+-
+-  void copy(const vector<T, Allocator> &rhs) {
+-    resize(rhs.size());
+-    for (int i = 0; i < rhs.size(); ++i) {
+-      (*this)[i] = rhs[i];
+-    }
+-  }
+-
+-  Allocator allocator_;
+-  size_t size_;
+-  size_t capacity_;
+-  T *data_;
+-};
++template <class ElementType>
++using vector = std::vector<ElementType, Eigen::aligned_allocator<ElementType>>;
+ 
+ }  // namespace libmv
+ 
+diff --git a/intern/libmv/libmv/base/vector_test.cc b/intern/libmv/libmv/base/vector_test.cc
+index f17718c3926..44b9a152148 100644
+--- a/intern/libmv/libmv/base/vector_test.cc
++++ b/intern/libmv/libmv/base/vector_test.cc
+@@ -115,31 +115,24 @@ TEST_F(VectorTest, ResizeConstructsAndDestructsAsExpected) {
+   // Create one object.
+   v.resize(1);
+   EXPECT_EQ(1, v.size());
+-  EXPECT_EQ(1, v.capacity());
+   EXPECT_EQ(1, foo_construct_calls);
+-  EXPECT_EQ(0, foo_destruct_calls);
+   EXPECT_EQ(5, v[0].value);
+ 
+   // Create two more.
+   v.resize(3);
+   EXPECT_EQ(3, v.size());
+-  EXPECT_EQ(3, v.capacity());
+   EXPECT_EQ(3, foo_construct_calls);
+-  EXPECT_EQ(0, foo_destruct_calls);
+ 
+   // Delete the last one.
+   v.resize(2);
+   EXPECT_EQ(2, v.size());
+   EXPECT_EQ(3, v.capacity());
+   EXPECT_EQ(3, foo_construct_calls);
+-  EXPECT_EQ(1, foo_destruct_calls);
+ 
+   // Delete the remaining two.
+   v.resize(0);
+   EXPECT_EQ(0, v.size());
+-  EXPECT_EQ(3, v.capacity());
+   EXPECT_EQ(3, foo_construct_calls);
+-  EXPECT_EQ(3, foo_destruct_calls);
+ }
+ 
+ TEST_F(VectorTest, PushPopBack) {
+@@ -192,15 +185,15 @@ TEST_F(VectorTest, STLFind) {
+   a.push_back(5);
+   a.push_back(3);
+ 
+-  // Find return an int *
++  // Find returns an int *
+   EXPECT_EQ(std::find(&a[0], &a[2], 1) == &a[0], true);
+   EXPECT_EQ(std::find(&a[0], &a[2], 5) == &a[1], true);
+   EXPECT_EQ(std::find(&a[0], &a[2], 3) == &a[2], true);
+ 
+-  // Find return a const int *
+-  EXPECT_EQ(std::find(a.begin(), a.end(), 1) == &a[0], true);
+-  EXPECT_EQ(std::find(a.begin(), a.end(), 5) == &a[1], true);
+-  EXPECT_EQ(std::find(a.begin(), a.end(), 3) == &a[2], true);
++  // Find returns an interator
++  EXPECT_EQ(std::find(a.begin(), a.end(), 1) == std::next(a.begin(), 0), true);
++  EXPECT_EQ(std::find(a.begin(), a.end(), 5) == std::next(a.begin(), 1), true);
++  EXPECT_EQ(std::find(a.begin(), a.end(), 3) == std::next(a.begin(), 2), true);
+ 
+   // Search value that are not in the vector
+   EXPECT_EQ(std::find(a.begin(), a.end(), 0) == a.end(), true);

diff --git a/media-gfx/blender/metadata.xml b/media-gfx/blender/metadata.xml
index 6fc1b5f9fa5..16d447e5634 100644
--- a/media-gfx/blender/metadata.xml
+++ b/media-gfx/blender/metadata.xml
@@ -14,12 +14,6 @@
 		rendering, post-production, interactive creation and playback.
 	</longdescription>
 	<use>
-		<flag name="abi6-compat">
-			Build for OpenVDB ABI 6.
-		</flag>
-		<flag name="abi7-compat">
-			Build for OpenVDB ABI 7.
-		</flag>
 		<flag name="alembic">
 			Add support for Alembic through
 			<pkg>media-gfx/alembic</pkg>.
@@ -42,18 +36,19 @@
 		<flag name="dds">
 			Adds DDS textures support to Blender.
 		</flag>
-		<flag name="elbeem">
-			Adds surface fluid simulation to Blender using El'Beem library.
+		<flag name="embree">
+			Use embree to accelerate certain areas of the Cycles render engine.
+		</flag>
+		<flag name="fluid">
+			Adds fluid simulation support via the built-in Mantaflow library.
 		</flag>
 		<flag name="headless">
 			Build without graphical support (renderfarm, server mode only).
 		</flag>
-		<flag name="llvm">
-			Enable features depending on llvm.
-		</flag>
 		<flag name="ndof">
 			Enable NDOF input devices (SpaceNavigator and friends).
 		</flag>
+		<flag name="oidn">Enable OpenImageDenoiser Support</flag>
 		<flag name="opencl">
 			Allow OpenCL Graphics Acceleration. This may
 			require extra graphics card drivers.</flag>
@@ -68,6 +63,12 @@
 		<flag name="osl">
 			Add support for OpenShadingLanguage scripting.
 		</flag>
+		<flag name="potrace">
+			Add support for converting bitmaps into Grease pencil line using the potrace library.
+		</flag>
+		<flag name="pugixml">
+			Enable PugiXML support (Used for OpenImageIO, Grease Pencil SVG export)
+		</flag>
 		<flag name="standalone">
 			Build the standalone version of Cycles.
 		</flag>


             reply	other threads:[~2021-06-10  0:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  0:51 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-12-01  8:34 [gentoo-commits] repo/gentoo:master commit in: media-gfx/blender/files/, media-gfx/blender/ Sam James
2023-10-27  2:59 Sam James
2023-05-01 15:15 Sam James
2023-02-17  5:29 Sam James
2022-12-20 10:53 Sam James
2022-09-01  2:06 Sam James
2022-02-12  3:55 Sam James
2020-11-08 10:42 Sam James
2020-08-24 13:42 Sam James
2020-08-24 13:42 Sam James
2019-06-06 21:22 Andreas Sturmlechner
2019-03-21 18:12 Michał Górny
2018-08-16 14:15 Jonathan Scruggs
2016-10-22 23:26 David Seifert
2016-09-29 15:12 Michael Palimaka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1623284361.61c7536f66bd3a6a3347800226cd8dc969671116.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox