blender: update to python3.12, add patch

- fetch patch from upstream to fix build
- update to python3.12 to also fix build

Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
This commit is contained in:
2024-07-07 16:52:43 +02:00
parent 0134950909
commit 0f3d1ea625

View File

@@ -19,6 +19,7 @@
darwin, darwin,
dbus, dbus,
embree, embree,
fetchpatch,
fetchurl, fetchurl,
fetchzip, fetchzip,
ffmpeg, ffmpeg,
@@ -111,7 +112,14 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-T7s69k0/hN9ccQN0hFQibBiFwawu1Tc9DOoegOgsCEg="; hash = "sha256-T7s69k0/hN9ccQN0hFQibBiFwawu1Tc9DOoegOgsCEg=";
}; };
patches = [ ./draco.patch ] ++ lib.optional stdenv.isDarwin ./darwin.patch; patches = [
./draco.patch
# https://projects.blender.org/blender/blender/pulls/121636
(fetchpatch {
url = " https://projects.blender.org/blender/blender/commit/ae35b5758791bebb21741f9b505b9fca347ae50e.patch";
hash = "sha256-xUi55+7aiwEjtjqOi8to1YxdPlsBUThCCkCa5T6LIQc=";
})
] ++ lib.optional stdenv.isDarwin ./darwin.patch;
postPatch = postPatch =
( (
@@ -130,12 +138,12 @@ stdenv.mkDerivation (finalAttrs: {
'' ''
else else
'' ''
substituteInPlace extern/clew/src/clew.c --replace '"libOpenCL.so"' '"${ocl-icd}/lib/libOpenCL.so"' substituteInPlace extern/clew/src/clew.c --replace-fail '"libOpenCL.so"' '"${ocl-icd}/lib/libOpenCL.so"'
'' ''
) )
+ (lib.optionalString hipSupport '' + (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-fail '"/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"' substituteInPlace extern/hipew/src/hipew.c --replace-fail '"opt/rocm/hip/bin"' '"${rocmPackages.clr}/bin"'
''); '');
env.NIX_CFLAGS_COMPILE = "-I${python3}/include/${python3.libPrefix}"; env.NIX_CFLAGS_COMPILE = "-I${python3}/include/${python3.libPrefix}";
@@ -177,7 +185,9 @@ stdenv.mkDerivation (finalAttrs: {
"-DWITH_GHOST_WAYLAND_DYNLOAD=OFF" "-DWITH_GHOST_WAYLAND_DYNLOAD=OFF"
"-DWITH_GHOST_WAYLAND_LIBDECOR=ON" "-DWITH_GHOST_WAYLAND_LIBDECOR=ON"
] ]
++ lib.optionals (stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isLinux) [ "-DWITH_CYCLES_EMBREE=OFF" ] ++ lib.optionals (stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isLinux) [
"-DWITH_CYCLES_EMBREE=OFF"
]
++ lib.optionals stdenv.isDarwin [ ++ lib.optionals stdenv.isDarwin [
"-DLIBDIR=/does-not-exist" "-DLIBDIR=/does-not-exist"
"-DWITH_CYCLES_OSL=OFF" # causes segfault on aarch64-darwin "-DWITH_CYCLES_OSL=OFF" # causes segfault on aarch64-darwin
@@ -320,15 +330,16 @@ stdenv.mkDerivation (finalAttrs: {
# Set RUNPATH so that libcuda and libnvrtc in /run/opengl-driver(-32)/lib can be # Set RUNPATH so that libcuda and libnvrtc in /run/opengl-driver(-32)/lib can be
# found. See the explanation in libglvnd. # found. See the explanation in libglvnd.
postFixup = lib.optionalString cudaSupport '' postFixup =
for program in $out/bin/blender $out/bin/.blender-wrapped; do lib.optionalString cudaSupport ''
isELF "$program" || continue for program in $out/bin/blender $out/bin/.blender-wrapped; do
addOpenGLRunpath "$program" isELF "$program" || continue
done addOpenGLRunpath "$program"
'' done
+ lib.optionalString stdenv.isDarwin '' ''
makeWrapper $out/Applications/Blender.app/Contents/MacOS/Blender $out/bin/blender + lib.optionalString stdenv.isDarwin ''
''; makeWrapper $out/Applications/Blender.app/Contents/MacOS/Blender $out/bin/blender
'';
passthru = { passthru = {
python = python3; python = python3;
@@ -342,9 +353,7 @@ stdenv.mkDerivation (finalAttrs: {
}; };
tests = { tests = {
render = runCommand "${finalAttrs.pname}-test" { render = runCommand "${finalAttrs.pname}-test" { nativeBuildInputs = [ mesa.llvmpipeHook ]; } ''
nativeBuildInputs = [ mesa.llvmpipeHook ];
} ''
set -euo pipefail set -euo pipefail
cat <<'PYTHON' > scene-config.py cat <<'PYTHON' > scene-config.py
import bpy import bpy
@@ -396,7 +405,9 @@ stdenv.mkDerivation (finalAttrs: {
# They comment two licenses: GPLv2 and Blender License, but they # They comment two licenses: GPLv2 and Blender License, but they
# say: "We've decided to cancel the BL offering for an indefinite period." # say: "We've decided to cancel the BL offering for an indefinite period."
# OptiX, enabled with cudaSupport, is non-free. # OptiX, enabled with cudaSupport, is non-free.
license = with lib.licenses; [ gpl2Plus ] ++ lib.optional cudaSupport (unfree // { shortName = "NVidia OptiX EULA"; }); license =
with lib.licenses;
[ gpl2Plus ] ++ lib.optional cudaSupport (unfree // { shortName = "NVidia OptiX EULA"; });
platforms = [ platforms = [
"aarch64-linux" "aarch64-linux"