Skip to content

Commit

Permalink
blender-git: Update to latest. Use unix-like files layout.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexpux committed Dec 3, 2014
1 parent 931cd58 commit 9c654fc
Show file tree
Hide file tree
Showing 5 changed files with 179 additions and 66 deletions.
56 changes: 30 additions & 26 deletions mingw-w64-blender-git/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}-git"
provides=("${MINGW_PACKAGE_PREFIX}-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-${_realname}")
blender_version=2.71
pkgver=r55792.1e948b2
pkgver=r56781.47ebf96
_pyver=3.4
pkgrel=1
pkgdesc="A fully integrated 3D graphics creation suite (mingw-w64)"
arch=('any')
Expand Down Expand Up @@ -41,15 +42,19 @@ source=("${_realname}"::"git://git.blender.org/blender.git"
"mingw-w64-cmake.patch"
"fix-mingw-w64-definitions.patch"
"mingw-dont-install-3rdparty.patch"
"fix-finding-glew.patch")
"fix-finding-glew.patch"
"mingw-use-X11-like-path-layout.patch"
"fix-define-syntax.patch")
md5sums=('SKIP'
'SKIP'
'SKIP'
'SKIP'
'7e051acedaf998ac12406c4b1fc70104'
'696a364118b5b9adbde81f2d871febfa'
'803bad7d8a6bd148f88a1b66d36be31f'
'39e931d7652c9c95982330d95bfdd2e3'
'1969914e11d0a4f74dbfeddad742c9da'
'b11e3fe76c4433abb53c12e723dfbe4f')
'b11e3fe76c4433abb53c12e723dfbe4f'
'bdac7b47c5886bbcede99516a67de0c2'
'9c5a4e230d1c9081096d53d206cc03b4')

pkgver() {
cd "$srcdir/$_realname"
Expand All @@ -62,30 +67,34 @@ prepare() {
patch -p1 -i ${srcdir}/fix-mingw-w64-definitions.patch
patch -p1 -i ${srcdir}/mingw-dont-install-3rdparty.patch
patch -p1 -i ${srcdir}/fix-finding-glew.patch
patch -p1 -i ${srcdir}/fix-define-syntax.patch
patch -p1 -i ${srcdir}/mingw-use-X11-like-path-layout.patch

cp -rf $srcdir/translations/* $srcdir/$_realname/release/datafiles/locale/
cp -rf $srcdir/addons/* $srcdir/$_realname/release/scripts/addons/
cp -rf $srcdir/addons-contrib/* $srcdir/$_realname/release/scripts/addons_contrib/
}

build() {

pushd ${MINGW_PREFIX} > /dev/null
export PREFIX_DEPS=`pwd -W`
popd > /dev/null

mkdir $srcdir/build-${MINGW_CHOST}
cd $srcdir/build-${MINGW_CHOST}

[[ $CARCH == i686 ]] && ENABLESSE2="-DSUPPORT_SSE2_BUILD=OFF"
[[ $CARCH == i686 ]] && BUILDCUDA="OFF" || BUILDCUDA="ON"
#[[ $CARCH == i686 ]] && PMARCH="i686" || PMARCH="x86-64"
#CFLAGS="-O2 -pipe -march=${PMARCH} -mtune=generic -D__USE_MINGW_ANSI_STDIO=1"
#CXXFLAGS="$CFLAGS"

declare -a _btype
if check_option "debug" "y"; then
_btype=Debug
else
_btype=Release
fi

${MINGW_PREFIX}/bin/cmake \
-G"MSYS Makefiles" \
-DMINGW_LIBS=${PREFIX_DEPS} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${pkgdir}${MINGW_PREFIX} \
-DMINGW_LIBS=${MINGW_PREFIX} \
-DCMAKE_BUILD_TYPE=${_btype} \
-DWITH_SYSTEM_GLEW=ON \
-DWITH_SYSTEM_OPENJPEG=ON \
-DWITH_INSTALL_PORTABLE=OFF \
Expand All @@ -101,31 +110,26 @@ build() {
-DWITH_CYCLES_OSL=ON \
-DWITH_FFTW3=ON \
-DWITH_MOD_OCEANSIM=ON \
-DPYTHON_VERSION=3.4 \
-DPYTHON_LIBPATH=${PREFIX_DEPS}/lib \
-DPYTHON_LIBRARY=python3.4m \
-DPYTHON_INCLUDE_DIRS=${PREFIX_DEPS}/include/python3.4m \
-DPYTHON_VERSION=${_pyver} \
-DPYTHON_LIBPATH=${MINGW_PREFIX}/lib \
-DPYTHON_LIBRARY=python${_pyver}m \
-DPYTHON_INCLUDE_DIRS=${MINGW_PREFIX}/include/python${_pyver}m \
-DWITH_PYTHON_INSTALL=OFF \
-DWITH_PYTHON_INSTALL_NUMPY=OFF \
-DPYTHON_NUMPY_PATH=${PREFIX_DEPS}/lib/python3.4/site-packages \
-DCYCLES_OSL=${PREFIX_DEPS} \
-DPYTHON_NUMPY_PATH=${MINGW_PREFIX}/lib/python${_pyver}/site-packages \
-DCYCLES_OSL=${MINGW_PREFIX} \
-DWITH_IMAGE_REDCODE=ON \
-DWITH_OPENMP=ON \
-DWITH_LLVM=ON \
-DLLVM_STATIC=ON \
../${_realname}

# Remove the openjpeg line once blender accepts my patch
make # -j1 VERBOSE=1
make
}

package() {
cd "$srcdir/build-${MINGW_CHOST}"
make install
mkdir -p ${pkgdir}${MINGW_PREFIX}/lib
cp -r bin ${pkgdir}${MINGW_PREFIX}/
rm ${pkgdir}${MINGW_PREFIX}/bin/msgfmt.exe
mv ${pkgdir}${MINGW_PREFIX}/bin/*.a ${pkgdir}${MINGW_PREFIX}/lib/

${MINGW_PREFIX}/bin/python3 -m compileall "${pkgdir}${MINGW_PREFIX}/bin/$blender_version"
${MINGW_PREFIX}/bin/python3 -m compileall \
Expand Down
11 changes: 11 additions & 0 deletions mingw-w64-blender-git/fix-define-syntax.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- blender-2.72/extern/clew/include/clew.h.orig 2014-09-24 19:29:54.000000000 +0400
+++ blender-2.72/extern/clew/include/clew.h 2014-10-06 13:41:38.711800000 +0400
@@ -493,7 +493,7 @@
/* Define alignment keys */
#if defined( __GNUC__ )
#define CL_ALIGNED(_x) __attribute__ ((aligned(_x)))
-#elif defined( _WIN32) && (_MSC_VER)
+#elif defined( _WIN32) && defined(_MSC_VER)
/* Alignment keys neutered on windows because MSVC can't swallow function arguments with alignment requirements */
/* http://msdn.microsoft.com/en-us/library/373ak2y1%28VS.71%29.aspx */
/* #include <crtdefs.h> */
55 changes: 28 additions & 27 deletions mingw-w64-blender-git/fix-mingw-w64-definitions.patch
Original file line number Diff line number Diff line change
Expand Up @@ -158,42 +158,32 @@ diff -Naur blender/intern/ghost/intern/GHOST_TaskbarWin32.h blender-pp/intern/gh
diff -Naur blender/intern/ghost/intern/GHOST_WindowWin32.cpp blender-pp/intern/ghost/intern/GHOST_WindowWin32.cpp
--- blender/intern/ghost/intern/GHOST_WindowWin32.cpp 2014-01-14 08:17:57.783400000 +0400
+++ blender-pp/intern/ghost/intern/GHOST_WindowWin32.cpp 2014-01-14 07:08:38.456800000 +0400
@@ -29,6 +29,11 @@
* \ingroup GHOST
@@ -29,6 +29,12 @@
*/

+// Need glew for some defines
+#include <GL/glew.h>
+#include <GL/wglew.h>
+#include <math.h>
#define _USE_MATH_DEFINES
+
#include <string.h>
+#if defined(WITH_GL_EGL)
+# include "GHOST_ContextEGL.h"
+#else
+# include "GHOST_ContextWGL.h"
+#endif

#include "GHOST_WindowWin32.h"
#include "GHOST_SystemWin32.h"
@@ -36,11 +41,6 @@
@@ -36,12 +41,6 @@
#include "GHOST_ContextNone.h"
#include "utfconv.h"
#include "utf_winfunc.h"

-// Need glew for some defines
-#include <GL/glew.h>
-#include <GL/wglew.h>
-#include <math.h>
-
// MSVC6 still doesn't define M_PI
#ifndef M_PI
# define M_PI 3.1415926536
diff -Naur blender/intern/ghost/intern/GHOST_WindowWin32.h blender-pp/intern/ghost/intern/GHOST_WindowWin32.h
--- blender/intern/ghost/intern/GHOST_WindowWin32.h 2014-01-14 08:17:57.783400000 +0400
+++ blender-pp/intern/ghost/intern/GHOST_WindowWin32.h 2014-01-14 07:08:38.456800000 +0400
@@ -40,7 +40,7 @@
#include "GHOST_Window.h"
#include "GHOST_TaskbarWin32.h"
-#if defined(WITH_GL_EGL)
-# include "GHOST_ContextEGL.h"
-#else
-# include "GHOST_ContextWGL.h"
-#endif

-#ifndef __MINGW64__
+#ifndef __MINGW64_VERSION_MAJOR
#define _WIN32_WINNT 0x501 // require Windows XP or newer
#endif
#define WIN32_LEAN_AND_MEAN

#include <math.h>
diff -Naur blender/source/blender/blenlib/BLI_winstuff.h blender-pp/source/blender/blenlib/BLI_winstuff.h
--- blender/source/blender/blenlib/BLI_winstuff.h 2014-01-14 08:18:15.661000000 +0400
+++ blender-pp/source/blender/blenlib/BLI_winstuff.h 2014-01-14 07:08:38.456800000 +0400
Expand All @@ -220,3 +210,14 @@ diff -Naur blender/source/blender/blenlib/BLI_winstuff.h blender-pp/source/blend
/* python uses HAVE_SSIZE_T */
# ifndef HAVE_SSIZE_T
# define HAVE_SSIZE_T 1
diff -Naur blender/source/blender/blenlib/intern/rand.c blender-pp/source/blender/blenlib/intern/rand.c
--- blender/source/blender/blenlib/intern/rand.c 2014-01-14 08:18:15.661000000 +0400
+++ blender-pp/source/blender/blenlib/intern/rand.c 2014-01-14 07:08:38.456800000 +0400
@@ -33,6 +33,7 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
+#include <time.h>

#include "MEM_guardedalloc.h"

106 changes: 106 additions & 0 deletions mingw-w64-blender-git/mingw-use-X11-like-path-layout.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
diff -Naur blender-2.72-orig/intern/ghost/intern/GHOST_SystemPathsWin32.cpp blender-2.72/intern/ghost/intern/GHOST_SystemPathsWin32.cpp
--- blender-2.72-orig/intern/ghost/intern/GHOST_SystemPathsWin32.cpp 2014-10-08 00:07:23.583905600 +0100
+++ blender-2.72/intern/ghost/intern/GHOST_SystemPathsWin32.cpp 2014-10-08 00:08:46.678658400 +0100
@@ -69,6 +69,44 @@
{
}

+#if defined(__MINGW32__)
+
+const GHOST_TUns8 *GHOST_SystemPathsWin32::getSystemDir(int, const char *versionstr) const
+{
+ static char knownpath[MAX_PATH * 3 + 128] = {0};
+
+ char temppath[MAX_PATH + 1];
+ char temppath2[MAX_PATH + 1];
+ const GHOST_TUns8 *binary_dir = getBinaryDir();
+ strcpy(temppath2, reinterpret_cast<const char*>(binary_dir));
+ char* lastslash = strrchr(temppath2, '\\');
+ if (lastslash != NULL) {
+ *lastslash = '\0';
+ }
+ snprintf(temppath, sizeof(temppath), "%s\\..\\share\\blender\\%s", temppath2, versionstr);
+ temppath[MAX_PATH] = '\0';
+ GetFullPathNameA(temppath, sizeof(knownpath), knownpath, NULL);
+ return (GHOST_TUns8*)knownpath;
+}
+
+const GHOST_TUns8 *GHOST_SystemPathsWin32::getUserDir(int, const char *versionstr) const
+{
+ static char knownpath[MAX_PATH * 3 + 128] = {0};
+
+ char temppath[MAX_PATH + 1];
+ char temppath2[MAX_PATH + 1];
+ const GHOST_TUns8 *binary_dir = getBinaryDir();
+ strcpy(temppath2, reinterpret_cast<const char*>(binary_dir));
+ char* lastslash = strrchr(temppath2, '\\');
+ if (lastslash != NULL) {
+ *lastslash = '\0';
+ }
+ snprintf(temppath, sizeof(temppath), "%s\\..\\..\\home\\%s\\.blender\\%s", temppath2, getenv("USERNAME") ?: "unknown", versionstr);
+ temppath[MAX_PATH] = '\0';
+ GetFullPathNameA(temppath, sizeof(knownpath), knownpath, NULL);
+ return (GHOST_TUns8*)knownpath;
+}
+#else
const GHOST_TUns8 *GHOST_SystemPathsWin32::getSystemDir(int, const char *versionstr) const
{
static char knownpath[MAX_PATH * 3 + 128] = {0}; /* 1 utf-16 might translante into 3 utf-8. 2 utf-16 translates into 4 utf-8*/
@@ -105,6 +143,8 @@
return NULL;
}

+#endif
+
const GHOST_TUns8 *GHOST_SystemPathsWin32::getBinaryDir() const
{
static char fullname[MAX_PATH * 3] = {0};
diff -Naur blender-2.72-orig/source/creator/CMakeLists.txt blender-2.72/source/creator/CMakeLists.txt
--- blender-2.72-orig/source/creator/CMakeLists.txt 2014-09-24 19:29:55.000000000 +0400
+++ blender-2.72/source/creator/CMakeLists.txt 2014-10-07 09:16:00.095600000 +0400
@@ -256,7 +256,7 @@
# -----------------------------------------------------------------------------
# Platform Specific Var: TARGETDIR_VER

-if(UNIX AND NOT APPLE)
+if((UNIX AND NOT APPLE) OR MINGW)
if(WITH_INSTALL_PORTABLE)
set(TARGETDIR_VER ${TARGETDIR}/${BLENDER_VERSION})
else()
@@ -393,13 +393,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)
@@ -1003,7 +1003,7 @@

install(TARGETS blender blender-launcher
COMPONENT Blender
- DESTINATION ".")
+ DESTINATION bin)

if(MSVC12_REDIST_DIR)
if(CMAKE_CL_64)
diff -Naur blender-2.72-orig/source/blenderplayer/CMakeLists.txt blender-2.72/source/blenderplayer/CMakeLists.txt
--- blender-2.72-orig/source/blenderplayer/CMakeLists.txt 2014-09-24 19:29:55.000000000 +0400
+++ blender-2.72/source/blenderplayer/CMakeLists.txt 2014-10-07 09:16:00.095600000 +0400
@@ -58,7 +58,7 @@

install(TARGETS blenderplayer
COMPONENT Blenderplayer
- DESTINATION ".")
+ DESTINATION bin)

elseif(APPLE)
add_executable(blenderplayer ${EXETYPE} bad_level_call_stubs/stubs.c)
17 changes: 4 additions & 13 deletions mingw-w64-blender-git/mingw-w64-cmake.patch
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
--- blender/CMakeLists.txt.orig 2014-04-08 00:22:36.736800000 +0400
+++ blender/CMakeLists.txt 2014-04-08 06:51:03.051600000 +0400
@@ -171,6 +171,8 @@
if(UNIX AND NOT APPLE)
option(WITH_SYSTEM_GLEW "Use GLEW OpenGL wrapper library provided by the operating system" ON)

option(WITH_GHOST_XDND "Enable drag'n'drop support on X11 using XDND protocol" ON)
option(WITH_SYSTEM_GLES "Use OpenGL ES library provided by the operating system" ON)
+elseif(MINGW)
+ option(WITH_SYSTEM_GLEW "Use GLEW OpenGL wrapper library provided by the operating system" ON)
else()
# not an option for other OS's
set(WITH_SYSTEM_GLEW OFF)
@@ -178,7 +180,7 @@


# (unix defaults to System OpenJPEG On)
-if(UNIX AND NOT APPLE)
+if((UNIX AND NOT APPLE) OR MINGW)
set(PLATFORM_DEFAULT ON)
else()
set(PLATFORM_DEFAULT OFF)
@@ -579,7 +581,7 @@
#-----------------------------------------------------------------------------
#Platform specifics
Expand Down Expand Up @@ -80,9 +71,9 @@
set(WITH_OPENCOLLADA OFF)
endif()
@@ -855,8 +878,13 @@
message(FATAL_ERROR "LLVM not found.")
endif()
endif()

if(WITH_LLVM OR WITH_SDL_DYNLOAD)
+ if(MINGW)
+ # imagehelp is needed by LLVM 3.1 on MinGW, check lib\Support\Windows\Signals.inc
+ list(APPEND PLATFORM_LINKLIBS -limagehlp)
Expand Down

0 comments on commit 9c654fc

Please sign in to comment.