Merge pull request #180548 from veprbl/pr/blender_darwin_fix_3

blender: fix on darwin

authored by

Robert Scott and committed by
GitHub
e0c66dad 47c8a95f

+40 -21
+37 -16
pkgs/applications/misc/blender/darwin.patch
··· 1 + diff --git a/CMakeLists.txt b/CMakeLists.txt 2 + --- a/CMakeLists.txt 3 + +++ b/CMakeLists.txt 4 + @@ -1832,7 +1832,7 @@ if(WITH_COMPILER_SHORT_FILE_MACRO) 5 + ADD_CHECK_CXX_COMPILER_FLAG(CXX_PREFIX_MAP_FLAGS CXX_MACRO_PREFIX_MAP -fmacro-prefix-map=foo=bar) 6 + if(C_MACRO_PREFIX_MAP AND CXX_MACRO_PREFIX_MAP) 7 + if(APPLE) 8 + - if(XCODE AND ${XCODE_VERSION} VERSION_LESS 12.0) 9 + + if(FALSE) 10 + # Developers may have say LLVM Clang-10.0.1 toolchain (which supports the flag) 11 + # with Xcode-11 (the Clang of which doesn't support the flag). 12 + message(WARNING 1 13 diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake 2 14 --- a/build_files/cmake/platform/platform_apple.cmake 3 15 +++ b/build_files/cmake/platform/platform_apple.cmake 4 - @@ -77,7 +77,6 @@ else() 16 + @@ -60,7 +60,6 @@ else() 5 17 message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}") 6 18 endif() 7 19 if(NOT EXISTS "${LIBDIR}/") ··· 9 21 endif() 10 22 11 23 # Prefer lib directory paths 12 - @@ -114,10 +113,6 @@ if(WITH_CODEC_SNDFILE) 24 + @@ -98,10 +97,6 @@ if(WITH_CODEC_SNDFILE) 13 25 find_library(_sndfile_VORBIS_LIBRARY NAMES vorbis HINTS ${LIBDIR}/ffmpeg/lib) 14 26 find_library(_sndfile_VORBISENC_LIBRARY NAMES vorbisenc HINTS ${LIBDIR}/ffmpeg/lib) 15 27 list(APPEND LIBSNDFILE_LIBRARIES ··· 20 32 ) 21 33 22 34 print_found_status("SndFile libraries" "${LIBSNDFILE_LIBRARIES}") 23 - @@ -134,7 +129,7 @@ if(WITH_PYTHON) 24 - # normally cached but not since we include them with blender 35 + @@ -118,7 +113,7 @@ if(WITH_PYTHON) 36 + # Normally cached but not since we include them with blender. 25 37 set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}") 26 38 set(PYTHON_EXECUTABLE "${LIBDIR}/python/bin/python${PYTHON_VERSION}") 27 39 - set(PYTHON_LIBRARY ${LIBDIR}/python/lib/libpython${PYTHON_VERSION}.a) 28 40 + set(PYTHON_LIBRARY ${LIBDIR}/python/lib/libpython${PYTHON_VERSION}.dylib) 29 41 set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}") 30 - # set(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled 31 42 else() 32 - @@ -175,9 +170,7 @@ endif() 33 - if(WITH_CODEC_FFMPEG) 43 + # Module must be compiled against Python framework. 44 + @@ -147,7 +142,7 @@ endif() 45 + 46 + # FreeType compiled with Brotli compression for woff2. 47 + find_package(Freetype REQUIRED) 48 + -list(APPEND FREETYPE_LIBRARIES 49 + +message(TRACE APPEND FREETYPE_LIBRARIES 50 + ${LIBDIR}/brotli/lib/libbrotlicommon-static.a 51 + ${LIBDIR}/brotli/lib/libbrotlidec-static.a) 52 + 53 + @@ -159,9 +154,7 @@ if(WITH_CODEC_FFMPEG) 54 + set(FFMPEG_ROOT_DIR ${LIBDIR}/ffmpeg) 34 55 set(FFMPEG_FIND_COMPONENTS 35 56 avcodec avdevice avformat avutil 36 57 - mp3lame ogg opus swresample swscale ··· 40 61 find_package(FFmpeg) 41 62 endif() 42 63 43 - @@ -275,7 +268,6 @@ if(WITH_BOOST) 64 + @@ -270,7 +263,6 @@ if(WITH_BOOST) 44 65 endif() 45 66 46 67 if(WITH_INTERNATIONAL OR WITH_CODEC_FFMPEG) ··· 48 69 endif() 49 70 50 71 if(WITH_PUGIXML) 51 - @@ -476,7 +468,7 @@ else() 52 - set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic") 53 - endif() 72 + @@ -399,7 +391,7 @@ endif() 54 73 55 - -if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5) 56 - +if(FALSE) 57 - # Xcode 5 is always using CLANG, which has too low template depth of 128 for libmv 58 - string(APPEND CMAKE_CXX_FLAGS " -ftemplate-depth=1024") 59 - endif() 74 + # CMake FindOpenMP doesn't know about AppleClang before 3.12, so provide custom flags. 75 + if(WITH_OPENMP) 76 + - if(CMAKE_C_COMPILER_ID MATCHES "Clang") 77 + + if(FALSE) 78 + # Use OpenMP from our precompiled libraries. 79 + message(STATUS "Using ${LIBDIR}/openmp for OpenMP") 80 + set(OPENMP_CUSTOM ON)
+1 -5
pkgs/applications/misc/blender/default.nix
··· 76 76 : > build_files/cmake/platform/platform_apple_xcode.cmake 77 77 substituteInPlace source/creator/CMakeLists.txt \ 78 78 --replace '${"$"}{LIBDIR}/python' \ 79 - '${python}' \ 80 - --replace '${"$"}{LIBDIR}/openmp' \ 81 - '${llvmPackages.openmp}' 79 + '${python}' 82 80 substituteInPlace build_files/cmake/platform/platform_apple.cmake \ 83 81 --replace '${"$"}{LIBDIR}/python' \ 84 82 '${python}' \ ··· 159 157 ''; 160 158 161 159 meta = with lib; { 162 - # darwin.patch doesn't apply anymore, needs update 163 - broken = stdenv.isDarwin; 164 160 description = "3D Creation/Animation/Publishing System"; 165 161 homepage = "https://www.blender.org"; 166 162 # They comment two licenses: GPLv2 and Blender License, but they
+2
pkgs/top-level/all-packages.nix
··· 25851 25851 bleachbit = callPackage ../applications/misc/bleachbit { }; 25852 25852 25853 25853 blender = callPackage ../applications/misc/blender { 25854 + # LLVM 11 crashes when compiling GHOST_SystemCocoa.mm 25855 + stdenv = if stdenv.isDarwin then llvmPackages_10.stdenv else stdenv; 25854 25856 inherit (darwin.apple_sdk.frameworks) Cocoa CoreGraphics ForceFeedback OpenAL OpenGL; 25855 25857 }; 25856 25858