blender: add patch for gcc8

This commit is contained in:
Sergei Reznikov
2019-07-26 13:19:29 +03:00
parent 036b473b6a
commit af8e9f5e38
5 changed files with 26 additions and 3883 deletions

View File

@@ -13,7 +13,10 @@ LICENSE="GNU GPL v2"
REVISION="12"
SOURCE_URI="https://download.blender.org/source/blender-$portVersion.tar.gz"
CHECKSUM_SHA256="4c944c304a49e68ac687ea06f5758204def049b66dc211e1cffa1857716393bc"
PATCHES="blender-$portVersion.patchset"
PATCHES="
blender-$portVersion.patchset
blender-$portVersion-gcc-8.patch
"
ADDITIONAL_FILES="
blender.rdef.in
Blender.sh

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,458 +0,0 @@
From cd9bf78ae65a160e0e21143ace41dd7b86747c30 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 6 Jun 2015 10:06:04 +0000
Subject: Haiku patch
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 029198f..17e976b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -189,7 +189,7 @@ endif()
# Options
# First platform spesific non-cached vars
-if(UNIX AND NOT APPLE)
+if(UNIX AND NOT (APPLE OR HAIKU))
set(WITH_X11 ON)
endif()
@@ -1159,7 +1159,8 @@ if(UNIX AND NOT APPLE)
endif()
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
- list(APPEND PLATFORM_LINKLIBS -lutil -lc -lm)
+ #list(APPEND PLATFORM_LINKLIBS -lutil -lc -lm)
+ list(APPEND PLATFORM_LINKLIBS -lnetwork)
find_package(Threads REQUIRED)
list(APPEND PLATFORM_LINKLIBS ${CMAKE_THREAD_LIBS_INIT})
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 90c4fbd..7d1e389 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -1446,6 +1446,7 @@ function(find_python_package
PATH_SUFFIXES
site-packages
dist-packages
+ vendor-packages
NO_DEFAULT_PATH
)
@@ -1455,6 +1456,8 @@ function(find_python_package
"'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/site-packages/${package}', "
"'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/dist-packages/${package}', "
"'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/dist-packages/${package}', "
+ "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/vendor-packages/${package}', "
+ "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/vendor-packages/${package}', "
"WITH_PYTHON_INSTALL_${_upper_package} option will be ignored when installing python")
set(WITH_PYTHON_INSTALL_${_upper_package} OFF PARENT_SCOPE)
else()
diff --git a/extern/libmv/libmv/numeric/numeric.h b/extern/libmv/libmv/numeric/numeric.h
index 55d4c7d..d8ebd72 100644
--- a/extern/libmv/libmv/numeric/numeric.h
+++ b/extern/libmv/libmv/numeric/numeric.h
@@ -35,7 +35,7 @@
#if !defined(__MINGW64__)
# if defined(_WIN32) || defined(__APPLE__) || \
- defined(__FreeBSD__) || defined(__NetBSD__)
+ defined(__FreeBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
static void sincos(double x, double *sinx, double *cosx) {
*sinx = sin(x);
*cosx = cos(x);
diff --git a/extern/libmv/third_party/glog/src/config.h b/extern/libmv/third_party/glog/src/config.h
index f5c9c0b..2703b7b 100644
--- a/extern/libmv/third_party/glog/src/config.h
+++ b/extern/libmv/third_party/glog/src/config.h
@@ -14,4 +14,6 @@
#include "windows/config.h"
#elif defined(__GNU__)
#include "config_hurd.h"
+#elif defined(__HAIKU__)
+ #include "config_haiku.h"
#endif
diff --git a/extern/libmv/third_party/glog/src/config_haiku.h b/extern/libmv/third_party/glog/src/config_haiku.h
new file mode 100644
index 0000000..7d19272
--- /dev/null
+++ b/extern/libmv/third_party/glog/src/config_haiku.h
@@ -0,0 +1,172 @@
+/* src/config.h. Generated from config.h.in by configure. */
+/* src/config.h.in. Generated from configure.ac by autoheader. */
+
+/* Namespace for Google classes */
+#define GOOGLE_NAMESPACE google
+
+/* Define if you have the `dladdr' function */
+/* #undef HAVE_DLADDR */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <execinfo.h> header file. */
+#undef HAVE_EXECINFO_H
+
+/* Define if you have the `fcntl' function */
+#define HAVE_FCNTL 1
+
+/* Define to 1 if you have the <glob.h> header file. */
+#define HAVE_GLOB_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `pthread' library (-lpthread). */
+/* #undef HAVE_LIBPTHREAD */
+
+/* Define to 1 if you have the <libunwind.h> header file. */
+/* #undef HAVE_LIBUNWIND_H */
+
+/* define if you have google gflags library */
+#define HAVE_LIB_GFLAGS 1
+
+/* define if you have google gmock library */
+/* #undef HAVE_LIB_GMOCK */
+
+/* define if you have google gtest library */
+/* #undef HAVE_LIB_GTEST */
+
+/* define if you have libunwind */
+/* #undef HAVE_LIB_UNWIND */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* define if the compiler implements namespaces */
+#define HAVE_NAMESPACES 1
+
+/* Define if you have the 'pread' function */
+#define HAVE_PREAD 1
+
+/* Define if you have POSIX threads libraries and header files. */
+#define HAVE_PTHREAD 1
+
+/* Define to 1 if you have the <pwd.h> header file. */
+#define HAVE_PWD_H 1
+
+/* Define if you have the 'pwrite' function */
+#define HAVE_PWRITE 1
+
+/* define if the compiler implements pthread_rwlock_* */
+#define HAVE_RWLOCK 1
+
+/* Define if you have the `sigaltstack' function */
+#define HAVE_SIGALTSTACK 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <syscall.h> header file. */
+/* #undef HAVE_SYSCALL_H */
+
+/* Define to 1 if you have the <syslog.h> header file. */
+#define HAVE_SYSLOG_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/syscall.h> header file. */
+/* #undef HAVE_SYS_SYSCALL_H */
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/ucontext.h> header file. */
+/* #undef HAVE_SYS_UCONTEXT_H */
+
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#define HAVE_SYS_UTSNAME_H 1
+
+/* Define to 1 if you have the <ucontext.h> header file. */
+/* #undef HAVE_UCONTEXT_H */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* define if the compiler supports using expression for operator */
+#define HAVE_USING_OPERATOR 1
+
+/* define if your compiler has __attribute__ */
+#define HAVE___ATTRIBUTE__ 1
+
+/* define if your compiler has __builtin_expect */
+#define HAVE___BUILTIN_EXPECT 1
+
+/* define if your compiler has __sync_val_compare_and_swap */
+/* #undef HAVE___SYNC_VAL_COMPARE_AND_SWAP */
+
+/* Name of package */
+#define PACKAGE "glog"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "opensource@google.com"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "glog"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "glog 0.3.2"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "glog"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "0.3.2"
+
+/* How to access the PC from a struct ucontext */
+/* #define PC_FROM_UCONTEXT uc_mcontext.gregs[REG_RIP] */
+
+/* Define to necessary symbol if this constant uses a non-standard name on
+ your system. */
+/* #undef PTHREAD_CREATE_JOINABLE */
+
+/* The size of `void *', as computed by sizeof. */
+#define SIZEOF_VOID_P 8
+
+/* Define to 1 if you have the ANSI C header files. */
+/* #undef STDC_HEADERS */
+
+#define STDC_HEADERS 1
+/* the namespace where STL code like vector<> is defined */
+#define STL_NAMESPACE std
+
+/* location of source code */
+#define TEST_SRC_DIR "."
+
+/* Version number of package */
+#define VERSION "0.3.2"
+
+/* Stops putting the code inside the Google namespace */
+#define _END_GOOGLE_NAMESPACE_ }
+
+/* Puts following code inside the Google namespace */
+#define _START_GOOGLE_NAMESPACE_ namespace google {
+
+/* isn't getting defined by configure script when clang compilers are used
+ and cuases compilation errors in stactrace/unwind modules */
+#ifdef __clang__
+# define NO_FRAME_POINTER
+#endif
diff --git a/intern/guardedalloc/intern/mallocn_intern.h b/intern/guardedalloc/intern/mallocn_intern.h
index 3f7e462..38abccb 100644
--- a/intern/guardedalloc/intern/mallocn_intern.h
+++ b/intern/guardedalloc/intern/mallocn_intern.h
@@ -63,6 +63,9 @@
#elif defined(WIN32)
# include <malloc.h>
# define malloc_usable_size _msize
+#elif defined(__HAIKU__)
+# include <malloc.h>
+size_t malloc_usable_size(void *ptr);
#else
# pragma message "We don't know how to use malloc_usable_size on your platform"
# undef USE_MALLOC_USABLE_SIZE
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index 9004985..7432ab7 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -52,6 +52,17 @@ static ThreadRWMutex cache_rwlock = BLI_RWLOCK_INITIALIZER;
/** \name Local Callbacks
* \{ */
+#ifdef __HAIKU__
+static pthread_once_t sInitOnce = PTHREAD_ONCE_INIT;
+
+static void
+init_cache_rwlock()
+{
+ pthread_rwlock_init(&cache_rwlock, NULL);
+}
+#endif
+
+
/* Math stuff for ray casting on mesh faces and for nearest surface */
float bvhtree_ray_tri_intersection(
@@ -1192,6 +1203,9 @@ void bvhcache_insert(BVHCache *cache, BVHTree *tree, int type)
void bvhcache_init(BVHCache *cache)
{
+#ifdef __HAIKU__
+ pthread_once(&sInitOnce, &init_cache_rwlock);
+#endif
*cache = NULL;
}
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 23261b6..9a81af7 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -64,6 +64,16 @@
static ThreadRWMutex vfont_rwlock = BLI_RWLOCK_INITIALIZER;
+#ifdef __HAIKU__
+static pthread_once_t sInitOnce = PTHREAD_ONCE_INIT;
+
+static void
+init_vfont_rwlock()
+{
+ pthread_rwlock_init(&vfont_rwlock, NULL);
+}
+#endif
+
/* The vfont code */
void BKE_vfont_free_data(struct VFont *vfont)
{
@@ -597,6 +607,11 @@ bool BKE_vfont_to_curve_ex(Main *bmain, Object *ob, int mode, ListBase *r_nubase
* because the cursor can be at that location */
BLI_assert(ob->type == OB_FONT);
+
+#ifdef __HAIKU__
+ pthread_once(&sInitOnce, &init_vfont_rwlock);
+#endif
+
/* Set font data */
vfont = cu->vfont;
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 9c72012..7b0570c 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -107,6 +107,16 @@
static ThreadRWMutex psys_bvhtree_rwlock = BLI_RWLOCK_INITIALIZER;
+#ifdef __HAIKU__
+static pthread_once_t sInitOnce = PTHREAD_ONCE_INIT;
+
+static void
+init_psys_bvhtree_rwlock()
+{
+ pthread_rwlock_init(&psys_bvhtree_rwlock, NULL);
+}
+#endif
+
/************************************************/
/* Reacting to system events */
/************************************************/
@@ -4042,6 +4052,11 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
ParticleSimulationData sim= {0};
ParticleSettings *part = psys->part;
float cfra;
+
+#ifdef __HAIKU__
+ pthread_once(&sInitOnce, &init_psys_bvhtree_rwlock);
+#endif
+
/* drawdata is outdated after ANY change */
if (psys->pdd) psys->pdd->flag &= ~PARTICLE_DRAW_DATA_UPDATED;
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 509ca9c..d3525dc 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -89,6 +89,17 @@ extern GLubyte stipple_quarttone[128]; /* glutil.c, bad level data */
static ThreadRWMutex loops_cache_rwlock = BLI_RWLOCK_INITIALIZER;
static ThreadRWMutex origindex_cache_rwlock = BLI_RWLOCK_INITIALIZER;
+#ifdef __HAIKU__
+static pthread_once_t sInitOnce = PTHREAD_ONCE_INIT;
+
+static void
+init_cache_rwlock()
+{
+ pthread_rwlock_init(&loops_cache_rwlock, NULL);
+ pthread_rwlock_init(&origindex_cache_rwlock, NULL);
+}
+#endif
+
static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
int drawInteriorEdges,
int useSubsurfUv,
@@ -4335,6 +4346,10 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm,
MPoly *mpoly = NULL;
bool has_edge_cd;
+#ifdef __HAIKU__
+ pthread_once(&sInitOnce, &init_cache_rwlock);
+#endif
+
edgeSize = ccgSubSurf_getEdgeSize(ss);
gridSize = ccgSubSurf_getGridSize(ss);
gridFaces = gridSize - 1;
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h
index 6ae833d..c7729f6 100644
--- a/source/blender/blenlib/BLI_threads.h
+++ b/source/blender/blenlib/BLI_threads.h
@@ -127,7 +127,11 @@ void BLI_spin_end(SpinLock *spin);
#define THREAD_LOCK_READ 1
#define THREAD_LOCK_WRITE 2
+#ifdef __HAIKU__
+#define BLI_RWLOCK_INITIALIZER {}
+#else
#define BLI_RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER
+#endif
typedef pthread_rwlock_t ThreadRWMutex;
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index ef9a7c0..6d80ae7 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -616,6 +616,10 @@ static int recursive_operation(const char *startfrom, const char *startto,
for (i = 0; i < n; i++) {
const struct dirent * const dirent = dirlist[i];
+#ifdef __HAIKU__
+ struct stat st;
+ char filename[512];
+#endif
if (FILENAME_IS_CURRPAR(dirent->d_name))
continue;
@@ -624,7 +628,13 @@ static int recursive_operation(const char *startfrom, const char *startto,
if (to)
join_dirfile_alloc(&to_path, &to_alloc_len, to, dirent->d_name);
+#ifdef __HAIKU__
+ snprintf(filename, sizeof(filename), "%s/%s", startfrom, dirent->d_name);
+ lstat(filename, &st);
+ if (S_ISDIR(st.st_mode)) {
+#else
if (dirent->d_type == DT_DIR) {
+#endif
/* recursively dig into a subfolder */
ret = recursive_operation(from_path, to_path, callback_dir_pre, callback_file, callback_dir_post);
}
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index 7fdf6ec..30d4c4c 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -37,7 +37,7 @@
#include <sys/stat.h>
-#if defined(__NetBSD__) || defined(__DragonFly__) || defined(__sun__) || defined(__sun)
+#if defined(__NetBSD__) || defined(__DragonFly__) || defined(__sun__) || defined(__sun) || defined(__HAIKU__)
/* Other modern unix os's should probably use this also */
# include <sys/statvfs.h>
# define USE_STATFS_STATVFS
--
2.2.2

View File

@@ -0,0 +1,22 @@
--- blender-2.79b-orig/intern/cycles/util/util_sseb.h 2018-03-24 02:22:25.000000000 +1100
+++ blender-2.79b/intern/cycles/util/util_sseb.h 2018-05-30 20:43:33.888717930 +1000
@@ -116,7 +116,7 @@
__forceinline const sseb unpackhi( const sseb& a, const sseb& b ) { return _mm_unpackhi_ps(a, b); }
template<size_t i0, size_t i1, size_t i2, size_t i3> __forceinline const sseb shuffle( const sseb& a ) {
- return _mm_shuffle_epi32(a, _MM_SHUFFLE(i3, i2, i1, i0));
+ return _mm_castsi128_ps(_mm_shuffle_epi32(a, _MM_SHUFFLE(i3, i2, i1, i0)));
}
template<> __forceinline const sseb shuffle<0, 1, 0, 1>( const sseb& a ) {
--- blender-2.79b-orig/intern/itasc/kdl/tree.hpp 2018-03-24 02:22:25.000000000 +1100
+++ blender-2.79b/intern/itasc/kdl/tree.hpp 2018-05-30 20:33:52.045179988 +1000
@@ -34,7 +34,7 @@
//Forward declaration
class TreeElement;
// Eigen allocator is needed for alignment of Eigen data types
- typedef std::map<std::string,TreeElement, std::less<std::string>, Eigen::aligned_allocator<std::pair<std::string, TreeElement> > > SegmentMap;
+ typedef std::map<std::string,TreeElement, std::less<std::string>, Eigen::aligned_allocator<std::pair<const std::string, TreeElement> > > SegmentMap;
class TreeElement
{