diff --git a/media-gfx/blender/blender-2.74.recipe b/media-gfx/blender/blender-2.74.recipe index 24c1d93d0..a23e9cd3c 100644 --- a/media-gfx/blender/blender-2.74.recipe +++ b/media-gfx/blender/blender-2.74.recipe @@ -20,12 +20,14 @@ PATCHES="blender-$portVersion.patchset" PROVIDES=" blender = $portVersion compat >= 2 + cmd:blender + cmd:blender_thumbnailer.py " REQUIRES=" haiku lib:libfreetype$secondaryArchSuffix - lib:libGL$secondaryArchSuffix + lib:libgl$secondaryArchSuffix lib:libglew$secondaryArchSuffix lib:libglu$secondaryArchSuffix lib:libjpeg$secondaryArchSuffix @@ -33,6 +35,9 @@ REQUIRES=" lib:libtiff$secondaryArchSuffix lib:libz$secondaryArchSuffix lib:libopenimageio$secondaryArchSuffix + lib:libpython3.4m$secondaryArchSuffix + lib:libstdc++$secondaryArchSuffix + lib:libgcc_s$secondaryArchSuffix " BUILD_REQUIRES=" @@ -46,11 +51,12 @@ BUILD_REQUIRES=" devel:libtiff$secondaryArchSuffix devel:libz$secondaryArchSuffix devel:libopenimageio$secondaryArchSuffix + devel:libpython3.4m$secondaryArchSuffix " BUILD_PREREQUIRES=" python3_numpy - cmd:python34 + cmd:python3.4 cmd:cmake cmd:make cmd:gcc$secondaryArchSuffix @@ -62,11 +68,25 @@ BUILD() mkdir -p build_haiku make $jobArgs BUILD_DIR=`pwd`/build_haiku \ BUILD_CMAKE_ARGS="-DPYTHON_INCLUDE_DIR=/system/develop/headers/python3.4m/ \ - -DPYTHON_LIBRARY=/system/lib/python3.4/ -DWITH_CYCLES=OFF \ - -DWITH_BOOST=OFF" + -DPYTHON_LIBRARY=/system/lib/libpython3.4m.so.1.0 \ + -DPYTHON_EXECUTABLE=/bin/python3.4 \ + -DWITH_CYCLES=OFF \ + -DWITH_BOOST=OFF \ + -DWITH_PYTHON_INSTALL=OFF \ + -DCMAKE_INSTALL_PREFIX:PATH=$prefix" } INSTALL() { + cd build_haiku make install + + mkdir -p $binDir $dataDir $docDir $appsDir + mv $prefix/blender $prefix/blender-thumbnailer.py $binDir/ + mv $prefix/GPL-license.txt $prefix/LICENSE-bfont.ttf.txt \ + $prefix/Python-license.txt $prefix/copyright.txt $prefix/readme.html \ + $prefix/blender.svg $docDir + mv $prefix/2.74/* $dataDir/ + mv $prefix/blender.desktop $appsDir/ + rmdir $prefix/2.74 } diff --git a/media-gfx/blender/patches/blender-2.74.patchset b/media-gfx/blender/patches/blender-2.74.patchset index 8ab36783c..2345afcaf 100644 --- a/media-gfx/blender/patches/blender-2.74.patchset +++ b/media-gfx/blender/patches/blender-2.74.patchset @@ -1,11 +1,11 @@ -From 33ad3170459bfdaaac326a2d0a09c5a24ad9fb7b Mon Sep 17 00:00:00 2001 +From 52160fdf8796197a09e63a393ca9911cdf3983bd Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Sat, 6 Jun 2015 10:06:04 +0000 Subject: Haiku patch diff --git a/CMakeLists.txt b/CMakeLists.txt -index b52dd05..382c8a9 100644 +index b52dd05..6ffe6fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -183,7 +183,7 @@ endif() @@ -17,6 +17,16 @@ index b52dd05..382c8a9 100644 set(WITH_X11 ON) endif() +@@ -1104,7 +1104,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 33c7644..1457f65 100644 --- a/build_files/cmake/macros.cmake @@ -38,6 +48,19 @@ index 33c7644..1457f65 100644 "WITH_PYTHON_INSTALL_${_upper_package} option will be ignored when installing python") set(WITH_PYTHON_INSTALL_${_upper_package} OFF) 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 @@ -241,6 +264,195 @@ index 6cab1f0..95dcf55 100644 #else # error "We don't know how to use malloc_usable_size on your platform" #endif +diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c +index 1a4a4bd..36cebb2 100644 +--- a/source/blender/blenkernel/intern/bvhutils.c ++++ b/source/blender/blenkernel/intern/bvhutils.c +@@ -48,6 +48,17 @@ + + static ThreadRWMutex cache_rwlock = BLI_RWLOCK_INITIALIZER; + ++#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(const BVHTreeRay *ray, const float UNUSED(m_dist), const float v0[3], const float v1[3], const float v2[3]) +@@ -812,6 +823,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 2adf8eb..06d2807 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 b7ebcfa..9fc872a 100644 +--- a/source/blender/blenkernel/intern/particle_system.c ++++ b/source/blender/blenkernel/intern/particle_system.c +@@ -106,6 +106,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 */ + /************************************************/ +@@ -4034,6 +4044,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 9519c7b..6e03981 100644 +--- a/source/blender/blenkernel/intern/subsurf_ccg.c ++++ b/source/blender/blenkernel/intern/subsurf_ccg.c +@@ -80,6 +80,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, +@@ -3392,6 +3403,10 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, + MPoly *mpoly = NULL; + bool has_edge_cd; + ++#ifdef __HAIKU__ ++ pthread_once(&sInitOnce, &init_cache_rwlock); ++#endif ++ + DM_from_template(&ccgdm->dm, dm, DM_TYPE_CCGDM, + ccgSubSurf_getNumFinalVerts(ss), + ccgSubSurf_getNumFinalEdges(ss), +diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h +index 74291ca..9d031ba 100644 +--- a/source/blender/blenlib/BLI_threads.h ++++ b/source/blender/blenlib/BLI_threads.h +@@ -126,7 +126,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 d6fe5e5..a81355d 100644 +--- a/source/blender/blenlib/intern/fileops.c ++++ b/source/blender/blenlib/intern/fileops.c +@@ -583,6 +583,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; +@@ -591,7 +595,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 46c5a11..a38bbb3 100644 +--- a/source/blender/blenlib/intern/storage.c ++++ b/source/blender/blenlib/intern/storage.c +@@ -42,7 +42,7 @@ + #include + #include + +-#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 + # define USE_STATFS_STATVFS -- 1.8.3.4