[Bf-blender-cvs] [05d09dcb816] blender-v3.3-release: Build: fix/workaround for the opencollada.diff not applying on Linux

Campbell Barton noreply at git.blender.org
Thu Nov 3 15:04:28 CET 2022


Commit: 05d09dcb816ff4c588292d6ed593fc0163cd7a69
Author: Campbell Barton
Date:   Tue Oct 25 17:49:14 2022 +1100
Branches: blender-v3.3-release
https://developer.blender.org/rB05d09dcb816ff4c588292d6ed593fc0163cd7a69

Build: fix/workaround for the opencollada.diff not applying on Linux

===================================================================

M	build_files/build_environment/cmake/opencollada.cmake

===================================================================

diff --git a/build_files/build_environment/cmake/opencollada.cmake b/build_files/build_environment/cmake/opencollada.cmake
index 9473aafbe88..b1a3028debd 100644
--- a/build_files/build_environment/cmake/opencollada.cmake
+++ b/build_files/build_environment/cmake/opencollada.cmake
@@ -4,6 +4,18 @@ if(UNIX)
   set(OPENCOLLADA_EXTRA_ARGS
     -DLIBXML2_INCLUDE_DIR=${LIBDIR}/xml2/include/libxml2
     -DLIBXML2_LIBRARIES=${LIBDIR}/xml2/lib/libxml2.a)
+
+  # WARNING: the patch contains mixed UNIX and DOS line endings
+  # as does the OPENCOLLADA package, if this can be corrected upstream that would be better.
+  # For now use `sed` to force UNIX line endings so the patch applies.
+  # Needed as neither ignoring white-space or applying as a binary resolve this problem.
+  set(PATCH_MAYBE_DOS2UNIX_CMD
+    sed -i "s/\\r//"
+    ${PATCH_DIR}/opencollada.diff
+    ${BUILD_DIR}/opencollada/src/external_opencollada/CMakeLists.txt
+    ${BUILD_DIR}/opencollada/src/external_opencollada/Externals/LibXML/CMakeLists.txt &&
+  )
+
 else()
   set(OPENCOLLADA_EXTRA_ARGS
     -DCMAKE_DEBUG_POSTFIX=_d
@@ -14,6 +26,7 @@ else()
   else()
     list(APPEND  OPENCOLLADA_EXTRA_ARGS -DLIBXML2_LIBRARIES=${LIBDIR}/xml2/lib/libxml2sd.lib)
   endif()
+  set(PATCH_MAYBE_DOS2UNIX_CMD)
 endif()
 
 ExternalProject_Add(external_opencollada
@@ -21,11 +34,14 @@ ExternalProject_Add(external_opencollada
   DOWNLOAD_DIR ${DOWNLOAD_DIR}
   URL_HASH ${OPENCOLLADA_HASH_TYPE}=${OPENCOLLADA_HASH}
   PREFIX ${BUILD_DIR}/opencollada
-  PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/opencollada/src/external_opencollada < ${PATCH_DIR}/opencollada.diff
+  PATCH_COMMAND
+    ${PATCH_MAYBE_DOS2UNIX_CMD}
+    ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/opencollada/src/external_opencollada < ${PATCH_DIR}/opencollada.diff
   CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/opencollada ${DEFAULT_CMAKE_FLAGS} ${OPENCOLLADA_EXTRA_ARGS}
   INSTALL_DIR ${LIBDIR}/opencollada
 )
 
+unset(PATCH_MAYBE_DOS2UNIX_CMD)
 
 add_dependencies(
   external_opencollada



More information about the Bf-blender-cvs mailing list