public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: media-libs/freeimage/files/, media-libs/freeimage/
@ 2019-04-14 16:25 James Le Cuirot
  0 siblings, 0 replies; 8+ messages in thread
From: James Le Cuirot @ 2019-04-14 16:25 UTC (permalink / raw
  To: gentoo-commits

commit:     106c26f9a93a0c86346a3ef378ee62ec15bc89d1
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 14 16:24:41 2019 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sun Apr 14 16:25:29 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=106c26f9

media-libs/freeimage: Fix building against libjpeg-9

Upstream only applied half of the earlier patch.

Closes: https://bugs.gentoo.org/683320
Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 .../files/freeimage-3.18.0-libjpeg9.patch          | 24 ++++++++++++++++++++++
 media-libs/freeimage/freeimage-3.18.0.ebuild       |  1 +
 2 files changed, 25 insertions(+)

diff --git a/media-libs/freeimage/files/freeimage-3.18.0-libjpeg9.patch b/media-libs/freeimage/files/freeimage-3.18.0-libjpeg9.patch
new file mode 100644
index 00000000000..fe344229520
--- /dev/null
+++ b/media-libs/freeimage/files/freeimage-3.18.0-libjpeg9.patch
@@ -0,0 +1,24 @@
+Bug: https://bugs.gentoo.org/647422
+Upstream Patch: https://sourceforge.net/p/freeimage/patches/130/
+
+diff -Naur a/Source/FreeImage.h b/Source/FreeImage.h
+--- a/Source/FreeImage.h	2018-03-24 23:24:11.066695395 -0400
++++ b/Source/FreeImage.h	2018-03-24 23:26:35.945391182 -0400
+@@ -117,12 +117,17 @@
+ #ifndef _WINDOWS_
+ #define _WINDOWS_
+ 
++#if JPEG_LIB_VERSION < 90
++
+ #ifndef FALSE
+ #define FALSE 0
+ #endif
+ #ifndef TRUE
+ #define TRUE 1
+ #endif
++
++#endif
++
+ #ifndef NULL
+ #define NULL 0
+ #endif

diff --git a/media-libs/freeimage/freeimage-3.18.0.ebuild b/media-libs/freeimage/freeimage-3.18.0.ebuild
index 35dd66ffd42..fa58c6fc2f7 100644
--- a/media-libs/freeimage/freeimage-3.18.0.ebuild
+++ b/media-libs/freeimage/freeimage-3.18.0.ebuild
@@ -48,6 +48,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-3.18.0-rename-jpeg_read_icc_profile.patch
 	"${FILESDIR}"/${PN}-3.18.0-disable-plugin-G3.patch
 	"${FILESDIR}"/${PN}-3.18.0-raw.patch
+	"${FILESDIR}"/${PN}-3.18.0-libjpeg9.patch
 )
 
 src_prepare() {


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/freeimage/files/, media-libs/freeimage/
@ 2019-11-26 20:26 James Le Cuirot
  0 siblings, 0 replies; 8+ messages in thread
From: James Le Cuirot @ 2019-11-26 20:26 UTC (permalink / raw
  To: gentoo-commits

commit:     bd034ff8887960d9351529ab7fbae2b4754e4eea
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 26 20:26:23 2019 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Tue Nov 26 20:26:23 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bd034ff8

media-libs/freeimage: Drop old 3.15.4-r1

Closes: https://bugs.gentoo.org/663614
Package-Manager: Portage-2.3.79, Repoman-2.3.17
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 media-libs/freeimage/Manifest                      |   2 -
 .../files/freeimage-3.15.4-CVE-2015-0852.patch     | 214 -------
 .../files/freeimage-3.15.4-CVE-2016-5684-1.patch   |  23 -
 .../files/freeimage-3.15.4-CVE-2016-5684-2.patch   |  11 -
 .../files/freeimage-3.15.4-libjpeg-turbo.patch     | 531 -----------------
 .../files/freeimage-3.15.4-libjpeg9.patch          |  45 --
 .../freeimage/files/freeimage-3.15.4-raw.patch     |  16 -
 .../files/freeimage-3.15.4-unbundling.patch        | 639 ---------------------
 media-libs/freeimage/freeimage-3.15.4-r1.ebuild    | 116 ----
 9 files changed, 1597 deletions(-)

diff --git a/media-libs/freeimage/Manifest b/media-libs/freeimage/Manifest
index d7eb8ba5764..292f9ee3c9d 100644
--- a/media-libs/freeimage/Manifest
+++ b/media-libs/freeimage/Manifest
@@ -1,4 +1,2 @@
-DIST FreeImage3154.pdf 1007480 BLAKE2B 801d39c4b7eeab833c7225c2d53a3a0e8e9d2a91ea3f7173047705c8b750706f3a4a9ac60f7ba9d5e8150b548bd5add242e9e40f498c57ad9e5a623972bbb239 SHA512 cebde5e2609c9a0c06b4e07e1c595d7d6714895095cd9935f59c8b2ff9b34116248f5453b41f469f6242d87cae79be82d59f6a9ec0f75b1ea3df61ac1f651b28
-DIST FreeImage3154.zip 5513923 BLAKE2B 376b00faaae2c10c9eb36f89726a022734e109ca7ca11951c9e6525f21d2a7ee305ec195be29a272ecb7935ba5d0b61f3d84f26a6aec5f7a9229d5e47cd665bb SHA512 0db9eb7d0ed8e08e10ff4fa274c4484541ca119c3d437a85fdc3b2d9232bf14a7877c79b1e62c8c99278d7020a9f623c161f2342475f3ee526233404138112cc
 DIST FreeImage3180.pdf 1665541 BLAKE2B 5d40ee6fa0a1e73df0cc961edbd70a2835ef88fb540f123fd81f2bb826d4c949d2a60dfe3fc02406ce632a389935abac0d471c963c9803b8c2aece2b48afb003 SHA512 632f68b14f7a5916a1b95bbf86c268d0afe786a2537472301bb002254aa3195f046efb41f073133633211e985e90edbb99285ab6f42bc55501c756292a3c4c03
 DIST FreeImage3180.zip 7415716 BLAKE2B b695271f4e80eb304eccde66e38b5095eceae51fbe0dd97df69c55f364f8440d8c97139b8edc2f01c400f5c53a7336fdfab1e28aa3ea04f485901d5def443d25 SHA512 9d9cc7e2d57552c3115e277aeb036e0455204d389026b17a3f513da5be1fd595421655488bb1ec2f76faebed66049119ca55e26e2a6d37024b3fb7ef36ad4818

diff --git a/media-libs/freeimage/files/freeimage-3.15.4-CVE-2015-0852.patch b/media-libs/freeimage/files/freeimage-3.15.4-CVE-2015-0852.patch
deleted file mode 100644
index e0c4b0cf19c..00000000000
--- a/media-libs/freeimage/files/freeimage-3.15.4-CVE-2015-0852.patch
+++ /dev/null
@@ -1,214 +0,0 @@
---- a/Source/FreeImage/PluginPCX.cpp
-+++ b/Source/FreeImage/PluginPCX.cpp
-@@ -30,7 +30,7 @@
- //   Constants + headers
- // ----------------------------------------------------------
- 
--#define IO_BUF_SIZE	2048
-+#define PCX_IO_BUF_SIZE	2048
- 
- // ----------------------------------------------------------
- 
-@@ -120,17 +120,17 @@
- 
- 		while (length--) {
- 			if (count == 0) {
--				if (*ReadPos >= IO_BUF_SIZE - 1 ) {
--					if (*ReadPos == IO_BUF_SIZE - 1) {
-+				if (*ReadPos >= PCX_IO_BUF_SIZE - 1 ) {
-+					if (*ReadPos == PCX_IO_BUF_SIZE - 1) {
- 						// we still have one BYTE, copy it to the start pos
- 
--						*ReadBuf = ReadBuf[IO_BUF_SIZE - 1];
-+						*ReadBuf = ReadBuf[PCX_IO_BUF_SIZE - 1];
- 
--						io.read_proc(ReadBuf + 1, 1, IO_BUF_SIZE - 1, handle);
-+						io.read_proc(ReadBuf + 1, 1, PCX_IO_BUF_SIZE - 1, handle);
- 					} else {
- 						// read the complete buffer
- 
--						io.read_proc(ReadBuf, 1, IO_BUF_SIZE, handle);
-+						io.read_proc(ReadBuf, 1, PCX_IO_BUF_SIZE, handle);
- 					}
- 
- 					*ReadPos = 0;
-@@ -346,19 +346,9 @@
- 	BOOL header_only = (flags & FIF_LOAD_NOPIXELS) == FIF_LOAD_NOPIXELS;
- 
- 	try {
--		// check PCX identifier
--
--		long start_pos = io->tell_proc(handle);
--		BOOL validated = pcx_validate(io, handle);		
--		io->seek_proc(handle, start_pos, SEEK_SET);
--		if(!validated) {
--			throw FI_MSG_ERROR_MAGIC_NUMBER;
--		}
--
--		// process the header
--
- 		PCXHEADER header;
- 
-+		// process the header
- 		if(io->read_proc(&header, sizeof(PCXHEADER), 1, handle) != 1) {
- 			throw FI_MSG_ERROR_PARSING;
- 		}
-@@ -366,20 +356,38 @@
- 		SwapHeader(&header);
- #endif
- 
--		// allocate a new DIB
-+		// process the window
-+		const WORD *window = header.window;	// left, upper, right,lower pixel coord.
-+		const int left		= window[0];
-+		const int top		= window[1];
-+		const int right		= window[2];
-+		const int bottom	= window[3];
- 
--		unsigned width = header.window[2] - header.window[0] + 1;
--		unsigned height = header.window[3] - header.window[1] + 1;
--		unsigned bitcount = header.bpp * header.planes;
-+		// check image size
-+		if((left >= right) || (top >= bottom)) {
-+			throw FI_MSG_ERROR_PARSING;
-+		}
- 
--		if (bitcount == 24) {
--			dib = FreeImage_AllocateHeader(header_only, width, height, bitcount, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
--		} else {
--			dib = FreeImage_AllocateHeader(header_only, width, height, bitcount);			
-+		const unsigned width = right - left + 1;
-+		const unsigned height = bottom - top + 1;
-+		const unsigned bitcount = header.bpp * header.planes;
-+
-+		// allocate a new dib
-+		switch(bitcount) {
-+			case 1:
-+			case 4:
-+			case 8:
-+				dib = FreeImage_AllocateHeader(header_only, width, height, bitcount);
-+				break;
-+			case 24:
-+				dib = FreeImage_AllocateHeader(header_only, width, height, bitcount, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
-+				break;
-+			default:
-+				throw FI_MSG_ERROR_DIB_MEMORY;
-+				break;
- 		}
- 
- 		// if the dib couldn't be allocated, throw an error
--
- 		if (!dib) {
- 			throw FI_MSG_ERROR_DIB_MEMORY;
- 		}
-@@ -426,19 +434,23 @@
- 
- 				if (palette_id == 0x0C) {
- 					BYTE *cmap = (BYTE*)malloc(768 * sizeof(BYTE));
--					io->read_proc(cmap, 768, 1, handle);
- 
--					pal = FreeImage_GetPalette(dib);
--					BYTE *pColormap = &cmap[0];
-+					if(cmap) {
-+						io->read_proc(cmap, 768, 1, handle);
- 
--					for(int i = 0; i < 256; i++) {
--						pal[i].rgbRed   = pColormap[0];
--						pal[i].rgbGreen = pColormap[1];
--						pal[i].rgbBlue  = pColormap[2];
--						pColormap += 3;
-+						pal = FreeImage_GetPalette(dib);
-+						BYTE *pColormap = &cmap[0];
-+
-+						for(int i = 0; i < 256; i++) {
-+							pal[i].rgbRed   = pColormap[0];
-+							pal[i].rgbGreen = pColormap[1];
-+							pal[i].rgbBlue  = pColormap[2];
-+							pColormap += 3;
-+						}
-+
-+						free(cmap);
- 					}
- 
--					free(cmap);
- 				}
- 
- 				// wrong palette ID, perhaps a gray scale is needed ?
-@@ -463,12 +475,12 @@
- 			return dib;
- 		}
- 
--		// calculate the line length for the PCX and the DIB
-+		// calculate the line length for the PCX and the dib
- 
- 		// length of raster line in bytes
--		unsigned linelength = header.bytes_per_line * header.planes;
--		// length of DIB line (rounded to DWORD) in bytes
--		unsigned pitch = FreeImage_GetPitch(dib);
-+		const unsigned linelength = header.bytes_per_line * header.planes;
-+		// length of dib line (rounded to DWORD) in bytes
-+		const unsigned pitch = FreeImage_GetPitch(dib);
- 
- 		// run-length encoding ?
- 
-@@ -478,14 +490,18 @@
- 		// ---------------
- 
- 		line = (BYTE*)malloc(linelength * sizeof(BYTE));
--		if(!line) throw FI_MSG_ERROR_MEMORY;
-+		if(!line) {
-+			throw FI_MSG_ERROR_MEMORY;
-+		}
- 		
--		ReadBuf = (BYTE*)malloc(IO_BUF_SIZE * sizeof(BYTE));
--		if(!ReadBuf) throw FI_MSG_ERROR_MEMORY;
-+		ReadBuf = (BYTE*)malloc(PCX_IO_BUF_SIZE * sizeof(BYTE));
-+		if(!ReadBuf) {
-+			throw FI_MSG_ERROR_MEMORY;
-+		}
- 		
- 		bits = FreeImage_GetScanLine(dib, height - 1);
- 
--		int ReadPos = IO_BUF_SIZE;
-+		int ReadPos = PCX_IO_BUF_SIZE;
- 
- 		if ((header.planes == 1) && ((header.bpp == 1) || (header.bpp == 8))) {
- 			BYTE skip;
-@@ -497,7 +513,7 @@
- 				// skip trailing garbage at the end of the scanline
- 
- 				for (unsigned count = written; count < linelength; count++) {
--					if (ReadPos < IO_BUF_SIZE) {
-+					if (ReadPos < PCX_IO_BUF_SIZE) {
- 						ReadPos++;
- 					} else {
- 						io->read_proc(&skip, sizeof(BYTE), 1, handle);
-@@ -513,7 +529,9 @@
- 			unsigned x, y, written;
- 
- 			buffer = (BYTE*)malloc(width * sizeof(BYTE));
--			if(!buffer) throw FI_MSG_ERROR_MEMORY;
-+			if(!buffer) {
-+				throw FI_MSG_ERROR_MEMORY;
-+			}
- 
- 			for (y = 0; y < height; y++) {
- 				written = readline(*io, handle, line, linelength, bIsRLE, ReadBuf, &ReadPos);
-@@ -532,7 +550,7 @@
- 					}
- 				}
- 
--				// then write the DIB row
-+				// then write the dib row
- 
- 				for (x = 0; x < width / 2; x++) {
- 					bits[x] = (buffer[2*x] << 4) | buffer[2*x+1];
-@@ -541,7 +559,7 @@
- 				// skip trailing garbage at the end of the scanline
- 
- 				for (unsigned count = written; count < linelength; count++) {
--					if (ReadPos < IO_BUF_SIZE) {
-+					if (ReadPos < PCX_IO_BUF_SIZE) {
- 						ReadPos++;
- 					} else {
- 						io->read_proc(&skip, sizeof(BYTE), 1, handle);

diff --git a/media-libs/freeimage/files/freeimage-3.15.4-CVE-2016-5684-1.patch b/media-libs/freeimage/files/freeimage-3.15.4-CVE-2016-5684-1.patch
deleted file mode 100644
index 1e94602e0e5..00000000000
--- a/media-libs/freeimage/files/freeimage-3.15.4-CVE-2016-5684-1.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- a/Source/FreeImage/PluginXPM.cpp
-+++ b/Source/FreeImage/PluginXPM.cpp
-@@ -181,6 +181,11 @@
- 		}
- 		free(str);
- 
-+		// check info string
-+		if((width <= 0) || (height <= 0) || (colors <= 0) || (cpp <= 0)) {
-+			throw "Improperly formed info string";
-+		}
-+
-         if (colors > 256) {
- 			dib = FreeImage_AllocateHeader(header_only, width, height, 24, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
- 		} else {
-@@ -193,7 +198,7 @@
- 			FILE_RGBA rgba;
- 
- 			str = ReadString(io, handle);
--			if(!str)
-+			if(!str || (strlen(str) < cpp))
- 				throw "Error reading color strings";
- 
- 			std::string chrs(str,cpp); //create a string for the color chars using the first cpp chars

diff --git a/media-libs/freeimage/files/freeimage-3.15.4-CVE-2016-5684-2.patch b/media-libs/freeimage/files/freeimage-3.15.4-CVE-2016-5684-2.patch
deleted file mode 100644
index 542a9aeab09..00000000000
--- a/media-libs/freeimage/files/freeimage-3.15.4-CVE-2016-5684-2.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/Source/FreeImage/PluginXPM.cpp
-+++ b/Source/FreeImage/PluginXPM.cpp
-@@ -198,7 +198,7 @@
- 			FILE_RGBA rgba;
- 
- 			str = ReadString(io, handle);
--			if(!str || (strlen(str) < cpp))
-+			if(!str || (strlen(str) < (size_t)cpp))
- 				throw "Error reading color strings";
- 
- 			std::string chrs(str,cpp); //create a string for the color chars using the first cpp chars

diff --git a/media-libs/freeimage/files/freeimage-3.15.4-libjpeg-turbo.patch b/media-libs/freeimage/files/freeimage-3.15.4-libjpeg-turbo.patch
deleted file mode 100644
index 62037c59deb..00000000000
--- a/media-libs/freeimage/files/freeimage-3.15.4-libjpeg-turbo.patch
+++ /dev/null
@@ -1,531 +0,0 @@
---- /dev/null
-+++ b/LibJPEG/jpegcomp.h
-@@ -0,0 +1,26 @@
-+/*
-+ * jpegcomp.h
-+ *
-+ * Copyright (C) 2010, D. R. Commander
-+ * For conditions of distribution and use, see the accompanying README file.
-+ *
-+ * JPEG compatibility macros
-+ * These declarations are considered internal to the JPEG library; most
-+ * applications using the library shouldn't need to include this file.
-+ */
-+
-+#if JPEG_LIB_VERSION >= 70
-+#define _DCT_scaled_size DCT_h_scaled_size
-+#define _min_DCT_scaled_size min_DCT_h_scaled_size
-+#define _min_DCT_h_scaled_size min_DCT_h_scaled_size
-+#define _min_DCT_v_scaled_size min_DCT_v_scaled_size
-+#define _jpeg_width jpeg_width
-+#define _jpeg_height jpeg_height
-+#else
-+#define _DCT_scaled_size DCT_scaled_size
-+#define _min_DCT_scaled_size min_DCT_scaled_size
-+#define _min_DCT_h_scaled_size min_DCT_scaled_size
-+#define _min_DCT_v_scaled_size min_DCT_scaled_size
-+#define _jpeg_width image_width
-+#define _jpeg_height image_height
-+#endif
---- a/LibJPEG/jpegint.h
-+++ b/LibJPEG/jpegint.h
-@@ -2,7 +2,7 @@
-  * jpegint.h
-  *
-  * Copyright (C) 1991-1997, Thomas G. Lane.
-- * Modified 1997-2011 by Guido Vollbeding.
-+ * Modified 1997-2009 by Guido Vollbeding.
-  * This file is part of the Independent JPEG Group's software.
-  * For conditions of distribution and use, see the accompanying README file.
-  *
-@@ -100,16 +100,14 @@
- };
- 
- /* Forward DCT (also controls coefficient quantization) */
--typedef JMETHOD(void, forward_DCT_ptr,
--		(j_compress_ptr cinfo, jpeg_component_info * compptr,
--		 JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
--		 JDIMENSION start_row, JDIMENSION start_col,
--		 JDIMENSION num_blocks));
--
- struct jpeg_forward_dct {
-   JMETHOD(void, start_pass, (j_compress_ptr cinfo));
--  /* It is useful to allow each component to have a separate FDCT method. */
--  forward_DCT_ptr forward_DCT[MAX_COMPONENTS];
-+  /* perhaps this should be an array??? */
-+  JMETHOD(void, forward_DCT, (j_compress_ptr cinfo,
-+			      jpeg_component_info * compptr,
-+			      JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
-+			      JDIMENSION start_row, JDIMENSION start_col,
-+			      JDIMENSION num_blocks));
- };
- 
- /* Entropy encoding */
-@@ -213,6 +211,10 @@
-   JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
-   JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo,
- 				JBLOCKROW *MCU_data));
-+
-+  /* This is here to share code between baseline and progressive decoders; */
-+  /* other modules probably should not use it */
-+  boolean insufficient_data;	/* set TRUE after emitting warning */
- };
- 
- /* Inverse DCT (also performs dequantization) */
-@@ -302,6 +304,7 @@
- #define jinit_downsampler	jIDownsampler
- #define jinit_forward_dct	jIFDCT
- #define jinit_huff_encoder	jIHEncoder
-+#define jinit_phuff_encoder	jIPHEncoder
- #define jinit_arith_encoder	jIAEncoder
- #define jinit_marker_writer	jIMWriter
- #define jinit_master_decompress	jIDMaster
-@@ -311,6 +314,7 @@
- #define jinit_input_controller	jIInCtlr
- #define jinit_marker_reader	jIMReader
- #define jinit_huff_decoder	jIHDecoder
-+#define jinit_phuff_decoder	jIPHDecoder
- #define jinit_arith_decoder	jIADecoder
- #define jinit_inverse_dct	jIIDCT
- #define jinit_upsampler		jIUpsampler
-@@ -321,41 +325,15 @@
- #define jinit_memory_mgr	jIMemMgr
- #define jdiv_round_up		jDivRound
- #define jround_up		jRound
--#define jzero_far		jZeroFar
- #define jcopy_sample_rows	jCopySamples
- #define jcopy_block_row		jCopyBlocks
-+#define jzero_far		jZeroFar
- #define jpeg_zigzag_order	jZIGTable
- #define jpeg_natural_order	jZAGTable
--#define jpeg_natural_order7	jZAG7Table
--#define jpeg_natural_order6	jZAG6Table
--#define jpeg_natural_order5	jZAG5Table
--#define jpeg_natural_order4	jZAG4Table
--#define jpeg_natural_order3	jZAG3Table
--#define jpeg_natural_order2	jZAG2Table
- #define jpeg_aritab		jAriTab
- #endif /* NEED_SHORT_EXTERNAL_NAMES */
- 
- 
--/* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays
-- * and coefficient-block arrays.  This won't work on 80x86 because the arrays
-- * are FAR and we're assuming a small-pointer memory model.  However, some
-- * DOS compilers provide far-pointer versions of memcpy() and memset() even
-- * in the small-model libraries.  These will be used if USE_FMEM is defined.
-- * Otherwise, the routines in jutils.c do it the hard way.
-- */
--
--#ifndef NEED_FAR_POINTERS	/* normal case, same as regular macro */
--#define FMEMZERO(target,size)	MEMZERO(target,size)
--#else				/* 80x86 case */
--#ifdef USE_FMEM
--#define FMEMZERO(target,size)	_fmemset((void FAR *)(target), 0, (size_t)(size))
--#else
--EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero));
--#define FMEMZERO(target,size)	jzero_far(target, size)
--#endif
--#endif
--
--
- /* Compression module initialization routines */
- EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo));
- EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo,
-@@ -370,6 +348,7 @@
- EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo));
- EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo));
- EXTERN(void) jinit_huff_encoder JPP((j_compress_ptr cinfo));
-+EXTERN(void) jinit_phuff_encoder JPP((j_compress_ptr cinfo));
- EXTERN(void) jinit_arith_encoder JPP((j_compress_ptr cinfo));
- EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo));
- /* Decompression module initialization routines */
-@@ -383,6 +362,7 @@
- EXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo));
- EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo));
- EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo));
-+EXTERN(void) jinit_phuff_decoder JPP((j_decompress_ptr cinfo));
- EXTERN(void) jinit_arith_decoder JPP((j_decompress_ptr cinfo));
- EXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo));
- EXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo));
-@@ -401,17 +381,12 @@
- 				    int num_rows, JDIMENSION num_cols));
- EXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row,
- 				  JDIMENSION num_blocks));
-+EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero));
- /* Constant tables in jutils.c */
- #if 0				/* This table is not actually needed in v6a */
- extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */
- #endif
- extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */
--extern const int jpeg_natural_order7[]; /* zz to natural order for 7x7 block */
--extern const int jpeg_natural_order6[]; /* zz to natural order for 6x6 block */
--extern const int jpeg_natural_order5[]; /* zz to natural order for 5x5 block */
--extern const int jpeg_natural_order4[]; /* zz to natural order for 4x4 block */
--extern const int jpeg_natural_order3[]; /* zz to natural order for 3x3 block */
--extern const int jpeg_natural_order2[]; /* zz to natural order for 2x2 block */
- 
- /* Arithmetic coding probability estimation tables in jaricom.c */
- extern const INT32 jpeg_aritab[];
---- a/LibJPEG/transupp.h
-+++ b/LibJPEG/transupp.h
-@@ -1,7 +1,7 @@
- /*
-  * transupp.h
-  *
-- * Copyright (C) 1997-2011, Thomas G. Lane, Guido Vollbeding.
-+ * Copyright (C) 1997-2009, Thomas G. Lane, Guido Vollbeding.
-  * This file is part of the Independent JPEG Group's software.
-  * For conditions of distribution and use, see the accompanying README file.
-  *
-@@ -57,7 +57,6 @@
-  * corner up and/or left to make it so, simultaneously increasing the region
-  * dimensions to keep the lower right crop corner unchanged.  (Thus, the
-  * output image covers at least the requested region, but may cover more.)
-- * The adjustment of the region dimensions may be optionally disabled.
-  *
-  * We also provide a lossless-resize option, which is kind of a lossless-crop
-  * operation in the DCT coefficient block domain - it discards higher-order
-@@ -107,15 +106,13 @@
- 
- /*
-  * Codes for crop parameters, which can individually be unspecified,
-- * positive or negative for xoffset or yoffset,
-- * positive or forced for width or height.
-+ * positive, or negative.  (Negative width or height makes no sense, though.)
-  */
- 
- typedef enum {
--        JCROP_UNSET,
--        JCROP_POS,
--        JCROP_NEG,
--        JCROP_FORCE
-+	JCROP_UNSET,
-+	JCROP_POS,
-+	JCROP_NEG
- } JCROP_CODE;
- 
- /*
-@@ -131,14 +128,21 @@
-   boolean trim;			/* if TRUE, trim partial MCUs as needed */
-   boolean force_grayscale;	/* if TRUE, convert color image to grayscale */
-   boolean crop;			/* if TRUE, crop source image */
-+  boolean slow_hflip;  /* For best performance, the JXFORM_FLIP_H transform
-+                          normally modifies the source coefficients in place.
-+                          Setting this to TRUE will instead use a slower,
-+                          double-buffered algorithm, which leaves the source
-+                          coefficients in tact (necessary if other transformed
-+                          images must be generated from the same set of
-+                          coefficients. */
- 
-   /* Crop parameters: application need not set these unless crop is TRUE.
-    * These can be filled in by jtransform_parse_crop_spec().
-    */
-   JDIMENSION crop_width;	/* Width of selected region */
--  JCROP_CODE crop_width_set;	/* (forced disables adjustment) */
-+  JCROP_CODE crop_width_set;
-   JDIMENSION crop_height;	/* Height of selected region */
--  JCROP_CODE crop_height_set;	/* (forced disables adjustment) */
-+  JCROP_CODE crop_height_set;
-   JDIMENSION crop_xoffset;	/* X offset of selected region */
-   JCROP_CODE crop_xoffset_set;	/* (negative measures from right edge) */
-   JDIMENSION crop_yoffset;	/* Y offset of selected region */
---- a/LibJPEG/transupp.c
-+++ b/LibJPEG/transupp.c
-@@ -1,7 +1,8 @@
- /*
-  * transupp.c
-  *
-- * Copyright (C) 1997-2011, Thomas G. Lane, Guido Vollbeding.
-+ * Copyright (C) 1997-2009, Thomas G. Lane, Guido Vollbeding.
-+ * Copyright (C) 2010, D. R. Commander.
-  * This file is part of the Independent JPEG Group's software.
-  * For conditions of distribution and use, see the accompanying README file.
-  *
-@@ -20,9 +21,19 @@
- #include "jinclude.h"
- #include "jpeglib.h"
- #include "transupp.h"		/* My own external interface */
-+#include "jpegcomp.h"
- #include <ctype.h>		/* to declare isdigit() */
- 
- 
-+#if JPEG_LIB_VERSION >= 70
-+#define dstinfo_min_DCT_h_scaled_size dstinfo->min_DCT_h_scaled_size
-+#define dstinfo_min_DCT_v_scaled_size dstinfo->min_DCT_v_scaled_size
-+#else
-+#define dstinfo_min_DCT_h_scaled_size DCTSIZE
-+#define dstinfo_min_DCT_v_scaled_size DCTSIZE
-+#endif
-+
-+
- #if TRANSFORMS_SUPPORTED
- 
- /*
-@@ -134,7 +145,7 @@
-    * Partial iMCUs at the right edge are left untouched.
-    */
-   MCU_cols = srcinfo->output_width /
--    (dstinfo->max_h_samp_factor * dstinfo->min_DCT_h_scaled_size);
-+    (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
- 
-   for (ci = 0; ci < dstinfo->num_components; ci++) {
-     compptr = dstinfo->comp_info + ci;
-@@ -200,7 +211,7 @@
-    * this is essentially the same as the routine above.
-    */
-   MCU_cols = srcinfo->output_width /
--    (dstinfo->max_h_samp_factor * dstinfo->min_DCT_h_scaled_size);
-+    (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
- 
-   for (ci = 0; ci < dstinfo->num_components; ci++) {
-     compptr = dstinfo->comp_info + ci;
-@@ -265,7 +276,7 @@
-    * Partial iMCUs at the bottom edge are copied verbatim.
-    */
-   MCU_rows = srcinfo->output_height /
--    (dstinfo->max_v_samp_factor * dstinfo->min_DCT_v_scaled_size);
-+    (dstinfo->max_v_samp_factor * dstinfo_min_DCT_v_scaled_size);
- 
-   for (ci = 0; ci < dstinfo->num_components; ci++) {
-     compptr = dstinfo->comp_info + ci;
-@@ -393,7 +404,7 @@
-    * not mirrored.
-    */
-   MCU_cols = srcinfo->output_height /
--    (dstinfo->max_h_samp_factor * dstinfo->min_DCT_h_scaled_size);
-+    (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
- 
-   for (ci = 0; ci < dstinfo->num_components; ci++) {
-     compptr = dstinfo->comp_info + ci;
-@@ -474,7 +485,7 @@
-    * not mirrored.
-    */
-   MCU_rows = srcinfo->output_width /
--    (dstinfo->max_v_samp_factor * dstinfo->min_DCT_v_scaled_size);
-+    (dstinfo->max_v_samp_factor * dstinfo_min_DCT_v_scaled_size);
- 
-   for (ci = 0; ci < dstinfo->num_components; ci++) {
-     compptr = dstinfo->comp_info + ci;
-@@ -542,9 +553,9 @@
-   jpeg_component_info *compptr;
- 
-   MCU_cols = srcinfo->output_width /
--    (dstinfo->max_h_samp_factor * dstinfo->min_DCT_h_scaled_size);
-+    (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
-   MCU_rows = srcinfo->output_height /
--    (dstinfo->max_v_samp_factor * dstinfo->min_DCT_v_scaled_size);
-+    (dstinfo->max_v_samp_factor * dstinfo_min_DCT_v_scaled_size);
- 
-   for (ci = 0; ci < dstinfo->num_components; ci++) {
-     compptr = dstinfo->comp_info + ci;
-@@ -653,9 +664,9 @@
-   jpeg_component_info *compptr;
- 
-   MCU_cols = srcinfo->output_height /
--    (dstinfo->max_h_samp_factor * dstinfo->min_DCT_h_scaled_size);
-+    (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
-   MCU_rows = srcinfo->output_width /
--    (dstinfo->max_v_samp_factor * dstinfo->min_DCT_v_scaled_size);
-+    (dstinfo->max_v_samp_factor * dstinfo_min_DCT_v_scaled_size);
- 
-   for (ci = 0; ci < dstinfo->num_components; ci++) {
-     compptr = dstinfo->comp_info + ci;
-@@ -771,7 +782,7 @@
-  * The routine returns TRUE if the spec string is valid, FALSE if not.
-  *
-  * The crop spec string should have the format
-- *	<width>[f]x<height>[f]{+-}<xoffset>{+-}<yoffset>
-+ *	<width>x<height>{+-}<xoffset>{+-}<yoffset>
-  * where width, height, xoffset, and yoffset are unsigned integers.
-  * Each of the elements can be omitted to indicate a default value.
-  * (A weakness of this style is that it is not possible to omit xoffset
-@@ -793,22 +804,14 @@
-     /* fetch width */
-     if (! jt_read_integer(&spec, &info->crop_width))
-       return FALSE;
--    if (*spec == 'f' || *spec == 'F') {
--      spec++;
--      info->crop_width_set = JCROP_FORCE;
--    } else
--      info->crop_width_set = JCROP_POS;
-+    info->crop_width_set = JCROP_POS;
-   }
--  if (*spec == 'x' || *spec == 'X') {
-+  if (*spec == 'x' || *spec == 'X') {	
-     /* fetch height */
-     spec++;
-     if (! jt_read_integer(&spec, &info->crop_height))
-       return FALSE;
--    if (*spec == 'f' || *spec == 'F') {
--      spec++;
--      info->crop_height_set = JCROP_FORCE;
--    } else
--      info->crop_height_set = JCROP_POS;
-+    info->crop_height_set = JCROP_POS;
-   }
-   if (*spec == '+' || *spec == '-') {
-     /* fetch xoffset */
-@@ -897,7 +900,12 @@
-     info->num_components = srcinfo->num_components;
- 
-   /* Compute output image dimensions and related values. */
-+#if JPEG_LIB_VERSION >= 80
-   jpeg_core_output_dimensions(srcinfo);
-+#else
-+  srcinfo->output_width = srcinfo->image_width;
-+  srcinfo->output_height = srcinfo->image_height;
-+#endif
- 
-   /* Return right away if -perfect is given and transformation is not perfect.
-    */
-@@ -905,15 +913,15 @@
-     if (info->num_components == 1) {
-       if (!jtransform_perfect_transform(srcinfo->output_width,
- 	  srcinfo->output_height,
--	  srcinfo->min_DCT_h_scaled_size,
--	  srcinfo->min_DCT_v_scaled_size,
-+	  srcinfo->_min_DCT_h_scaled_size,
-+	  srcinfo->_min_DCT_v_scaled_size,
- 	  info->transform))
- 	return FALSE;
-     } else {
-       if (!jtransform_perfect_transform(srcinfo->output_width,
- 	  srcinfo->output_height,
--	  srcinfo->max_h_samp_factor * srcinfo->min_DCT_h_scaled_size,
--	  srcinfo->max_v_samp_factor * srcinfo->min_DCT_v_scaled_size,
-+	  srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size,
-+	  srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size,
- 	  info->transform))
- 	return FALSE;
-     }
-@@ -932,26 +940,26 @@
-     info->output_width = srcinfo->output_height;
-     info->output_height = srcinfo->output_width;
-     if (info->num_components == 1) {
--      info->iMCU_sample_width = srcinfo->min_DCT_v_scaled_size;
--      info->iMCU_sample_height = srcinfo->min_DCT_h_scaled_size;
-+      info->iMCU_sample_width = srcinfo->_min_DCT_v_scaled_size;
-+      info->iMCU_sample_height = srcinfo->_min_DCT_h_scaled_size;
-     } else {
-       info->iMCU_sample_width =
--	srcinfo->max_v_samp_factor * srcinfo->min_DCT_v_scaled_size;
-+	srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size;
-       info->iMCU_sample_height =
--	srcinfo->max_h_samp_factor * srcinfo->min_DCT_h_scaled_size;
-+	srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size;
-     }
-     break;
-   default:
-     info->output_width = srcinfo->output_width;
-     info->output_height = srcinfo->output_height;
-     if (info->num_components == 1) {
--      info->iMCU_sample_width = srcinfo->min_DCT_h_scaled_size;
--      info->iMCU_sample_height = srcinfo->min_DCT_v_scaled_size;
-+      info->iMCU_sample_width = srcinfo->_min_DCT_h_scaled_size;
-+      info->iMCU_sample_height = srcinfo->_min_DCT_v_scaled_size;
-     } else {
-       info->iMCU_sample_width =
--	srcinfo->max_h_samp_factor * srcinfo->min_DCT_h_scaled_size;
-+	srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size;
-       info->iMCU_sample_height =
--	srcinfo->max_v_samp_factor * srcinfo->min_DCT_v_scaled_size;
-+	srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size;
-     }
-     break;
-   }
-@@ -988,16 +996,10 @@
-     else
-       yoffset = info->crop_yoffset;
-     /* Now adjust so that upper left corner falls at an iMCU boundary */
--    if (info->crop_width_set == JCROP_FORCE)
--      info->output_width = info->crop_width;
--    else
--      info->output_width =
--        info->crop_width + (xoffset % info->iMCU_sample_width);
--    if (info->crop_height_set == JCROP_FORCE)
--      info->output_height = info->crop_height;
--    else
--      info->output_height =
--        info->crop_height + (yoffset % info->iMCU_sample_height);
-+    info->output_width =
-+      info->crop_width + (xoffset % info->iMCU_sample_width);
-+    info->output_height =
-+      info->crop_height + (yoffset % info->iMCU_sample_height);
-     /* Save x/y offsets measured in iMCUs */
-     info->x_crop_offset = xoffset / info->iMCU_sample_width;
-     info->y_crop_offset = yoffset / info->iMCU_sample_height;
-@@ -1020,7 +1022,7 @@
-   case JXFORM_FLIP_H:
-     if (info->trim)
-       trim_right_edge(info, srcinfo->output_width);
--    if (info->y_crop_offset != 0)
-+    if (info->y_crop_offset != 0 || info->slow_hflip)
-       need_workspace = TRUE;
-     /* do_flip_h_no_crop doesn't need a workspace array */
-     break;
-@@ -1124,9 +1126,11 @@
-   jtemp = dstinfo->image_width;
-   dstinfo->image_width = dstinfo->image_height;
-   dstinfo->image_height = jtemp;
-+#if JPEG_LIB_VERSION >= 70
-   itemp = dstinfo->min_DCT_h_scaled_size;
-   dstinfo->min_DCT_h_scaled_size = dstinfo->min_DCT_v_scaled_size;
-   dstinfo->min_DCT_v_scaled_size = itemp;
-+#endif
- 
-   /* Transpose sampling factors */
-   for (ci = 0; ci < dstinfo->num_components; ci++) {
-@@ -1362,8 +1366,10 @@
-   /* Correct the destination's image dimensions as necessary
-    * for rotate/flip, resize, and crop operations.
-    */
-+#if JPEG_LIB_VERSION >= 70
-   dstinfo->jpeg_width = info->output_width;
-   dstinfo->jpeg_height = info->output_height;
-+#endif
- 
-   /* Transpose destination image parameters */
-   switch (info->transform) {
-@@ -1371,9 +1377,17 @@
-   case JXFORM_TRANSVERSE:
-   case JXFORM_ROT_90:
-   case JXFORM_ROT_270:
-+#if JPEG_LIB_VERSION < 70
-+    dstinfo->image_width = info->output_height;
-+    dstinfo->image_height = info->output_width;
-+#endif
-     transpose_critical_parameters(dstinfo);
-     break;
-   default:
-+#if JPEG_LIB_VERSION < 70
-+    dstinfo->image_width = info->output_width;
-+    dstinfo->image_height = info->output_height;
-+#endif
-     break;
-   }
- 
-@@ -1389,6 +1403,7 @@
-       GETJOCTET(srcinfo->marker_list->data[5]) == 0) {
-     /* Suppress output of JFIF marker */
-     dstinfo->write_JFIF_header = FALSE;
-+#if JPEG_LIB_VERSION >= 70
-     /* Adjust Exif image parameters */
-     if (dstinfo->jpeg_width != srcinfo->image_width ||
- 	dstinfo->jpeg_height != srcinfo->image_height)
-@@ -1396,6 +1411,7 @@
-       adjust_exif_parameters(srcinfo->marker_list->data + 6,
- 	srcinfo->marker_list->data_length - 6,
- 	dstinfo->jpeg_width, dstinfo->jpeg_height);
-+#endif
-   }
- 
-   /* Return the appropriate output data set */
-@@ -1432,7 +1448,7 @@
- 	      src_coef_arrays, dst_coef_arrays);
-     break;
-   case JXFORM_FLIP_H:
--    if (info->y_crop_offset != 0)
-+    if (info->y_crop_offset != 0 || info->slow_hflip)
-       do_flip_h(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
- 		src_coef_arrays, dst_coef_arrays);
-     else

diff --git a/media-libs/freeimage/files/freeimage-3.15.4-libjpeg9.patch b/media-libs/freeimage/files/freeimage-3.15.4-libjpeg9.patch
deleted file mode 100644
index 24eb9e010fc..00000000000
--- a/media-libs/freeimage/files/freeimage-3.15.4-libjpeg9.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-Bug: https://bugs.gentoo.org/647422
-Upstream Patch: https://sourceforge.net/p/freeimage/patches/130/
-
-diff -Naur a/Source/FreeImage/PluginJPEG.cpp b/Source/FreeImage/PluginJPEG.cpp
---- a/Source/FreeImage/PluginJPEG.cpp	2018-03-24 23:24:11.062695375 -0400
-+++ b/Source/FreeImage/PluginJPEG.cpp	2018-03-24 23:25:39.451124161 -0400
-@@ -1586,14 +1586,14 @@
- 
- 			// thumbnail support (JFIF 1.02 extension markers)
- 			if(FreeImage_GetThumbnail(dib) != NULL) {
--				cinfo.write_JFIF_header = 1; //<### force it, though when color is CMYK it will be incorrect
-+				cinfo.write_JFIF_header = static_cast<boolean>(1); //<### force it, though when color is CMYK it will be incorrect
- 				cinfo.JFIF_minor_version = 2;
- 			}
- 
- 			// baseline JPEG support
- 			if ((flags & JPEG_BASELINE) ==  JPEG_BASELINE) {
--				cinfo.write_JFIF_header = 0;	// No marker for non-JFIF colorspaces
--				cinfo.write_Adobe_marker = 0;	// write no Adobe marker by default				
-+				cinfo.write_JFIF_header = static_cast<boolean>(0);	// No marker for non-JFIF colorspaces
-+				cinfo.write_Adobe_marker = static_cast<boolean>(0);	// write no Adobe marker by default
- 			}
- 
- 			// set subsampling options if required
-diff -Naur a/Source/FreeImage.h b/Source/FreeImage.h
---- a/Source/FreeImage.h	2018-03-24 23:24:11.066695395 -0400
-+++ b/Source/FreeImage.h	2018-03-24 23:26:35.945391182 -0400
-@@ -117,12 +117,17 @@
- #ifndef _WINDOWS_
- #define _WINDOWS_
- 
-+#if JPEG_LIB_VERSION < 90
-+
- #ifndef FALSE
- #define FALSE 0
- #endif
- #ifndef TRUE
- #define TRUE 1
- #endif
-+
-+#endif
-+
- #ifndef NULL
- #define NULL 0
- #endif

diff --git a/media-libs/freeimage/files/freeimage-3.15.4-raw.patch b/media-libs/freeimage/files/freeimage-3.15.4-raw.patch
deleted file mode 100644
index 44f566627e2..00000000000
--- a/media-libs/freeimage/files/freeimage-3.15.4-raw.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-https://bugs.gentoo.org/show_bug.cgi?id=458516
-
---- FreeImage/Source/FreeImage.h
-+++ FreeImage/Source/FreeImage.h
-@@ -141,8 +141,10 @@
- typedef uint16_t WORD;
- typedef uint32_t DWORD;
- typedef int32_t LONG;
-+#ifndef _LIBRAW_TYPES_H
- typedef int64_t INT64;
- typedef uint64_t UINT64;
-+#endif
- #else
- // MS is not C99 ISO compliant
- typedef long BOOL;
-

diff --git a/media-libs/freeimage/files/freeimage-3.15.4-unbundling.patch b/media-libs/freeimage/files/freeimage-3.15.4-unbundling.patch
deleted file mode 100644
index ac2ac54ce5c..00000000000
--- a/media-libs/freeimage/files/freeimage-3.15.4-unbundling.patch
+++ /dev/null
@@ -1,639 +0,0 @@
-lots of fixes here:
-	- use system graphics libraries
-	- make all of them optional
-	- drop root users from install (fix user installs)
-	- make static lib build optional
-	- link with CXX and CXXFLAGS (since this is C++ code)
-
---- a/Makefile.gnu
-+++ b/Makefile.gnu
-@@ -11,7 +11,24 @@
- # Converts cr/lf to just lf
- DOS2UNIX = dos2unix
- 
--LIBRARIES = -lstdc++
-+PKG_CONFIG ?= pkg-config
-+
-+USE_EXR ?= yes
-+USE_JPEG ?= yes
-+USE_JPEG2K ?= yes
-+USE_MNG ?= yes
-+USE_PNG ?= yes
-+USE_TIFF ?= yes
-+USE_RAW ?= yes
-+
-+LIBRARIES-yes = $(shell $(PKG_CONFIG) --libs zlib)
-+LIBRARIES-$(USE_EXR)    += $(shell $(PKG_CONFIG) --libs OpenEXR)
-+LIBRARIES-$(USE_JPEG)   += -ljpeg
-+LIBRARIES-$(USE_JPEG2K) += $(shell $(PKG_CONFIG) --libs libopenjpeg)
-+LIBRARIES-$(USE_MNG)    += -lmng
-+LIBRARIES-$(USE_PNG)    += $(shell $(PKG_CONFIG) --libs libpng)
-+LIBRARIES-$(USE_TIFF)   += $(shell $(PKG_CONFIG) --libs libtiff-4 IlmBase)
-+LIBRARIES-$(USE_RAW)    += $(shell $(PKG_CONFIG) --libs libraw)
- 
- MODULES = $(SRCS:.c=.o)
- MODULES := $(MODULES:.cpp=.o)
-@@ -64,13 +81,15 @@
- 	$(AR) r $@ $(MODULES)
- 
- $(SHAREDLIB): $(MODULES)
--	$(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
-+	$(CXX) $(CXXFLAGS) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES-yes)
- 
- 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)
-+	install -m 644 $(HEADER) $(INCDIR)
-+ifneq ($(STATICLIB),)
-+	install -m 644 $(STATICLIB) $(INSTALLDIR)
-+endif
-+	install -m 755 $(SHAREDLIB) $(INSTALLDIR)
- 	ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
- 	ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)	
- #	ldconfig
---- a/Source/FreeImage/J2KHelper.cpp
-+++ b/Source/FreeImage/J2KHelper.cpp
-@@ -21,7 +21,7 @@
- 
- #include "FreeImage.h"
- #include "Utilities.h"
--#include "../LibOpenJPEG/openjpeg.h"
-+#include <openjpeg.h>
- 
- /**
- Divide an integer by a power of 2 and round upwards
---- a/Source/FreeImage/PluginEXR.cpp
-+++ b/Source/FreeImage/PluginEXR.cpp
-@@ -22,16 +22,16 @@
- 
- #include "FreeImage.h"
- #include "Utilities.h"
--#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 <ImfIO.h>
-+#include <Iex.h>
-+#include <ImfOutputFile.h>
-+#include <ImfInputFile.h>
-+#include <ImfRgbaFile.h>
-+#include <ImfChannelList.h>
-+#include <ImfRgba.h>
-+#include <ImfArray.h>
-+#include <ImfPreviewImage.h>
-+#include <half.h>
- 
- 
- // ==========================================================
---- a/Source/FreeImage/PluginJ2K.cpp
-+++ b/Source/FreeImage/PluginJ2K.cpp
-@@ -21,7 +21,7 @@
- 
- #include "FreeImage.h"
- #include "Utilities.h"
--#include "../LibOpenJPEG/openjpeg.h"
-+#include <openjpeg.h>
- 
- // ==========================================================
- // Plugin Interface
---- a/Source/FreeImage/PluginJP2.cpp
-+++ b/Source/FreeImage/PluginJP2.cpp
-@@ -21,7 +21,7 @@
- 
- #include "FreeImage.h"
- #include "Utilities.h"
--#include "../LibOpenJPEG/openjpeg.h"
-+#include <openjpeg.h>
- 
- // ==========================================================
- // Plugin Interface
---- a/Source/FreeImage/PluginPNG.cpp
-+++ b/Source/FreeImage/PluginPNG.cpp
-@@ -37,8 +37,8 @@
- 
- // ----------------------------------------------------------
- 
--#include "../ZLib/zlib.h"
--#include "../LibPNG/png.h"
-+#include <zlib.h>
-+#include <png.h>
- 
- // ----------------------------------------------------------
- 
---- a/Source/transupp.c
-+++ b/Source/transupp.c
-@@ -15,8 +15,7 @@
- /* Although this file really shouldn't have access to the library internals,
-  * it's helpful to let it call jround_up() and jcopy_block_row().
-  */
--#define JPEG_INTERNALS
--
-+#include <jerror.h>
- #include "jinclude.h"
- #include "jpeglib.h"
- #include "transupp.h"		/* My own external interface */
---- a/Source/FreeImage/ZLibInterface.cpp
-+++ b/Source/FreeImage/ZLibInterface.cpp
-@@ -19,10 +19,10 @@
- // 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) */
-+#define OS_CODE 0x03
- 
- /**
- Compresses a source buffer into a target buffer, using the ZLib library. 
---- a/Source/FreeImage/PluginG3.cpp
-+++ b/Source/FreeImage/PluginG3.cpp
-@@ -20,7 +20,7 @@
- // Use at your own risk!
- // ==========================================================
- 
--#include "../LibTIFF4/tiffiop.h"
-+#include "tiffiop.h"
- 
- #include "FreeImage.h"
- #include "Utilities.h"
---- a/Source/FreeImage/PluginJPEG.cpp
-+++ b/Source/FreeImage/PluginJPEG.cpp
-@@ -35,11 +35,15 @@
- #undef FAR
- #include <setjmp.h>
- 
--#include "../LibJPEG/jinclude.h"
--#include "../LibJPEG/jpeglib.h"
--#include "../LibJPEG/jerror.h"
-+#include <string.h>
-+#include <stdio.h>
-+#include <jconfig.h>
-+#include <jpeglib.h>
-+#include <jerror.h>
- }
- 
-+#define SIZEOF(object)        ((size_t) sizeof(object))
-+
- #include "FreeImage.h"
- #include "Utilities.h"
- 
---- a/Source/FreeImageToolkit/JPEGTransform.cpp
-+++ b/Source/FreeImageToolkit/JPEGTransform.cpp
-@@ -25,10 +25,11 @@
- #undef FAR
- #include <setjmp.h>
- 
--#include "../LibJPEG/jinclude.h"
--#include "../LibJPEG/jpeglib.h"
--#include "../LibJPEG/jerror.h"
--#include "../LibJPEG/transupp.h"
-+#include <string.h>
-+#include <stdio.h>
-+#include <jpeglib.h>
-+#include <jerror.h>
-+#include "transupp.h"
- }
- 
- #include "FreeImage.h"
---- a/Makefile.fip
-+++ b/Makefile.fip
-@@ -11,7 +11,24 @@
- # Converts cr/lf to just lf
- DOS2UNIX = dos2unix
- 
--LIBRARIES = -lstdc++
-+PKG_CONFIG ?= pkg-config
-+
-+USE_EXR ?= yes
-+USE_JPEG ?= yes
-+USE_JPEG2K ?= yes
-+USE_MNG ?= yes
-+USE_PNG ?= yes
-+USE_TIFF ?= yes
-+USE_RAW ?= yes
-+
-+LIBRARIES-yes = $(shell $(PKG_CONFIG) --libs zlib)
-+LIBRARIES-$(USE_EXR)    += $(shell $(PKG_CONFIG) --libs OpenEXR)
-+LIBRARIES-$(USE_JPEG)   += -ljpeg
-+LIBRARIES-$(USE_JPEG2K) += $(shell $(PKG_CONFIG) --libs libopenjpeg)
-+LIBRARIES-$(USE_MNG)    += -lmng
-+LIBRARIES-$(USE_PNG)    += $(shell $(PKG_CONFIG) --libs libpng)
-+LIBRARIES-$(USE_TIFF)   += $(shell $(PKG_CONFIG) --libs libtiff-4 IlmBase)
-+LIBRARIES-$(USE_RAW)    += $(shell $(PKG_CONFIG) --libs libraw)
- 
- MODULES = $(SRCS:.c=.o)
- MODULES := $(MODULES:.cpp=.o)
-@@ -65,14 +82,18 @@
- 	$(AR) r $@ $(MODULES)
- 
- $(SHAREDLIB): $(MODULES)
--	$(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
-+	$(CXX) $(CXXFLAGS) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES-yes)
- 
- install:
- 	install -d $(INCDIR) $(INSTALLDIR)
--	install -m 644 -o root -g root $(HEADER) $(INCDIR)
--	install -m 644 -o root -g root $(HEADERFIP) $(INCDIR)
--	install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
--	install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
-+	install -m 644 $(HEADER) $(INCDIR)
-+	install -m 644 $(HEADERFIP) $(INCDIR)
-+ifneq ($(STATICLIB),)
-+	install -m 644 $(STATICLIB) $(INSTALLDIR)
-+endif
-+	install -m 755 $(SHAREDLIB) $(INSTALLDIR)
-+	ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
-+	ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
- 
- clean:
- 	rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
---- a/Makefile.srcs
-+++ b/Makefile.srcs
-@@ -1,6 +1,14 @@
-+USE_EXR ?= yes
-+USE_JPEG ?= yes
-+USE_JPEG2K ?= yes
-+USE_MNG ?= yes
-+USE_PNG ?= yes
-+USE_TIFF ?= yes
-+USE_RAW ?= yes
-+
- VER_MAJOR = 3
- VER_MINOR = 15.4
--SRCS = \
-+SRCS-yes = \
- 	Source/FreeImage/BitmapAccess.cpp \
- 	Source/FreeImage/ColorLookup.cpp \
- 	Source/FreeImage/FreeImage.cpp \
-@@ -17,36 +25,74 @@ SRCS = \
- 	Source/FreeImage/GetType.cpp \
- 	Source/FreeImage/MemoryIO.cpp \
- 	Source/FreeImage/PixelAccess.cpp \
-+
-+SRCS-$(USE_JPEG2K) += \
- 	Source/FreeImage/J2KHelper.cpp \
-+
-+SRCS-$(USE_MNG) += \
- 	Source/FreeImage/MNGHelper.cpp \
-+
-+SRCS-yes += \
- 	Source/FreeImage/Plugin.cpp \
- 	Source/FreeImage/PluginBMP.cpp \
- 	Source/FreeImage/PluginCUT.cpp \
- 	Source/FreeImage/PluginDDS.cpp \
-+
-+SRCS-$(USE_EXR) += \
- 	Source/FreeImage/PluginEXR.cpp \
-+
-+SRCS-$(USE_TIFF) += \
- 	Source/FreeImage/PluginG3.cpp \
-+
-+SRCS-yes += \
- 	Source/FreeImage/PluginGIF.cpp \
- 	Source/FreeImage/PluginHDR.cpp \
- 	Source/FreeImage/PluginICO.cpp \
- 	Source/FreeImage/PluginIFF.cpp \
-+
-+SRCS-$(USE_JPEG2K) += \
- 	Source/FreeImage/PluginJ2K.cpp \
-+
-+SRCS-$(USE_MNG) += \
- 	Source/FreeImage/PluginJNG.cpp \
-+
-+SRCS-$(USE_JPEG2K) += \
- 	Source/FreeImage/PluginJP2.cpp \
-+
-+SRCS-$(USE_JPEG) += \
- 	Source/FreeImage/PluginJPEG.cpp \
-+
-+SRCS-yes += \
- 	Source/FreeImage/PluginKOALA.cpp \
-+
-+SRCS-$(USE_MNG) += \
- 	Source/FreeImage/PluginMNG.cpp \
-+
-+SRCS-yes += \
- 	Source/FreeImage/PluginPCD.cpp \
- 	Source/FreeImage/PluginPCX.cpp \
- 	Source/FreeImage/PluginPFM.cpp \
- 	Source/FreeImage/PluginPICT.cpp \
-+
-+SRCS-$(USE_PNG) += \
- 	Source/FreeImage/PluginPNG.cpp \
-+
-+SRCS-yes += \
- 	Source/FreeImage/PluginPNM.cpp \
- 	Source/FreeImage/PluginPSD.cpp \
- 	Source/FreeImage/PluginRAS.cpp \
-+
-+SRCS-$(USE_RAW) += \
- 	Source/FreeImage/PluginRAW.cpp \
-+
-+SRCS-yes += \
- 	Source/FreeImage/PluginSGI.cpp \
- 	Source/FreeImage/PluginTARGA.cpp \
-+
-+SRCS-$(USE_TIFF) += \
- 	Source/FreeImage/PluginTIFF.cpp \
-+
-+SRCS-yes += \
- 	Source/FreeImage/PluginWBMP.cpp \
- 	Source/FreeImage/PluginXBM.cpp \
- 	Source/FreeImage/PluginXPM.cpp \
-@@ -83,7 +129,11 @@ SRCS = \
- 	Source/Metadata/IPTC.cpp \
- 	Source/Metadata/TagConversion.cpp \
- 	Source/Metadata/TagLib.cpp \
-+
-+SRCS-$(USE_TIFF) += \
- 	Source/Metadata/XTIFF.cpp \
-+
-+SRCS-yes += \
- 	Source/FreeImageToolkit/Background.cpp \
- 	Source/FreeImageToolkit/BSplineRotate.cpp \
- 	Source/FreeImageToolkit/Channels.cpp \
-@@ -92,10 +142,18 @@ SRCS = \
- 	Source/FreeImageToolkit/CopyPaste.cpp \
- 	Source/FreeImageToolkit/Display.cpp \
- 	Source/FreeImageToolkit/Flip.cpp \
-+
-+SRCS-$(USE_JPEG) += \
- 	Source/FreeImageToolkit/JPEGTransform.cpp \
-+
-+SRCS-yes += \
- 	Source/FreeImageToolkit/MultigridPoissonSolver.cpp \
- 	Source/FreeImageToolkit/Rescale.cpp \
- 	Source/FreeImageToolkit/Resize.cpp \
-+
-+SRCS-$(USE_JPEG) += \
-+	Source/transupp.c
-+SRCS = $(SRCS-yes)
- INCLS = \
- 	Examples/OpenGL/TextureManager/TextureManager.h \
- 	Examples/Plugin/PluginCradle.h \
-@@ -116,7 +174,17 @@
- 	Wrapper/FreeImagePlus/test/fipTest.h \
- 	TestAPI/TestSuite.h
- 
--INCLUDE = -I. \
-+INCLUDE-yes = -I. \
- 	-ISource \
- 	-ISource/Metadata \
- 	-ISource/FreeImageToolkit \
-+
-+INCLUDE-yes += $(shell $(PKG_CONFIG) --cflags-only-I zlib)
-+INCLUDE-$(USE_EXR)    += -DUSE_EXR    $(shell $(PKG_CONFIG) --cflags-only-I OpenEXR)
-+INCLUDE-$(USE_JPEG)   += -DUSE_JPEG
-+INCLUDE-$(USE_JPEG2K) += -DUSE_JPEG2K $(shell $(PKG_CONFIG) --cflags-only-I libopenjpeg)
-+INCLUDE-$(USE_MNG)    += -DUSE_MNG
-+INCLUDE-$(USE_PNG)    += -DUSE_PNG    $(shell $(PKG_CONFIG) --cflags-only-I libpng)
-+INCLUDE-$(USE_TIFF)   += -DUSE_TIFF   $(shell $(PKG_CONFIG) --cflags-only-I libtiff-4 IlmBase)
-+INCLUDE-$(USE_RAW)    += -DUSE_RAW    $(shell $(PKG_CONFIG) --cflags-only-I libraw)
-+INCLUDE = $(INCLUDE-yes)
---- a/fipMakefile.srcs
-+++ b/fipMakefile.srcs
-@@ -1,6 +1,14 @@
-+USE_EXR ?= yes
-+USE_JPEG ?= yes
-+USE_JPEG2K ?= yes
-+USE_MNG ?= yes
-+USE_PNG ?= yes
-+USE_TIFF ?= yes
-+USE_RAW ?= yes
-+
- VER_MAJOR = 3
- VER_MINOR = 15.4
--SRCS = \
-+SRCS-yes = \
- 	Source/FreeImage/BitmapAccess.cpp \
- 	Source/FreeImage/ColorLookup.cpp \
- 	Source/FreeImage/FreeImage.cpp \
-@@ -9,36 +17,74 @@
- 	Source/FreeImage/GetType.cpp \
- 	Source/FreeImage/MemoryIO.cpp \
- 	Source/FreeImage/PixelAccess.cpp \
-+
-+SRCS-$(USE_JPEG2K) += \
- 	Source/FreeImage/J2KHelper.cpp \
-+
-+SRCS-$(USE_MNG) += \
- 	Source/FreeImage/MNGHelper.cpp \
-+
-+SRCS-yes += \
- 	Source/FreeImage/Plugin.cpp \
- 	Source/FreeImage/PluginBMP.cpp \
- 	Source/FreeImage/PluginCUT.cpp \
- 	Source/FreeImage/PluginDDS.cpp \
-+
-+SRCS-$(USE_EXR) += \
- 	Source/FreeImage/PluginEXR.cpp \
-+
-+SRCS-$(USE_TIFF) += \
- 	Source/FreeImage/PluginG3.cpp \
-+
-+SRCS-yes += \
- 	Source/FreeImage/PluginGIF.cpp \
- 	Source/FreeImage/PluginHDR.cpp \
- 	Source/FreeImage/PluginICO.cpp \
- 	Source/FreeImage/PluginIFF.cpp \
-+
-+SRCS-$(USE_JPEG2K) += \
- 	Source/FreeImage/PluginJ2K.cpp \
-+
-+SRCS-$(USE_MNG) += \
- 	Source/FreeImage/PluginJNG.cpp \
-+
-+SRCS-$(USE_JPEG2K) += \
- 	Source/FreeImage/PluginJP2.cpp \
-+
-+SRCS-$(USE_JPEG) += \
- 	Source/FreeImage/PluginJPEG.cpp \
-+
-+SRCS-yes += \
- 	Source/FreeImage/PluginKOALA.cpp \
-+
-+SRCS-$(USE_MNG) += \
- 	Source/FreeImage/PluginMNG.cpp \
-+
-+SRCS-yes += \
- 	Source/FreeImage/PluginPCD.cpp \
- 	Source/FreeImage/PluginPCX.cpp \
- 	Source/FreeImage/PluginPFM.cpp \
- 	Source/FreeImage/PluginPICT.cpp \
-+
-+SRCS-$(USE_PNG) += \
- 	Source/FreeImage/PluginPNG.cpp \
-+
-+SRCS-yes += \
- 	Source/FreeImage/PluginPNM.cpp \
- 	Source/FreeImage/PluginPSD.cpp \
- 	Source/FreeImage/PluginRAS.cpp \
-+
-+SRCS-$(USE_RAW) += \
- 	Source/FreeImage/PluginRAW.cpp \
-+
-+SRCS-yes += \
- 	Source/FreeImage/PluginSGI.cpp \
- 	Source/FreeImage/PluginTARGA.cpp \
-+
-+SRCS-$(USE_TIFF) += \
- 	Source/FreeImage/PluginTIFF.cpp \
-+
-+SRCS-yes += \
- 	Source/FreeImage/PluginWBMP.cpp \
- 	Source/FreeImage/PluginXBM.cpp \
- 	Source/FreeImage/PluginXPM.cpp \
-@@ -75,7 +121,11 @@
- 	Source/Metadata/IPTC.cpp \
- 	Source/Metadata/TagConversion.cpp \
- 	Source/Metadata/TagLib.cpp \
-+
-+SRCS-$(USE_TIFF) += \
- 	Source/Metadata/XTIFF.cpp \
-+
-+SRCS-yes += \
- 	Source/FreeImageToolkit/Background.cpp \
- 	Source/FreeImageToolkit/BSplineRotate.cpp \
- 	Source/FreeImageToolkit/Channels.cpp \
-@@ -84,7 +134,11 @@
- 	Source/FreeImageToolkit/CopyPaste.cpp \
- 	Source/FreeImageToolkit/Display.cpp \
- 	Source/FreeImageToolkit/Flip.cpp \
-+
-+SRCS-$(USE_JPEG) += \
- 	Source/FreeImageToolkit/JPEGTransform.cpp \
-+
-+SRCS-yes += \
- 	Source/FreeImageToolkit/MultigridPoissonSolver.cpp \
- 	Source/FreeImageToolkit/Rescale.cpp \
- 	Source/FreeImageToolkit/Resize.cpp \
-@@ -95,6 +149,11 @@
- 	Wrapper/FreeImagePlus/src/fipTag.cpp \
- 	Wrapper/FreeImagePlus/src/fipWinImage.cpp \
- 	Wrapper/FreeImagePlus/src/FreeImagePlus.cpp 
-+
-+SRCS-$(USE_JPEG) += \
-+	Source/transupp.c
-+
-+SRCS = $(SRCS-yes)
- INCLUDE = -I. \
- 	-ISource \
- 	-ISource/Metadata \
---- a/Source/FreeImage/PluginRAW.cpp
-+++ b/Source/FreeImage/PluginRAW.cpp
-@@ -19,7 +19,7 @@
- // Use at your own risk!
- // ==========================================================
- 
--#include "../LibRawLite/libraw/libraw.h"
-+#include <libraw.h>
- 
- #include "FreeImage.h"
- #include "Utilities.h"
---- a/Source/Metadata/XTIFF.cpp
-+++ b/Source/Metadata/XTIFF.cpp
-@@ -29,7 +29,7 @@
- #pragma warning (disable : 4786) // identifier was truncated to 'number' characters
- #endif
- 
--#include "../LibTIFF4/tiffiop.h"
-+#include "tiffiop.h"
- 
- #include "FreeImage.h"
- #include "Utilities.h"
---- a/Source/FreeImage/PluginTIFF.cpp
-+++ b/Source/FreeImage/PluginTIFF.cpp
-@@ -37,9 +37,9 @@
- 
- #include "FreeImage.h"
- #include "Utilities.h"
--#include "../LibTIFF4/tiffiop.h"
-+#include "tiffiop.h"
- #include "../Metadata/FreeImageTag.h"
--#include "../OpenEXR/Half/half.h"
-+#include <half.h>
- 
- #include "FreeImageIO.h"
- #include "PSDParser.h"
---- a/Source/tiffiop.h
-+++ b/Source/tiffiop.h
-@@ -30,7 +30,9 @@
-  * ``Library-private'' definitions.
-  */
- 
--#include "tif_config.h"
-+#include <tiffconf.h>
-+#define HAVE_SEARCH_H
-+#define HAVE_FCNTL_H
- 
- #ifdef HAVE_FCNTL_H
- # include <fcntl.h>
---- a/Source/FreeImage/Plugin.cpp
-+++ b/Source/FreeImage/Plugin.cpp
-@@ -223,23 +223,33 @@
- 			*/
- 			s_plugins->AddNode(InitBMP);
- 			s_plugins->AddNode(InitICO);
-+#ifdef USE_JPEG
- 			s_plugins->AddNode(InitJPEG);
-+#endif
-+#ifdef USE_MNG
- 			s_plugins->AddNode(InitJNG);
-+#endif
- 			s_plugins->AddNode(InitKOALA);
- 			s_plugins->AddNode(InitIFF);
-+#ifdef USE_MNG
- 			s_plugins->AddNode(InitMNG);
-+#endif
- 			s_plugins->AddNode(InitPNM, NULL, "PBM", "Portable Bitmap (ASCII)", "pbm", "^P1");
- 			s_plugins->AddNode(InitPNM, NULL, "PBMRAW", "Portable Bitmap (RAW)", "pbm", "^P4");
- 			s_plugins->AddNode(InitPCD);
- 			s_plugins->AddNode(InitPCX);
- 			s_plugins->AddNode(InitPNM, NULL, "PGM", "Portable Greymap (ASCII)", "pgm", "^P2");
- 			s_plugins->AddNode(InitPNM, NULL, "PGMRAW", "Portable Greymap (RAW)", "pgm", "^P5");
-+#ifdef USE_PNG
- 			s_plugins->AddNode(InitPNG);
-+#endif
- 			s_plugins->AddNode(InitPNM, NULL, "PPM", "Portable Pixelmap (ASCII)", "ppm", "^P3");
- 			s_plugins->AddNode(InitPNM, NULL, "PPMRAW", "Portable Pixelmap (RAW)", "ppm", "^P6");
- 			s_plugins->AddNode(InitRAS);
- 			s_plugins->AddNode(InitTARGA);
-+#ifdef USE_TIFF
- 			s_plugins->AddNode(InitTIFF);
-+#endif
- 			s_plugins->AddNode(InitWBMP);
- 			s_plugins->AddNode(InitPSD);
- 			s_plugins->AddNode(InitCUT);
-@@ -248,14 +258,22 @@
- 			s_plugins->AddNode(InitDDS);
- 	        s_plugins->AddNode(InitGIF);
- 	        s_plugins->AddNode(InitHDR);
-+#ifdef USE_TIFF
- 			s_plugins->AddNode(InitG3);
-+#endif
- 			s_plugins->AddNode(InitSGI);
-+#ifdef USE_EXR
- 			s_plugins->AddNode(InitEXR);
-+#endif
-+#ifdef USE_JPEG2K
- 			s_plugins->AddNode(InitJ2K);
- 			s_plugins->AddNode(InitJP2);
-+#endif
- 			s_plugins->AddNode(InitPFM);
- 			s_plugins->AddNode(InitPICT);
-+#ifdef USE_RAW
- 			s_plugins->AddNode(InitRAW);
-+#endif
- 			
- 			// external plugin initialization
- 

diff --git a/media-libs/freeimage/freeimage-3.15.4-r1.ebuild b/media-libs/freeimage/freeimage-3.15.4-r1.ebuild
deleted file mode 100644
index f79cd6ac5c1..00000000000
--- a/media-libs/freeimage/freeimage-3.15.4-r1.ebuild
+++ /dev/null
@@ -1,116 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit eutils toolchain-funcs
-
-MY_PN=FreeImage
-MY_PV=${PV//.}
-MY_P=${MY_PN}${MY_PV}
-
-DESCRIPTION="Image library supporting many formats"
-HOMEPAGE="http://freeimage.sourceforge.net/"
-SRC_URI="mirror://sourceforge/${PN}/${MY_P}.zip
-	mirror://sourceforge/${PN}/${MY_P}.pdf"
-
-LICENSE="|| ( GPL-2 FIPL-1.0 )"
-SLOT="0"
-KEYWORDS="amd64 ~arm x86 ~amd64-linux ~x86-linux"
-IUSE="jpeg jpeg2k mng openexr png raw static-libs tiff"
-
-# The tiff/ilmbase isn't a typo.  The TIFF plugin cheats and
-# uses code from it to handle 16bit<->float conversions.
-RDEPEND="
-	sys-libs/zlib
-	jpeg? ( virtual/jpeg:0 )
-	jpeg2k? ( media-libs/openjpeg:0= )
-	mng? ( media-libs/libmng:= )
-	openexr? ( media-libs/openexr:= )
-	png? ( media-libs/libpng:0= )
-	raw? ( media-libs/libraw:= )
-	tiff? (
-		media-libs/ilmbase:=
-		media-libs/tiff:0
-	)"
-DEPEND="${RDEPEND}
-	virtual/pkgconfig
-	app-arch/unzip"
-
-S=${WORKDIR}/${MY_PN}
-
-DOCS=( "${DISTDIR}"/${MY_P}.pdf README.linux Whatsnew.txt )
-PATCHES=(
-	"${FILESDIR}"/${PN}-3.15.4-{unbundling,raw}.patch
-	"${FILESDIR}"/${PN}-3.15.4-CVE-2016-5684-1.patch
-	"${FILESDIR}"/${PN}-3.15.4-CVE-2016-5684-2.patch
-	"${FILESDIR}"/${PN}-3.15.4-CVE-2015-0852.patch
-	"${FILESDIR}"/${PN}-3.15.4-libjpeg9.patch
-)
-
-src_prepare() {
-	pushd Source >/dev/null || die
-	if has_version ">=media-libs/libjpeg-turbo-1.2.1"; then
-		# Patch from Christian Heimes's fork (thanks)
-		# https://bitbucket.org/tiran/freeimageturbo
-		eapply "${FILESDIR}"/${PN}-3.15.4-libjpeg-turbo.patch
-		cp LibJPEG/{jpegcomp.h,jpegint.h} . || die
-	fi
-	cp LibJPEG/{transupp.c,transupp.h,jinclude.h} . || die
-	cp LibTIFF4/{tiffiop,tif_dir}.h . || die
-	rm -rf LibPNG LibMNG LibOpenJPEG ZLib OpenEXR LibRawLite LibTIFF4 LibJPEG || die
-	popd >/dev/null || die
-
-	edos2unix Makefile.{gnu,fip,srcs} fipMakefile.srcs */*.h */*/*.cpp
-	sed -i \
-		-e "s:/./:/:g" \
-		-e "s: ./: :g" \
-		-e 's: Source: \\\n\tSource:g' \
-		-e 's: Wrapper: \\\n\tWrapper:g' \
-		-e 's: Examples: \\\n\tExamples:g' \
-		-e 's: TestAPI: \\\n\tTestAPI:g' \
-		-e 's: -ISource: \\\n\t-ISource:g' \
-		-e 's: -IWrapper: \\\n\t-IWrapper:g' \
-		Makefile.srcs fipMakefile.srcs || die
-	sed -i \
-		-e "/LibJPEG/d" \
-		-e "/LibPNG/d" \
-		-e "/LibTIFF/d" \
-		-e "/Source\/ZLib/d" \
-		-e "/LibOpenJPEG/d" \
-		-e "/OpenEXR/d" \
-		-e "/LibRawLite/d" \
-		-e "/LibMNG/d" \
-		Makefile.srcs fipMakefile.srcs || die
-
-	default
-}
-
-foreach_make() {
-	local m
-	for m in Makefile.{gnu,fip} ; do
-		emake -f ${m} \
-			USE_EXR=$(usex openexr) \
-			USE_JPEG=$(usex jpeg) \
-			USE_JPEG2K=$(usex jpeg2k) \
-			USE_MNG=$(usex mng) \
-			USE_PNG=$(usex png) \
-			USE_TIFF=$(usex tiff) \
-			USE_RAW=$(usex raw) \
-			$(usex static-libs '' STATICLIB=) \
-			"$@"
-	done
-}
-
-src_compile() {
-	tc-export AR PKG_CONFIG
-	foreach_make \
-		CXX="$(tc-getCXX) -fPIC" \
-		CC="$(tc-getCC) -fPIC" \
-		${MY_PN}
-}
-
-src_install() {
-	foreach_make install DESTDIR="${ED}" INSTALLDIR="${ED%/}"/usr/$(get_libdir)
-	einstalldocs
-}


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/freeimage/files/, media-libs/freeimage/
@ 2020-07-19 12:02 James Le Cuirot
  0 siblings, 0 replies; 8+ messages in thread
From: James Le Cuirot @ 2020-07-19 12:02 UTC (permalink / raw
  To: gentoo-commits

commit:     16338bcf52d57417ef2c66df7d4a0a3c206751ec
Author:     John Helmert III <jchelmert3 <AT> posteo <DOT> net>
AuthorDate: Sat Jul 11 19:05:59 2020 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sun Jul 19 11:58:58 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=16338bcf

media-libs/freeimage: Revbump + security patch

Bug: https://bugs.gentoo.org/701850
Package-Manager: Portage-2.3.103, Repoman-2.3.23
Signed-off-by: John Helmert III <jchelmert3 <AT> posteo.net>
Closes: https://github.com/gentoo/gentoo/pull/16670
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 ...mage-3.18.0-CVE-2019-12211-CVE-2019-12213.patch | 193 +++++++++++++++++++++
 media-libs/freeimage/freeimage-3.18.0-r2.ebuild    | 119 +++++++++++++
 2 files changed, 312 insertions(+)

diff --git a/media-libs/freeimage/files/freeimage-3.18.0-CVE-2019-12211-CVE-2019-12213.patch b/media-libs/freeimage/files/freeimage-3.18.0-CVE-2019-12211-CVE-2019-12213.patch
new file mode 100644
index 00000000000..fc861854509
--- /dev/null
+++ b/media-libs/freeimage/files/freeimage-3.18.0-CVE-2019-12211-CVE-2019-12213.patch
@@ -0,0 +1,193 @@
+commit 1826164f90d97b7207247ad268fd2622cd1c6717
+Author: drolon <drolon@f6e0daa0-2725-47c6-9c0b-5e6e9cdd0720>
+Date:   Mon Nov 11 05:45:27 2019 +0000
+
+    improved TIFF plugin when working with malicious images
+    
+    git-svn-id: https://svn.code.sf.net/p/freeimage/svn@1825 f6e0daa0-2725-47c6-9c0b-5e6e9cdd0720
+
+diff --git a/Source/FreeImage/PluginTIFF.cpp b/Source/FreeImage/PluginTIFF.cpp
+index f85c2201..a8053196 100644
+--- a/Source/FreeImage/PluginTIFF.cpp
++++ b/Source/FreeImage/PluginTIFF.cpp
+@@ -122,9 +122,14 @@ static void ReadThumbnail(FreeImageIO *io, fi_handle handle, void *data, TIFF *t
+ static int s_format_id;
+ 
+ typedef struct {
++	//! FreeImage IO functions
+     FreeImageIO *io;
++	//! FreeImage handle
+ 	fi_handle handle;
++	//! LibTIFF handle
+ 	TIFF *tif;
++	//! Count the number of thumbnails already read (used to avoid recursion on loading)
++	unsigned thumbnailCount;
+ } fi_TIFFIO;
+ 
+ // ----------------------------------------------------------
+@@ -184,10 +189,8 @@ Open a TIFF file descriptor for reading or writing
+ */
+ TIFF *
+ TIFFFdOpen(thandle_t handle, const char *name, const char *mode) {
+-	TIFF *tif;
+-	
+ 	// Open the file; the callback will set everything up
+-	tif = TIFFClientOpen(name, mode, handle,
++	TIFF *tif = TIFFClientOpen(name, mode, handle,
+ 	    _tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc,
+ 	    _tiffSizeProc, _tiffMapProc, _tiffUnmapProc);
+ 
+@@ -460,12 +463,10 @@ CreateImageType(BOOL header_only, FREE_IMAGE_TYPE fit, int width, int height, ui
+ 			}
+ 			
+ 		}
+-		else {
+-
+-			dib = FreeImage_AllocateHeader(header_only, width, height, MIN(bpp, 32), FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
++		else if (bpp <= 32) {
++			dib = FreeImage_AllocateHeader(header_only, width, height, bpp, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
+ 		}
+ 
+-
+ 	} else {
+ 		// other bitmap types
+ 		
+@@ -1067,9 +1068,12 @@ static void * DLL_CALLCONV
+ Open(FreeImageIO *io, fi_handle handle, BOOL read) {
+ 	// wrapper for TIFF I/O
+ 	fi_TIFFIO *fio = (fi_TIFFIO*)malloc(sizeof(fi_TIFFIO));
+-	if(!fio) return NULL;
++	if (!fio) {
++		return NULL;
++	}
+ 	fio->io = io;
+ 	fio->handle = handle;
++	fio->thumbnailCount = 0;
+ 
+ 	if (read) {
+ 		fio->tif = TIFFFdOpen((thandle_t)fio, "", "r");
+@@ -1125,6 +1129,27 @@ check for uncommon bitspersample values (e.g. 10, 12, ...)
+ */
+ static BOOL 
+ IsValidBitsPerSample(uint16 photometric, uint16 bitspersample, uint16 samplesperpixel) {
++	// get the pixel depth in bits
++	const uint16 pixel_depth = bitspersample * samplesperpixel;
++
++	// check for a supported pixel depth
++	switch (pixel_depth) {
++		case 1:
++		case 4:
++		case 8:
++		case 16:
++		case 24:
++		case 32:
++		case 48:
++		case 64:
++		case 96:
++		case 128:
++			// OK, go on
++			break;
++		default:
++			// unsupported pixel depth
++			return FALSE;
++	}
+ 
+ 	switch(bitspersample) {
+ 		case 1:
+@@ -1165,6 +1190,8 @@ IsValidBitsPerSample(uint16 photometric, uint16 bitspersample, uint16 samplesper
+ 		default:
+ 			return FALSE;
+ 	}
++	
++	return FALSE;
+ }
+ 
+ static TIFFLoadMethod  
+@@ -1254,16 +1281,31 @@ Read embedded thumbnail
+ static void 
+ ReadThumbnail(FreeImageIO *io, fi_handle handle, void *data, TIFF *tiff, FIBITMAP *dib) {
+ 	FIBITMAP* thumbnail = NULL;
++
++	fi_TIFFIO *fio = (fi_TIFFIO*)data;
++
++	/*
++	Thumbnail loading can cause recursions because of the way 
++	functions TIFFLastDirectory and TIFFSetSubDirectory are working.
++	We use here a hack to count the number of times the ReadThumbnail function was called. 
++	We only allow one call, check for this
++	*/
++	if (fio->thumbnailCount > 0) {
++		return;
++	}
++	else {
++		// update the thumbnail count (used to avoid recursion)
++		fio->thumbnailCount++;
++	}
+ 	
+ 	// read exif thumbnail (IFD 1) ...
+ 	
+-	/*
+-	// this code can cause unwanted recursion causing an overflow, it is thus disabled until we have a better solution
+-	// do we really need to read a thumbnail from the Exif segment ? knowing that TIFF store the thumbnail in the subIFD ...
+-	// 
+ 	toff_t exif_offset = 0;
+ 	if(TIFFGetField(tiff, TIFFTAG_EXIFIFD, &exif_offset)) {
+ 		
++		// this code can cause unwanted recursion causing an overflow, because of the way TIFFLastDirectory work
++		// => this is checked using 
++
+ 		if(!TIFFLastDirectory(tiff)) {
+ 			// save current position
+ 			const long tell_pos = io->tell_proc(handle);
+@@ -1273,15 +1315,15 @@ ReadThumbnail(FreeImageIO *io, fi_handle handle, void *data, TIFF *tiff, FIBITMA
+ 			int page = 1;
+ 			int flags = TIFF_DEFAULT;
+ 			thumbnail = Load(io, handle, page, flags, data);
++
+ 			// store the thumbnail (remember to release it before return)
+ 			FreeImage_SetThumbnail(dib, thumbnail);
+-			
++		
+ 			// restore current position
+ 			io->seek_proc(handle, tell_pos, SEEK_SET);
+ 			TIFFSetDirectory(tiff, cur_dir);
+ 		}
+ 	}
+-	*/
+ 	
+ 	// ... or read the first subIFD
+ 	
+@@ -1297,12 +1339,15 @@ ReadThumbnail(FreeImageIO *io, fi_handle handle, void *data, TIFF *tiff, FIBITMA
+ 				// save current position
+ 				const long tell_pos = io->tell_proc(handle);
+ 				const uint16 cur_dir = TIFFCurrentDirectory(tiff);
++
++				// this code can cause unwanted recursion causing an overflow, because of the way TIFFSetSubDirectory work
+ 				
+ 				if(TIFFSetSubDirectory(tiff, subIFD_offsets[0])) {
+ 					// load the thumbnail
+ 					int page = -1; 
+ 					int flags = TIFF_DEFAULT;
+ 					thumbnail = Load(io, handle, page, flags, data);
++
+ 					// store the thumbnail (remember to release it before return)
+ 					FreeImage_SetThumbnail(dib, thumbnail);
+ 				}
+@@ -2058,7 +2103,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
+ 				}
+ 
+ 				// calculate src line and dst pitch
+-				int dst_pitch = FreeImage_GetPitch(dib);
++				unsigned dst_pitch = FreeImage_GetPitch(dib);
+ 				uint32 tileRowSize = (uint32)TIFFTileRowSize(tif);
+ 				uint32 imageRowSize = (uint32)TIFFScanlineSize(tif);
+ 
+@@ -2088,7 +2133,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
+ 						BYTE *src_bits = tileBuffer;
+ 						BYTE *dst_bits = bits + rowSize;
+ 						for(int k = 0; k < nrows; k++) {
+-							memcpy(dst_bits, src_bits, src_line);
++							memcpy(dst_bits, src_bits, MIN(dst_pitch, src_line));
+ 							src_bits += tileRowSize;
+ 							dst_bits -= dst_pitch;
+ 						}

diff --git a/media-libs/freeimage/freeimage-3.18.0-r2.ebuild b/media-libs/freeimage/freeimage-3.18.0-r2.ebuild
new file mode 100644
index 00000000000..3e551b4b349
--- /dev/null
+++ b/media-libs/freeimage/freeimage-3.18.0-r2.ebuild
@@ -0,0 +1,119 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit eutils toolchain-funcs
+
+MY_PN=FreeImage
+MY_PV=${PV//.}
+MY_P=${MY_PN}${MY_PV}
+
+DESCRIPTION="Image library supporting many formats"
+HOMEPAGE="https://freeimage.sourceforge.io/"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.zip
+	mirror://sourceforge/${PN}/${MY_P}.pdf"
+
+LICENSE="|| ( GPL-2 FIPL-1.0 )"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86 ~amd64-linux ~x86-linux"
+IUSE="jpeg jpeg2k mng openexr png raw static-libs tiff webp"
+
+# The tiff/ilmbase isn't a typo.  The TIFF plugin cheats and
+# uses code from it to handle 16bit<->float conversions.
+RDEPEND="
+	sys-libs/zlib
+	jpeg? ( virtual/jpeg:0 )
+	jpeg2k? ( media-libs/openjpeg:2= )
+	mng? ( media-libs/libmng:= )
+	openexr? ( media-libs/openexr:= )
+	png? ( media-libs/libpng:0= )
+	raw? ( media-libs/libraw:= )
+	tiff? (
+		media-libs/ilmbase:=
+		media-libs/tiff:0
+	)
+	webp? ( media-libs/libwebp:= )"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	app-arch/unzip
+	virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_PN}
+
+DOCS=( "${DISTDIR}"/${MY_P}.pdf README.linux Whatsnew.txt )
+PATCHES=(
+	"${FILESDIR}"/${PN}-3.18.0-unbundling.patch
+	"${FILESDIR}"/${PN}-3.18.0-remove-jpeg-transform.patch
+	"${FILESDIR}"/${PN}-3.18.0-rename-jpeg_read_icc_profile.patch
+	"${FILESDIR}"/${PN}-3.18.0-disable-plugin-G3.patch
+	"${FILESDIR}"/${PN}-3.18.0-raw.patch
+	"${FILESDIR}"/${PN}-3.18.0-libjpeg9.patch
+	"${FILESDIR}"/${PN}-3.18.0-CVE-2019-12211-CVE-2019-12213.patch
+)
+
+src_prepare() {
+	pushd Source >/dev/null || die
+	cp LibJPEG/{transupp.c,transupp.h,jinclude.h} . || die
+	cp LibTIFF4/{tiffiop,tif_dir}.h . || die
+	rm -rf LibPNG LibMNG LibOpenJPEG ZLib OpenEXR LibRawLite LibTIFF4 LibJPEG LibWebP LibJXR || die
+	popd >/dev/null || die
+
+	edos2unix Makefile.{gnu,fip,srcs} fipMakefile.srcs */*.h */*/*.cpp
+	sed -i \
+		-e "s:/./:/:g" \
+		-e "s: ./: :g" \
+		-e 's: Source: \\\n\tSource:g' \
+		-e 's: Wrapper: \\\n\tWrapper:g' \
+		-e 's: Examples: \\\n\tExamples:g' \
+		-e 's: TestAPI: \\\n\tTestAPI:g' \
+		-e 's: -ISource: \\\n\t-ISource:g' \
+		-e 's: -IWrapper: \\\n\t-IWrapper:g' \
+		-e 's:INCLS:\nINCLS:g' \
+		Makefile.srcs fipMakefile.srcs || die
+	sed -i \
+		-e "/LibJPEG/d" \
+		-e "/LibJXR/d" \
+		-e "/LibPNG/d" \
+		-e "/LibTIFF/d" \
+		-e "/Source\/ZLib/d" \
+		-e "/LibOpenJPEG/d" \
+		-e "/OpenEXR/d" \
+		-e "/LibRawLite/d" \
+		-e "/LibMNG/d" \
+		-e "/LibWebP/d" \
+		-e "/LibJXR/d" \
+		Makefile.srcs fipMakefile.srcs || die
+
+	default
+}
+
+foreach_make() {
+	local m
+	for m in Makefile.{gnu,fip} ; do
+		emake -f ${m} \
+			USE_EXR=$(usex openexr) \
+			USE_JPEG=$(usex jpeg) \
+			USE_JPEG2K=$(usex jpeg2k) \
+			USE_MNG=$(usex mng) \
+			USE_PNG=$(usex png) \
+			USE_TIFF=$(usex tiff) \
+			USE_RAW=$(usex raw) \
+			USE_WEBP=$(usex webp) \
+			$(usex static-libs '' STATICLIB=) \
+			"$@"
+	done
+}
+
+src_compile() {
+	tc-export AR PKG_CONFIG
+	foreach_make \
+		CXX="$(tc-getCXX) -fPIC" \
+		CC="$(tc-getCC) -fPIC" \
+		${MY_PN}
+}
+
+src_install() {
+	foreach_make install DESTDIR="${ED}" INSTALLDIR="${ED}"/usr/$(get_libdir)
+	einstalldocs
+}


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/freeimage/files/, media-libs/freeimage/
@ 2020-12-29  1:05 Sam James
  0 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2020-12-29  1:05 UTC (permalink / raw
  To: gentoo-commits

commit:     4e04aa9c3a2fc91635da5023090ba023a1e4932f
Author:     Larry Pyeatt <larry.pyeatt <AT> sdsmt <DOT> edu>
AuthorDate: Mon Dec 28 22:24:36 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Dec 29 01:02:34 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4e04aa9c

media-libs/freeimage: fix build with >=media-libs/libraw-0.20.0

Signed-off-by: Larry Pyeatt <larry.pyeatt <AT> sdsmt.edu>
Closes: https://bugs.gentoo.org/734724
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/freeimage-3.18.0-libraw-0.20.0.patch     | 70 ++++++++++++++++++++++
 media-libs/freeimage/freeimage-3.18.0-r2.ebuild    |  1 +
 2 files changed, 71 insertions(+)

diff --git a/media-libs/freeimage/files/freeimage-3.18.0-libraw-0.20.0.patch b/media-libs/freeimage/files/freeimage-3.18.0-libraw-0.20.0.patch
new file mode 100644
index 00000000000..6b15a99838c
--- /dev/null
+++ b/media-libs/freeimage/files/freeimage-3.18.0-libraw-0.20.0.patch
@@ -0,0 +1,70 @@
+diff --git a/Source/FreeImage/PluginRAW.cpp b/Source/FreeImage/PluginRAW.cpp
+index b3f2a8db..ab0499ff 100644
+--- a/Source/FreeImage/PluginRAW.cpp
++++ b/Source/FreeImage/PluginRAW.cpp
+@@ -59,21 +59,18 @@ public:
+ 	}
+ 
+     int valid() { 
+-		return (_io && _handle);
++		return (_io && _handle) ? 1 : 0;
+ 	}
+ 
+     int read(void *buffer, size_t size, size_t count) { 
+-		if(substream) return substream->read(buffer, size, count);
+ 		return _io->read_proc(buffer, (unsigned)size, (unsigned)count, _handle);
+ 	}
+ 
+     int seek(INT64 offset, int origin) { 
+-        if(substream) return substream->seek(offset, origin);
+ 		return _io->seek_proc(_handle, (long)offset, origin);
+ 	}
+ 
+     INT64 tell() { 
+-		if(substream) return substream->tell();
+         return _io->tell_proc(_handle);
+     }
+ 	
+@@ -83,19 +80,21 @@ public:
+ 
+     int get_char() { 
+ 		int c = 0;
+-		if(substream) return substream->get_char();
+-		if(!_io->read_proc(&c, 1, 1, _handle)) return -1;
++		if (!_io->read_proc(&c, 1, 1, _handle)) {
++			return -1;
++		}
+ 		return c;
+    }
+ 	
+ 	char* gets(char *buffer, int length) { 
+-		if (substream) return substream->gets(buffer, length);
+ 		memset(buffer, 0, length);
+ 		for(int i = 0; i < length; i++) {
+-			if(!_io->read_proc(&buffer[i], 1, 1, _handle))
++			if (!_io->read_proc(&buffer[i], 1, 1, _handle)) {
+ 				return NULL;
+-			if(buffer[i] == 0x0A)
++			}
++			if (buffer[i] == 0x0A) {
+ 				break;
++			}
+ 		}
+ 		return buffer;
+ 	}
+@@ -104,7 +103,6 @@ public:
+ 		std::string buffer;
+ 		char element = 0;
+ 		bool bDone = false;
+-		if(substream) return substream->scanf_one(fmt,val);				
+ 		do {
+ 			if(_io->read_proc(&element, 1, 1, _handle) == 1) {
+ 				switch(element) {
+@@ -127,7 +125,6 @@ public:
+ 	}
+ 
+ 	int eof() { 
+-		if(substream) return substream->eof();
+         return (_io->tell_proc(_handle) >= _eof);
+     }
+ 

diff --git a/media-libs/freeimage/freeimage-3.18.0-r2.ebuild b/media-libs/freeimage/freeimage-3.18.0-r2.ebuild
index d8b629ca9c1..e833f947fde 100644
--- a/media-libs/freeimage/freeimage-3.18.0-r2.ebuild
+++ b/media-libs/freeimage/freeimage-3.18.0-r2.ebuild
@@ -51,6 +51,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-3.18.0-raw.patch
 	"${FILESDIR}"/${PN}-3.18.0-libjpeg9.patch
 	"${FILESDIR}"/${PN}-3.18.0-CVE-2019-12211-CVE-2019-12213.patch
+	"${FILESDIR}"/${PN}-3.18.0-libraw-0.20.0.patch
 )
 
 src_prepare() {


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/freeimage/files/, media-libs/freeimage/
@ 2022-02-15 19:51 Sam James
  0 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2022-02-15 19:51 UTC (permalink / raw
  To: gentoo-commits

commit:     c1949e9bbaf18f55016c6d8b2853f29675bd8d25
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 12 22:16:26 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Feb 15 19:50:23 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c1949e9b

media-libs/freeimage: support OpenEXR 3 / imath

Bug: https://bugs.gentoo.org/833158
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/freeimage-3.18.0-openexr-3-imath.patch   | 144 +++++++++++++++++++++
 media-libs/freeimage/freeimage-3.18.0-r4.ebuild    | 122 +++++++++++++++++
 2 files changed, 266 insertions(+)

diff --git a/media-libs/freeimage/files/freeimage-3.18.0-openexr-3-imath.patch b/media-libs/freeimage/files/freeimage-3.18.0-openexr-3-imath.patch
new file mode 100644
index 000000000000..693c71fef321
--- /dev/null
+++ b/media-libs/freeimage/files/freeimage-3.18.0-openexr-3-imath.patch
@@ -0,0 +1,144 @@
+diff --git a/Source/FreeImage/PluginEXR.cpp b/Source/FreeImage/PluginEXR.cpp
+index faa8037..e88bd2d 100644
+--- a/Source/FreeImage/PluginEXR.cpp
++++ b/Source/FreeImage/PluginEXR.cpp
+@@ -28,16 +28,32 @@
+ #pragma warning (disable : 4800) // ImfVersion.h - 'const int' : forcing value to bool 'true' or 'false' (performance warning)
+ #endif 
+ 
+-#include <ImfIO.h>
+-#include <Iex.h>
+-#include <ImfOutputFile.h>
+-#include <ImfInputFile.h>
+-#include <ImfRgbaFile.h>
+-#include <ImfChannelList.h>
+-#include <ImfRgba.h>
+-#include <ImfArray.h>
+-#include <ImfPreviewImage.h>
+-#include <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>
++
++// 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
+ 
+ 
+ // ==========================================================
+@@ -66,11 +82,11 @@ public:
+ 		return ((unsigned)n != _io->read_proc(c, 1, n, _handle));
+ 	}
+ 
+-	virtual Imath::Int64 tellg() {
++	virtual uint64_t tellg() {
+ 		return _io->tell_proc(_handle);
+ 	}
+ 
+-	virtual void seekg(Imath::Int64 pos) {
++	virtual void seekg(uint64_t pos) {
+ 		_io->seek_proc(_handle, (unsigned)pos, SEEK_SET);
+ 	}
+ 
+@@ -100,11 +116,11 @@ public:
+ 		}
+ 	}
+ 
+-	virtual Imath::Int64 tellp() {
++	virtual uint64_t tellp() {
+ 		return _io->tell_proc(_handle);
+ 	}
+ 
+-	virtual void seekp(Imath::Int64 pos) {
++	virtual void seekp(uint64_t pos) {
+ 		_io->seek_proc(_handle, (unsigned)pos, SEEK_SET);
+ 	}
+ };
+diff --git a/Source/FreeImage/PluginTIFF.cpp b/Source/FreeImage/PluginTIFF.cpp
+index b9da767..96da4d7 100644
+--- a/Source/FreeImage/PluginTIFF.cpp
++++ b/Source/FreeImage/PluginTIFF.cpp
+@@ -39,7 +39,24 @@
+ #include "Utilities.h"
+ #include "tiffiop.h"
+ #include "../Metadata/FreeImageTag.h"
+-#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/ImathVec.h>
++#   include <Imath/half.h>
++#else
++    // OpenEXR 2.x, use the old locations
++#   include <OpenEXR/ImathVec.h>
++#   include <OpenEXR/half.h>
++#endif
+ 
+ #include "FreeImageIO.h"
+ #include "PSDParser.h"
+diff --git a/Makefile.fip b/Makefile.fip
+index 60bedbc..193126d 100644
+--- a/Makefile.fip
++++ b/Makefile.fip
+@@ -28,7 +28,7 @@ LIBRARIES-$(USE_JPEG)   += -ljpeg
+ LIBRARIES-$(USE_JPEG2K) += $(shell $(PKG_CONFIG) --libs libopenjp2)
+ LIBRARIES-$(USE_MNG)    += -lmng
+ LIBRARIES-$(USE_PNG)    += $(shell $(PKG_CONFIG) --libs libpng)
+-LIBRARIES-$(USE_TIFF)   += $(shell $(PKG_CONFIG) --libs libtiff-4 IlmBase)
++LIBRARIES-$(USE_TIFF)   += $(shell $(PKG_CONFIG) --libs libtiff-4 Imath)
+ LIBRARIES-$(USE_RAW)    += $(shell $(PKG_CONFIG) --libs libraw)
+ LIBRARIES-$(USE_WEBP)    += $(shell $(PKG_CONFIG) --libs libwebp libwebpmux)
+ 
+diff --git a/Makefile.gnu b/Makefile.gnu
+index b11c554..3de5a1b 100644
+--- a/Makefile.gnu
++++ b/Makefile.gnu
+@@ -28,7 +28,7 @@ LIBRARIES-$(USE_JPEG)   += -ljpeg
+ LIBRARIES-$(USE_JPEG2K) += $(shell $(PKG_CONFIG) --libs libopenjp2)
+ LIBRARIES-$(USE_MNG)    += -lmng
+ LIBRARIES-$(USE_PNG)    += $(shell $(PKG_CONFIG) --libs libpng)
+-LIBRARIES-$(USE_TIFF)   += $(shell $(PKG_CONFIG) --libs libtiff-4 IlmBase)
++LIBRARIES-$(USE_TIFF)   += $(shell $(PKG_CONFIG) --libs libtiff-4 Imath)
+ LIBRARIES-$(USE_RAW)    += $(shell $(PKG_CONFIG) --libs libraw)
+ LIBRARIES-$(USE_WEBP)    += $(shell $(PKG_CONFIG) --libs libwebp libwebpmux)
+ 
+diff --git a/Makefile.srcs b/Makefile.srcs
+index 26e1a6d..d97eacf 100644
+--- a/Makefile.srcs
++++ b/Makefile.srcs
+@@ -180,7 +180,7 @@ INCLUDE-$(USE_JPEG)   += -DUSE_JPEG
+ INCLUDE-$(USE_JPEG2K) += -DUSE_JPEG2K $(shell $(PKG_CONFIG) --cflags-only-I libopenjp2)
+ INCLUDE-$(USE_MNG)    += -DUSE_MNG
+ INCLUDE-$(USE_PNG)    += -DUSE_PNG    $(shell $(PKG_CONFIG) --cflags-only-I libpng)
+-INCLUDE-$(USE_TIFF)   += -DUSE_TIFF   $(shell $(PKG_CONFIG) --cflags-only-I libtiff-4 IlmBase)
++INCLUDE-$(USE_TIFF)   += -DUSE_TIFF   $(shell $(PKG_CONFIG) --cflags-only-I libtiff-4 Imath)
+ INCLUDE-$(USE_RAW)    += -DUSE_RAW    $(shell $(PKG_CONFIG) --cflags-only-I libraw)
+ INCLUDE-$(USE_WEBP)   += -DUSE_WEBP   $(shell $(PKG_CONFIG) --cflags-only-I libwebp libwebpmux)
+ INCLUDE = $(INCLUDE-yes)

diff --git a/media-libs/freeimage/freeimage-3.18.0-r4.ebuild b/media-libs/freeimage/freeimage-3.18.0-r4.ebuild
new file mode 100644
index 000000000000..5d9ec9c1f57c
--- /dev/null
+++ b/media-libs/freeimage/freeimage-3.18.0-r4.ebuild
@@ -0,0 +1,122 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit edos2unix toolchain-funcs
+
+MY_PN=FreeImage
+MY_PV=${PV//.}
+MY_P=${MY_PN}${MY_PV}
+
+DESCRIPTION="Image library supporting many formats"
+HOMEPAGE="https://freeimage.sourceforge.io/"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.zip
+	mirror://sourceforge/${PN}/${MY_P}.pdf
+	https://dev.gentoo.org/~juippis/distfiles/tmp/freeimage-3.18.0-unbundling.patch"
+
+LICENSE="|| ( GPL-2 FIPL-1.0 )"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86 ~amd64-linux ~x86-linux"
+IUSE="jpeg jpeg2k mng openexr png raw static-libs tiff webp"
+
+# The tiff/ilmbase isn't a typo.  The TIFF plugin cheats and
+# uses code from it to handle 16bit<->float conversions.
+RDEPEND="
+	sys-libs/zlib
+	jpeg? ( virtual/jpeg:0 )
+	jpeg2k? ( media-libs/openjpeg:2= )
+	mng? ( media-libs/libmng:= )
+	openexr? ( media-libs/openexr:0= )
+	png? ( media-libs/libpng:0= )
+	raw? ( media-libs/libraw:= )
+	tiff? (
+		dev-libs/imath:=
+		media-libs/tiff:0
+	)
+	webp? ( media-libs/libwebp:= )"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	app-arch/unzip
+	virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_PN}
+
+DOCS=( "${DISTDIR}"/${MY_P}.pdf README.linux Whatsnew.txt )
+
+PATCHES=(
+	"${DISTDIR}"/${PN}-3.18.0-unbundling.patch
+	"${FILESDIR}"/${PN}-3.18.0-remove-jpeg-transform.patch
+	"${FILESDIR}"/${PN}-3.18.0-rename-jpeg_read_icc_profile.patch
+	"${FILESDIR}"/${PN}-3.18.0-disable-plugin-G3.patch
+	"${FILESDIR}"/${PN}-3.18.0-raw.patch
+	"${FILESDIR}"/${PN}-3.18.0-libjpeg9.patch
+	"${FILESDIR}"/${PN}-3.18.0-CVE-2019-12211-CVE-2019-12213.patch
+	"${FILESDIR}"/${PN}-3.18.0-openexr-3-imath.patch
+)
+
+src_prepare() {
+	pushd Source >/dev/null || die
+	cp LibJPEG/{transupp.c,transupp.h,jinclude.h} . || die
+	cp LibTIFF4/{tiffiop,tif_dir}.h . || die
+	rm -rf LibPNG LibMNG LibOpenJPEG ZLib OpenEXR LibRawLite LibTIFF4 LibJPEG LibWebP LibJXR || die
+	popd >/dev/null || die
+
+	edos2unix Makefile.{gnu,fip,srcs} fipMakefile.srcs */*.h */*/*.cpp
+	sed -i \
+		-e "s:/./:/:g" \
+		-e "s: ./: :g" \
+		-e 's: Source: \\\n\tSource:g' \
+		-e 's: Wrapper: \\\n\tWrapper:g' \
+		-e 's: Examples: \\\n\tExamples:g' \
+		-e 's: TestAPI: \\\n\tTestAPI:g' \
+		-e 's: -ISource: \\\n\t-ISource:g' \
+		-e 's: -IWrapper: \\\n\t-IWrapper:g' \
+		-e 's:INCLS:\nINCLS:g' \
+		Makefile.srcs fipMakefile.srcs || die
+	sed -i \
+		-e "/LibJPEG/d" \
+		-e "/LibJXR/d" \
+		-e "/LibPNG/d" \
+		-e "/LibTIFF/d" \
+		-e "/Source\/ZLib/d" \
+		-e "/LibOpenJPEG/d" \
+		-e "/OpenEXR/d" \
+		-e "/LibRawLite/d" \
+		-e "/LibMNG/d" \
+		-e "/LibWebP/d" \
+		-e "/LibJXR/d" \
+		Makefile.srcs fipMakefile.srcs || die
+
+	default
+}
+
+foreach_make() {
+	local m
+	for m in Makefile.{gnu,fip} ; do
+		emake -f ${m} \
+			USE_EXR=$(usex openexr) \
+			USE_JPEG=$(usex jpeg) \
+			USE_JPEG2K=$(usex jpeg2k) \
+			USE_MNG=$(usex mng) \
+			USE_PNG=$(usex png) \
+			USE_TIFF=$(usex tiff) \
+			USE_RAW=$(usex raw) \
+			USE_WEBP=$(usex webp) \
+			$(usex static-libs '' STATICLIB=) \
+			"$@"
+	done
+}
+
+src_compile() {
+	tc-export AR PKG_CONFIG
+	foreach_make \
+		CXX="$(tc-getCXX) -fPIC" \
+		CC="$(tc-getCC) -fPIC" \
+		${MY_PN}
+}
+
+src_install() {
+	foreach_make install DESTDIR="${ED}" INSTALLDIR="${ED}"/usr/$(get_libdir)
+	einstalldocs
+}


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/freeimage/files/, media-libs/freeimage/
@ 2022-05-30 20:27 Ionen Wolkens
  0 siblings, 0 replies; 8+ messages in thread
From: Ionen Wolkens @ 2022-05-30 20:27 UTC (permalink / raw
  To: gentoo-commits

commit:     01647baea4dca5b7c53519672abae1160e596d3f
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Mon May 30 20:13:20 2022 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Mon May 30 20:25:45 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=01647bae

media-libs/freeimage: fix revdeps when using >=tiff-4.4.0

Closes: https://bugs.gentoo.org/848531
Closes: https://bugs.gentoo.org/848534
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 .../files/freeimage-3.18.0-tiff-4.4.0.patch        |  12 ++
 media-libs/freeimage/freeimage-3.18.0-r8.ebuild    | 125 +++++++++++++++++++++
 2 files changed, 137 insertions(+)

diff --git a/media-libs/freeimage/files/freeimage-3.18.0-tiff-4.4.0.patch b/media-libs/freeimage/files/freeimage-3.18.0-tiff-4.4.0.patch
new file mode 100644
index 000000000000..a0c39064aa34
--- /dev/null
+++ b/media-libs/freeimage/files/freeimage-3.18.0-tiff-4.4.0.patch
@@ -0,0 +1,12 @@
+https://bugs.gentoo.org/848531
+https://bugs.gentoo.org/848534
+https://www.asmail.be/msg0055228425.html
+--- a/Source/Metadata/XTIFF.cpp
++++ b/Source/Metadata/XTIFF.cpp
+@@ -750,5 +750,5 @@
+ 			}
+ 			// type of storage may differ (e.g. rationnal array vs float array type)
+-			if((unsigned)_TIFFDataSize(tif_tag_type) != FreeImage_TagDataWidth(tag_type)) {
++			if((unsigned)TIFFFieldSetGetSize(fld) != FreeImage_TagDataWidth(tag_type)) {
+ 				// skip tag or _TIFFmemcpy will fail
+ 				continue;

diff --git a/media-libs/freeimage/freeimage-3.18.0-r8.ebuild b/media-libs/freeimage/freeimage-3.18.0-r8.ebuild
new file mode 100644
index 000000000000..aef7915a1072
--- /dev/null
+++ b/media-libs/freeimage/freeimage-3.18.0-r8.ebuild
@@ -0,0 +1,125 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit edos2unix toolchain-funcs
+
+MY_PN=FreeImage
+MY_PV=${PV//.}
+MY_P=${MY_PN}${MY_PV}
+
+DESCRIPTION="Image library supporting many formats"
+HOMEPAGE="https://freeimage.sourceforge.io/"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.zip
+	mirror://sourceforge/${PN}/${MY_P}.pdf
+	https://dev.gentoo.org/~juippis/distfiles/tmp/freeimage-3.18.0-unbundling.patch"
+
+LICENSE="|| ( GPL-2 FIPL-1.0 )"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86 ~amd64-linux ~x86-linux"
+IUSE="jpeg jpeg2k mng openexr png raw static-libs tiff webp"
+
+# The tiff/imath+openexr isn't a typo. The TIFF plugin cheats and
+# uses code from it to handle 16bit<->float conversions.
+RDEPEND="
+	sys-libs/zlib
+	jpeg? ( media-libs/libjpeg-turbo:= )
+	jpeg2k? ( media-libs/openjpeg:2= )
+	mng? ( media-libs/libmng:= )
+	openexr? ( media-libs/openexr:= )
+	png? ( media-libs/libpng:0= )
+	raw? ( media-libs/libraw:= )
+	tiff? (
+		>=dev-libs/imath-3.1.4-r2:=
+		>=media-libs/openexr-3:0=
+		>=media-libs/tiff-4.4.0
+	)
+	webp? ( media-libs/libwebp:= )"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	app-arch/unzip
+	virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_PN}
+
+DOCS=( "${DISTDIR}"/${MY_P}.pdf README.linux Whatsnew.txt )
+
+PATCHES=(
+	"${DISTDIR}"/${PN}-3.18.0-unbundling.patch
+	"${FILESDIR}"/${PN}-3.18.0-remove-jpeg-transform.patch
+	"${FILESDIR}"/${PN}-3.18.0-rename-jpeg_read_icc_profile.patch
+	"${FILESDIR}"/${PN}-3.18.0-disable-plugin-G3.patch
+	"${FILESDIR}"/${PN}-3.18.0-raw.patch
+	"${FILESDIR}"/${PN}-3.18.0-libjpeg9.patch
+	"${FILESDIR}"/${PN}-3.18.0-CVE-2019-12211-CVE-2019-12213.patch
+	"${FILESDIR}"/${PN}-3.18.0-openexr-3-imath.patch
+	"${FILESDIR}"/${PN}-3.18.0-libraw-0.20.0.patch
+	"${FILESDIR}"/${PN}-3.18.0-tiff-4.4.0.patch
+)
+
+src_prepare() {
+	pushd Source >/dev/null || die
+	cp LibJPEG/{transupp.c,transupp.h,jinclude.h} . || die
+	cp LibTIFF4/{tiffiop,tif_dir}.h . || die
+	rm -rf LibPNG LibMNG LibOpenJPEG ZLib OpenEXR LibRawLite LibTIFF4 LibJPEG LibWebP LibJXR || die
+	popd >/dev/null || die
+
+	edos2unix Makefile.{gnu,fip,srcs} fipMakefile.srcs */*.h */*/*.cpp
+	sed -i \
+		-e "s:/./:/:g" \
+		-e "s: ./: :g" \
+		-e 's: Source: \\\n\tSource:g' \
+		-e 's: Wrapper: \\\n\tWrapper:g' \
+		-e 's: Examples: \\\n\tExamples:g' \
+		-e 's: TestAPI: \\\n\tTestAPI:g' \
+		-e 's: -ISource: \\\n\t-ISource:g' \
+		-e 's: -IWrapper: \\\n\t-IWrapper:g' \
+		-e 's:INCLS:\nINCLS:g' \
+		Makefile.srcs fipMakefile.srcs || die
+	sed -i \
+		-e "/LibJPEG/d" \
+		-e "/LibJXR/d" \
+		-e "/LibPNG/d" \
+		-e "/LibTIFF/d" \
+		-e "/Source\/ZLib/d" \
+		-e "/LibOpenJPEG/d" \
+		-e "/OpenEXR/d" \
+		-e "/LibRawLite/d" \
+		-e "/LibMNG/d" \
+		-e "/LibWebP/d" \
+		-e "/LibJXR/d" \
+		Makefile.srcs fipMakefile.srcs || die
+
+	default
+}
+
+foreach_make() {
+	local m
+	for m in Makefile.{gnu,fip} ; do
+		emake -f ${m} \
+			USE_EXR=$(usex openexr) \
+			USE_JPEG=$(usex jpeg) \
+			USE_JPEG2K=$(usex jpeg2k) \
+			USE_MNG=$(usex mng) \
+			USE_PNG=$(usex png) \
+			USE_TIFF=$(usex tiff) \
+			USE_RAW=$(usex raw) \
+			USE_WEBP=$(usex webp) \
+			$(usex static-libs '' STATICLIB=) \
+			"$@"
+	done
+}
+
+src_compile() {
+	tc-export AR PKG_CONFIG
+	foreach_make \
+		CXX="$(tc-getCXX) -fPIC" \
+		CC="$(tc-getCC) -fPIC" \
+		${MY_PN}
+}
+
+src_install() {
+	foreach_make install DESTDIR="${ED}" INSTALLDIR="${ED}"/usr/$(get_libdir)
+	einstalldocs
+}


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/freeimage/files/, media-libs/freeimage/
@ 2022-06-16 21:14 Sam James
  0 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2022-06-16 21:14 UTC (permalink / raw
  To: gentoo-commits

commit:     a6bf07acc01f5848f2b0b7c17b93e05611a651b5
Author:     Alfred Persson Forsberg <cat <AT> catcream <DOT> org>
AuthorDate: Thu Jun 16 18:54:32 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun 16 21:08:49 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a6bf07ac

media-libs/freeimage: fix build with musl 1.2.3

FreeImage relies on NULL being 0, while on musl for stdc++ >= 11 it is
defined as nullptr. This breaks the build for musl.
Returning FALSE here is correct.

Closes: https://bugs.gentoo.org/841973
Signed-off-by: Alfred Persson Forsberg <cat <AT> catcream.org>
Closes: https://github.com/gentoo/gentoo/pull/25926
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/freeimage-3.18.0-null-to-false.patch     | 22 ++++++++++++++++++++++
 media-libs/freeimage/freeimage-3.18.0-r8.ebuild    |  1 +
 2 files changed, 23 insertions(+)

diff --git a/media-libs/freeimage/files/freeimage-3.18.0-null-to-false.patch b/media-libs/freeimage/files/freeimage-3.18.0-null-to-false.patch
new file mode 100644
index 000000000000..3e8e13a40b3c
--- /dev/null
+++ b/media-libs/freeimage/files/freeimage-3.18.0-null-to-false.patch
@@ -0,0 +1,22 @@
+https://bugs.gentoo.org/841973
+
+See also:
+https://sourceforge.net/p/freeimage/mailman/message/37668470/
+https://git.alpinelinux.org/aports/commit/?id=9b938a7b38ea4b8d9a73f1bf0d90ee45bbfa9139
+
+diff --git a/Source/FreeImage/PluginPSD.cpp b/Source/FreeImage/PluginPSD.cpp
+index e5b5ffa..d9de81f 100644
+--- a/Source/FreeImage/PluginPSD.cpp
++++ b/Source/FreeImage/PluginPSD.cpp
+@@ -127,7 +127,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
+ static BOOL DLL_CALLCONV
+ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data) {
+ 	if(!handle) {
+-		return NULL;
++		return FALSE;
+ 	}
+ 	try {
+ 		psdParser parser;
+-- 
+2.35.1
+

diff --git a/media-libs/freeimage/freeimage-3.18.0-r8.ebuild b/media-libs/freeimage/freeimage-3.18.0-r8.ebuild
index aef7915a1072..826ed42b593c 100644
--- a/media-libs/freeimage/freeimage-3.18.0-r8.ebuild
+++ b/media-libs/freeimage/freeimage-3.18.0-r8.ebuild
@@ -56,6 +56,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-3.18.0-openexr-3-imath.patch
 	"${FILESDIR}"/${PN}-3.18.0-libraw-0.20.0.patch
 	"${FILESDIR}"/${PN}-3.18.0-tiff-4.4.0.patch
+	"${FILESDIR}"/${PN}-3.18.0-null-to-false.patch
 )
 
 src_prepare() {


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/freeimage/files/, media-libs/freeimage/
@ 2022-12-22  9:55 Ionen Wolkens
  0 siblings, 0 replies; 8+ messages in thread
From: Ionen Wolkens @ 2022-12-22  9:55 UTC (permalink / raw
  To: gentoo-commits

commit:     0835197ed52e7862bb0b72172930444a4ae2a421
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 22 09:51:13 2022 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Thu Dec 22 09:53:52 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0835197e

media-libs/freeimage: fix build with libraw-0.21

Closes: https://bugs.gentoo.org/887467
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 media-libs/freeimage/files/freeimage-3.18.0-libraw-0.21.patch | 11 +++++++++++
 media-libs/freeimage/freeimage-3.18.0-r10.ebuild              |  1 +
 2 files changed, 12 insertions(+)

diff --git a/media-libs/freeimage/files/freeimage-3.18.0-libraw-0.21.patch b/media-libs/freeimage/files/freeimage-3.18.0-libraw-0.21.patch
new file mode 100644
index 000000000000..3005bf44d623
--- /dev/null
+++ b/media-libs/freeimage/files/freeimage-3.18.0-libraw-0.21.patch
@@ -0,0 +1,11 @@
+https://bugs.gentoo.org/887467
+--- a/Source/FreeImage/PluginRAW.cpp
++++ b/Source/FreeImage/PluginRAW.cpp
+@@ -693,3 +693,7 @@
+ 		// (-s [0..N-1]) Select one raw image from input file
++		#if LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(0, 21)
++		RawProcessor->imgdata.rawparams.shot_select = 0;
++		#else
+ 		RawProcessor->imgdata.params.shot_select = 0;
++		#endif
+ 		// (-w) Use camera white balance, if possible (otherwise, fallback to auto_wb)

diff --git a/media-libs/freeimage/freeimage-3.18.0-r10.ebuild b/media-libs/freeimage/freeimage-3.18.0-r10.ebuild
index bdfe70e999ad..24e12d89db37 100644
--- a/media-libs/freeimage/freeimage-3.18.0-r10.ebuild
+++ b/media-libs/freeimage/freeimage-3.18.0-r10.ebuild
@@ -57,6 +57,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-3.18.0-libraw-0.20.0.patch
 	"${FILESDIR}"/${PN}-3.18.0-tiff-4.4.0.patch
 	"${FILESDIR}"/${PN}-3.18.0-null-to-false.patch
+	"${FILESDIR}"/${PN}-3.18.0-libraw-0.21.patch
 )
 
 src_prepare() {


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-12-22  9:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-26 20:26 [gentoo-commits] repo/gentoo:master commit in: media-libs/freeimage/files/, media-libs/freeimage/ James Le Cuirot
  -- strict thread matches above, loose matches on Subject: below --
2022-12-22  9:55 Ionen Wolkens
2022-06-16 21:14 Sam James
2022-05-30 20:27 Ionen Wolkens
2022-02-15 19:51 Sam James
2020-12-29  1:05 Sam James
2020-07-19 12:02 James Le Cuirot
2019-04-14 16:25 James Le Cuirot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox