svn commit: r395520 - in head/graphics: . appleseed appleseed/files

Alexey Dokuchaev danfe at FreeBSD.org
Fri Aug 28 18:19:29 UTC 2015


Author: danfe
Date: Fri Aug 28 18:19:22 2015
New Revision: 395520
URL: https://svnweb.freebsd.org/changeset/ports/395520

Log:
  Add a port of appleseed: modern, open source, physically-based rendering
  engine designed to produce photorealistic images, animations, and visual
  effects.
  
  To ease initial maintenance, disable Doxygen API documentation generation,
  unit tests, installation of headers and Python bindings for now; there'll
  be OPTIONS for those things once the dust settles.

Added:
  head/graphics/appleseed/
  head/graphics/appleseed/Makefile   (contents, props changed)
  head/graphics/appleseed/distinfo   (contents, props changed)
  head/graphics/appleseed/files/
  head/graphics/appleseed/files/patch-CMakeLists.txt   (contents, props changed)
  head/graphics/appleseed/files/patch-sandbox_stylesheets_default.qss   (contents, props changed)
  head/graphics/appleseed/files/patch-src_appleseed.cli_continuoussavingtilecallback.cpp   (contents, props changed)
  head/graphics/appleseed/files/patch-src_appleseed.shared_application_superlogger.cpp   (contents, props changed)
  head/graphics/appleseed/files/patch-src_appleseed.studio_main_main.cpp   (contents, props changed)
  head/graphics/appleseed/files/patch-src_appleseed.studio_mainwindow_project_materialcollectionitem.cpp   (contents, props changed)
  head/graphics/appleseed/files/patch-src_appleseed.studio_mainwindow_project_objectinstanceitem.cpp   (contents, props changed)
  head/graphics/appleseed/files/patch-src_appleseed.studio_mainwindow_project_texturecollectionitem.cpp   (contents, props changed)
  head/graphics/appleseed/files/patch-src_appleseed_foundation_platform_compiler.cpp   (contents, props changed)
  head/graphics/appleseed/files/patch-src_appleseed_foundation_platform_path.cpp   (contents, props changed)
  head/graphics/appleseed/files/patch-src_appleseed_foundation_platform_path.h   (contents, props changed)
  head/graphics/appleseed/files/patch-src_appleseed_foundation_platform_system.cpp   (contents, props changed)
  head/graphics/appleseed/files/patch-src_appleseed_foundation_platform_thread.cpp   (contents, props changed)
  head/graphics/appleseed/files/patch-src_appleseed_foundation_utility_job_workerthread.cpp   (contents, props changed)
  head/graphics/appleseed/files/patch-src_appleseed_renderer_kernel_rendering_generic_genericframerenderer.cpp   (contents, props changed)
  head/graphics/appleseed/files/patch-src_appleseed_renderer_kernel_rendering_progressive_progressiveframerenderer.cpp   (contents, props changed)
  head/graphics/appleseed/files/patch-src_appleseed_renderer_utility_plugin.cpp   (contents, props changed)
  head/graphics/appleseed/files/patch-src_cmake_config_linux-gcc.txt   (contents, props changed)
  head/graphics/appleseed/files/pkg-message.in   (contents, props changed)
  head/graphics/appleseed/pkg-descr   (contents, props changed)
  head/graphics/appleseed/pkg-plist   (contents, props changed)
Modified:
  head/graphics/Makefile

Modified: head/graphics/Makefile
==============================================================================
--- head/graphics/Makefile	Fri Aug 28 17:49:52 2015	(r395519)
+++ head/graphics/Makefile	Fri Aug 28 18:19:22 2015	(r395520)
@@ -47,6 +47,7 @@
     SUBDIR += aoi
     SUBDIR += apngasm
     SUBDIR += apngdis
+    SUBDIR += appleseed
     SUBDIR += apvlv
     SUBDIR += aqsis
     SUBDIR += argyllcms

Added: head/graphics/appleseed/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/Makefile	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,62 @@
+# Created by: Alexey Dokuchaev <danfe at FreeBSD.org>
+# $FreeBSD$
+
+PORTNAME=	appleseed
+DISTVERSION=	1.2.0-beta
+CATEGORIES=	graphics
+
+MAINTAINER=	danfe at FreeBSD.org
+COMMENT=	Modern, physically-based production renderer
+
+LICENSE=	MIT
+
+LIB_DEPENDS=	libboost_thread.so:${PORTSDIR}/devel/boost-libs \
+		libpng.so:${PORTSDIR}/graphics/png \
+		libIlmImf.so:${PORTSDIR}/graphics/OpenEXR \
+		libxerces-c.so:${PORTSDIR}/textproc/xerces-c3
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	${PORTNAME}hq
+
+ONLY_FOR_ARCHS=	i386 amd64
+ONLY_FOR_ARCHS_REASON=	uses SSE instructions
+
+USES=		cmake:outsource
+USE_GL=		gl
+USE_QT4=	moc_build qmake_build rcc_build uic_build opengl
+
+CMAKE_ARGS=	-DUSE_STATIC_BOOST:BOOL=OFF -DWITH_DOXYGEN:BOOL=OFF \
+		-DWITH_TESTS:BOOL=OFF -DWITH_HEADERS:BOOL=OFF \
+		-DWITH_PYTHON:BOOL=OFF
+
+.for lib in ZLIB PNG EXR XERCES
+CMAKE_ARGS+=	-DUSE_EXTERNAL_${lib}:BOOL=ON
+.endfor
+
+# Not ready for hier(7)-conforming installation yet
+CMAKE_INSTALL_PREFIX=	${PREFIX}/${PKGBASE}
+PLIST_SUB=	APPHOME=${CMAKE_INSTALL_PREFIX}
+
+SUB_FILES=	pkg-message
+SUB_LIST:=	${PLIST_SUB}
+
+.include <bsd.port.pre.mk>
+
+post-patch:
+.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1100074
+# Fix "undefined reference to `LZ4_compressBound'" upon linking with Clang
+# on -CURRENT (I'm not sure how it can be mapped to specific Clang version)
+	@${REINPLACE_CMD} -e '/LZ4_compressBound/s,static inline ,,' \
+		${WRKSRC}/src/lz4/lz4.h
+.endif
+	@${REINPLACE_CMD} -e 's,Linux,${OPSYS},' \
+		${WRKSRC}/src/appleseed.cli/CMakeLists.txt \
+		${WRKSRC}/src/appleseed.studio/CMakeLists.txt \
+		${WRKSRC}/src/tools/animatecamera/CMakeLists.txt \
+		${WRKSRC}/src/tools/convertmeshfile/CMakeLists.txt \
+		${WRKSRC}/src/tools/dumpmetadata/CMakeLists.txt \
+		${WRKSRC}/src/tools/makefluffy/CMakeLists.txt \
+		${WRKSRC}/src/tools/updateprojectfile/CMakeLists.txt
+	@${RMDIR} ${WRKSRC}/sandbox/docs/api
+
+.include <bsd.port.post.mk>

Added: head/graphics/appleseed/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/distinfo	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,2 @@
+SHA256 (appleseedhq-appleseed-1.2.0-beta_GH0.tar.gz) = ec14a0846f2d357a39c6b4be163f85931e8effa56a1f0518b46e3203a4ae06d3
+SIZE (appleseedhq-appleseed-1.2.0-beta_GH0.tar.gz) = 107789060

Added: head/graphics/appleseed/files/patch-CMakeLists.txt
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/files/patch-CMakeLists.txt	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,64 @@
+--- CMakeLists.txt.orig	2015-06-13 09:38:53 UTC
++++ CMakeLists.txt
+@@ -84,6 +84,9 @@ option (USE_EXTERNAL_ZLIB       "Use ext
+ option (WITH_CLI                "Build appleseed.cli"                                   ON)
+ option (WITH_STUDIO             "Build appleseed.studio"                                ON)
+ option (WITH_TOOLS              "Build appleseed tools"                                 ON)
++option (WITH_DOXYGEN            "Generate API Reference with Doxygen"                   ON)
++option (WITH_TESTS              "Install unit tests and benchmarks"                     ON)
++option (WITH_HEADERS            "Install header files"                                  ON)
+ option (WITH_PYTHON             "Build Python bindings"                                 ON)
+ option (WITH_ALEMBIC            "Build Alembic support"                                 OFF)
+ option (WITH_OSL                "Build OSL support"                                     OFF)
+@@ -115,7 +118,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows"
+     include (src/cmake/config/win-vs.txt)
+ elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+     include (src/cmake/config/mac-clang.txt)
+-elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
++elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD")
+     include (src/cmake/config/linux-gcc.txt)
+ else ()
+     message (FATAL_ERROR "Unsupported platform or compiler (CMAKE_SYSTEM_NAME is \"${CMAKE_SYSTEM_NAME}\"). "
+@@ -546,7 +549,7 @@ endif ()
+ 
+ find_package (Doxygen)
+ 
+-if (DOXYGEN_FOUND)
++if (DOXYGEN_FOUND AND WITH_DOXYGEN)
+     configure_file (${PROJECT_SOURCE_DIR}/scripts/appleseed.doxyfile.in ${PROJECT_BINARY_DIR}/appleseed.doxyfile @ONLY)
+     add_custom_target (
+         doc ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/appleseed.doxyfile
+@@ -596,22 +599,25 @@ install (
+     DIRECTORY
+         sandbox/docs
+         sandbox/samples
+-        sandbox/share
+     DESTINATION .
+ )
+ 
+ install (
+-    CODE "FILE (MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/images)"
+-    CODE "FILE (MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/images/autosave)"
++    DIRECTORY
++        sandbox/share
++    DESTINATION ..
+ )
+ 
++if (WITH_TESTS)
+ install (
+     DIRECTORY
+         "sandbox/tests/unit benchmarks"
+         "sandbox/tests/unit tests"
+     DESTINATION tests
+ )
++endif ()
+ 
++if (WITH_HEADERS)
+ install (
+     DIRECTORY src/appleseed/foundation
+     DESTINATION include
+@@ -629,3 +635,4 @@ install (
+     DESTINATION include
+     FILES_MATCHING PATTERN "*.h"
+ )
++endif ()

Added: head/graphics/appleseed/files/patch-sandbox_stylesheets_default.qss
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/files/patch-sandbox_stylesheets_default.qss	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,12 @@
+--- sandbox/stylesheets/default.qss.orig	2015-06-13 09:38:53 UTC
++++ sandbox/stylesheets/default.qss
+@@ -58,6 +58,9 @@
+ #ifdef __linux__
+     #define FIXED_WIDTH_FONT_FAMILY         "Courier New"
+ #endif
++#ifdef __FreeBSD__
++    #define FIXED_WIDTH_FONT_FAMILY         "Courier New"
++#endif
+ 
+ 
+ /*

Added: head/graphics/appleseed/files/patch-src_appleseed.cli_continuoussavingtilecallback.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/files/patch-src_appleseed.cli_continuoussavingtilecallback.cpp	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,20 @@
+--- src/appleseed.cli/continuoussavingtilecallback.cpp.orig	2015-06-13 09:38:53 UTC
++++ src/appleseed.cli/continuoussavingtilecallback.cpp
+@@ -85,7 +85,7 @@ namespace
+         }
+ 
+       private:
+-        mutex               m_mutex;
++        boost::mutex        m_mutex;
+         filesystem::path    m_output_path;
+         filesystem::path    m_tmp_output_path;
+         bool                m_write_tiled_image;
+@@ -95,7 +95,7 @@ namespace
+             const size_t    tile_x,
+             const size_t    tile_y) APPLESEED_OVERRIDE
+         {
+-            mutex::scoped_lock lock(m_mutex);
++            boost::mutex::scoped_lock lock(m_mutex);
+             ProgressTileCallback::do_post_render_tile(frame, tile_x, tile_y);
+             frame->write_main_image(m_tmp_output_path.string().c_str());
+             filesystem::rename(m_tmp_output_path, m_output_path);

Added: head/graphics/appleseed/files/patch-src_appleseed.shared_application_superlogger.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/files/patch-src_appleseed.shared_application_superlogger.cpp	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,20 @@
+--- src/appleseed.shared/application/superlogger.cpp.orig	2015-06-13 09:38:53 UTC
++++ src/appleseed.shared/application/superlogger.cpp
+@@ -34,7 +34,7 @@
+ #include <cstdio>
+ 
+ // Platform headers.
+-#if defined __APPLE__ || defined __linux__
++#ifndef _WIN32
+ #include <unistd.h>
+ #endif
+ 
+@@ -74,7 +74,7 @@ ILogTarget& SuperLogger::get_log_target(
+ 
+ void SuperLogger::enable_message_coloring()
+ {
+-#if defined __APPLE__ || defined __linux__
++#ifndef _WIN32
+     const int StdErrFileDesc = 2;
+     if (!isatty(StdErrFileDesc))
+         return;

Added: head/graphics/appleseed/files/patch-src_appleseed.studio_main_main.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/files/patch-src_appleseed.studio_main_main.cpp	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,12 @@
+--- src/appleseed.studio/main/main.cpp.orig	2015-06-13 09:38:53 UTC
++++ src/appleseed.studio/main/main.cpp
+@@ -174,6 +174,9 @@ namespace
+ #ifdef __linux__
+         preprocessor.define_symbol("__linux__");
+ #endif
++#ifdef __FreeBSD__
++        preprocessor.define_symbol("__FreeBSD__");
++#endif
+ 
+         preprocessor.process(stylesheet.c_str());
+ 

Added: head/graphics/appleseed/files/patch-src_appleseed.studio_mainwindow_project_materialcollectionitem.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/files/patch-src_appleseed.studio_mainwindow_project_materialcollectionitem.cpp	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,18 @@
+--- src/appleseed.studio/mainwindow/project/materialcollectionitem.cpp.orig	2015-06-13 09:38:53 UTC
++++ src/appleseed.studio/mainwindow/project/materialcollectionitem.cpp
+@@ -94,6 +94,7 @@ MaterialCollectionItem::MaterialCollecti
+     add_items(materials);
+ }
+ 
++#ifdef APPLESEED_WITH_DISNEY_MATERIAL
+ const Material& MaterialCollectionItem::create_default_disney_material(const string& material_name)
+ {
+     auto_release_ptr<Material> material =
+@@ -110,6 +111,7 @@ const Material& MaterialCollectionItem::
+ 
+     return *material_ptr;
+ }
++#endif // APPLESEED_WITH_DISNEY_MATERIAL
+ 
+ QMenu* MaterialCollectionItem::get_single_item_context_menu() const
+ {

Added: head/graphics/appleseed/files/patch-src_appleseed.studio_mainwindow_project_objectinstanceitem.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/files/patch-src_appleseed.studio_mainwindow_project_objectinstanceitem.cpp	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,48 @@
+--- src/appleseed.studio/mainwindow/project/objectinstanceitem.cpp.orig	2015-06-13 09:38:53 UTC
++++ src/appleseed.studio/mainwindow/project/objectinstanceitem.cpp
+@@ -124,8 +124,10 @@ QMenu* ObjectInstanceItem::get_single_it
+ {
+     QMenu* menu = ItemBase::get_single_item_context_menu();
+ 
++#ifdef APPLESEED_WITH_DISNEY_MATERIAL
+     menu->addSeparator();
+     menu->addAction("Assign New Disney Material", this, SLOT(slot_assign_new_disney_material()));
++#endif // APPLESEED_WITH_DISNEY_MATERIAL
+ 
+     menu->addSeparator();
+     menu->addAction("Assign Materials...", this, SLOT(slot_open_material_assignment_editor()));
+@@ -168,15 +170,18 @@ QMenu* ObjectInstanceItem::get_multiple_
+ 
+     QMenu* menu = ItemBase::get_multiple_items_context_menu(items);
+ 
++#ifdef APPLESEED_WITH_DISNEY_MATERIAL
+     menu->addSeparator();
+     menu->addAction("Assign New Disney Material", this, SLOT(slot_assign_new_disney_material()))
+         ->setData(QVariant::fromValue(items));
++#endif // APPLESEED_WITH_DISNEY_MATERIAL
+ 
+     add_material_assignment_menu_actions(menu, items);
+ 
+     return menu;
+ }
+ 
++#ifdef APPLESEED_WITH_DISNEY_MATERIAL
+ // Friend of ObjectInstanceItem class, thus cannot be placed in anonymous namespace.
+ class AssignNewDisneyMaterialAction
+   : public RenderingManager::IScheduledAction
+@@ -255,12 +260,15 @@ class AssignNewDisneyMaterialAction
+     EntityEditorContext&    m_editor_context;
+     const QList<ItemBase*>  m_items;
+ };
++#endif // APPLESEED_WITH_DISNEY_MATERIAL
+ 
+ void ObjectInstanceItem::slot_assign_new_disney_material()
+ {
++#ifdef APPLESEED_WITH_DISNEY_MATERIAL
+     m_editor_context.m_rendering_manager.schedule_or_execute(
+         auto_ptr<RenderingManager::IScheduledAction>(
+             new AssignNewDisneyMaterialAction(m_editor_context, get_action_items())));
++#endif // APPLESEED_WITH_DISNEY_MATERIAL
+ }
+ 
+ void ObjectInstanceItem::slot_open_material_assignment_editor()

Added: head/graphics/appleseed/files/patch-src_appleseed.studio_mainwindow_project_texturecollectionitem.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/files/patch-src_appleseed.studio_mainwindow_project_texturecollectionitem.cpp	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,19 @@
+--- src/appleseed.studio/mainwindow/project/texturecollectionitem.cpp.orig	2015-06-13 09:38:53 UTC
++++ src/appleseed.studio/mainwindow/project/texturecollectionitem.cpp
+@@ -108,11 +108,15 @@ namespace
+         texture_params.insert("filename", path);
+         texture_params.insert("color_space", "srgb");
+ 
++        // Workaround for GCC 4.2.1: we cannot construct object in .create() below
++        // because GCC will attempt to invoke copy ctor which is private of course.
++        SearchPaths paths;
++
+         return
+             DiskTexture2dFactory().create(
+                 texture_name.c_str(),
+                 texture_params,
+-                SearchPaths());
++                paths);
+     }
+ 
+     auto_release_ptr<TextureInstance> create_texture_instance(const string& texture_name)

Added: head/graphics/appleseed/files/patch-src_appleseed_foundation_platform_compiler.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/files/patch-src_appleseed_foundation_platform_compiler.cpp	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,26 @@
+--- src/appleseed/foundation/platform/compiler.cpp.orig	2015-06-13 09:38:53 UTC
++++ src/appleseed/foundation/platform/compiler.cpp
+@@ -43,6 +43,10 @@ const char* Compiler::get_compiler_name(
+ #if defined _MSC_VER
+     return "Microsoft Visual C++";
+ 
++// Clang.
++#elif defined __clang__
++    return "clang";
++
+ // gcc.
+ #elif defined __GNUC__
+     return "gcc";
+@@ -59,6 +63,12 @@ const char* Compiler::get_compiler_versi
+ #if defined _MSC_VER
+     return TO_STRING_EVAL(_MSC_VER);
+ 
++// Clang.
++#elif defined __clang__
++    return TO_STRING_EVAL(__clang_major__) "."
++           TO_STRING_EVAL(__clang_minor__) "."
++           TO_STRING_EVAL(__clang_patchlevel__);
++
+ // gcc.
+ #elif defined __GNUC__
+     return TO_STRING_EVAL(__GNUC__) "."

Added: head/graphics/appleseed/files/patch-src_appleseed_foundation_platform_path.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/files/patch-src_appleseed_foundation_platform_path.cpp	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,29 @@
+--- src/appleseed/foundation/platform/path.cpp.orig	2015-06-13 09:38:53 UTC
++++ src/appleseed/foundation/platform/path.cpp
+@@ -49,6 +49,8 @@
+ #include <mach-o/dyld.h>
+ #elif defined __linux__
+ #include <unistd.h>
++#elif defined __FreeBSD__
++#include <sys/sysctl.h>
+ #endif
+ 
+ using namespace boost;
+@@ -88,6 +90,17 @@ const char* get_executable_path()
+         assert(result > 0);
+         path[result] = '\0';
+ 
++// FreeBSD.
++#elif defined __FreeBSD__
++
++#if __FreeBSD_version > 900009
++        const
++#endif
++        int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
++        size_t len = sizeof(path);
++        const int result = sysctl(mib, 4, path, &len, 0x0, 0);
++        assert(result == 0);
++
+ // Other platforms.
+ #else
+ 

Added: head/graphics/appleseed/files/patch-src_appleseed_foundation_platform_path.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/files/patch-src_appleseed_foundation_platform_path.h	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,20 @@
+--- src/appleseed/foundation/platform/path.h.orig	2015-06-13 09:38:53 UTC
++++ src/appleseed/foundation/platform/path.h
+@@ -42,7 +42,7 @@
+ #include "boost/filesystem/path.hpp"
+ 
+ // Platform headers.
+-#if defined __APPLE__
++#if defined __APPLE__ || defined __FreeBSD__
+ #include <sys/param.h>
+ #elif defined __linux__
+ #include <linux/limits.h>
+@@ -60,7 +60,7 @@ namespace foundation
+     #define FOUNDATION_MAX_PATH_LENGTH  MAX_PATH
+ 
+ // OS X.
+-#elif defined __APPLE__
++#elif defined __APPLE__ || defined __FreeBSD__
+     #define FOUNDATION_MAX_PATH_LENGTH  MAXPATHLEN
+ 
+ // Linux.

Added: head/graphics/appleseed/files/patch-src_appleseed_foundation_platform_system.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/files/patch-src_appleseed_foundation_platform_system.cpp	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,402 @@
+--- src/appleseed/foundation/platform/system.cpp.orig	2015-06-13 09:38:53 UTC
++++ src/appleseed/foundation/platform/system.cpp
+@@ -74,6 +74,14 @@
+     #include <sys/types.h>
+     #include <unistd.h>
+ 
++// Linux.
++#elif defined __FreeBSD__
++
++    #include <sys/types.h>
++    #include <sys/resource.h>
++    #include <sys/sysctl.h>
++    #include <unistd.h>
++
+ // Other platforms.
+ #else
+ 
+@@ -421,6 +429,384 @@ uint64 System::get_process_virtual_memor
+     return static_cast<uint64>(rss) * sysconf(_SC_PAGESIZE);
+ }
+ 
++// ------------------------------------------------------------------------------------------------
++// FreeBSD.
++// ------------------------------------------------------------------------------------------------
++
++#elif defined __FreeBSD__ && (__x86_64__ || __i386__)
++
++// FreeBSD does not provide an API to query CPU cache information, so we'd
++// have to ask for it by ourselves...
++
++#define bit(n)          (1ul << (n))
++#define bitmask(h,l)    ((bit(h) | (bit(h) - 1)) & ~(bit(l) - 1))
++#define bitfield(x,h,l) (((x) & bitmask(h, l)) >> l)
++
++enum { L1D, L2, L3 };
++enum { eax, ebx, ecx, edx };
++
++// Since we only want to know cache size and line size, structure below is
++// very simplistic.  Initially, all caches have zero size (i.e. absent).
++static struct trivial_x86_cache
++{
++    size_t size;
++    size_t linesize;
++} mycaches[3];
++
++// %ebx may be used to store GOT (Global Offset Table) for PIC (Position
++// Independent Code), so use %esi instead.
++static inline void
++cpuid(uint32_t* data)
++{
++    asm("pushl %%ebx\n\t"
++        "movl %%esi, %%ebx\n\t"
++        "cpuid\n\t"
++        "movl %%ebx, %%esi\n\t"
++        "popl %%ebx"
++      : "=a" (data[eax]),
++        "=S" (data[ebx]),
++        "=c" (data[ecx]),
++        "=d" (data[edx])
++      :  "a" (data[eax]),
++         "S" (data[ebx]),
++         "c" (data[ecx]),
++         "d" (data[edx]));
++}
++
++// For modern CPUs, we use Deterministic Cache Parameters (Function 04h) to
++// obtain the cache data.
++static void
++get_cache_info_deterministic(struct trivial_x86_cache *caches)
++{
++    uint32_t regs[4];
++
++    // Cycle up to ten possible caches to be extra sure
++    for (size_t i = 0; i < 10; i++)
++    {
++        regs[eax] = 4;
++        regs[ecx] = i;
++        cpuid(regs);
++
++        unsigned type = bitfield(regs[eax], 4, 0);
++        if (type == 0) break;    // no more caches, we're done
++        if (type == 2) continue; // ignore instruction caches
++
++        unsigned level = bitfield(regs[eax], 7, 5);
++        unsigned linesize = bitfield(regs[ebx], 11, 0) + 1;
++        unsigned sets = bitfield(regs[ecx], 31, 0) + 1;
++        unsigned associativity = bitfield(regs[ebx], 31, 22) + 1;
++
++        assert(level > 0);
++
++        caches[level - 1].size = linesize * sets * associativity;
++        caches[level - 1].linesize = linesize;
++    }
++}
++
++// On older CPUs we might have to rely on Cache Descriptors (Function 02h)
++// and Intel documentation (table of the known values).
++static void
++get_cache_info_from_table(struct trivial_x86_cache *caches)
++{
++    uint32_t regs[4];
++    int no_higher_level_cache = 0;
++
++    regs[eax] = 2;
++    cpuid(regs);
++    // Doing only one call is technically wrong, but all CPUs
++    // up to Core i7 require a single call.  Since this is a
++    // fallback code path for really old CPUs anyways (modern
++    // ones will provide Function 4), we should be safe, but
++    // let's add an assert() on the lower 8 bits just in case.
++
++    assert ((regs[eax] & 0xFF) == 1);
++
++    for (size_t i = 1; i < 4 * 4; i++)
++    {
++        // Check descriptor validity for every octet: if bit 31 is set,
++        // skip to next one.
++        if (i % 4 == 0 && (regs[i / 4] >> 31) == 1)
++        {
++            i += 4;
++            continue;
++        }
++
++        // Descriptor decode values from the Intel manual, Table 2-7
++        switch ((regs[i / 4] >> (i % 4) * 8) & 0xFF)
++        {
++        case 0x0A:
++            caches[L1D].size = 8;
++            caches[L1D].linesize = 32;
++            break;
++        case 0x0C:
++            caches[L1D].size = 16;
++            caches[L1D].linesize = 32;
++            break;
++        case 0x0D:
++        case 0x60:
++        case 0x67:
++            caches[L1D].size = 16;
++            caches[L1D].linesize = 64;
++            break;
++        case 0x21:
++        case 0x3C:
++        case 0x7A:
++            caches[L2].size = 256;
++            caches[L2].linesize = 64;
++            break;
++        case 0x22:
++        case 0xD0:
++            caches[L3].size = 512;
++            caches[L3].linesize = 64;
++            break;
++        case 0x23:
++        case 0xD1:
++        case 0xD6:
++            caches[L3].size = 1024;
++            caches[L3].linesize = 64;
++            break;
++        case 0x25:
++        case 0xD2:
++        case 0xD7:
++        case 0xE2:
++            caches[L3].size = 2048;
++            caches[L3].linesize = 64;
++            break;
++        case 0x29:
++        case 0x46:
++        case 0xD8:
++        case 0xE3:
++            caches[L3].size = 4096;
++            caches[L3].linesize = 64;
++            break;
++        case 0x2C:
++            caches[L1D].size = 32;
++            caches[L1D].linesize = 64;
++            break;
++        case 0x39:
++        case 0x3B:
++        case 0x79:
++            caches[L2].size = 128;
++            caches[L2].linesize = 64;
++            break;
++        case 0x3A:
++            caches[L2].size = 192;
++            caches[L2].linesize = 64;
++            break;
++        case 0x3D:
++            caches[L2].size = 384;
++            caches[L2].linesize = 64;
++            break;
++        case 0x3E:
++        case 0x7B:
++        case 0x7F:
++        case 0x86:
++            caches[L2].size = 512;
++            caches[L2].linesize = 64;
++            break;
++        case 0x40:
++            no_higher_level_cache = 1;
++            break;
++        case 0x41:
++            caches[L2].size = 128;
++            caches[L2].linesize = 32;
++            break;
++        case 0x42:
++        case 0x82:
++            caches[L2].size = 256;
++            caches[L2].linesize = 32;
++            break;
++        case 0x43:
++        case 0x83:
++            caches[L2].size = 512;
++            caches[L2].linesize = 32;
++            break;
++        case 0x44:
++            caches[L2].size = 1024;
++            caches[L2].linesize = 32;
++            break;
++        case 0x45:
++            caches[L2].size = 2048;
++            caches[L2].linesize = 32;
++            break;
++        case 0x47:
++        case 0x4B:
++        case 0xE4:
++            caches[L3].size = 8192;
++            caches[L3].linesize = 64;
++            break;
++        case 0x48:
++            caches[L2].size = 3072;
++            caches[L2].linesize = 64;
++            break;
++        case 0x49:
++            // TODO: check for Intel Xeon processor MP, Family 0Fh,
++            // Model 06h, because 0x49 means L3 cache (4MB, 16-way,
++            // 64-byte linesize) for this CPU.
++            caches[L2].size = 4096;
++            caches[L2].linesize = 64;
++            break;
++        case 0x4A:
++        case 0xDE:
++            caches[L3].size = 6 * 1024;
++            caches[L3].linesize = 64;
++            break;
++        case 0x4C:
++        case 0xEA:
++            caches[L3].size = 12 * 1024;
++            caches[L3].linesize = 64;
++            break;
++        case 0x4D:
++            caches[L3].size = 16 * 1024;
++            caches[L3].linesize = 64;
++            break;
++        case 0x4E:
++            caches[L2].size = 6 * 1024;
++            caches[L2].linesize = 64;
++            break;
++        case 0x66:
++            caches[L1D].size = 8;
++            caches[L1D].linesize = 64;
++            break;
++        case 0x68:
++            caches[L1D].size = 32;
++            caches[L1D].linesize = 64;
++            break;
++        case 0x78:
++        case 0x7C:
++            caches[L2].size = 1024;
++            caches[L2].linesize = 64;
++            break;
++        case 0x7D:
++            caches[L2].size = 2048;
++            caches[L2].linesize = 64;
++            break;
++        case 0x84:
++            caches[L2].size = 1024;
++            caches[L2].linesize = 32;
++            break;
++        case 0x85:
++            caches[L2].size = 2048;
++            caches[L2].linesize = 32;
++            break;
++        case 0x87:
++            caches[L2].size = 1024;
++            caches[L2].linesize = 64;
++            break;
++        case 0xDC:
++            caches[L3].size = 1536;
++            caches[L3].linesize = 64;
++            break;
++        case 0xDD:
++            caches[L3].size = 3 * 1024;
++            caches[L3].linesize = 64;
++            break;
++        case 0xEB:
++            caches[L3].size = 18 * 1024;
++            caches[L3].linesize = 64;
++            break;
++        case 0xEC:
++            caches[L3].size = 24 * 1024;
++            caches[L3].linesize = 64;
++            break;
++        }
++    }
++    // Convert Kbytes to bytes.
++    caches[L1D].size *= 1024;
++    caches[L2].size *= 1024;
++    caches[L3].size *= 1024;
++}
++
++static void
++x86_get_cache_basic_info(struct trivial_x86_cache *caches)
++{
++    uint32_t regs[4];
++
++    regs[eax] = 0;
++    cpuid(regs);
++    if (regs[eax] >= 4)
++        get_cache_info_deterministic(caches);
++    else if (regs[eax] >= 2)
++        get_cache_info_from_table(caches);
++}
++
++size_t System::get_l1_data_cache_size()
++{
++    // Here and below we'd check for L1D cache size: if it's initialized,
++    // it means that x86_get_cache_basic_info() was already called, and
++    // we don't have to do it again.
++    if (!mycaches[L1D].size)
++        x86_get_cache_basic_info(mycaches);
++    return mycaches[L1D].size;
++}
++
++size_t System::get_l1_data_cache_line_size()
++{
++    if (!mycaches[L1D].size)
++        x86_get_cache_basic_info(mycaches);
++    return mycaches[L1D].linesize;
++}
++
++size_t System::get_l2_cache_size()
++{
++    if (!mycaches[L1D].size)
++        x86_get_cache_basic_info(mycaches);
++    return mycaches[L2].size;
++}
++
++size_t System::get_l2_cache_line_size()
++{
++    if (!mycaches[L1D].size)
++        x86_get_cache_basic_info(mycaches);
++    return mycaches[L2].linesize;
++}
++
++size_t System::get_l3_cache_size()
++{
++    if (!mycaches[L1D].size)
++        x86_get_cache_basic_info(mycaches);
++    return mycaches[L3].size;
++}
++
++size_t System::get_l3_cache_line_size()
++{
++    if (!mycaches[L1D].size)
++        x86_get_cache_basic_info(mycaches);
++    return mycaches[L3].linesize;
++}
++
++uint64 System::get_total_physical_memory_size()
++{
++    const long pagesize = sysconf(_SC_PAGESIZE);
++    const long numpages = sysconf(_SC_PHYS_PAGES);
++
++    return static_cast<uint64>(pagesize) * numpages;
++}
++
++uint64 System::get_total_virtual_memory_size()
++{
++    quad_t swap;
++    size_t len = sizeof(swap);
++
++    const int result = sysctlbyname("vm.swap_total", &swap, &len, 0x0, 0);
++    assert(result == 0);
++
++    return get_total_physical_memory_size() + swap;
++}
++
++// curproc->p_stats->p_ru is updated on statclock tick and can be not very
++// granular (if called early in program's life, it can even yield zeros).
++// Reference: https://lists.freebsd.org/pipermail/freebsd-stable/2006-March/023262.html
++uint64 System::get_process_virtual_memory_size()
++{
++    struct rusage ru;
++
++    const int result = getrusage(RUSAGE_SELF, &ru);
++    assert(result == 0);
++
++    return static_cast<uint64>(ru.ru_maxrss) * 1024;
++}
++
+ #endif
+ 
+ }   // namespace foundation

Added: head/graphics/appleseed/files/patch-src_appleseed_foundation_platform_thread.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/files/patch-src_appleseed_foundation_platform_thread.cpp	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,27 @@
+--- src/appleseed/foundation/platform/thread.cpp.orig	2015-06-13 09:38:53 UTC
++++ src/appleseed/foundation/platform/thread.cpp
+@@ -47,6 +47,9 @@
+ // Platform headers.
+ #if defined __APPLE__
+ #include <pthread.h>
++#elif defined __FreeBSD__
++#include <pthread.h>
++#include <pthread_np.h>
+ #elif defined __linux__
+ #include <sys/prctl.h>
+ #endif
+@@ -325,6 +328,14 @@ namespace foundation
+         pthread_setname_np(name);
+     }
+ 
++// FreeBSD.
++#elif defined __FreeBSD__
++
++    void set_current_thread_name(const char* name)
++    {
++        pthread_set_name_np(pthread_self(), name);
++    }
++
+ // Linux.
+ #elif defined __linux__
+ 

Added: head/graphics/appleseed/files/patch-src_appleseed_foundation_utility_job_workerthread.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/files/patch-src_appleseed_foundation_utility_job_workerthread.cpp	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,38 @@
+--- src/appleseed/foundation/utility/job/workerthread.cpp.orig	2015-06-13 09:38:53 UTC
++++ src/appleseed/foundation/utility/job/workerthread.cpp
+@@ -80,7 +80,7 @@ void WorkerThread::start()
+     assert(!m_abort_switch.is_aborted());
+ 
+     // Start the thread.
+-    m_thread = new thread(m_thread_func);
++    m_thread = new boost::thread(m_thread_func);
+ }
+ 
+ void WorkerThread::stop()
+@@ -110,7 +110,7 @@ void WorkerThread::pause()
+     if (!m_thread)
+         return;
+ 
+-    mutex::scoped_lock lock(m_pause_mutex);
++    boost::mutex::scoped_lock lock(m_pause_mutex);
+     m_pause_flag.set();
+ }
+ 
+@@ -120,7 +120,7 @@ void WorkerThread::resume()
+     if (!m_thread)
+         return;
+ 
+-    mutex::scoped_lock lock(m_pause_mutex);
++    boost::mutex::scoped_lock lock(m_pause_mutex);
+     m_pause_flag.clear();
+     m_pause_event.notify_all();
+ }
+@@ -141,7 +141,7 @@ void WorkerThread::run()
+         if (m_pause_flag.is_set())
+         {
+             // Wait until the resume event.
+-            mutex::scoped_lock lock(m_pause_mutex);
++            boost::mutex::scoped_lock lock(m_pause_mutex);
+             while (m_pause_flag.is_set())
+                 m_pause_event.wait(lock);
+         }

Added: head/graphics/appleseed/files/patch-src_appleseed_renderer_kernel_rendering_generic_genericframerenderer.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/files/patch-src_appleseed_renderer_kernel_rendering_generic_genericframerenderer.cpp	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,20 @@
+--- src/appleseed/renderer/kernel/rendering/generic/genericframerenderer.cpp.orig	2015-06-13 09:38:53 UTC
++++ src/appleseed/renderer/kernel/rendering/generic/genericframerenderer.cpp
+@@ -169,7 +169,7 @@ namespace
+                     m_abort_switch,
+                     m_is_rendering));
+             ThreadFunctionWrapper<PassManagerFunc> wrapper(m_pass_manager_func.get());
+-            m_pass_manager_thread.reset(new thread(wrapper));
++            m_pass_manager_thread.reset(new boost::thread(wrapper));
+         }
+ 
+         virtual void stop_rendering() APPLESEED_OVERRIDE
+@@ -352,7 +352,7 @@ namespace
+ 
+         bool                        m_is_rendering;
+         auto_ptr<PassManagerFunc>   m_pass_manager_func;
+-        auto_ptr<thread>            m_pass_manager_thread;
++        auto_ptr<boost::thread>     m_pass_manager_thread;
+ 
+         void print_tile_renderers_stats() const
+         {

Added: head/graphics/appleseed/files/patch-src_appleseed_renderer_kernel_rendering_progressive_progressiveframerenderer.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/files/patch-src_appleseed_renderer_kernel_rendering_progressive_progressiveframerenderer.cpp	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,34 @@
+--- src/appleseed/renderer/kernel/rendering/progressive/progressiveframerenderer.cpp.orig	2015-06-13 09:38:53 UTC
++++ src/appleseed/renderer/kernel/rendering/progressive/progressiveframerenderer.cpp
+@@ -235,7 +235,7 @@ namespace
+                     m_ref_image_avg_lum,
+                     m_abort_switch));
+             m_statistics_thread.reset(
+-                new thread(
++                new boost::thread(
+                     ThreadFunctionWrapper<StatisticsFunc>(m_statistics_func.get())));
+ 
+             // Create and start the display thread.
+@@ -249,7 +249,7 @@ namespace
+                         m_params.m_max_fps,
+                         m_display_thread_abort_switch));
+                 m_display_thread.reset(
+-                    new thread(
++                    new boost::thread(
+                         ThreadFunctionWrapper<DisplayFunc>(m_display_func.get())));
+             }
+ 
+@@ -592,11 +592,11 @@ namespace
+         double                              m_ref_image_avg_lum;
+ 
+         auto_ptr<DisplayFunc>               m_display_func;
+-        auto_ptr<thread>                    m_display_thread;
++        auto_ptr<boost::thread>             m_display_thread;
+         AbortSwitch                         m_display_thread_abort_switch;
+ 
+         auto_ptr<StatisticsFunc>            m_statistics_func;
+-        auto_ptr<thread>                    m_statistics_thread;
++        auto_ptr<boost::thread>             m_statistics_thread;
+ 
+         void print_sample_generators_stats() const
+         {

Added: head/graphics/appleseed/files/patch-src_appleseed_renderer_utility_plugin.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/files/patch-src_appleseed_renderer_utility_plugin.cpp	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,27 @@
+--- src/appleseed/renderer/utility/plugin.cpp.orig	2015-06-13 09:38:53 UTC
++++ src/appleseed/renderer/utility/plugin.cpp
+@@ -119,13 +119,13 @@ namespace
+     typedef map<string, boost::weak_ptr<SharedLibrary> > PluginCacheType;
+ 
+     PluginCacheType g_plugin_cache;
+-    mutex g_plugin_cache_mutex;
++    boost::mutex g_plugin_cache_mutex;
+ 
+     struct PluginDeleter
+     {
+         void operator()(SharedLibrary* p)
+         {
+-            lock_guard<mutex> lock(g_plugin_cache_mutex);
++            boost::lock_guard<boost::mutex> lock(g_plugin_cache_mutex);
+ 
+             // Try to call the plugin uninitialize function if defined.
+             Plugin::UnInitPluginFnType uninit_fn =
+@@ -141,7 +141,7 @@ namespace
+ 
+ auto_release_ptr<Plugin> PluginCache::load(const char* path)
+ {
+-    lock_guard<mutex> lock(g_plugin_cache_mutex);
++    boost::lock_guard<boost::mutex> lock(g_plugin_cache_mutex);
+ 
+     // Check if we loaded this plugin before.
+     PluginCacheType::iterator it = g_plugin_cache.find(path);

Added: head/graphics/appleseed/files/patch-src_cmake_config_linux-gcc.txt
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/files/patch-src_cmake_config_linux-gcc.txt	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,23 @@
+--- src/cmake/config/linux-gcc.txt.orig	2015-06-13 09:38:53 UTC
++++ src/cmake/config/linux-gcc.txt
+@@ -60,7 +60,6 @@ set (git_command "git")
+ 
+ # Flags common to all configurations.
+ set (c_compiler_flags_common
+-    -Werror                                             # Treat Warnings As Errors
+     -Wno-switch                                         # don't complain about unhandled enumeration values in switch
+     -fno-math-errno                                     # ignore errno when calling math functions
+     -fPIC                                               # emit position-independent code
+@@ -102,12 +101,6 @@ if (HIDE_SYMBOLS)
+     )
+ endif ()
+ 
+-# Release configuration.
+-set (c_compiler_flags_release
+-    -O3                                                 # optimization level
+-)
+-
+-
+ #--------------------------------------------------------------------------------------------------
+ # Libraries.
+ #--------------------------------------------------------------------------------------------------

Added: head/graphics/appleseed/files/pkg-message.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/appleseed/files/pkg-message.in	Fri Aug 28 18:19:22 2015	(r395520)
@@ -0,0 +1,6 @@
+appleseed currently requires itself to be installed under common prefix:
+%%APPHOME%%.  To run CLI or GUI version, execute the following
+commands, respectively:
+

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-ports-all mailing list