--- blender-2.80/CMakeLists.txt.orig	2019-08-01 09:34:24.337794500 +0300
+++ blender-2.80/CMakeLists.txt	2019-08-01 09:51:40.828741800 +0300
@@ -285,6 +285,8 @@
 if(UNIX AND NOT APPLE)
   option(WITH_SYSTEM_GLEW "Use GLEW OpenGL wrapper library provided by the operating system" OFF)
   option(WITH_SYSTEM_GLES "Use OpenGL ES library provided by the operating system"           ON)
+elseif(MINGW)
+  set(WITH_SYSTEM_GLEW ON)
 else()
   # not an option for other OS's
   set(WITH_SYSTEM_GLEW OFF)
@@ -366,7 +368,7 @@
   option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON)
 endif()
 option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ON)
-if(UNIX AND NOT APPLE)
+if((UNIX AND NOT APPLE) OR MINGW)
   option(WITH_INSTALL_PORTABLE "Install redistributeable runtime, otherwise install into CMAKE_INSTALL_PREFIX" ON)
   option(WITH_STATIC_LIBS "Try to link with static libraries, as much as possible, to make blender more portable across distributions" OFF)
   if(WITH_STATIC_LIBS)
@@ -490,7 +492,7 @@
   set(WITH_SYSTEM_GLEW OFF)
 endif()
 
-if(WIN32)
+if(MSVC)
   getDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES)
   set(CPACK_INSTALL_PREFIX ${CMAKE_GENERIC_PROGRAM_FILES}/${})
 endif()
@@ -544,7 +546,7 @@
   endif()
 endif()
 
-if(WIN32)
+if(MSVC)
   # Use hardcoded paths or find_package to find externals
   option(WITH_WINDOWS_FIND_MODULES "Use find_package to locate libraries" OFF)
   mark_as_advanced(WITH_WINDOWS_FIND_MODULES)
@@ -897,8 +899,10 @@
 
 if(UNIX AND NOT APPLE)
   include(platform_unix)
-elseif(WIN32)
+elseif(MSVC)
   include(platform_win32)
+elseif(MINGW)
+  include(platform_win32_mingw64)
 elseif(APPLE)
   include(platform_apple)
 endif()
@@ -990,7 +990,7 @@
 endif()
 if(WITH_IMAGE_OPENJPEG)
   # Special handling of Windows platform where openjpeg is always static.
-  if(WIN32)
+  if(WIN32 AND WITH_STATIC_LIBS)
     set(OPENJPEG_DEFINES "-DOPJ_STATIC")
   else()
     set(OPENJPEG_DEFINES "")
@@ -1586,7 +1590,7 @@
     )
   endif()
 
-  if(WIN32 OR APPLE)
+  if(MSVC OR APPLE)
     # Windows and macOS have this bundled with Python libraries.
   elseif((WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY) OR (WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE))
     if(("${PYTHON_NUMPY_PATH}" STREQUAL "") OR (${PYTHON_NUMPY_PATH} MATCHES NOTFOUND))
@@ -1597,7 +1601,7 @@
     endif()
   endif()
 
-  if(WIN32 OR APPLE)
+  if(MSVC OR APPLE)
     # pass, we have this in lib/python/site-packages
   elseif(WITH_PYTHON_INSTALL_REQUESTS)
     find_python_package(requests)
--- blender-2.78/build_files/cmake/Modules/FindOpenImageIO.cmake.orig	2016-10-09 13:01:04.500104400 +0300
+++ blender-2.78/build_files/cmake/Modules/FindOpenImageIO.cmake	2016-10-09 13:01:20.038306000 +0300
@@ -59,6 +59,7 @@
 FIND_FILE(OPENIMAGEIO_IDIFF
   NAMES
     idiff
+    idiff.exe
   HINTS
     ${OPENIMAGEIO_ROOT_DIR}
   PATH_SUFFIXES
--- blender-2.80/build_files/cmake/platform/platform_win32_mingw64.cmake.orig	1970-01-01 03:00:00.000000000 +0300
+++ blender-2.80/build_files/cmake/platform/platform_win32_mingw64.cmake	2019-08-01 10:07:13.714675300 +0300
@@ -0,0 +1,488 @@
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# The Original Code is Copyright (C) 2016, Blender Foundation
+# All rights reserved.
+#
+# Contributor(s): Sergey Sharybin.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+# Libraries configuration for Windows when compiling with MinGW.
+
+# keep GCC specific stuff here
+include(CheckCSourceCompiles)
+# Setup 64bit and 64bit windows systems
+CHECK_C_SOURCE_COMPILES("
+	#ifndef __MINGW64__
+	#error
+	#endif
+	int main(void) { return 0; }
+	"
+	WITH_MINGW64
+)
+
+set(LIBDIR ${MINGW_LIBS})
+if(WITH_MINGW64)
+	message(STATUS "Compiling for 64 bit with MinGW-w64.")
+else()
+	message(STATUS "Compiling for 32 bit with MinGW-w32.")
+endif()
+
+set(WINTAB_INC ${LIBDIR}/include)
+
+if(NOT EXISTS "${LIBDIR}/")
+	message(FATAL_ERROR "Windows requires pre-compiled libs at: '${LIBDIR}'")
+endif()
+
+list(APPEND PLATFORM_LINKLIBS
+	-lshell32 -lvfw32 -ladvapi32 -lshfolder -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32
+	-lz -lstdc++ -lshell32 -lole32 -luuid -lwsock32 -lpsapi -ldbghelp -lshlwapi -lglu32
+)
+
+if(WITH_INPUT_IME)
+	list(APPEND PLATFORM_LINKLIBS -limm32)
+endif()
+
+# We want to support Windows 7 level ABI
+add_definitions(-D_WIN32_WINNT=0x601)
+include(build_files/cmake/platform/platform_win32_bundle_crt.cmake)
+
+set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
+
+# GNU Compiler
+if(CMAKE_COMPILER_IS_GNUCC)
+	# `maybe-uninitialized` is unreliable in release builds, but fine in debug builds.
+	set(GCC_EXTRA_FLAGS_RELEASE "-Wno-maybe-uninitialized")
+	set(CMAKE_C_FLAGS_RELEASE          "${GCC_EXTRA_FLAGS_RELEASE} ${CMAKE_C_FLAGS_RELEASE}")
+	set(CMAKE_C_FLAGS_RELWITHDEBINFO   "${GCC_EXTRA_FLAGS_RELEASE} ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
+	set(CMAKE_CXX_FLAGS_RELEASE        "${GCC_EXTRA_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELEASE}")
+	set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${GCC_EXTRA_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
+	unset(GCC_EXTRA_FLAGS_RELEASE)
+endif()
+
+if(WITH_MINGW64)
+	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
+	list(APPEND PLATFORM_LINKLIBS -lpthread)
+
+	add_definitions(-DFREE_WINDOWS64 -DMS_WIN64)
+endif()
+
+add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
+
+add_definitions(-DFREE_WINDOWS -D_XOPEN_SOURCE -DWIN32)
+
+macro(find_package_wrapper)
+	if(WITH_STATIC_LIBS)
+		find_package_static(${ARGV})
+	else()
+		find_package(${ARGV})
+	endif()
+endmacro()
+
+find_package_wrapper(JPEG REQUIRED)
+find_package_wrapper(PNG REQUIRED)
+find_package_wrapper(ZLIB REQUIRED)
+find_package_wrapper(Freetype REQUIRED)
+
+if(WITH_LZO AND WITH_SYSTEM_LZO)
+	find_package_wrapper(LZO)
+	if(NOT LZO_FOUND)
+		message(FATAL_ERROR "Failed finding system LZO version!")
+	endif()
+endif()
+
+if(WITH_SYSTEM_EIGEN3)
+	find_package_wrapper(Eigen3)
+	if(NOT EIGEN3_FOUND)
+		message(FATAL_ERROR "Failed finding system Eigen3 version!")
+	endif()
+endif()
+# else values are set below for all platforms
+
+if(WITH_PYTHON)
+	# normally cached but not since we include them with blender
+	#set(PYTHON_VERSION 3.7) #  CACHE STRING)
+	#set(PYTHON_INCLUDE_DIR "${LIBDIR}/include/python${PYTHON_VERSION}m")  # CACHE PATH)
+	#set(PYTHON_LIBRARY "${LIBDIR}/lib/libpython${PYTHON_VERSION}m.dll.a")  # CACHE FILEPATH)
+	# uncached vars
+	#set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
+	#set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
+	find_package(PythonLibsUnix REQUIRED)
+endif()
+
+if(WITH_IMAGE_OPENEXR)
+	find_package_wrapper(OpenEXR)  # our own module
+	if(NOT OPENEXR_FOUND)
+		set(WITH_IMAGE_OPENEXR OFF)
+	endif()
+endif()
+
+if(WITH_IMAGE_OPENJPEG)
+	find_package_wrapper(OpenJPEG)
+	if(NOT OPENJPEG_FOUND)
+		set(WITH_IMAGE_OPENJPEG OFF)
+	endif()
+endif()
+
+if(WITH_IMAGE_TIFF)
+	# XXX Linking errors with debian static tiff :/
+#		find_package_wrapper(TIFF)
+	find_package(TIFF)
+	if(NOT TIFF_FOUND)
+		set(WITH_IMAGE_TIFF OFF)
+	endif()
+endif()
+
+# Audio IO
+if(WITH_SYSTEM_AUDASPACE)
+	find_package_wrapper(Audaspace)
+	if(NOT AUDASPACE_FOUND OR NOT AUDASPACE_C_FOUND)
+		message(FATAL_ERROR "Audaspace external library not found!")
+	endif()
+endif()
+
+if(WITH_OPENAL)
+	find_package_wrapper(OpenAL)
+	if(NOT OPENAL_FOUND)
+		set(WITH_OPENAL OFF)
+	endif()
+endif()
+
+if(WITH_SDL)
+	find_package_wrapper(SDL2)
+	if(SDL2_FOUND)
+		# Use same names for both versions of SDL until we move to 2.x.
+		set(SDL_INCLUDE_DIR "${SDL2_INCLUDE_DIR}")
+		set(SDL_LIBRARY "${SDL2_LIBRARY}")
+		set(SDL_FOUND "${SDL2_FOUND}")
+	else()
+		find_package_wrapper(SDL)
+	endif()
+	mark_as_advanced(
+		SDL_INCLUDE_DIR
+		SDL_LIBRARY
+	)
+	# unset(SDLMAIN_LIBRARY CACHE)
+	if(NOT SDL_FOUND)
+		set(WITH_SDL OFF)
+	endif()
+endif()
+
+if(WITH_JACK)
+	find_package_wrapper(Jack)
+	if(NOT JACK_FOUND)
+		set(WITH_JACK OFF)
+	endif()
+endif()
+
+# Codecs
+if(WITH_CODEC_SNDFILE)
+	find_package_wrapper(SndFile)
+	if(NOT SNDFILE_FOUND)
+		set(WITH_CODEC_SNDFILE OFF)
+	endif()
+endif()
+
+if(WITH_CODEC_FFMPEG)
+	set(FFMPEG ${LIBDIR} CACHE PATH "FFMPEG Directory")
+	set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
+
+	mark_as_advanced(FFMPEG)
+
+	# lame, but until we have proper find module for ffmpeg
+	if(EXISTS "${FFMPEG}/include/ffmpeg/")
+		list(APPEND FFMPEG_INCLUDE_DIRS "${FFMPEG}/include/ffmpeg")
+	endif()
+	# end lameness
+
+	mark_as_advanced(FFMPEG_LIBRARIES)
+	set(FFMPEG_LIBPATH ${FFMPEG}/lib)
+endif()
+
+if(WITH_FFTW3)
+	find_package_wrapper(Fftw3)
+	if(NOT FFTW3_FOUND)
+		set(WITH_FFTW3 OFF)
+	endif()
+endif()
+
+if(WITH_OPENCOLLADA)
+	find_package_wrapper(OpenCOLLADA)
+	if(OPENCOLLADA_FOUND)
+		find_package_wrapper(XML2)
+		find_package_wrapper(PCRE)
+		list(APPEND OPENCOLLADA_LIBRARIES ${XML2_LIBRARY})
+	else()
+		set(WITH_OPENCOLLADA OFF)
+	endif()
+endif()
+
+if(WITH_MEM_JEMALLOC)
+	find_package_wrapper(JeMalloc)
+	if(NOT JEMALLOC_FOUND)
+		set(WITH_MEM_JEMALLOC OFF)
+	endif()
+endif()
+
+if(WITH_INPUT_NDOF)
+	find_package_wrapper(Spacenav)
+	if(SPACENAV_FOUND)
+		# use generic names within blenders buildsystem.
+		set(NDOF_INCLUDE_DIRS ${SPACENAV_INCLUDE_DIRS})
+		set(NDOF_LIBRARIES ${SPACENAV_LIBRARIES})
+	else()
+		set(WITH_INPUT_NDOF OFF)
+	endif()
+endif()
+
+if(WITH_CYCLES_OSL)
+	set(CYCLES_OSL ${LIBDIR} CACHE PATH "Path to OpenShadingLanguage installation")
+	if(EXISTS ${CYCLES_OSL} AND NOT OSL_ROOT)
+		set(OSL_ROOT ${CYCLES_OSL})
+	endif()
+	find_package_wrapper(OSL)
+	if(OSL_FOUND)
+		if(${OSL_LIBRARY_VERSION_MAJOR} EQUAL "1" AND ${OSL_LIBRARY_VERSION_MINOR} LESS "6")
+			list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} ${OSL_LIB_EXEC} ${OSL_LIB_QUERY})
+		endif()
+	else()
+		message(STATUS "OSL not found, disabling it from Cycles")
+		set(WITH_CYCLES_OSL OFF)
+	endif()
+endif()
+
+if(WITH_OPENVDB)
+	find_package_wrapper(OpenVDB)
+	find_package_wrapper(Blosc)
+	if(NOT OPENVDB_FOUND)
+		set(WITH_OPENVDB OFF)
+		set(WITH_OPENVDB_BLOSC OFF)
+		message(STATUS "OpenVDB not found, disabling it")
+	elseif(NOT BLOSC_FOUND)
+		set(WITH_OPENVDB_BLOSC OFF)
+		message(STATUS "Blosc not found, disabling it for OpenVBD")
+	endif()
+	set(OPENVDB_DEFINITIONS -DOPENVDB_DLL -D_USE_MATH_DEFINES)
+endif()
+
+if(WITH_NANOVDB)
+	find_package_wrapper(NanoVDB)
+
+	if(NOT NANOVDB_FOUND)
+		set(WITH_NANOVDB OFF)
+		message(STATUS "NanoVDB not found, disabling it")
+	endif()
+endif()
+
+if(WITH_ALEMBIC)
+	find_package_wrapper(Alembic)
+
+	if(WITH_ALEMBIC_HDF5)
+		set(HDF5_ROOT_DIR ${LIBDIR}/hdf5)
+		find_package_wrapper(HDF5)
+	endif()
+
+	if(NOT ALEMBIC_FOUND OR (WITH_ALEMBIC_HDF5 AND NOT HDF5_FOUND))
+		set(WITH_ALEMBIC OFF)
+		set(WITH_ALEMBIC_HDF5 OFF)
+	endif()
+endif()
+
+if(WITH_USD)
+	find_package_wrapper(USD)
+
+	if(NOT USD_FOUND)
+		set(WITH_USD OFF)
+	endif()
+endif()
+
+if(WITH_BOOST)
+	# uses in build instructions to override include and library variables
+	if(NOT BOOST_CUSTOM)
+		if(WITH_STATIC_LIBS)
+			set(Boost_USE_STATIC_LIBS ON)
+		endif()
+		set(Boost_USE_MULTITHREADED ON)
+		set(__boost_packages filesystem regex thread date_time)
+		if(WITH_CYCLES_OSL)
+			if(NOT (${OSL_LIBRARY_VERSION_MAJOR} EQUAL "1" AND ${OSL_LIBRARY_VERSION_MINOR} LESS "6"))
+				list(APPEND __boost_packages wave)
+			else()
+			endif()
+		endif()
+		if(WITH_INTERNATIONAL)
+			list(APPEND __boost_packages locale)
+		endif()
+		if(WITH_CYCLES_NETWORK)
+			list(APPEND __boost_packages serialization)
+		endif()
+		if(WITH_OPENVDB)
+			list(APPEND __boost_packages iostreams)
+		endif()
+		list(APPEND __boost_packages system)
+		find_package(Boost 1.48 COMPONENTS ${__boost_packages})
+		if(NOT Boost_FOUND)
+			# try to find non-multithreaded if -mt not found, this flag
+			# doesn't matter for us, it has nothing to do with thread
+			# safety, but keep it to not disturb build setups
+			set(Boost_USE_MULTITHREADED OFF)
+			find_package(Boost 1.48 COMPONENTS ${__boost_packages})
+		endif()
+		unset(__boost_packages)
+		if(Boost_USE_STATIC_LIBS AND WITH_BOOST_ICU)
+			find_package(IcuLinux)
+		endif()
+		mark_as_advanced(Boost_DIR)  # why doesnt boost do this?
+	endif()
+
+	set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
+	set(BOOST_LIBRARIES ${Boost_LIBRARIES})
+	set(BOOST_LIBPATH ${Boost_LIBRARY_DIRS})
+	set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
+endif()
+
+if(WITH_OPENIMAGEIO)
+	find_package_wrapper(OpenImageIO)
+	if(NOT OPENIMAGEIO_PUGIXML_FOUND AND WITH_CYCLES_STANDALONE)
+		find_package_wrapper(PugiXML)
+	else()
+		set(PUGIXML_INCLUDE_DIR "${OPENIMAGEIO_INCLUDE_DIR/OpenImageIO}")
+		set(PUGIXML_LIBRARIES "")
+	endif()
+
+	set(OPENIMAGEIO_LIBRARIES
+		${OPENIMAGEIO_LIBRARIES}
+		${PNG_LIBRARIES}
+		${JPEG_LIBRARIES}
+		${ZLIB_LIBRARIES}
+		${BOOST_LIBRARIES}
+	)
+	set(OPENIMAGEIO_LIBPATH)  # TODO, remove and reference the absolute path everywhere
+	set(OPENIMAGEIO_DEFINITIONS "")
+
+	if(WITH_IMAGE_TIFF)
+		list(APPEND OPENIMAGEIO_LIBRARIES "${TIFF_LIBRARY}")
+	endif()
+	if(WITH_IMAGE_OPENEXR)
+		list(APPEND OPENIMAGEIO_LIBRARIES "${OPENEXR_LIBRARIES}")
+	endif()
+
+	if(NOT OPENIMAGEIO_FOUND)
+		set(WITH_OPENIMAGEIO OFF)
+		message(STATUS "OpenImageIO not found, disabling WITH_CYCLES")
+	endif()
+endif()
+
+if(WITH_OPENCOLORIO)
+	find_package_wrapper(OpenColorIO)
+
+	set(OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARIES})
+	set(OPENCOLORIO_LIBPATH)  # TODO, remove and reference the absolute path everywhere
+	set(OPENCOLORIO_DEFINITIONS)
+
+	if(NOT OPENCOLORIO_FOUND)
+		set(WITH_OPENCOLORIO OFF)
+		message(STATUS "OpenColorIO not found")
+	endif()
+endif()
+
+if(WITH_CYCLES_EMBREE)
+	find_package(Embree 3.8.0 REQUIRED)
+endif()
+
+if(WITH_OPENIMAGEDENOISE)
+	find_package_wrapper(OpenImageDenoise)
+
+	if(NOT OPENIMAGEDENOISE_FOUND)
+		set(WITH_OPENIMAGEDENOISE OFF)
+		message(STATUS "OpenImageDenoise not found")
+	endif()
+endif()
+
+if(WITH_LLVM)
+	find_package_wrapper(LLVM)
+
+	if(NOT LLVM_FOUND)
+		set(WITH_LLVM OFF)
+		message(STATUS "LLVM not found")
+	else()
+		# imagehelp is needed by LLVM 3.1 on MinGW, check lib\Support\Windows\Signals.inc
+		list(APPEND PLATFORM_LINKLIBS -limagehlp)
+	endif()
+endif()
+
+if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
+	find_package_wrapper(OpenSubdiv)
+
+	set(OPENSUBDIV_LIBRARIES ${OPENSUBDIV_LIBRARIES})
+	set(OPENSUBDIV_LIBPATH)  # TODO, remove and reference the absolute path everywhere
+
+	if(NOT OPENSUBDIV_FOUND)
+		set(WITH_OPENSUBDIV OFF)
+		set(WITH_CYCLES_OPENSUBDIV OFF)
+		message(STATUS "OpenSubdiv not found")
+	endif()
+endif()
+
+if(WITH_TBB)
+	find_package_wrapper(TBB)
+endif()
+
+if(NOT WITH_TBB OR NOT TBB_FOUND)
+	if(WITH_OPENIMAGEDENOISE)
+		message(STATUS "TBB not found, disabling OpenImageDenoise")
+		set(WITH_OPENIMAGEDENOISE OFF)
+	endif()
+	if(WITH_OPENVDB)
+		message(STATUS "TBB not found, disabling OpenVDB")
+		set(WITH_OPENVDB OFF)
+	endif()
+	if(WITH_MOD_FLUID)
+		message(STATUS "TBB disabled, disabling Fluid modifier")
+		set(WITH_MOD_FLUID OFF)
+	endif()
+endif()
+
+if(WITH_XR_OPENXR)
+	find_package(XR_OpenXR_SDK)
+	if(NOT XR_OPENXR_SDK_FOUND)
+		message(WARNING "OpenXR-SDK not found, disabling WITH_XR_OPENXR")
+		set(WITH_XR_OPENXR OFF)
+	endif()
+endif()
+
+if(WITH_GMP)
+	find_package_wrapper(GMP)
+	if(NOT GMP_FOUND)
+		message(WARNING "GMP not found, disabling WITH_GMP")
+		set(WITH_GMP OFF)
+	endif()
+endif()
+
+if(WITH_POTRACE)
+	find_package_wrapper(Potrace)
+	if(NOT POTRACE_FOUND)
+		message(WARNING "potrace not found, disabling WITH_POTRACE")
+		set(WITH_POTRACE OFF)
+	endif()
+endif()
+
+set(PLATFORM_LINKFLAGS "-Xlinker --stack=2097152")
+
+## DISABLE - causes linking errors
+## for re-distribution, so users dont need mingw installed
+# set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-libgcc -static-libstdc++")
--- blender-2.80/source/creator/CMakeLists.txt.orig	2019-08-01 11:08:03.806515200 +0300
+++ blender-2.80/source/creator/CMakeLists.txt	2019-08-01 11:18:49.638850100 +0300
@@ -318,7 +318,7 @@
 # -----------------------------------------------------------------------------
 # Platform Specific Var: TARGETDIR_VER
 
-if(UNIX AND NOT APPLE)
+if((UNIX AND NOT APPLE) OR MINGW)
   if(WITH_PYTHON_MODULE)
     if(WITH_INSTALL_PORTABLE)
       set(TARGETDIR_VER ${BLENDER_VERSION})
@@ -460,13 +460,13 @@
 # -----------------------------------------------------------------------------
 # Install Targets (Platform Specific)
 
-if(UNIX AND NOT APPLE)
+if((UNIX AND NOT APPLE) OR MINGW)
 
   if(NOT WITH_PYTHON_MODULE)
     if(WITH_DOC_MANPAGE)
       add_custom_target(
         blender_man_page ALL
-        COMMAND ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1.py
+        COMMAND python3 ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1.py
                 ${EXECUTABLE_OUTPUT_PATH}/blender
                 ${CMAKE_CURRENT_BINARY_DIR}/blender.1)
       add_dependencies(blender_man_page blender)
@@ -1054,7 +1054,7 @@
 # -----------------------------------------------------------------------------
 # Setup launcher
 
-if(WIN32 AND NOT WITH_PYTHON_MODULE)
+if(MSVC AND NOT WITH_PYTHON_MODULE)
   install(
     TARGETS blender
     COMPONENT Blender
--- blender-2.80/build_files/cmake/Modules/FindPythonLibsUnix.cmake.orig	2019-08-01 15:48:36.544120800 +0300
+++ blender-2.80/build_files/cmake/Modules/FindPythonLibsUnix.cmake	2019-08-01 15:49:05.123371000 +0300
@@ -44,7 +44,9 @@
 
 # See: http://docs.python.org/extending/embedding.html#linking-requirements
 #      for why this is needed
+if(NOT MINGW)
 SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic" CACHE STRING "Linker flags for python")
+endif()
 MARK_AS_ADVANCED(PYTHON_LINKFLAGS)
 
 
