Add patches for upgraded dependency compatibility

- Add patch for ImageMagick 7 compatibility
- Add patch for OpenEXR 3+ compatibility
This commit is contained in:
Neal Gompa 2022-12-04 15:49:16 -05:00
parent badab7248b
commit 4f1bb379dd
3 changed files with 102 additions and 12 deletions

View File

@ -0,0 +1,35 @@
From 95c5e87b8fe19cc6d067e1c2ce6239a5ba413a1c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Mon, 3 Jan 2022 06:09:25 +0100
Subject: [PATCH] Prefer upstream CMake Config Mode files for OpenEXR
The bundled FindOpenEXR.cmake Find Module is quite outdated, import
the OpenEXR target from its upstream definition.
---
CMakeLists.txt | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b2923cf..a33293b 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -106,7 +106,15 @@ OPTION(WITH_OpenEXR "Compile with OpenEXR library" ON)
if( WITH_OpenEXR )
-find_package (OpenEXR)
+find_package (OpenEXR NO_MODULE)
+if( TARGET OpenEXR::OpenEXR )
+ set( OPENEXR_FOUND TRUE )
+ set( OPENEXR_LIBRARIES OpenEXR::OpenEXR )
+ get_target_property( OPENEXR_INCLUDE_DIR OpenEXR::OpenEXR INTERFACE_INCLUDE_DIRECTORIES )
+else ()
+ find_package (OpenEXR MODULE)
+endif ()
+
if( NOT OPENEXR_FOUND )
MESSAGE( STATUS "OpenEXR not found. The following command will not be
compiled: pfsinexr pfsoutexr. " )
--
2.34.1

View File

@ -0,0 +1,56 @@
diff --git a/src/fileformat/pfsinimgmagick.cpp b/src/fileformat/pfsinimgmagick.cpp
index 5dab440..f4358ce 100644
--- a/src/fileformat/pfsinimgmagick.cpp
+++ b/src/fileformat/pfsinimgmagick.cpp
@@ -35,6 +35,7 @@
#define PROG_NAME "pfsinimgmagick"
+using namespace Magick;
class QuietException
{
@@ -114,7 +115,11 @@ void readFrames( int argc, char* argv[] )
Magick::Image imImage( ff.fileName );
VERBOSE_STR << "input image gamma: " << imImage.gamma() << std::endl;
+#if MagickLibVersion >= 0x700
+ bool hasAlpha = imImage.alpha();
+#else
bool hasAlpha = imImage.matte();
+#endif
if( hasAlpha )
VERBOSE_STR << "alpha channel found" << std::endl;
@@ -129,17 +134,30 @@ void readFrames( int argc, char* argv[] )
// Copy line by line to pfs::Frame
int pixInd = 0;
- const float maxValue = (float)(1<<QuantumDepth) - 1;
+ const float maxValue = (float)QuantumRange;
for( int r = 0; r < imImage.rows(); r++ ) {
+#if MagickLibVersion >= 0x700
+ const Magick::Quantum *pixels =
+#else
const Magick::PixelPacket *pixels =
+#endif
imImage.getConstPixels( 0, r, imImage.columns(), 1 );
for( int c = 0; c < imImage.columns(); c++ ) {
+#if MagickLibVersion >= 0x700
+ (*X)(pixInd) = (float)MagickCore::GetPixelRed(imImage.image(), pixels) / maxValue;
+ (*Y)(pixInd) = (float)MagickCore::GetPixelGreen(imImage.image(), pixels) / maxValue;
+ (*Z)(pixInd) = (float)MagickCore::GetPixelBlue(imImage.image(), pixels) / maxValue;
+ if( alpha != NULL )
+ (*alpha)(pixInd) = (float)MagickCore::GetPixelAlpha(imImage.image(), pixels) / maxValue;
+ pixels += MagickCore::GetPixelChannels(imImage.image());
+#else
(*X)(pixInd) = (float)pixels[c].red / maxValue;
(*Y)(pixInd) = (float)pixels[c].green / maxValue;
(*Z)(pixInd) = (float)pixels[c].blue / maxValue;
if( alpha != NULL )
(*alpha)(pixInd) = (float)pixels[c].opacity / maxValue;
+#endif
pixInd++;
}
}

View File

@ -1,27 +1,21 @@
Name: pfstools
Version: 2.2.0
Release: 6%{?dist}
Release: 7%{?dist}
Summary: Programs for handling high-dynamic range images
License: GPLv2+
URL: http://pfstools.sourceforge.net/
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tgz
Patch0: pfstools-freeglut.patch
# From https://sourceforge.net/p/pfstools/bugs/54
Patch1: 0001-Prefer-upstream-CMake-Config-Mode-files-for-OpenEXR.patch
# From openSUSE
Patch2: pfstools-ImageMagick7.patch
BuildRequires: make
BuildRequires: cmake
BuildRequires: libtiff-devel
# As of OpenEXR 3 upstream has significantly reorganized the libraries
# including splitting out imath as a standalone library (which this project may
# or may not need). Please see
# https://github.com/AcademySoftwareFoundation/Imath/blob/master/docs/PortingGuide2-3.md
# for porting details and encourage upstream to support it. For now a 2.x
# compat package is provided.
%if 0%{?fedora} > 33
BuildRequires: cmake(OpenEXR) < 3
%else
BuildRequires: OpenEXR-devel
%endif
BuildRequires: cmake(OpenEXR)
BuildRequires: octave-devel
BuildRequires: libGL-devel
BuildRequires: ImageMagick-devel
@ -313,6 +307,11 @@ export CXXFLAGS="%{optflags} -std=gnu++11"
%{_includedir}/pfs
%changelog
* Sun Dec 04 2022 Neal Gompa <ngompa@fedoraproject.org> - 2.2.0-7
- Add patches for upgraded dependency compatibility
+ Add patch for ImageMagick 7 compatibility
+ Add patch for OpenEXR 3+ compatibility
* Tue Aug 23 2022 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.2.0-6
- Rebuild for gsl-2.7.1