[packages/Field3D] - rel 5, build fixes for OpenEXR 3.x

baggins baggins at pld-linux.org
Sun Feb 6 11:44:02 CET 2022


commit 4739bfc928da272dfd3f8311cb4f9974026d405b
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Sun Feb 6 11:43:46 2022 +0100

    - rel 5, build fixes for OpenEXR 3.x

 Field3D.spec   |   4 +-
 openexr3.patch | 253 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 256 insertions(+), 1 deletion(-)
---
diff --git a/Field3D.spec b/Field3D.spec
index bf9ed81..444c594 100644
--- a/Field3D.spec
+++ b/Field3D.spec
@@ -3,12 +3,13 @@ Summary:	Field3D - open source library for storing voxel data
 Summary(pl.UTF-8):	Field3D - mająca otwarte źródła biblioteka do przechowywania danych vokseli
 Name:		Field3D
 Version:	1.7.3
-Release:	4
+Release:	5
 License:	BSD
 Group:		Libraries
 #Source0Download: https://github.com/imageworks/Field3D/releases
 Source0:	https://github.com/imageworks/Field3D/archive/v%{version}/%{name}-%{version}.tar.gz
 # Source0-md5:	536198b1b4840a5b35400ccf05d4431c
+Patch0:		openexr3.patch
 URL:		http://opensource.imageworks.com/?p=field3d
 BuildRequires:	cmake >= 2.8
 BuildRequires:	boost-devel >= 1.34.0
@@ -62,6 +63,7 @@ Dokumentacja API biblioteki Field3D.
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
 # main build system is scons, but there is cmake alternative, which is slightly more usable in rpm building
diff --git a/openexr3.patch b/openexr3.patch
new file mode 100644
index 0000000..31a8126
--- /dev/null
+++ b/openexr3.patch
@@ -0,0 +1,253 @@
+Index: Field3D-1.7.3/export/StdMathLib.h
+===================================================================
+--- Field3D-1.7.3.orig/export/StdMathLib.h
++++ Field3D-1.7.3/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"
+Index: Field3D-1.7.3/export/Curve.h
+===================================================================
+--- Field3D-1.7.3.orig/export/Curve.h
++++ Field3D-1.7.3/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
++
+ 
+ //----------------------------------------------------------------------------//
+ 
+Index: Field3D-1.7.3/include/OgUtil.h
+===================================================================
+--- Field3D-1.7.3.orig/include/OgUtil.h
++++ Field3D-1.7.3/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"
+Index: Field3D-1.7.3/include/UtilFoundation.h
+===================================================================
+--- Field3D-1.7.3.orig/include/UtilFoundation.h
++++ Field3D-1.7.3/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>
+Index: Field3D-1.7.3/include/OgIAttribute.h
+===================================================================
+--- Field3D-1.7.3.orig/include/OgIAttribute.h
++++ Field3D-1.7.3/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
+ 
+ //----------------------------------------------------------------------------//
+ 
+Index: Field3D-1.7.3/CMakeLists.txt
+===================================================================
+--- Field3D-1.7.3.orig/CMakeLists.txt
++++ Field3D-1.7.3/CMakeLists.txt
+@@ -38,7 +38,6 @@
+ set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake )
+ 
+ FIND_PACKAGE (Doxygen)
+-FIND_PACKAGE (HDF5 COMPONENTS C)
+ IF ( CMAKE_HOST_WIN32 )
+ # f3dinfo relies on program_options but don't include it, since
+ # for some reason, unlike all the other boost components, a link is
+@@ -49,7 +49,14 @@ 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)
++find_package(HDF5 COMPONENTS C)
+ 
+ # 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} )
+Index: Field3D-1.7.3/test/unit_tests/UnitTest.cpp
+===================================================================
+--- Field3D-1.7.3.orig/test/unit_tests/UnitTest.cpp
++++ Field3D-1.7.3/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"
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/Field3D.git/commitdiff/4739bfc928da272dfd3f8311cb4f9974026d405b



More information about the pld-cvs-commit mailing list