pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/graphics/freeimage



Module Name:    pkgsrc
Committed By:   nia
Date:           Thu May 14 16:42:14 UTC 2020

Modified Files:
        pkgsrc/graphics/freeimage: Makefile PLIST distinfo
Added Files:
        pkgsrc/graphics/freeimage/patches: patch-Makefile.gnu
            patch-Source_FreeImage.h
            patch-Source_FreeImageToolkit_JPEGTransform.cpp
            patch-Source_FreeImage_J2KHelper.cpp
            patch-Source_FreeImage_PSDParser.cpp
            patch-Source_FreeImage_Plugin.cpp
            patch-Source_FreeImage_PluginEXR.cpp
            patch-Source_FreeImage_PluginJ2K.cpp
            patch-Source_FreeImage_PluginJP2.cpp
            patch-Source_FreeImage_PluginJPEG.cpp
            patch-Source_FreeImage_PluginPNG.cpp
            patch-Source_FreeImage_PluginRAW.cpp
            patch-Source_FreeImage_PluginTIFF.cpp
            patch-Source_FreeImage_PluginWebP.cpp
            patch-Source_FreeImage_ZLibInterface.cpp
            patch-Source_Metadata_TagConversion.cpp
            patch-Source_Metadata_XTIFF.cpp patch-Source_Utilities.h
            patch-genfipsrclist.sh patch-gensrclist.sh
Removed Files:
        pkgsrc/graphics/freeimage/patches: patch-Makefile patch-Makefile.fip
            patch-Source_LibOpenJPEG_opj__malloc.h
            patch-Source_LibRawLite_internal_dcraw__common.cpp

Log Message:
freeimage: Force use of unbundled libraries.

Most Linux distributions have been forcing this for a while, because
the reference image libraries are often full of bugs and slow to do
releases, so everyone (including us) is carrying lots of local patches
for security fixes.

Bump PKGREVISION


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 pkgsrc/graphics/freeimage/Makefile
cvs rdiff -u -r1.2 -r1.3 pkgsrc/graphics/freeimage/PLIST
cvs rdiff -u -r1.8 -r1.9 pkgsrc/graphics/freeimage/distinfo
cvs rdiff -u -r1.3 -r0 pkgsrc/graphics/freeimage/patches/patch-Makefile \
    pkgsrc/graphics/freeimage/patches/patch-Makefile.fip
cvs rdiff -u -r0 -r1.1 pkgsrc/graphics/freeimage/patches/patch-Makefile.gnu \
    pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage.h \
    pkgsrc/graphics/freeimage/patches/patch-Source_FreeImageToolkit_JPEGTransform.cpp \
    pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_J2KHelper.cpp \
    pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PSDParser.cpp \
    pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_Plugin.cpp \
    pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginEXR.cpp \
    pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginJ2K.cpp \
    pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginJP2.cpp \
    pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginJPEG.cpp \
    pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginPNG.cpp \
    pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginRAW.cpp \
    pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginTIFF.cpp \
    pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginWebP.cpp \
    pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_ZLibInterface.cpp \
    pkgsrc/graphics/freeimage/patches/patch-Source_Metadata_TagConversion.cpp \
    pkgsrc/graphics/freeimage/patches/patch-Source_Metadata_XTIFF.cpp \
    pkgsrc/graphics/freeimage/patches/patch-Source_Utilities.h \
    pkgsrc/graphics/freeimage/patches/patch-genfipsrclist.sh \
    pkgsrc/graphics/freeimage/patches/patch-gensrclist.sh
cvs rdiff -u -r1.2 -r0 \
    pkgsrc/graphics/freeimage/patches/patch-Source_LibOpenJPEG_opj__malloc.h
cvs rdiff -u -r1.1 -r0 \
    pkgsrc/graphics/freeimage/patches/patch-Source_LibRawLite_internal_dcraw__common.cpp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/graphics/freeimage/Makefile
diff -u pkgsrc/graphics/freeimage/Makefile:1.10 pkgsrc/graphics/freeimage/Makefile:1.11
--- pkgsrc/graphics/freeimage/Makefile:1.10     Sat Jan 18 23:32:11 2020
+++ pkgsrc/graphics/freeimage/Makefile  Thu May 14 16:42:13 2020
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.10 2020/01/18 23:32:11 rillig Exp $
+# $NetBSD: Makefile,v 1.11 2020/05/14 16:42:13 nia Exp $
 
 DISTNAME=      FreeImage3180
 PKGNAME=       freeimage-3.18.0
-CATEGORIES=    devel graphics
+PKGREVISION=   1
+CATEGORIES=    graphics
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=freeimage/}
 EXTRACT_SUFX=  .zip
 
@@ -11,33 +12,42 @@ HOMEPAGE=   https://freeimage.sf.net/
 COMMENT=       Library for supporting PNG, BMP, JPEG, and TIFF
 LICENSE=       gnu-gpl-v2 OR gnu-gpl-v3 OR mpl-1.0
 
-USE_LANGUAGES+=        c c++03
+USE_LANGUAGES+=        c c++11
 USE_TOOLS+=    gmake
 
 WRKSRC=                ${WRKDIR}/FreeImage
 
+MAKE_FILE=     Makefile.gnu
+
 INSTALLATION_DIRS+=    include lib share/doc/${PKGBASE}
 
-post-install:
-       ${INSTALL_DATA} ${WRKSRC}/Source/LibJXR/LICENCE \
-               ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}/LICENSE.LibJXR
-       ${INSTALL_DATA} ${WRKSRC}/Source/LibOpenJPEG/LICENSE \
-               ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}/LICENSE.OpenJPEG
-       ${HEAD} -n 31 ${WRKSRC}/Source/LibRawLite/internal/libraw_x3f.cpp \
-               > ${WRKDIR}/LICENSE.x3f
-       ${HEAD} -n 33 ${WRKSRC}/Source/LibRawLite/internal/dcb_demosaicing.c \
-               > ${WRKDIR}/LICENSE.dcb
-       ${HEAD} -n 25 ${WRKSRC}/Source/LibTIFF4/tif_open.c \
-               > ${WRKDIR}/LICENSE.LibTIFF4
-       ${INSTALL_DATA} ${WRKDIR}/LICENSE.* \
-               ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
-       ${INSTALL_DATA} ${WRKSRC}/Source/LibWebP/COPYING \
-               ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}/LICENSE.LibWebP
-       ${INSTALL_DATA} ${WRKSRC}/Source/OpenEXR/Copyrights/openexr/LICENSE \
-               ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}/LICENSE.OpenEXR
+pre-configure:
+       # G3 and JPEGTransform can't be built,
+       # due to using private headers in bundled libs
+       cd ${WRKSRC} && ${RM} -r Source/Lib* \
+           Source/ZLib \
+           Source/OpenEXR \
+           Source/FreeImage/PluginG3.cpp \
+           Source/FreeImage/PluginJXR.cpp \
+           Source/FreeImageToolkit/JPEGTransform.cpp
+       cd ${WRKSRC} && ${SH} gensrclist.sh
+       cd ${WRKSRC} && ${SH} genfipsrclist.sh
+       ${SED} \
+           -e 's| \./Source/FreeImage/PluginG3\.cpp||g' \
+           -e 's| \./Source/FreeImage/PluginJXR\.cpp||g' \
+           -e 's| \./Source/FreeImageToolkit/JPEGTransform\.cpp||g' \
+           ${WRKSRC}/Makefile.srcs > ${WRKSRC}/Makefile.srcs.new
+       ${MV} ${WRKSRC}/Makefile.srcs.new ${WRKSRC}/Makefile.srcs
 
 PLIST_SUBST+=  PKGVERSION_NOREV=${PKGVERSION_NOREV}
 
 NOT_FOR_PLATFORM=      Darwin-*-*
 
+.include "../../graphics/libraw/buildlink3.mk"
+.include "../../graphics/libwebp/buildlink3.mk"
+.include "../../graphics/openexr/buildlink3.mk"
+.include "../../graphics/openjpeg/buildlink3.mk"
+.include "../../graphics/png/buildlink3.mk"
+.include "../../graphics/tiff/buildlink3.mk"
+.include "../../mk/jpeg.buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"

Index: pkgsrc/graphics/freeimage/PLIST
diff -u pkgsrc/graphics/freeimage/PLIST:1.2 pkgsrc/graphics/freeimage/PLIST:1.3
--- pkgsrc/graphics/freeimage/PLIST:1.2 Fri Aug 11 15:26:20 2017
+++ pkgsrc/graphics/freeimage/PLIST     Thu May 14 16:42:13 2020
@@ -1,13 +1,6 @@
-@comment $NetBSD: PLIST,v 1.2 2017/08/11 15:26:20 nros Exp $
+@comment $NetBSD: PLIST,v 1.3 2020/05/14 16:42:13 nia Exp $
 include/FreeImage.h
 lib/libfreeimage-${PKGVERSION_NOREV}.so
 lib/libfreeimage.a
 lib/libfreeimage.so
 lib/libfreeimage.so.3
-share/doc/freeimage/LICENSE.LibJXR
-share/doc/freeimage/LICENSE.LibTIFF4
-share/doc/freeimage/LICENSE.LibWebP
-share/doc/freeimage/LICENSE.OpenEXR
-share/doc/freeimage/LICENSE.OpenJPEG
-share/doc/freeimage/LICENSE.dcb
-share/doc/freeimage/LICENSE.x3f

Index: pkgsrc/graphics/freeimage/distinfo
diff -u pkgsrc/graphics/freeimage/distinfo:1.8 pkgsrc/graphics/freeimage/distinfo:1.9
--- pkgsrc/graphics/freeimage/distinfo:1.8      Sat Mar 21 16:41:41 2020
+++ pkgsrc/graphics/freeimage/distinfo  Thu May 14 16:42:13 2020
@@ -1,10 +1,26 @@
-$NetBSD: distinfo,v 1.8 2020/03/21 16:41:41 rillig Exp $
+$NetBSD: distinfo,v 1.9 2020/05/14 16:42:13 nia Exp $
 
 SHA1 (FreeImage3180.zip) = 38daa9d8f1bca2330a2eaa42ec66fbe6ede7dce9
 RMD160 (FreeImage3180.zip) = b791715fccf49355a3cb27b6250d8ed809c2454e
 SHA512 (FreeImage3180.zip) = 9d9cc7e2d57552c3115e277aeb036e0455204d389026b17a3f513da5be1fd595421655488bb1ec2f76faebed66049119ca55e26e2a6d37024b3fb7ef36ad4818
 Size (FreeImage3180.zip) = 7415716 bytes
-SHA1 (patch-Makefile) = d453337cb2a34f4480d1bd3c2115cb93715170b8
-SHA1 (patch-Makefile.fip) = 466b82e70d06f9552a73d86a742aa1bd3450f881
-SHA1 (patch-Source_LibOpenJPEG_opj__malloc.h) = 7e8b65d17cf1f0ed295964d477b96acac56bd927
-SHA1 (patch-Source_LibRawLite_internal_dcraw__common.cpp) = 3f9a149c7294b3ed3f2c17f4c28fe5b7cc223838
+SHA1 (patch-Makefile.gnu) = 1aa31ec7566565e9e59d06bfa2cd729500a0d2cb
+SHA1 (patch-Source_FreeImage.h) = 9b648a8734a0c3391850e2dd7eaa501d29e99689
+SHA1 (patch-Source_FreeImageToolkit_JPEGTransform.cpp) = 4e7372c8947b4359de4d428bcfcfa2f55210f2e8
+SHA1 (patch-Source_FreeImage_J2KHelper.cpp) = a479a373f5a584978129c00d723251a784210603
+SHA1 (patch-Source_FreeImage_PSDParser.cpp) = ee4f3e1bb2b6644033a93ac58e12b9126d0dd060
+SHA1 (patch-Source_FreeImage_Plugin.cpp) = 58f5d7ca78a66ad7109b0e8dff219c26dfe50a86
+SHA1 (patch-Source_FreeImage_PluginEXR.cpp) = 6c4f6ea9a413d27dee940f24588bdf6f7ae38038
+SHA1 (patch-Source_FreeImage_PluginJ2K.cpp) = bbc44884aba8be3af2aa824da5cf788d91c27fb6
+SHA1 (patch-Source_FreeImage_PluginJP2.cpp) = 9a6d27e039b2050004a2d331389bdfa32dffe681
+SHA1 (patch-Source_FreeImage_PluginJPEG.cpp) = a3998454b11c2f73890828b24c0ea276bff7ee7f
+SHA1 (patch-Source_FreeImage_PluginPNG.cpp) = 0d9c71856a9355f56c3e9a571a414098d8af2e88
+SHA1 (patch-Source_FreeImage_PluginRAW.cpp) = 1d67ad2b634e2a5b1fa82be240a4d6edfad7c05d
+SHA1 (patch-Source_FreeImage_PluginTIFF.cpp) = 5fc6f4a9debf555ba41ff7bd4311ed76ec3f1b51
+SHA1 (patch-Source_FreeImage_PluginWebP.cpp) = d7b57cfcb1379c6a849edb219c8a59edae83ff5c
+SHA1 (patch-Source_FreeImage_ZLibInterface.cpp) = 73211e8ecefb7972f1fcb579dc4a17409c81c480
+SHA1 (patch-Source_Metadata_TagConversion.cpp) = 0785cc5dd395bca538e9a82cadbb7ef450eebe86
+SHA1 (patch-Source_Metadata_XTIFF.cpp) = bfcafc31b8407258c52f30fa0c62d062ce108c00
+SHA1 (patch-Source_Utilities.h) = bb9cdd7d72c46e72cd3a636beb27541783609191
+SHA1 (patch-genfipsrclist.sh) = 9b22593e0ca5ff869ea22ddb91f46785ae45d5cd
+SHA1 (patch-gensrclist.sh) = 2582848736654138b3ebdda9d8469046e992745b

Added files:

Index: pkgsrc/graphics/freeimage/patches/patch-Makefile.gnu
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-Makefile.gnu:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-Makefile.gnu        Thu May 14 16:42:14 2020
@@ -0,0 +1,68 @@
+$NetBSD: patch-Makefile.gnu,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+- Use pkgsrc directories.
+- Link with CXX for libstdc++.
+- Unbundle image libraries.
+
+--- Makefile.gnu.orig  2015-03-10 09:04:00.000000000 +0000
++++ Makefile.gnu
+@@ -5,14 +5,17 @@ include Makefile.srcs
+ 
+ # General configuration variables:
+ DESTDIR ?= /
+-INCDIR ?= $(DESTDIR)/usr/include
+-INSTALLDIR ?= $(DESTDIR)/usr/lib
++INCDIR ?= $(DESTDIR)/$(PREFIX)/include
++INSTALLDIR ?= $(DESTDIR)/$(PREFIX)/lib
+ 
+ # Converts cr/lf to just lf
+ DOS2UNIX = dos2unix
+ 
+ LIBRARIES = -lstdc++
+ 
++INCLUDE += $(shell pkg-config --cflags libjpeg OpenEXR libopenjp2 libraw libpng libtiff-4 libwebp libwebpmux zlib)
++LDFLAGS += $(shell pkg-config --libs libjpeg OpenEXR libopenjp2 libraw libpng libtiff-4 libwebp libwebpmux zlib)
++
+ MODULES = $(SRCS:.c=.o)
+ MODULES := $(MODULES:.cpp=.o)
+ CFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden
+@@ -28,10 +31,8 @@ CXXFLAGS ?= -O3 -fPIC -fexceptions -fvis
+ CXXFLAGS += -D__ANSI__
+ CXXFLAGS += $(INCLUDE)
+ 
+-ifeq ($(shell sh -c 'uname -m 2>/dev/null || echo not'),x86_64)
+-      CFLAGS += -fPIC
+-      CXXFLAGS += -fPIC
+-endif
++CFLAGS += -fPIC
++CXXFLAGS += -fPIC
+ 
+ TARGET  = freeimage
+ STATICLIB = lib$(TARGET).a
+@@ -40,8 +41,6 @@ LIBNAME      = lib$(TARGET).so
+ VERLIBNAME = $(LIBNAME).$(VER_MAJOR)
+ HEADER = Source/FreeImage.h
+ 
+-
+-
+ default: all
+ 
+ all: dist
+@@ -67,13 +66,12 @@ $(STATICLIB): $(MODULES)
+       $(AR) r $@ $(MODULES)
+ 
+ $(SHAREDLIB): $(MODULES)
+-      $(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
++      $(CXX) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES)
+ 
+ install:
+-      install -d $(INCDIR) $(INSTALLDIR)
+-      install -m 644 -o root -g root $(HEADER) $(INCDIR)
+-      install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
+-      install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
++      $(BSD_INSTALL_DATA) $(HEADER) $(INCDIR)
++      $(BSD_INSTALL_DATA) $(STATICLIB) $(INSTALLDIR)
++      $(BSD_INSTALL_LIB) $(SHAREDLIB) $(INSTALLDIR)
+       ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
+       ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)   
+ #     ldconfig
Index: pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage.h
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage.h:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage.h  Thu May 14 16:42:14 2020
@@ -0,0 +1,71 @@
+$NetBSD: patch-Source_FreeImage.h,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+Unbundle image libraries.
+
+--- Source/FreeImage.h.orig    2018-03-25 17:42:20.000000000 +0000
++++ Source/FreeImage.h
+@@ -155,8 +155,11 @@ typedef uint8_t BYTE;
+ typedef uint16_t WORD;
+ typedef uint32_t DWORD;
+ typedef int32_t LONG;
++// Disable these, they conflict with the (wrong) ones of libraw
++#if 0
+ typedef int64_t INT64;
+ typedef uint64_t UINT64;
++#endif
+ #else
+ // MS is not C99 ISO compliant
+ typedef long BOOL;
+@@ -410,7 +413,12 @@ FI_ENUM(FREE_IMAGE_FORMAT) {
+       FIF_DDS         = 24,
+       FIF_GIF     = 25,
+       FIF_HDR         = 26,
+-      FIF_FAXG3       = 27,
++/* The G3 fax format plugin is deliberately disabled in the Fedora build of
++   FreeImage as it requires that FreeImage uses a private copy of libtiff
++   which is a no no because of security reasons. */
++#if 0
++      FIF_FAXG3       = 27,
++#endif
+       FIF_SGI         = 28,
+       FIF_EXR         = 29,
+       FIF_J2K         = 30,
+@@ -473,6 +481,10 @@ FI_ENUM(FREE_IMAGE_DITHER) {
+       FID_BAYER16x16  = 6             //! Bayer ordered dispersed dot dithering (order 4 dithering matrix)
+ };
+ 
++/* The FreeImage_JPEGTransform functions are deliberately disabled in the
++   Fedora build of FreeImage as they require that FreeImage uses a private copy
++   of libjpeg which is a no no because of security reasons. */
++#if 0
+ /** Lossless JPEG transformations
+ Constants used in FreeImage_JPEGTransform
+ */
+@@ -486,6 +498,7 @@ FI_ENUM(FREE_IMAGE_JPEG_OPERATION) {
+       FIJPEG_OP_ROTATE_180    = 6,    //! 180-degree rotation
+       FIJPEG_OP_ROTATE_270    = 7             //! 270-degree clockwise (or 90 ccw)
+ };
++#endif
+ 
+ /** Tone mapping operators.
+ Constants used in FreeImage_ToneMapping.
+@@ -1088,7 +1101,10 @@ DLL_API const char* DLL_CALLCONV FreeIma
+ // --------------------------------------------------------------------------
+ // JPEG lossless transformation routines
+ // --------------------------------------------------------------------------
+-
++/* The FreeImage_JPEGTransform functions are deliberately disabled in the
+++   Fedora build of FreeImage as they require that FreeImage uses a private copy
+++   of libjpeg which is a no no because of security reasons. */
++#if 0
+ DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(TRUE));
+ DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(TRUE));
+ DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom);
+@@ -1097,6 +1113,7 @@ DLL_API BOOL DLL_CALLCONV FreeImage_JPEG
+ DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombined(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect 
FI_DEFAULT(TRUE));
+ DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL 
perfect FI_DEFAULT(TRUE));
+ DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedFromMemory(FIMEMORY* src_stream, FIMEMORY* dst_stream, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, 
BOOL perfect FI_DEFAULT(TRUE));
++#endif
+ 
+ 
+ // --------------------------------------------------------------------------
Index: pkgsrc/graphics/freeimage/patches/patch-Source_FreeImageToolkit_JPEGTransform.cpp
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-Source_FreeImageToolkit_JPEGTransform.cpp:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-Source_FreeImageToolkit_JPEGTransform.cpp   Thu May 14 16:42:14 2020
@@ -0,0 +1,21 @@
+$NetBSD: patch-Source_FreeImageToolkit_JPEGTransform.cpp,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+Unbundle image libraries.
+
+--- Source/FreeImageToolkit/JPEGTransform.cpp.orig     2015-03-04 00:07:10.000000000 +0000
++++ Source/FreeImageToolkit/JPEGTransform.cpp
+@@ -26,10 +26,10 @@ extern "C" {
+ #undef FAR
+ #include <setjmp.h>
+ 
+-#include "../LibJPEG/jinclude.h"
+-#include "../LibJPEG/jpeglib.h"
+-#include "../LibJPEG/jerror.h"
+-#include "../LibJPEG/transupp.h"
++#include <jinclude.h>
++#include <jpeglib.h>
++#include <jerror.h>
++#include <transupp.h>
+ }
+ 
+ #include "FreeImage.h"
Index: pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_J2KHelper.cpp
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_J2KHelper.cpp:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_J2KHelper.cpp      Thu May 14 16:42:14 2020
@@ -0,0 +1,15 @@
+$NetBSD: patch-Source_FreeImage_J2KHelper.cpp,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+Unbundle image libraries.
+
+--- Source/FreeImage/J2KHelper.cpp.orig        2015-03-04 00:07:08.000000000 +0000
++++ Source/FreeImage/J2KHelper.cpp
+@@ -21,7 +21,7 @@
+ 
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibOpenJPEG/openjpeg.h"
++#include <openjpeg.h>
+ #include "J2KHelper.h"
+ 
+ // --------------------------------------------------------------------------
Index: pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PSDParser.cpp
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PSDParser.cpp:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PSDParser.cpp      Thu May 14 16:42:14 2020
@@ -0,0 +1,71 @@
+$NetBSD: patch-Source_FreeImage_PSDParser.cpp,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+Unbundle image libraries.
+
+--- Source/FreeImage/PSDParser.cpp.orig        2016-02-11 04:18:02.000000000 +0000
++++ Source/FreeImage/PSDParser.cpp
+@@ -133,8 +133,8 @@ public:
+ template <>
+ class PSDGetValue<8> {
+ public:
+-      static inline UINT64 get(const BYTE * iprBuffer) {
+-              UINT64 v = ((const UINT64*)iprBuffer)[0];
++      static inline uint64_t get(const BYTE * iprBuffer) {
++              uint64_t v = ((const uint64_t*)iprBuffer)[0];
+ #ifndef FREEIMAGE_BIGENDIAN
+               SwapInt64(&v);
+ #endif
+@@ -147,7 +147,7 @@ public:
+ 
+ // --------------------------------------------------------------------------
+ 
+-static UINT64
++static uint64_t
+ psdReadSize(FreeImageIO *io, fi_handle handle, const psdHeaderInfo& header) {
+       if(header._Version == 1) {
+               BYTE Length[4];
+@@ -199,11 +199,11 @@ public:
+ template <>
+ class PSDSetValue<8> {
+ public:
+-      static inline void set(const BYTE * iprBuffer, UINT64 v) {
++      static inline void set(const BYTE * iprBuffer, uint64_t v) {
+ #ifndef FREEIMAGE_BIGENDIAN
+               SwapInt64(&v);
+ #endif
+-              ((UINT64*)iprBuffer)[0] = v;
++              ((uint64_t*)iprBuffer)[0] = v;
+       }
+ };
+ 
+@@ -213,7 +213,7 @@ public:
+ // --------------------------------------------------------------------------
+ 
+ static inline bool
+-psdWriteSize(FreeImageIO *io, fi_handle handle, const psdHeaderInfo& header, UINT64 v) {
++psdWriteSize(FreeImageIO *io, fi_handle handle, const psdHeaderInfo& header, uint64_t v) {
+       if(header._Version == 1) {
+               BYTE Length[4];
+               psdSetLongValue(Length, sizeof(Length), (DWORD)v);
+@@ -1063,10 +1063,10 @@ unsigned psdParser::GetChannelOffset(FIB
+ bool psdParser::ReadLayerAndMaskInfoSection(FreeImageIO *io, fi_handle handle)        {
+       bool bSuccess = true;
+ 
+-      UINT64 nTotalBytes = psdReadSize(io, handle, _headerInfo);
++      uint64_t nTotalBytes = psdReadSize(io, handle, _headerInfo);
+ 
+       // Hack to handle large PSB files without using fseeko().
+-      if (sizeof(long) < sizeof(UINT64)) {
++      if (sizeof(long) < sizeof(uint64_t)) {
+               const long offset = 0x10000000;
+               while (nTotalBytes > offset) {
+                       if (io->seek_proc(handle, offset, SEEK_CUR) != 0) {
+@@ -1672,7 +1672,7 @@ bool psdParser::WriteLayerAndMaskInfoSec
+       // Short section with no layers.
+       BYTE IntValue[4];
+ 
+-      UINT64 size;
++      uint64_t size;
+       if(_headerInfo._Version == 1) {
+               size = 8;
+       } else {
Index: pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_Plugin.cpp
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_Plugin.cpp:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_Plugin.cpp Thu May 14 16:42:14 2020
@@ -0,0 +1,29 @@
+$NetBSD: patch-Source_FreeImage_Plugin.cpp,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+Unbundle image libraries.
+
+--- Source/FreeImage/Plugin.cpp.orig   2017-02-18 15:09:28.000000000 +0000
++++ Source/FreeImage/Plugin.cpp
+@@ -263,7 +263,12 @@ FreeImage_Initialise(BOOL load_local_plu
+                       s_plugins->AddNode(InitDDS);
+               s_plugins->AddNode(InitGIF);
+               s_plugins->AddNode(InitHDR);
+-                      s_plugins->AddNode(InitG3);
++/* The G3 fax format plugin is deliberately disabled in the build of
++   FreeImage as it requires that FreeImage uses a private copy of libtiff
++   which is a no no because of security reasons. */
++#if 0
++                      s_plugins->AddNode(InitG3);
++#endif
+                       s_plugins->AddNode(InitSGI);
+                       s_plugins->AddNode(InitEXR);
+                       s_plugins->AddNode(InitJ2K);
+@@ -272,7 +277,7 @@ FreeImage_Initialise(BOOL load_local_plu
+                       s_plugins->AddNode(InitPICT);
+                       s_plugins->AddNode(InitRAW);
+                       s_plugins->AddNode(InitWEBP);
+-#if !(defined(_MSC_VER) && (_MSC_VER <= 1310))
++#if 0
+                       s_plugins->AddNode(InitJXR);
+ #endif // unsupported by MS Visual Studio 2003 !!!
+                       
Index: pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginEXR.cpp
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginEXR.cpp:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginEXR.cpp      Thu May 14 16:42:14 2020
@@ -0,0 +1,33 @@
+$NetBSD: patch-Source_FreeImage_PluginEXR.cpp,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+Unbundle image libraries.
+
+--- Source/FreeImage/PluginEXR.cpp.orig        2015-03-04 00:07:08.000000000 +0000
++++ Source/FreeImage/PluginEXR.cpp
+@@ -28,16 +28,16 @@
+ #pragma warning (disable : 4800) // ImfVersion.h - 'const int' : forcing value to bool 'true' or 'false' (performance warning)
+ #endif 
+ 
+-#include "../OpenEXR/IlmImf/ImfIO.h"
+-#include "../OpenEXR/Iex/Iex.h"
+-#include "../OpenEXR/IlmImf/ImfOutputFile.h"
+-#include "../OpenEXR/IlmImf/ImfInputFile.h"
+-#include "../OpenEXR/IlmImf/ImfRgbaFile.h"
+-#include "../OpenEXR/IlmImf/ImfChannelList.h"
+-#include "../OpenEXR/IlmImf/ImfRgba.h"
+-#include "../OpenEXR/IlmImf/ImfArray.h"
+-#include "../OpenEXR/IlmImf/ImfPreviewImage.h"
+-#include "../OpenEXR/Half/half.h"
++#include <OpenEXR/ImfIO.h>
++#include <OpenEXR/Iex.h>
++#include <OpenEXR/ImfOutputFile.h>
++#include <OpenEXR/ImfInputFile.h>
++#include <OpenEXR/ImfRgbaFile.h>
++#include <OpenEXR/ImfChannelList.h>
++#include <OpenEXR/ImfRgba.h>
++#include <OpenEXR/ImfArray.h>
++#include <OpenEXR/ImfPreviewImage.h>
++#include <OpenEXR/half.h>
+ 
+ 
+ // ==========================================================
Index: pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginJ2K.cpp
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginJ2K.cpp:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginJ2K.cpp      Thu May 14 16:42:14 2020
@@ -0,0 +1,15 @@
+$NetBSD: patch-Source_FreeImage_PluginJ2K.cpp,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+Unbundle image libraries.
+
+--- Source/FreeImage/PluginJ2K.cpp.orig        2015-03-04 00:07:08.000000000 +0000
++++ Source/FreeImage/PluginJ2K.cpp
+@@ -21,7 +21,7 @@
+ 
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibOpenJPEG/openjpeg.h"
++#include <openjpeg.h>
+ #include "J2KHelper.h"
+ 
+ // ==========================================================
Index: pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginJP2.cpp
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginJP2.cpp:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginJP2.cpp      Thu May 14 16:42:14 2020
@@ -0,0 +1,15 @@
+$NetBSD: patch-Source_FreeImage_PluginJP2.cpp,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+Unbundle image libraries.
+
+--- Source/FreeImage/PluginJP2.cpp.orig        2015-03-04 00:07:08.000000000 +0000
++++ Source/FreeImage/PluginJP2.cpp
+@@ -21,7 +21,7 @@
+ 
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibOpenJPEG/openjpeg.h"
++#include <openjpeg.h>
+ #include "J2KHelper.h"
+ 
+ // ==========================================================
Index: pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginJPEG.cpp
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginJPEG.cpp:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginJPEG.cpp     Thu May 14 16:42:14 2020
@@ -0,0 +1,19 @@
+$NetBSD: patch-Source_FreeImage_PluginJPEG.cpp,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+Unbundle image libraries.
+
+--- Source/FreeImage/PluginJPEG.cpp.orig       2018-07-28 18:22:24.000000000 +0000
++++ Source/FreeImage/PluginJPEG.cpp
+@@ -35,9 +35,9 @@ extern "C" {
+ #undef FAR
+ #include <setjmp.h>
+ 
+-#include "../LibJPEG/jinclude.h"
+-#include "../LibJPEG/jpeglib.h"
+-#include "../LibJPEG/jerror.h"
++#include <stdio.h>
++#include <jpeglib.h>
++#include <jerror.h>
+ }
+ 
+ #include "FreeImage.h"
Index: pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginPNG.cpp
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginPNG.cpp:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginPNG.cpp      Thu May 14 16:42:14 2020
@@ -0,0 +1,17 @@
+$NetBSD: patch-Source_FreeImage_PluginPNG.cpp,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+Unbundle image libraries.
+
+--- Source/FreeImage/PluginPNG.cpp.orig        2018-07-28 19:15:26.000000000 +0000
++++ Source/FreeImage/PluginPNG.cpp
+@@ -40,8 +40,8 @@
+ 
+ // ----------------------------------------------------------
+ 
+-#include "../ZLib/zlib.h"
+-#include "../LibPNG/png.h"
++#include <zlib.h>
++#include <png.h>
+ 
+ // ----------------------------------------------------------
+ 
Index: pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginRAW.cpp
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginRAW.cpp:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginRAW.cpp      Thu May 14 16:42:14 2020
@@ -0,0 +1,15 @@
+$NetBSD: patch-Source_FreeImage_PluginRAW.cpp,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+Unbundle image libraries.
+
+--- Source/FreeImage/PluginRAW.cpp.orig        2015-03-10 11:12:04.000000000 +0000
++++ Source/FreeImage/PluginRAW.cpp
+@@ -19,7 +19,7 @@
+ // Use at your own risk!
+ // ==========================================================
+ 
+-#include "../LibRawLite/libraw/libraw.h"
++#include <libraw/libraw.h>
+ 
+ #include "FreeImage.h"
+ #include "Utilities.h"
Index: pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginTIFF.cpp
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginTIFF.cpp:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginTIFF.cpp     Thu May 14 16:42:14 2020
@@ -0,0 +1,35 @@
+$NetBSD: patch-Source_FreeImage_PluginTIFF.cpp,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+Unbundle image libraries.
+
+--- Source/FreeImage/PluginTIFF.cpp.orig       2018-07-28 23:24:44.000000000 +0000
++++ Source/FreeImage/PluginTIFF.cpp
+@@ -37,9 +37,9 @@
+ 
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibTIFF4/tiffiop.h"
++#include <tiffio.h>
+ #include "../Metadata/FreeImageTag.h"
+-#include "../OpenEXR/Half/half.h"
++#include <OpenEXR/half.h>
+ 
+ #include "FreeImageIO.h"
+ #include "PSDParser.h"
+@@ -194,16 +194,6 @@ TIFFFdOpen(thandle_t handle, const char 
+       return tif;
+ }
+ 
+-/**
+-Open a TIFF file for reading or writing
+-@param name
+-@param mode
+-*/
+-TIFF*
+-TIFFOpen(const char* name, const char* mode) {
+-      return 0;
+-}
+-
+ // ----------------------------------------------------------
+ //   TIFF library FreeImage-specific routines.
+ // ----------------------------------------------------------
Index: pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginWebP.cpp
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginWebP.cpp:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_PluginWebP.cpp     Thu May 14 16:42:14 2020
@@ -0,0 +1,19 @@
+$NetBSD: patch-Source_FreeImage_PluginWebP.cpp,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+Unbundle image libraries.
+
+--- Source/FreeImage/PluginWebP.cpp.orig       2016-06-15 14:48:12.000000000 +0000
++++ Source/FreeImage/PluginWebP.cpp
+@@ -24,9 +24,9 @@
+ 
+ #include "../Metadata/FreeImageTag.h"
+ 
+-#include "../LibWebP/src/webp/decode.h"
+-#include "../LibWebP/src/webp/encode.h"
+-#include "../LibWebP/src/webp/mux.h"
++#include <webp/decode.h>
++#include <webp/encode.h>
++#include <webp/mux.h>
+ 
+ // ==========================================================
+ // Plugin Interface
Index: pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_ZLibInterface.cpp
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_ZLibInterface.cpp:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-Source_FreeImage_ZLibInterface.cpp  Thu May 14 16:42:14 2020
@@ -0,0 +1,27 @@
+$NetBSD: patch-Source_FreeImage_ZLibInterface.cpp,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+Unbundle image libraries.
+
+--- Source/FreeImage/ZLibInterface.cpp.orig    2015-03-04 00:07:10.000000000 +0000
++++ Source/FreeImage/ZLibInterface.cpp
+@@ -19,10 +19,9 @@
+ // Use at your own risk!
+ // ==========================================================
+ 
+-#include "../ZLib/zlib.h"
++#include <zlib.h>
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../ZLib/zutil.h"    /* must be the last header because of error C3163 in VS2008 (_vsnprintf defined in stdio.h) */
+ 
+ /**
+ Compresses a source buffer into a target buffer, using the ZLib library. 
+@@ -115,7 +114,7 @@ FreeImage_ZLibGZip(BYTE *target, DWORD t
+                       return 0;
+         case Z_OK: {
+             // patch header, setup crc and length (stolen from mod_trace_output)
+-            BYTE *p = target + 8; *p++ = 2; *p = OS_CODE; // xflags, os_code
++            BYTE *p = target + 8; *p++ = 2; *p = 0x03; // xflags, os_code (unix)
+               crc = crc32(crc, source, source_size);
+               memcpy(target + 4 + dest_len, &crc, 4);
+               memcpy(target + 8 + dest_len, &source_size, 4);
Index: pkgsrc/graphics/freeimage/patches/patch-Source_Metadata_TagConversion.cpp
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-Source_Metadata_TagConversion.cpp:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-Source_Metadata_TagConversion.cpp   Thu May 14 16:42:14 2020
@@ -0,0 +1,18 @@
+$NetBSD: patch-Source_Metadata_TagConversion.cpp,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+Unbundle image libraries.
+
+--- Source/Metadata/TagConversion.cpp.orig     2018-03-25 11:30:54.000000000 +0000
++++ Source/Metadata/TagConversion.cpp
+@@ -30,6 +30,11 @@
+ 
+ #define MAX_TEXT_EXTENT       512
+ 
++// These were in FreeImage.h, but are moved here to avoid conflicts (see note in FreeImage.h)
++typedef int64_t INT64;
++typedef uint64_t UINT64;
++
++
+ /**
+ Convert a tag to a C string
+ */
Index: pkgsrc/graphics/freeimage/patches/patch-Source_Metadata_XTIFF.cpp
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-Source_Metadata_XTIFF.cpp:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-Source_Metadata_XTIFF.cpp   Thu May 14 16:42:14 2020
@@ -0,0 +1,123 @@
+$NetBSD: patch-Source_Metadata_XTIFF.cpp,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+Unbundle image libraries.
+
+--- Source/Metadata/XTIFF.cpp.orig     2015-03-04 00:07:10.000000000 +0000
++++ Source/Metadata/XTIFF.cpp
+@@ -29,13 +29,18 @@
+ #pragma warning (disable : 4786) // identifier was truncated to 'number' characters
+ #endif
+ 
+-#include "../LibTIFF4/tiffiop.h"
++#include <tiffio.h>
+ 
+ #include "FreeImage.h"
+ #include "Utilities.h"
+ #include "FreeImageTag.h"
+ #include "FIRational.h"
+ 
++extern "C"
++{
++    int _TIFFDataSize(TIFFDataType type);
++}
++
+ // ----------------------------------------------------------
+ //   Extended TIFF Directory GEO Tag Support
+ // ----------------------------------------------------------
+@@ -224,6 +229,33 @@ tiff_write_geotiff_profile(TIFF *tif, FI
+ //   TIFF EXIF tag reading & writing
+ // ----------------------------------------------------------
+ 
++static uint32 exif_tag_ids[] = {
++  EXIFTAG_EXPOSURETIME, EXIFTAG_FNUMBER, EXIFTAG_EXPOSUREPROGRAM,
++  EXIFTAG_SPECTRALSENSITIVITY, EXIFTAG_ISOSPEEDRATINGS, EXIFTAG_OECF,
++  EXIFTAG_EXIFVERSION, EXIFTAG_DATETIMEORIGINAL, EXIFTAG_DATETIMEDIGITIZED,
++  EXIFTAG_COMPONENTSCONFIGURATION, EXIFTAG_COMPRESSEDBITSPERPIXEL,
++  EXIFTAG_SHUTTERSPEEDVALUE, EXIFTAG_APERTUREVALUE,
++  EXIFTAG_BRIGHTNESSVALUE, EXIFTAG_EXPOSUREBIASVALUE,
++  EXIFTAG_MAXAPERTUREVALUE, EXIFTAG_SUBJECTDISTANCE, EXIFTAG_METERINGMODE,
++  EXIFTAG_LIGHTSOURCE, EXIFTAG_FLASH, EXIFTAG_FOCALLENGTH,
++  EXIFTAG_SUBJECTAREA, EXIFTAG_MAKERNOTE, EXIFTAG_USERCOMMENT,
++  EXIFTAG_SUBSECTIME, EXIFTAG_SUBSECTIMEORIGINAL,
++  EXIFTAG_SUBSECTIMEDIGITIZED, EXIFTAG_FLASHPIXVERSION, EXIFTAG_COLORSPACE,
++  EXIFTAG_PIXELXDIMENSION, EXIFTAG_PIXELYDIMENSION,
++  EXIFTAG_RELATEDSOUNDFILE, EXIFTAG_FLASHENERGY,
++  EXIFTAG_SPATIALFREQUENCYRESPONSE, EXIFTAG_FOCALPLANEXRESOLUTION,
++  EXIFTAG_FOCALPLANEYRESOLUTION, EXIFTAG_FOCALPLANERESOLUTIONUNIT,
++  EXIFTAG_SUBJECTLOCATION, EXIFTAG_EXPOSUREINDEX, EXIFTAG_SENSINGMETHOD,
++  EXIFTAG_FILESOURCE, EXIFTAG_SCENETYPE, EXIFTAG_CFAPATTERN,
++  EXIFTAG_CUSTOMRENDERED, EXIFTAG_EXPOSUREMODE, EXIFTAG_WHITEBALANCE,
++  EXIFTAG_DIGITALZOOMRATIO, EXIFTAG_FOCALLENGTHIN35MMFILM,
++  EXIFTAG_SCENECAPTURETYPE, EXIFTAG_GAINCONTROL, EXIFTAG_CONTRAST,
++  EXIFTAG_SATURATION, EXIFTAG_SHARPNESS, EXIFTAG_DEVICESETTINGDESCRIPTION,
++  EXIFTAG_SUBJECTDISTANCERANGE, EXIFTAG_GAINCONTROL, EXIFTAG_GAINCONTROL,
++  EXIFTAG_IMAGEUNIQUEID
++};
++static int nExifTags = sizeof(exif_tag_ids) / sizeof(exif_tag_ids[0]);
++
+ /**
+ Read a single Exif tag
+ 
+@@ -575,45 +607,11 @@ tiff_read_exif_tags(TIFF *tif, TagLib::M
+ 
+       // loop over all Core Directory Tags
+       // ### uses private data, but there is no other way
++      // -> Fedora: Best we can do without private headers is to hard-code a list of known EXIF tags and read those
+       if(md_model == TagLib::EXIF_MAIN) {
+-              const TIFFDirectory *td = &tif->tif_dir;
+-
+-              uint32 lastTag = 0;     //<- used to prevent reading some tags twice (as stored in tif_fieldinfo)
+-
+-              for (int fi = 0, nfi = (int)tif->tif_nfields; nfi > 0; nfi--, fi++) {
+-                      const TIFFField *fld = tif->tif_fields[fi];
+-
+-                      const uint32 tag_id = TIFFFieldTag(fld);
+-
+-                      if(tag_id == lastTag) {
+-                              continue;
+-                      }
+-
+-                      // test if tag value is set
+-                      // (lifted directly from LibTiff _TIFFWriteDirectory)
+-
+-                      if( fld->field_bit == FIELD_CUSTOM ) {
+-                              int is_set = FALSE;
+-
+-                              for(int ci = 0; ci < td->td_customValueCount; ci++ ) {
+-                                      is_set |= (td->td_customValues[ci].info == fld);
+-                              }
+-
+-                              if( !is_set ) {
+-                                      continue;
+-                              }
+-
+-                      } else if(!TIFFFieldSet(tif, fld->field_bit)) {
+-                              continue;
+-                      }
+-
+-                      // process *all* other tags (some will be ignored)
+-
+-                      tiff_read_exif_tag(tif, tag_id, dib, md_model);
+-
+-                      lastTag = tag_id;
++              for (int i = 0; i < nExifTags; ++i) {
++                      tiff_read_exif_tag(tif, exif_tag_ids[i], dib, md_model);
+               }
+-
+       }
+ 
+       return TRUE;
+@@ -723,10 +721,9 @@ tiff_write_exif_tags(TIFF *tif, TagLib::
+       
+       TagLib& tag_lib = TagLib::instance();
+       
+-      for (int fi = 0, nfi = (int)tif->tif_nfields; nfi > 0; nfi--, fi++) {
+-              const TIFFField *fld = tif->tif_fields[fi];
+-              
+-              const uint32 tag_id = TIFFFieldTag(fld);
++      for (int fi = 0; fi < nExifTags; fi++) {
++              const uint32 tag_id = exif_tag_ids[fi];
++              const TIFFField *fld = TIFFFieldWithTag(tif, tag_id);
+ 
+               if(skip_write_field(tif, tag_id)) {
+                       // skip tags that are already handled by the LibTIFF writing process
Index: pkgsrc/graphics/freeimage/patches/patch-Source_Utilities.h
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-Source_Utilities.h:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-Source_Utilities.h  Thu May 14 16:42:14 2020
@@ -0,0 +1,21 @@
+$NetBSD: patch-Source_Utilities.h,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+Unbundle image libraries.
+
+--- Source/Utilities.h.orig    2016-04-11 14:15:32.000000000 +0000
++++ Source/Utilities.h
+@@ -446,12 +446,12 @@ SwapLong(DWORD *lp) {
+ }
+  
+ inline void
+-SwapInt64(UINT64 *arg) {
++SwapInt64(uint64_t *arg) {
+ #if defined(_MSC_VER) && _MSC_VER >= 1310
+       *arg = _byteswap_uint64(*arg);
+ #else
+       union Swap {
+-              UINT64 sv;
++              uint64_t sv;
+               DWORD ul[2];
+       } tmp, result;
+       tmp.sv = *arg;
Index: pkgsrc/graphics/freeimage/patches/patch-genfipsrclist.sh
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-genfipsrclist.sh:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-genfipsrclist.sh    Thu May 14 16:42:14 2020
@@ -0,0 +1,21 @@
+$NetBSD: patch-genfipsrclist.sh,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+Unbundle image libraries.
+
+--- genfipsrclist.sh.orig      2018-07-28 17:53:18.000000000 +0000
++++ genfipsrclist.sh
+@@ -1,6 +1,6 @@
+ #!/bin/sh
+ 
+-DIRLIST=". Source Source/Metadata Source/FreeImageToolkit Source/LibJPEG Source/LibPNG Source/LibTIFF4 Source/ZLib Source/LibOpenJPEG Source/OpenEXR Source/OpenEXR/Half Source/OpenEXR/Iex 
Source/OpenEXR/IlmImf Source/OpenEXR/IlmThread Source/OpenEXR/Imath Source/OpenEXR/IexMath Source/LibRawLite Source/LibRawLite/dcraw Source/LibRawLite/internal Source/LibRawLite/libraw 
Source/LibRawLite/src Source/LibWebP Source/LibJXR Source/LibJXR/common/include Source/LibJXR/image/sys Source/LibJXR/jxrgluelib Wrapper/FreeImagePlus"
++DIRLIST="Wrapper/FreeImagePlus"
+ 
+ 
+ echo "VER_MAJOR = 3" > fipMakefile.srcs
+@@ -19,5 +19,6 @@ echo -n "INCLUDE =" >> fipMakefile.srcs
+ for DIR in $DIRLIST; do
+       echo -n " -I$DIR" >> fipMakefile.srcs
+ done
++echo -n " -IDist" >> fipMakefile.srcs
+ echo >> fipMakefile.srcs
+ 
Index: pkgsrc/graphics/freeimage/patches/patch-gensrclist.sh
diff -u /dev/null pkgsrc/graphics/freeimage/patches/patch-gensrclist.sh:1.1
--- /dev/null   Thu May 14 16:42:14 2020
+++ pkgsrc/graphics/freeimage/patches/patch-gensrclist.sh       Thu May 14 16:42:14 2020
@@ -0,0 +1,14 @@
+$NetBSD: patch-gensrclist.sh,v 1.1 2020/05/14 16:42:14 nia Exp $
+
+Unbundle image libraries.
+
+--- gensrclist.sh.orig 2018-07-28 17:52:50.000000000 +0000
++++ gensrclist.sh
+@@ -1,6 +1,6 @@
+ #!/bin/sh
+ 
+-DIRLIST=". Source Source/Metadata Source/FreeImageToolkit Source/LibJPEG Source/LibPNG Source/LibTIFF4 Source/ZLib Source/LibOpenJPEG Source/OpenEXR Source/OpenEXR/Half Source/OpenEXR/Iex 
Source/OpenEXR/IlmImf Source/OpenEXR/IlmThread Source/OpenEXR/Imath Source/OpenEXR/IexMath Source/LibRawLite Source/LibRawLite/dcraw Source/LibRawLite/internal Source/LibRawLite/libraw 
Source/LibRawLite/src Source/LibWebP Source/LibJXR Source/LibJXR/common/include Source/LibJXR/image/sys Source/LibJXR/jxrgluelib"
++DIRLIST=". Source Source/Metadata Source/FreeImageToolkit"
+ 
+ echo "VER_MAJOR = 3" > Makefile.srcs
+ echo "VER_MINOR = 18.0" >> Makefile.srcs



Home | Main Index | Thread Index | Old Index