summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-02-12 20:50:23 +0000
committerSam James <sam@gentoo.org>2022-02-15 19:50:07 +0000
commit56aff67d12ed9fac1c638b64c804828f3e7026e9 (patch)
treec1d8eecdfa14a133e83cd12cf8da939340302fd8 /media-libs/Field3D
parentmedia-libs/vigra: support OpenEXR 3 / imath (diff)
downloadgentoo-56aff67d12ed9fac1c638b64c804828f3e7026e9.tar.gz
gentoo-56aff67d12ed9fac1c638b64c804828f3e7026e9.tar.bz2
gentoo-56aff67d12ed9fac1c638b64c804828f3e7026e9.zip
media-libs/Field3D: support OpenEXR 3 / imath
Bug: https://bugs.gentoo.org/833158 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'media-libs/Field3D')
-rw-r--r--media-libs/Field3D/Field3D-1.7.2-r1.ebuild41
-rw-r--r--media-libs/Field3D/files/Field3D-1.7.2-openexr-3-imath.patch233
2 files changed, 274 insertions, 0 deletions
diff --git a/media-libs/Field3D/Field3D-1.7.2-r1.ebuild b/media-libs/Field3D/Field3D-1.7.2-r1.ebuild
new file mode 100644
index 000000000000..71f70435a8ca
--- /dev/null
+++ b/media-libs/Field3D/Field3D-1.7.2-r1.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake flag-o-matic
+
+DESCRIPTION="A library for storing voxel data"
+HOMEPAGE="http://opensource.imageworks.com/?p=field3d"
+SRC_URI="https://github.com/imageworks/Field3D/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+IUSE="mpi"
+
+RDEPEND="
+ >=dev-libs/boost-1.62:=
+ dev-libs/imath:=
+ sci-libs/hdf5:=
+ mpi? ( virtual/mpi )
+"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.7.2-openexr-3-imath.patch
+)
+
+src_configure() {
+ # Needed for now ("fix" compatibility with >=sci-libs/hdf5-1.12)
+ # bug #808731
+ append-cppflags -DH5_USE_110_API
+
+ local mycmakeargs=(
+ -DINSTALL_DOCS=OFF # Docs are not finished yet.
+ -DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=ON
+ $(cmake_use_find_package mpi MPI)
+ )
+
+ cmake_src_configure
+}
diff --git a/media-libs/Field3D/files/Field3D-1.7.2-openexr-3-imath.patch b/media-libs/Field3D/files/Field3D-1.7.2-openexr-3-imath.patch
new file mode 100644
index 000000000000..a4155403d46c
--- /dev/null
+++ b/media-libs/Field3D/files/Field3D-1.7.2-openexr-3-imath.patch
@@ -0,0 +1,233 @@
+https://src.fedoraproject.org/rpms/Field3D/raw/rawhide/f/Field3D-openexr.patch
+https://github.com/imageworks/Field3D/issues/101
+
+--- a/export/StdMathLib.h
++++ b/export/StdMathLib.h
+@@ -38,18 +38,41 @@
+ #ifndef _INCLUDED_Field3D_StdMathLib_H_
+ #define _INCLUDED_Field3D_StdMathLib_H_
+
+-#include <OpenEXR/ImathBox.h>
+-#include <OpenEXR/ImathBoxAlgo.h>
+-#include <OpenEXR/ImathColor.h>
+-#include <OpenEXR/ImathHalfLimits.h>
+-#include <OpenEXR/ImathMatrix.h>
+-#include <OpenEXR/ImathMatrixAlgo.h>
+-#include <OpenEXR/ImathPlane.h>
+-#include <OpenEXR/ImathRandom.h>
+-#include <OpenEXR/ImathRoots.h>
+-#include <OpenEXR/ImathVec.h>
+-#include <OpenEXR/half.h>
++// The version can reliably be found in this header file from OpenEXR,
++// for both 2.x and 3.x:
++#include <OpenEXR/OpenEXRConfig.h>
++#define COMBINED_OPENEXR_VERSION ((10000*OPENEXR_VERSION_MAJOR) + \
++ (100*OPENEXR_VERSION_MINOR) + \
++ OPENEXR_VERSION_PATCH)
+
++// There's just no easy way to have an `#include` that works in both
++// cases, so we use the version to switch which set of include files we
++// use.
++#if COMBINED_OPENEXR_VERSION >= 20599 /* 2.5.99: pre-3.0 */
++# include <Imath/ImathBox.h>
++# include <Imath/ImathBoxAlgo.h>
++# include <Imath/ImathColor.h>
++# include <Imath/ImathMatrix.h>
++# include <Imath/ImathMatrixAlgo.h>
++# include <Imath/ImathPlane.h>
++# include <Imath/ImathRandom.h>
++# include <Imath/ImathRoots.h>
++# include <Imath/ImathVec.h>
++# include <Imath/half.h>
++#else
++ // OpenEXR 2.x, use the old locations
++# include <OpenEXR/ImathBox.h>
++# include <OpenEXR/ImathBoxAlgo.h>
++# include <OpenEXR/ImathColor.h>
++# include <OpenEXR/ImathHalfLimits.h>
++# include <OpenEXR/ImathMatrix.h>
++# include <OpenEXR/ImathMatrixAlgo.h>
++# include <OpenEXR/ImathPlane.h>
++# include <OpenEXR/ImathRandom.h>
++# include <OpenEXR/ImathRoots.h>
++# include <OpenEXR/ImathVec.h>
++# include <OpenEXR/half.h>
++#endif
+ //----------------------------------------------------------------------------//
+
+ #include "ns.h"
+--- a/export/Curve.h
++++ b/export/Curve.h
+@@ -53,8 +53,25 @@
+
+ #include <boost/lexical_cast.hpp>
+
+-#include <OpenEXR/ImathFun.h>
+-#include <OpenEXR/ImathMatrix.h>
++// The version can reliably be found in this header file from OpenEXR,
++// for both 2.x and 3.x:
++#include <OpenEXR/OpenEXRConfig.h>
++#define COMBINED_OPENEXR_VERSION ((10000*OPENEXR_VERSION_MAJOR) + \
++ (100*OPENEXR_VERSION_MINOR) + \
++ OPENEXR_VERSION_PATCH)
++
++// There's just no easy way to have an `#include` that works in both
++// cases, so we use the version to switch which set of include files we
++// use.
++#if COMBINED_OPENEXR_VERSION >= 20599 /* 2.5.99: pre-3.0 */
++# include <Imath/ImathFun.h>
++# include <Imath/ImathMatrix.h>
++#else
++ // OpenEXR 2.x, use the old locations
++# include <OpenEXR/ImathFun.h>
++# include <OpenEXR/ImathMatrix.h>
++#endif
++
+
+ //----------------------------------------------------------------------------//
+
+--- a/include/OgUtil.h
++++ b/include/OgUtil.h
+@@ -10,7 +10,22 @@
+ #include <iostream>
+ #include <string>
+
+-#include <OpenEXR/ImathVec.h>
++// The version can reliably be found in this header file from OpenEXR,
++// for both 2.x and 3.x:
++#include <OpenEXR/OpenEXRConfig.h>
++#define COMBINED_OPENEXR_VERSION ((10000*OPENEXR_VERSION_MAJOR) + \
++ (100*OPENEXR_VERSION_MINOR) + \
++ OPENEXR_VERSION_PATCH)
++
++// There's just no easy way to have an `#include` that works in both
++// cases, so we use the version to switch which set of include files we
++// use.
++#if COMBINED_OPENEXR_VERSION >= 20599 /* 2.5.99: pre-3.0 */
++# include <Imath/ImathVec.h>
++#else
++ // OpenEXR 2.x, use the old locations
++# include <OpenEXR/ImathVec.h>
++#endif
+
+ #include "All.h"
+ #include "UtilFoundation.h"
+--- a/include/UtilFoundation.h
++++ b/include/UtilFoundation.h
+@@ -68,7 +68,22 @@
+
+ #include <memory>
+
+-#include <half.h>
++// The version can reliably be found in this header file from OpenEXR,
++// for both 2.x and 3.x:
++#include <OpenEXR/OpenEXRConfig.h>
++#define COMBINED_OPENEXR_VERSION ((10000*OPENEXR_VERSION_MAJOR) + \
++ (100*OPENEXR_VERSION_MINOR) + \
++ OPENEXR_VERSION_PATCH)
++
++// There's just no easy way to have an `#include` that works in both
++// cases, so we use the version to switch which set of include files we
++// use.
++#if COMBINED_OPENEXR_VERSION >= 20599 /* 2.5.99: pre-3.0 */
++# include <Imath/half.h>
++#else
++ // OpenEXR 2.x, use the old locations
++# include <OpenEXR/half.h>
++#endif
+
+ #include <iomanip>
+ #include <iostream>
+--- a/include/OgIAttribute.h
++++ b/include/OgIAttribute.h
+@@ -9,7 +9,22 @@
+
+ #include "OgUtil.h"
+
+-#include <OpenEXR/ImathMatrix.h>
++// The version can reliably be found in this header file from OpenEXR,
++// for both 2.x and 3.x:
++#include <OpenEXR/OpenEXRConfig.h>
++#define COMBINED_OPENEXR_VERSION ((10000*OPENEXR_VERSION_MAJOR) + \
++ (100*OPENEXR_VERSION_MINOR) + \
++ OPENEXR_VERSION_PATCH)
++
++// There's just no easy way to have an `#include` that works in both
++// cases, so we use the version to switch which set of include files we
++// use.
++#if COMBINED_OPENEXR_VERSION >= 20599 /* 2.5.99: pre-3.0 */
++# include <Imath/ImathMatrix.h>
++#else
++ // OpenEXR 2.x, use the old locations
++# include <OpenEXR/ImathMatrix.h>
++#endif
+
+ //----------------------------------------------------------------------------//
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -49,7 +49,13 @@ FIND_PACKAGE (Boost COMPONENTS regex thr
+ FIND_PACKAGE (MPI)
+ ENDIF ()
+
+-FIND_PACKAGE (ILMBase)
++# First, try to find just the right config files
++find_package(Imath CONFIG)
++if (NOT TARGET Imath::Imath)
++ # Couldn't find Imath::Imath, maybe it's older and has IlmBase?
++ find_package(IlmBase CONFIG)
++endif ()
++find_package(OpenEXR CONFIG)
+
+ # Allow the developer to select if Dynamic or Static libraries are built
+ OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" ON)
+@@ -146,9 +152,20 @@ IF ( CMAKE_HOST_UNIX )
+ LIST ( APPEND Field3D_Libraries_Shared
+ ${MPI_LIBRARIES} )
+ ENDIF ( MPI_FOUND )
+- LIST ( APPEND Field3D_Libraries_Shared
+- Iex Half IlmThread Imath
+- pthread dl z )
++ if(TARGET Imath::Imath)
++ list(APPEND Field3D_Libraries_Shared
++ # For OpenEXR/Imath 3.x:
++ $<$<TARGET_EXISTS:OpenEXR::OpenEXR>:OpenEXR::OpenEXR>
++ $<$<TARGET_EXISTS:Imath::Imath>:Imath::Imath>
++ $<$<TARGET_EXISTS:Imath::Half>:Imath::Half>
++ pthread
++ dl
++ z)
++ else()
++ LIST ( APPEND Field3D_Libraries_Shared
++ Iex Half IlmThread Imath
++ pthread dl z )
++ endif()
+ SET ( Field3D_DSO_Libraries ${Field3D_Libraries_Shared} )
+ SET ( Field3D_BIN_Libraries Field3D ${Field3D_Libraries_Shared}
+ ${Boost_LIBRARIES} )
+--- a/test/unit_tests/UnitTest.cpp
++++ b/test/unit_tests/UnitTest.cpp
+@@ -44,7 +44,22 @@
+ #include <boost/thread/thread.hpp>
+ #include <boost/thread/mutex.hpp>
+
+-#include <OpenEXR/ImathFrustum.h>
++// The version can reliably be found in this header file from OpenEXR,
++// for both 2.x and 3.x:
++#include <OpenEXR/OpenEXRConfig.h>
++#define COMBINED_OPENEXR_VERSION ((10000*OPENEXR_VERSION_MAJOR) + \
++ (100*OPENEXR_VERSION_MINOR) + \
++ OPENEXR_VERSION_PATCH)
++
++// There's just no easy way to have an `#include` that works in both
++// cases, so we use the version to switch which set of include files we
++// use.
++#if COMBINED_OPENEXR_VERSION >= 20599 /* 2.5.99: pre-3.0 */
++# include <Imath/ImathFrustum.h>
++#else
++ // OpenEXR 2.x, use the old locations
++# include <OpenEXR/ImathFrustum.h>
++#endif
+
+ #include "Field3D/DenseField.h"
+ #include "Field3D/EmptyField.h"