From ec28d64900aebb44e960a910cf6e9493e6fe34f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= Date: Tue, 19 Sep 2017 23:03:48 +0200 Subject: Haiku patchset diff --git a/CMakeLists.txt b/CMakeLists.txt index bfea2dd..ebe6bef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -195,7 +195,7 @@ endif() # Options # First platform specific non-cached vars -if(UNIX AND NOT APPLE) +if(UNIX AND NOT (APPLE OR HAIKU)) set(WITH_X11 ON) endif() @@ -793,7 +793,9 @@ set(CC_REMOVE_STRICT_FLAGS) # libraries to link the binary with passed to target_link_libraries() # known as LLIBS to scons -set(PLATFORM_LINKLIBS "") +if(HAIKU) +set(PLATFORM_LINKLIBS "-lnetwork") +endif() # Added to linker flags in setup_liblinks # - CMAKE_EXE_LINKER_FLAGS diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 6303119..2083683 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -1508,6 +1508,7 @@ function(find_python_package PATH_SUFFIXES site-packages dist-packages + vendor-packages NO_DEFAULT_PATH ) @@ -1518,6 +1519,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}', " "\n" "The 'WITH_PYTHON_INSTALL_${_upper_package}' option will be ignored when installing Python.\n" "The build will be usable, only add-ons that depend on this package won't be functional." diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index 62e0caa..9eb6985 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -358,7 +358,11 @@ if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV) endif() # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed -list(APPEND PLATFORM_LINKLIBS -lutil -lc -lm) +if(HAIKU) + list(APPEND PLATFORM_LINKLIBS -lnetwork) +else() + list(APPEND PLATFORM_LINKLIBS -lutil -lc -lm) +endif() find_package(Threads REQUIRED) list(APPEND PLATFORM_LINKLIBS ${CMAKE_THREAD_LIBS_INIT}) diff --git a/intern/guardedalloc/intern/mallocn_intern.h b/intern/guardedalloc/intern/mallocn_intern.h index 4efa236..4b2282a 100644 --- a/intern/guardedalloc/intern/mallocn_intern.h +++ b/intern/guardedalloc/intern/mallocn_intern.h @@ -63,6 +63,9 @@ #elif defined(WIN32) # include # define malloc_usable_size _msize +#elif defined(__HAIKU__) +# include +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/intern/libmv/libmv/numeric/numeric.h b/intern/libmv/libmv/numeric/numeric.h index 1a23d65..6312b4e 100644 --- a/intern/libmv/libmv/numeric/numeric.h +++ b/intern/libmv/libmv/numeric/numeric.h @@ -35,7 +35,8 @@ #if !defined(__MINGW64__) # if defined(_WIN32) || defined(__APPLE__) || \ - defined(__FreeBSD__) || defined(__NetBSD__) + defined(__FreeBSD__) || defined(__NetBSD__) || \ + defined(__HAIKU__) inline void sincos(double x, double *sinx, double *cosx) { *sinx = sin(x); *cosx = cos(x); diff --git a/source/blender/blenlib/BLI_sys_types.h b/source/blender/blenlib/BLI_sys_types.h index 9477f61..95c0227 100644 --- a/source/blender/blenlib/BLI_sys_types.h +++ b/source/blender/blenlib/BLI_sys_types.h @@ -47,7 +47,7 @@ extern "C" { #endif -#if defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__) || defined(__GNU__) +#if defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__) || defined(__GNU__) || defined(__HAIKU__) /* Linux-i386, Linux-Alpha, Linux-ppc */ #include diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 1df7f6f..0978420 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -614,6 +614,11 @@ 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; @@ -621,7 +626,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 b819c51..9fb3fbf 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -37,7 +37,7 @@ #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 -- 2.23.0 From 9f274c91374ecd01456f441a2e76a89edc221894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= Date: Tue, 19 Sep 2017 23:15:20 +0200 Subject: Haiku SDL2 check fix diff --git a/build_files/cmake/Modules/FindSDL2.cmake b/build_files/cmake/Modules/FindSDL2.cmake index 2a835cf..61b7dee 100644 --- a/build_files/cmake/Modules/FindSDL2.cmake +++ b/build_files/cmake/Modules/FindSDL2.cmake @@ -43,7 +43,7 @@ FIND_PATH(SDL2_INCLUDE_DIR HINTS ${_sdl2_SEARCH_DIRS} PATH_SUFFIXES - include/SDL2 include + include/SDL2 include SDL2 ) FIND_LIBRARY(SDL2_LIBRARY -- 2.23.0 From 0430bba05bd566a1ec3c2df6477d94a67581264d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= Date: Tue, 19 Sep 2017 23:52:27 +0200 Subject: In-tree glog supporting patches diff --git a/extern/glog/src/config.h b/extern/glog/src/config.h index f5c9c0b..2703b7b 100644 --- a/extern/glog/src/config.h +++ b/extern/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/glog/src/config_haiku.h b/extern/glog/src/config_haiku.h new file mode 100644 index 0000000..4e6703b --- /dev/null +++ b/extern/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 */ +#define HAVE_DLADDR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_EXECINFO_H + +/* Define if you have the `fcntl' function */ +#define HAVE_FCNTL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_GLOB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#define HAVE_LIBPTHREAD 1 + +/* Define to 1 if you have the 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 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 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 header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYSCALL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYSLOG_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SYSCALL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_UCONTEXT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UTSNAME_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UCONTEXT_H */ + +/* Define to 1 if you have the 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.4" + +/* 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.4" + +/* 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.4" + +/* 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 -- 2.23.0 From b51551c8c1e8e487e5f219e27d2c227387a4a362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= Date: Sat, 16 Dec 2017 17:04:56 +0100 Subject: OpenCollada support diff --git a/build_files/cmake/Modules/FindOpenCOLLADA.cmake b/build_files/cmake/Modules/FindOpenCOLLADA.cmake index 63bc520..28cf0b9 100644 --- a/build_files/cmake/Modules/FindOpenCOLLADA.cmake +++ b/build_files/cmake/Modules/FindOpenCOLLADA.cmake @@ -67,6 +67,7 @@ SET(_opencollada_SEARCH_DIRS /opt/local # DarwinPorts /opt/csw # Blastwave /opt/lib/opencollada + /system/develop ) SET(_opencollada_INCLUDES) @@ -84,6 +85,7 @@ FOREACH(COMPONENT ${_opencollada_FIND_INCLUDES}) include/opencollada/${COMPONENT} include/${COMPONENT}/include include/${COMPONENT} + headers/opencollada HINTS ${_opencollada_SEARCH_DIRS} ) -- 2.23.0 From a3b457c6aa907ce2a77c46208d042129305e4f7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= Date: Sat, 4 Aug 2018 12:42:53 +0200 Subject: FFMPEG4 patches diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp index e9eea19..84aea33 100644 --- a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp +++ b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp @@ -264,9 +264,9 @@ AUD_FFMPEGReader::AUD_FFMPEGReader(boost::shared_ptr buffer) : m_membuffer(buffer), m_membufferpos(0) { - m_membuf = reinterpret_cast(av_malloc(FF_MIN_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE)); + m_membuf = reinterpret_cast(av_malloc(AV_INPUT_BUFFER_MIN_SIZE + AV_INPUT_BUFFER_PADDING_SIZE)); - m_aviocontext = avio_alloc_context(m_membuf, FF_MIN_BUFFER_SIZE, 0, this, + m_aviocontext = avio_alloc_context(m_membuf, AV_INPUT_BUFFER_MIN_SIZE, 0, this, read_packet, NULL, seek_packet); if(!m_aviocontext) diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp index 3f95ac7..2c2f091 100644 --- a/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp +++ b/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp @@ -163,7 +163,7 @@ AUD_FFMPEGWriter::AUD_FFMPEGWriter(std::string filename, AUD_DeviceSpecs specs, try { if(m_formatCtx->oformat->flags & AVFMT_GLOBALHEADER) - m_codecCtx->flags |= CODEC_FLAG_GLOBAL_HEADER; + m_codecCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; AVCodec* codec = avcodec_find_encoder(m_codecCtx->codec_id); if(!codec) @@ -185,11 +185,11 @@ AUD_FFMPEGWriter::AUD_FFMPEGWriter(std::string filename, AUD_DeviceSpecs specs, if(avcodec_open2(m_codecCtx, codec, NULL)) AUD_THROW(AUD_ERROR_FFMPEG, codec_error); - m_output_buffer.resize(FF_MIN_BUFFER_SIZE); + m_output_buffer.resize(AV_INPUT_BUFFER_MIN_SIZE); int samplesize = AUD_MAX(AUD_SAMPLE_SIZE(m_specs), AUD_DEVICE_SAMPLE_SIZE(m_specs)); if(m_codecCtx->frame_size <= 1) { - m_input_size = FF_MIN_BUFFER_SIZE * 8 / m_codecCtx->bits_per_coded_sample / m_codecCtx->channels; + m_input_size = AV_INPUT_BUFFER_MIN_SIZE * 8 / m_codecCtx->bits_per_coded_sample / m_codecCtx->channels; m_input_buffer.resize(m_input_size * samplesize); } else diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index a19e414..d586979 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -605,8 +605,6 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int c->rc_buffer_aggressivity = 1.0; #endif - c->me_method = ME_EPZS; - codec = avcodec_find_encoder(c->codec_id); if (!codec) return NULL; @@ -668,14 +666,14 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int ) { PRINT("Using global header\n"); - c->flags |= CODEC_FLAG_GLOBAL_HEADER; + c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; } /* Determine whether we are encoding interlaced material or not */ if (rd->mode & R_FIELDS) { PRINT("Encoding interlaced video\n"); - c->flags |= CODEC_FLAG_INTERLACED_DCT; - c->flags |= CODEC_FLAG_INTERLACED_ME; + c->flags |= AV_CODEC_FLAG_INTERLACED_DCT; + c->flags |= AV_CODEC_FLAG_INTERLACED_ME; } /* xasp & yasp got float lately... */ @@ -765,7 +763,7 @@ static AVStream *alloc_audio_stream(FFMpegContext *context, RenderData *rd, int } if (of->oformat->flags & AVFMT_GLOBALHEADER) { - c->flags |= CODEC_FLAG_GLOBAL_HEADER; + c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; } set_ffmpeg_properties(rd, c, "audio", &opts); @@ -784,14 +782,14 @@ static AVStream *alloc_audio_stream(FFMpegContext *context, RenderData *rd, int st->codec->time_base.den = st->codec->sample_rate; #ifndef FFMPEG_HAVE_ENCODE_AUDIO2 - context->audio_outbuf_size = FF_MIN_BUFFER_SIZE; + context->audio_outbuf_size = AV_INPUT_BUFFER_MIN_SIZE; #endif if (c->frame_size == 0) // used to be if ((c->codec_id >= CODEC_ID_PCM_S16LE) && (c->codec_id <= CODEC_ID_PCM_DVD)) // not sure if that is needed anymore, so let's try out if there are any // complaints regarding some ffmpeg versions users might have - context->audio_input_samples = FF_MIN_BUFFER_SIZE * 8 / c->bits_per_coded_sample / c->channels; + context->audio_input_samples = AV_INPUT_BUFFER_MIN_SIZE * 8 / c->bits_per_coded_sample / c->channels; else { context->audio_input_samples = c->frame_size; #ifndef FFMPEG_HAVE_ENCODE_AUDIO2 diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index e1b3abc..1850ffd 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -537,7 +537,7 @@ static struct proxy_output_ctx *alloc_proxy_output_ffmpeg( av_opt_set_int(rv->c, "qmax", ffmpeg_quality, 0); if (rv->of->flags & AVFMT_GLOBALHEADER) { - rv->c->flags |= CODEC_FLAG_GLOBAL_HEADER; + rv->c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; } if (avio_open(&rv->of->pb, fname, AVIO_FLAG_WRITE) < 0) { -- 2.23.0 From f77901394473f2c325d4bbf8f5175989f8268cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= Date: Thu, 22 Aug 2019 18:07:13 +0200 Subject: Build fixes from FreeBSD diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 435eaa0..8708926 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -1340,6 +1340,11 @@ bool DocumentImporter::writeAnimationList(const COLLADAFW::AnimationList *animat return anim_importer.write_animation_list(animationList); } +bool DocumentImporter::writeAnimationClip(const COLLADAFW::AnimationClip *AnimationClip) +{ + return true; +} + /** When this method is called, the writer must write the skin controller data. * \return The writer should return true, if writing succeeded, false otherwise.*/ bool DocumentImporter::writeSkinControllerData(const COLLADAFW::SkinControllerData *skin) diff --git a/source/blender/collada/DocumentImporter.h b/source/blender/collada/DocumentImporter.h index 62f76db..1f3b64f 100644 --- a/source/blender/collada/DocumentImporter.h +++ b/source/blender/collada/DocumentImporter.h @@ -108,6 +108,8 @@ public: bool writeAnimationList(const COLLADAFW::AnimationList*); + bool writeAnimationClip( const COLLADAFW::AnimationClip* ); + bool writeGeometry(const COLLADAFW::Geometry*); bool writeMaterial(const COLLADAFW::Material*); -- 2.23.0