From a5139cf271b771621b8f1a66e99986f8cdd18e2f Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Fri, 12 Jul 2024 06:59:59 -0400 Subject: [PATCH] blender: 4.1.1 -> 4.2.0 Changelog: https://developer.blender.org/docs/release_notes/4.2/ - Since we are using `srcs` instead of `src`, now need to use `fetchzip` instead of `fetchurl` - Bundled assets are no longer included in source tarball, but they are in the built-release tarball, so fetch them and move them into place. - fetchpatch-ed commit is now included - clew is removed upstream, so no need to patch it - EEVEE is replaced by EEVEE Next - Addons have been relocated --- pkgs/applications/misc/blender/default.nix | 73 +++++++++++----------- pkgs/applications/misc/blender/draco.patch | 4 +- 2 files changed, 40 insertions(+), 37 deletions(-) diff --git a/pkgs/applications/misc/blender/default.nix b/pkgs/applications/misc/blender/default.nix index 5a73be96c971..5bd57ca781eb 100644 --- a/pkgs/applications/misc/blender/default.nix +++ b/pkgs/applications/misc/blender/default.nix @@ -18,8 +18,7 @@ cudaSupport ? config.cudaSupport, dbus, embree, - fetchpatch, - fetchurl, + fetchgit, fetchzip, ffmpeg, fftw, @@ -55,7 +54,6 @@ llvmPackages, makeWrapper, mesa, - ocl-icd, openal, opencollada, opencolorio, @@ -102,41 +100,46 @@ in stdenv.mkDerivation (finalAttrs: { pname = "blender"; - version = "4.1.1"; + version = "4.2.0"; - src = fetchurl { - url = "https://download.blender.org/source/blender-${finalAttrs.version}.tar.xz"; - hash = "sha256-T7s69k0/hN9ccQN0hFQibBiFwawu1Tc9DOoegOgsCEg="; - }; - - patches = [ - ./draco.patch - (fetchpatch { - url = "https://projects.blender.org/blender/blender/commit/ae35b5758791bebb21741f9b505b9fca347ae50e.patch"; - hash = "sha256-xUi55+7aiwEjtjqOi8to1YxdPlsBUThCCkCa5T6LIQc="; + srcs = [ + (fetchzip { + name = "source"; + url = "https://download.blender.org/source/blender-${finalAttrs.version}.tar.xz"; + hash = "sha256-STG4IuEhkdA+sDPIpCAkSflyd3rSUZ9ZCS9PdB4vyTY="; }) - ] ++ lib.optional stdenv.isDarwin ./darwin.patch; + (fetchgit { + name = "assets"; + url = "https://projects.blender.org/blender/blender-assets.git"; + rev = "6864f1832e71a31e1e04f72bb7a5a1f53f0cd01c"; + fetchLFS = true; + hash = "sha256-vepK0inPMuleAJBSipwoI99nMBBiFaK/eSMHDetEtjY="; + }) + ]; + + postUnpack = '' + chmod -R u+w * + rm -r assets/working + mv assets --target-directory source/release/datafiles/ + ''; + + sourceRoot = "source"; + + patches = [ ./draco.patch ] ++ lib.optional stdenv.isDarwin ./darwin.patch; postPatch = - ( - if stdenv.isDarwin then - '' - : > build_files/cmake/platform/platform_apple_xcode.cmake - substituteInPlace source/creator/CMakeLists.txt \ - --replace-fail '${"$"}{LIBDIR}/python' \ - '${python3}' \ - --replace-fail '${"$"}{LIBDIR}/materialx/' '${python3Packages.materialx}/' - substituteInPlace build_files/cmake/platform/platform_apple.cmake \ - --replace-fail '${"$"}{LIBDIR}/brotli/lib/libbrotlicommon-static.a' \ - '${lib.getLib brotli}/lib/libbrotlicommon.dylib' \ - --replace-fail '${"$"}{LIBDIR}/brotli/lib/libbrotlidec-static.a' \ - '${lib.getLib brotli}/lib/libbrotlidec.dylib' - '' - else - '' - substituteInPlace extern/clew/src/clew.c --replace '"libOpenCL.so"' '"${ocl-icd}/lib/libOpenCL.so"' - '' - ) + (lib.optionalString stdenv.isDarwin '' + : > build_files/cmake/platform/platform_apple_xcode.cmake + substituteInPlace source/creator/CMakeLists.txt \ + --replace-fail '${"$"}{LIBDIR}/python' \ + '${python3}' \ + --replace-fail '${"$"}{LIBDIR}/materialx/' '${python3Packages.materialx}/' + substituteInPlace build_files/cmake/platform/platform_apple.cmake \ + --replace-fail '${"$"}{LIBDIR}/brotli/lib/libbrotlicommon-static.a' \ + '${lib.getLib brotli}/lib/libbrotlicommon.dylib' \ + --replace-fail '${"$"}{LIBDIR}/brotli/lib/libbrotlidec-static.a' \ + '${lib.getLib brotli}/lib/libbrotlidec.dylib' + '') + (lib.optionalString hipSupport '' substituteInPlace extern/hipew/src/hipew.c --replace '"/opt/rocm/hip/lib/libamdhip64.so"' '"${rocmPackages.clr}/lib/libamdhip64.so"' substituteInPlace extern/hipew/src/hipew.c --replace '"opt/rocm/hip/bin"' '"${rocmPackages.clr}/bin"' @@ -375,7 +378,7 @@ stdenv.mkDerivation (finalAttrs: { PYTHON mkdir $out - for engine in BLENDER_EEVEE CYCLES; do + for engine in BLENDER_EEVEE_NEXT CYCLES; do echo "Rendering with $engine..." # Beware that argument order matters ${lib.getExe finalAttrs.finalPackage} \ diff --git a/pkgs/applications/misc/blender/draco.patch b/pkgs/applications/misc/blender/draco.patch index 2a856a0638ae..df6729c445cc 100644 --- a/pkgs/applications/misc/blender/draco.patch +++ b/pkgs/applications/misc/blender/draco.patch @@ -12,8 +12,8 @@ # enable boost for cycles, audaspace or i18n # otherwise if the user disabled ---- a/scripts/addons/io_scene_gltf2/io/com/gltf2_io_draco_compression_extension.py -+++ b/scripts/addons/io_scene_gltf2/io/com/gltf2_io_draco_compression_extension.py +--- a/scripts/addons_core/io_scene_gltf2/io/com/gltf2_io_draco_compression_extension.py ++++ b/scripts/addons_core/io_scene_gltf2/io/com/gltf2_io_draco_compression_extension.py @@ -17,7 +17,7 @@ def dll_path() -> Path: """ lib_name = 'extern_draco'