Gentoo Archives: gentoo-commits

From: James Le Cuirot <chewi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/freeimage/files/, media-libs/freeimage/
Date: Tue, 26 Nov 2019 20:26:46
Message-Id: 1574799983.bd034ff8887960d9351529ab7fbae2b4754e4eea.chewi@gentoo
1 commit: bd034ff8887960d9351529ab7fbae2b4754e4eea
2 Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
3 AuthorDate: Tue Nov 26 20:26:23 2019 +0000
4 Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
5 CommitDate: Tue Nov 26 20:26:23 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bd034ff8
7
8 media-libs/freeimage: Drop old 3.15.4-r1
9
10 Closes: https://bugs.gentoo.org/663614
11 Package-Manager: Portage-2.3.79, Repoman-2.3.17
12 Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
13
14 media-libs/freeimage/Manifest | 2 -
15 .../files/freeimage-3.15.4-CVE-2015-0852.patch | 214 -------
16 .../files/freeimage-3.15.4-CVE-2016-5684-1.patch | 23 -
17 .../files/freeimage-3.15.4-CVE-2016-5684-2.patch | 11 -
18 .../files/freeimage-3.15.4-libjpeg-turbo.patch | 531 -----------------
19 .../files/freeimage-3.15.4-libjpeg9.patch | 45 --
20 .../freeimage/files/freeimage-3.15.4-raw.patch | 16 -
21 .../files/freeimage-3.15.4-unbundling.patch | 639 ---------------------
22 media-libs/freeimage/freeimage-3.15.4-r1.ebuild | 116 ----
23 9 files changed, 1597 deletions(-)
24
25 diff --git a/media-libs/freeimage/Manifest b/media-libs/freeimage/Manifest
26 index d7eb8ba5764..292f9ee3c9d 100644
27 --- a/media-libs/freeimage/Manifest
28 +++ b/media-libs/freeimage/Manifest
29 @@ -1,4 +1,2 @@
30 -DIST FreeImage3154.pdf 1007480 BLAKE2B 801d39c4b7eeab833c7225c2d53a3a0e8e9d2a91ea3f7173047705c8b750706f3a4a9ac60f7ba9d5e8150b548bd5add242e9e40f498c57ad9e5a623972bbb239 SHA512 cebde5e2609c9a0c06b4e07e1c595d7d6714895095cd9935f59c8b2ff9b34116248f5453b41f469f6242d87cae79be82d59f6a9ec0f75b1ea3df61ac1f651b28
31 -DIST FreeImage3154.zip 5513923 BLAKE2B 376b00faaae2c10c9eb36f89726a022734e109ca7ca11951c9e6525f21d2a7ee305ec195be29a272ecb7935ba5d0b61f3d84f26a6aec5f7a9229d5e47cd665bb SHA512 0db9eb7d0ed8e08e10ff4fa274c4484541ca119c3d437a85fdc3b2d9232bf14a7877c79b1e62c8c99278d7020a9f623c161f2342475f3ee526233404138112cc
32 DIST FreeImage3180.pdf 1665541 BLAKE2B 5d40ee6fa0a1e73df0cc961edbd70a2835ef88fb540f123fd81f2bb826d4c949d2a60dfe3fc02406ce632a389935abac0d471c963c9803b8c2aece2b48afb003 SHA512 632f68b14f7a5916a1b95bbf86c268d0afe786a2537472301bb002254aa3195f046efb41f073133633211e985e90edbb99285ab6f42bc55501c756292a3c4c03
33 DIST FreeImage3180.zip 7415716 BLAKE2B b695271f4e80eb304eccde66e38b5095eceae51fbe0dd97df69c55f364f8440d8c97139b8edc2f01c400f5c53a7336fdfab1e28aa3ea04f485901d5def443d25 SHA512 9d9cc7e2d57552c3115e277aeb036e0455204d389026b17a3f513da5be1fd595421655488bb1ec2f76faebed66049119ca55e26e2a6d37024b3fb7ef36ad4818
34
35 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
36 deleted file mode 100644
37 index e0c4b0cf19c..00000000000
38 --- a/media-libs/freeimage/files/freeimage-3.15.4-CVE-2015-0852.patch
39 +++ /dev/null
40 @@ -1,214 +0,0 @@
41 ---- a/Source/FreeImage/PluginPCX.cpp
42 -+++ b/Source/FreeImage/PluginPCX.cpp
43 -@@ -30,7 +30,7 @@
44 - // Constants + headers
45 - // ----------------------------------------------------------
46 -
47 --#define IO_BUF_SIZE 2048
48 -+#define PCX_IO_BUF_SIZE 2048
49 -
50 - // ----------------------------------------------------------
51 -
52 -@@ -120,17 +120,17 @@
53 -
54 - while (length--) {
55 - if (count == 0) {
56 -- if (*ReadPos >= IO_BUF_SIZE - 1 ) {
57 -- if (*ReadPos == IO_BUF_SIZE - 1) {
58 -+ if (*ReadPos >= PCX_IO_BUF_SIZE - 1 ) {
59 -+ if (*ReadPos == PCX_IO_BUF_SIZE - 1) {
60 - // we still have one BYTE, copy it to the start pos
61 -
62 -- *ReadBuf = ReadBuf[IO_BUF_SIZE - 1];
63 -+ *ReadBuf = ReadBuf[PCX_IO_BUF_SIZE - 1];
64 -
65 -- io.read_proc(ReadBuf + 1, 1, IO_BUF_SIZE - 1, handle);
66 -+ io.read_proc(ReadBuf + 1, 1, PCX_IO_BUF_SIZE - 1, handle);
67 - } else {
68 - // read the complete buffer
69 -
70 -- io.read_proc(ReadBuf, 1, IO_BUF_SIZE, handle);
71 -+ io.read_proc(ReadBuf, 1, PCX_IO_BUF_SIZE, handle);
72 - }
73 -
74 - *ReadPos = 0;
75 -@@ -346,19 +346,9 @@
76 - BOOL header_only = (flags & FIF_LOAD_NOPIXELS) == FIF_LOAD_NOPIXELS;
77 -
78 - try {
79 -- // check PCX identifier
80 --
81 -- long start_pos = io->tell_proc(handle);
82 -- BOOL validated = pcx_validate(io, handle);
83 -- io->seek_proc(handle, start_pos, SEEK_SET);
84 -- if(!validated) {
85 -- throw FI_MSG_ERROR_MAGIC_NUMBER;
86 -- }
87 --
88 -- // process the header
89 --
90 - PCXHEADER header;
91 -
92 -+ // process the header
93 - if(io->read_proc(&header, sizeof(PCXHEADER), 1, handle) != 1) {
94 - throw FI_MSG_ERROR_PARSING;
95 - }
96 -@@ -366,20 +356,38 @@
97 - SwapHeader(&header);
98 - #endif
99 -
100 -- // allocate a new DIB
101 -+ // process the window
102 -+ const WORD *window = header.window; // left, upper, right,lower pixel coord.
103 -+ const int left = window[0];
104 -+ const int top = window[1];
105 -+ const int right = window[2];
106 -+ const int bottom = window[3];
107 -
108 -- unsigned width = header.window[2] - header.window[0] + 1;
109 -- unsigned height = header.window[3] - header.window[1] + 1;
110 -- unsigned bitcount = header.bpp * header.planes;
111 -+ // check image size
112 -+ if((left >= right) || (top >= bottom)) {
113 -+ throw FI_MSG_ERROR_PARSING;
114 -+ }
115 -
116 -- if (bitcount == 24) {
117 -- dib = FreeImage_AllocateHeader(header_only, width, height, bitcount, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
118 -- } else {
119 -- dib = FreeImage_AllocateHeader(header_only, width, height, bitcount);
120 -+ const unsigned width = right - left + 1;
121 -+ const unsigned height = bottom - top + 1;
122 -+ const unsigned bitcount = header.bpp * header.planes;
123 -+
124 -+ // allocate a new dib
125 -+ switch(bitcount) {
126 -+ case 1:
127 -+ case 4:
128 -+ case 8:
129 -+ dib = FreeImage_AllocateHeader(header_only, width, height, bitcount);
130 -+ break;
131 -+ case 24:
132 -+ dib = FreeImage_AllocateHeader(header_only, width, height, bitcount, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
133 -+ break;
134 -+ default:
135 -+ throw FI_MSG_ERROR_DIB_MEMORY;
136 -+ break;
137 - }
138 -
139 - // if the dib couldn't be allocated, throw an error
140 --
141 - if (!dib) {
142 - throw FI_MSG_ERROR_DIB_MEMORY;
143 - }
144 -@@ -426,19 +434,23 @@
145 -
146 - if (palette_id == 0x0C) {
147 - BYTE *cmap = (BYTE*)malloc(768 * sizeof(BYTE));
148 -- io->read_proc(cmap, 768, 1, handle);
149 -
150 -- pal = FreeImage_GetPalette(dib);
151 -- BYTE *pColormap = &cmap[0];
152 -+ if(cmap) {
153 -+ io->read_proc(cmap, 768, 1, handle);
154 -
155 -- for(int i = 0; i < 256; i++) {
156 -- pal[i].rgbRed = pColormap[0];
157 -- pal[i].rgbGreen = pColormap[1];
158 -- pal[i].rgbBlue = pColormap[2];
159 -- pColormap += 3;
160 -+ pal = FreeImage_GetPalette(dib);
161 -+ BYTE *pColormap = &cmap[0];
162 -+
163 -+ for(int i = 0; i < 256; i++) {
164 -+ pal[i].rgbRed = pColormap[0];
165 -+ pal[i].rgbGreen = pColormap[1];
166 -+ pal[i].rgbBlue = pColormap[2];
167 -+ pColormap += 3;
168 -+ }
169 -+
170 -+ free(cmap);
171 - }
172 -
173 -- free(cmap);
174 - }
175 -
176 - // wrong palette ID, perhaps a gray scale is needed ?
177 -@@ -463,12 +475,12 @@
178 - return dib;
179 - }
180 -
181 -- // calculate the line length for the PCX and the DIB
182 -+ // calculate the line length for the PCX and the dib
183 -
184 - // length of raster line in bytes
185 -- unsigned linelength = header.bytes_per_line * header.planes;
186 -- // length of DIB line (rounded to DWORD) in bytes
187 -- unsigned pitch = FreeImage_GetPitch(dib);
188 -+ const unsigned linelength = header.bytes_per_line * header.planes;
189 -+ // length of dib line (rounded to DWORD) in bytes
190 -+ const unsigned pitch = FreeImage_GetPitch(dib);
191 -
192 - // run-length encoding ?
193 -
194 -@@ -478,14 +490,18 @@
195 - // ---------------
196 -
197 - line = (BYTE*)malloc(linelength * sizeof(BYTE));
198 -- if(!line) throw FI_MSG_ERROR_MEMORY;
199 -+ if(!line) {
200 -+ throw FI_MSG_ERROR_MEMORY;
201 -+ }
202 -
203 -- ReadBuf = (BYTE*)malloc(IO_BUF_SIZE * sizeof(BYTE));
204 -- if(!ReadBuf) throw FI_MSG_ERROR_MEMORY;
205 -+ ReadBuf = (BYTE*)malloc(PCX_IO_BUF_SIZE * sizeof(BYTE));
206 -+ if(!ReadBuf) {
207 -+ throw FI_MSG_ERROR_MEMORY;
208 -+ }
209 -
210 - bits = FreeImage_GetScanLine(dib, height - 1);
211 -
212 -- int ReadPos = IO_BUF_SIZE;
213 -+ int ReadPos = PCX_IO_BUF_SIZE;
214 -
215 - if ((header.planes == 1) && ((header.bpp == 1) || (header.bpp == 8))) {
216 - BYTE skip;
217 -@@ -497,7 +513,7 @@
218 - // skip trailing garbage at the end of the scanline
219 -
220 - for (unsigned count = written; count < linelength; count++) {
221 -- if (ReadPos < IO_BUF_SIZE) {
222 -+ if (ReadPos < PCX_IO_BUF_SIZE) {
223 - ReadPos++;
224 - } else {
225 - io->read_proc(&skip, sizeof(BYTE), 1, handle);
226 -@@ -513,7 +529,9 @@
227 - unsigned x, y, written;
228 -
229 - buffer = (BYTE*)malloc(width * sizeof(BYTE));
230 -- if(!buffer) throw FI_MSG_ERROR_MEMORY;
231 -+ if(!buffer) {
232 -+ throw FI_MSG_ERROR_MEMORY;
233 -+ }
234 -
235 - for (y = 0; y < height; y++) {
236 - written = readline(*io, handle, line, linelength, bIsRLE, ReadBuf, &ReadPos);
237 -@@ -532,7 +550,7 @@
238 - }
239 - }
240 -
241 -- // then write the DIB row
242 -+ // then write the dib row
243 -
244 - for (x = 0; x < width / 2; x++) {
245 - bits[x] = (buffer[2*x] << 4) | buffer[2*x+1];
246 -@@ -541,7 +559,7 @@
247 - // skip trailing garbage at the end of the scanline
248 -
249 - for (unsigned count = written; count < linelength; count++) {
250 -- if (ReadPos < IO_BUF_SIZE) {
251 -+ if (ReadPos < PCX_IO_BUF_SIZE) {
252 - ReadPos++;
253 - } else {
254 - io->read_proc(&skip, sizeof(BYTE), 1, handle);
255
256 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
257 deleted file mode 100644
258 index 1e94602e0e5..00000000000
259 --- a/media-libs/freeimage/files/freeimage-3.15.4-CVE-2016-5684-1.patch
260 +++ /dev/null
261 @@ -1,23 +0,0 @@
262 ---- a/Source/FreeImage/PluginXPM.cpp
263 -+++ b/Source/FreeImage/PluginXPM.cpp
264 -@@ -181,6 +181,11 @@
265 - }
266 - free(str);
267 -
268 -+ // check info string
269 -+ if((width <= 0) || (height <= 0) || (colors <= 0) || (cpp <= 0)) {
270 -+ throw "Improperly formed info string";
271 -+ }
272 -+
273 - if (colors > 256) {
274 - dib = FreeImage_AllocateHeader(header_only, width, height, 24, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
275 - } else {
276 -@@ -193,7 +198,7 @@
277 - FILE_RGBA rgba;
278 -
279 - str = ReadString(io, handle);
280 -- if(!str)
281 -+ if(!str || (strlen(str) < cpp))
282 - throw "Error reading color strings";
283 -
284 - std::string chrs(str,cpp); //create a string for the color chars using the first cpp chars
285
286 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
287 deleted file mode 100644
288 index 542a9aeab09..00000000000
289 --- a/media-libs/freeimage/files/freeimage-3.15.4-CVE-2016-5684-2.patch
290 +++ /dev/null
291 @@ -1,11 +0,0 @@
292 ---- a/Source/FreeImage/PluginXPM.cpp
293 -+++ b/Source/FreeImage/PluginXPM.cpp
294 -@@ -198,7 +198,7 @@
295 - FILE_RGBA rgba;
296 -
297 - str = ReadString(io, handle);
298 -- if(!str || (strlen(str) < cpp))
299 -+ if(!str || (strlen(str) < (size_t)cpp))
300 - throw "Error reading color strings";
301 -
302 - std::string chrs(str,cpp); //create a string for the color chars using the first cpp chars
303
304 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
305 deleted file mode 100644
306 index 62037c59deb..00000000000
307 --- a/media-libs/freeimage/files/freeimage-3.15.4-libjpeg-turbo.patch
308 +++ /dev/null
309 @@ -1,531 +0,0 @@
310 ---- /dev/null
311 -+++ b/LibJPEG/jpegcomp.h
312 -@@ -0,0 +1,26 @@
313 -+/*
314 -+ * jpegcomp.h
315 -+ *
316 -+ * Copyright (C) 2010, D. R. Commander
317 -+ * For conditions of distribution and use, see the accompanying README file.
318 -+ *
319 -+ * JPEG compatibility macros
320 -+ * These declarations are considered internal to the JPEG library; most
321 -+ * applications using the library shouldn't need to include this file.
322 -+ */
323 -+
324 -+#if JPEG_LIB_VERSION >= 70
325 -+#define _DCT_scaled_size DCT_h_scaled_size
326 -+#define _min_DCT_scaled_size min_DCT_h_scaled_size
327 -+#define _min_DCT_h_scaled_size min_DCT_h_scaled_size
328 -+#define _min_DCT_v_scaled_size min_DCT_v_scaled_size
329 -+#define _jpeg_width jpeg_width
330 -+#define _jpeg_height jpeg_height
331 -+#else
332 -+#define _DCT_scaled_size DCT_scaled_size
333 -+#define _min_DCT_scaled_size min_DCT_scaled_size
334 -+#define _min_DCT_h_scaled_size min_DCT_scaled_size
335 -+#define _min_DCT_v_scaled_size min_DCT_scaled_size
336 -+#define _jpeg_width image_width
337 -+#define _jpeg_height image_height
338 -+#endif
339 ---- a/LibJPEG/jpegint.h
340 -+++ b/LibJPEG/jpegint.h
341 -@@ -2,7 +2,7 @@
342 - * jpegint.h
343 - *
344 - * Copyright (C) 1991-1997, Thomas G. Lane.
345 -- * Modified 1997-2011 by Guido Vollbeding.
346 -+ * Modified 1997-2009 by Guido Vollbeding.
347 - * This file is part of the Independent JPEG Group's software.
348 - * For conditions of distribution and use, see the accompanying README file.
349 - *
350 -@@ -100,16 +100,14 @@
351 - };
352 -
353 - /* Forward DCT (also controls coefficient quantization) */
354 --typedef JMETHOD(void, forward_DCT_ptr,
355 -- (j_compress_ptr cinfo, jpeg_component_info * compptr,
356 -- JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
357 -- JDIMENSION start_row, JDIMENSION start_col,
358 -- JDIMENSION num_blocks));
359 --
360 - struct jpeg_forward_dct {
361 - JMETHOD(void, start_pass, (j_compress_ptr cinfo));
362 -- /* It is useful to allow each component to have a separate FDCT method. */
363 -- forward_DCT_ptr forward_DCT[MAX_COMPONENTS];
364 -+ /* perhaps this should be an array??? */
365 -+ JMETHOD(void, forward_DCT, (j_compress_ptr cinfo,
366 -+ jpeg_component_info * compptr,
367 -+ JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
368 -+ JDIMENSION start_row, JDIMENSION start_col,
369 -+ JDIMENSION num_blocks));
370 - };
371 -
372 - /* Entropy encoding */
373 -@@ -213,6 +211,10 @@
374 - JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
375 - JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo,
376 - JBLOCKROW *MCU_data));
377 -+
378 -+ /* This is here to share code between baseline and progressive decoders; */
379 -+ /* other modules probably should not use it */
380 -+ boolean insufficient_data; /* set TRUE after emitting warning */
381 - };
382 -
383 - /* Inverse DCT (also performs dequantization) */
384 -@@ -302,6 +304,7 @@
385 - #define jinit_downsampler jIDownsampler
386 - #define jinit_forward_dct jIFDCT
387 - #define jinit_huff_encoder jIHEncoder
388 -+#define jinit_phuff_encoder jIPHEncoder
389 - #define jinit_arith_encoder jIAEncoder
390 - #define jinit_marker_writer jIMWriter
391 - #define jinit_master_decompress jIDMaster
392 -@@ -311,6 +314,7 @@
393 - #define jinit_input_controller jIInCtlr
394 - #define jinit_marker_reader jIMReader
395 - #define jinit_huff_decoder jIHDecoder
396 -+#define jinit_phuff_decoder jIPHDecoder
397 - #define jinit_arith_decoder jIADecoder
398 - #define jinit_inverse_dct jIIDCT
399 - #define jinit_upsampler jIUpsampler
400 -@@ -321,41 +325,15 @@
401 - #define jinit_memory_mgr jIMemMgr
402 - #define jdiv_round_up jDivRound
403 - #define jround_up jRound
404 --#define jzero_far jZeroFar
405 - #define jcopy_sample_rows jCopySamples
406 - #define jcopy_block_row jCopyBlocks
407 -+#define jzero_far jZeroFar
408 - #define jpeg_zigzag_order jZIGTable
409 - #define jpeg_natural_order jZAGTable
410 --#define jpeg_natural_order7 jZAG7Table
411 --#define jpeg_natural_order6 jZAG6Table
412 --#define jpeg_natural_order5 jZAG5Table
413 --#define jpeg_natural_order4 jZAG4Table
414 --#define jpeg_natural_order3 jZAG3Table
415 --#define jpeg_natural_order2 jZAG2Table
416 - #define jpeg_aritab jAriTab
417 - #endif /* NEED_SHORT_EXTERNAL_NAMES */
418 -
419 -
420 --/* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays
421 -- * and coefficient-block arrays. This won't work on 80x86 because the arrays
422 -- * are FAR and we're assuming a small-pointer memory model. However, some
423 -- * DOS compilers provide far-pointer versions of memcpy() and memset() even
424 -- * in the small-model libraries. These will be used if USE_FMEM is defined.
425 -- * Otherwise, the routines in jutils.c do it the hard way.
426 -- */
427 --
428 --#ifndef NEED_FAR_POINTERS /* normal case, same as regular macro */
429 --#define FMEMZERO(target,size) MEMZERO(target,size)
430 --#else /* 80x86 case */
431 --#ifdef USE_FMEM
432 --#define FMEMZERO(target,size) _fmemset((void FAR *)(target), 0, (size_t)(size))
433 --#else
434 --EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero));
435 --#define FMEMZERO(target,size) jzero_far(target, size)
436 --#endif
437 --#endif
438 --
439 --
440 - /* Compression module initialization routines */
441 - EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo));
442 - EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo,
443 -@@ -370,6 +348,7 @@
444 - EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo));
445 - EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo));
446 - EXTERN(void) jinit_huff_encoder JPP((j_compress_ptr cinfo));
447 -+EXTERN(void) jinit_phuff_encoder JPP((j_compress_ptr cinfo));
448 - EXTERN(void) jinit_arith_encoder JPP((j_compress_ptr cinfo));
449 - EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo));
450 - /* Decompression module initialization routines */
451 -@@ -383,6 +362,7 @@
452 - EXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo));
453 - EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo));
454 - EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo));
455 -+EXTERN(void) jinit_phuff_decoder JPP((j_decompress_ptr cinfo));
456 - EXTERN(void) jinit_arith_decoder JPP((j_decompress_ptr cinfo));
457 - EXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo));
458 - EXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo));
459 -@@ -401,17 +381,12 @@
460 - int num_rows, JDIMENSION num_cols));
461 - EXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row,
462 - JDIMENSION num_blocks));
463 -+EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero));
464 - /* Constant tables in jutils.c */
465 - #if 0 /* This table is not actually needed in v6a */
466 - extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */
467 - #endif
468 - extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */
469 --extern const int jpeg_natural_order7[]; /* zz to natural order for 7x7 block */
470 --extern const int jpeg_natural_order6[]; /* zz to natural order for 6x6 block */
471 --extern const int jpeg_natural_order5[]; /* zz to natural order for 5x5 block */
472 --extern const int jpeg_natural_order4[]; /* zz to natural order for 4x4 block */
473 --extern const int jpeg_natural_order3[]; /* zz to natural order for 3x3 block */
474 --extern const int jpeg_natural_order2[]; /* zz to natural order for 2x2 block */
475 -
476 - /* Arithmetic coding probability estimation tables in jaricom.c */
477 - extern const INT32 jpeg_aritab[];
478 ---- a/LibJPEG/transupp.h
479 -+++ b/LibJPEG/transupp.h
480 -@@ -1,7 +1,7 @@
481 - /*
482 - * transupp.h
483 - *
484 -- * Copyright (C) 1997-2011, Thomas G. Lane, Guido Vollbeding.
485 -+ * Copyright (C) 1997-2009, Thomas G. Lane, Guido Vollbeding.
486 - * This file is part of the Independent JPEG Group's software.
487 - * For conditions of distribution and use, see the accompanying README file.
488 - *
489 -@@ -57,7 +57,6 @@
490 - * corner up and/or left to make it so, simultaneously increasing the region
491 - * dimensions to keep the lower right crop corner unchanged. (Thus, the
492 - * output image covers at least the requested region, but may cover more.)
493 -- * The adjustment of the region dimensions may be optionally disabled.
494 - *
495 - * We also provide a lossless-resize option, which is kind of a lossless-crop
496 - * operation in the DCT coefficient block domain - it discards higher-order
497 -@@ -107,15 +106,13 @@
498 -
499 - /*
500 - * Codes for crop parameters, which can individually be unspecified,
501 -- * positive or negative for xoffset or yoffset,
502 -- * positive or forced for width or height.
503 -+ * positive, or negative. (Negative width or height makes no sense, though.)
504 - */
505 -
506 - typedef enum {
507 -- JCROP_UNSET,
508 -- JCROP_POS,
509 -- JCROP_NEG,
510 -- JCROP_FORCE
511 -+ JCROP_UNSET,
512 -+ JCROP_POS,
513 -+ JCROP_NEG
514 - } JCROP_CODE;
515 -
516 - /*
517 -@@ -131,14 +128,21 @@
518 - boolean trim; /* if TRUE, trim partial MCUs as needed */
519 - boolean force_grayscale; /* if TRUE, convert color image to grayscale */
520 - boolean crop; /* if TRUE, crop source image */
521 -+ boolean slow_hflip; /* For best performance, the JXFORM_FLIP_H transform
522 -+ normally modifies the source coefficients in place.
523 -+ Setting this to TRUE will instead use a slower,
524 -+ double-buffered algorithm, which leaves the source
525 -+ coefficients in tact (necessary if other transformed
526 -+ images must be generated from the same set of
527 -+ coefficients. */
528 -
529 - /* Crop parameters: application need not set these unless crop is TRUE.
530 - * These can be filled in by jtransform_parse_crop_spec().
531 - */
532 - JDIMENSION crop_width; /* Width of selected region */
533 -- JCROP_CODE crop_width_set; /* (forced disables adjustment) */
534 -+ JCROP_CODE crop_width_set;
535 - JDIMENSION crop_height; /* Height of selected region */
536 -- JCROP_CODE crop_height_set; /* (forced disables adjustment) */
537 -+ JCROP_CODE crop_height_set;
538 - JDIMENSION crop_xoffset; /* X offset of selected region */
539 - JCROP_CODE crop_xoffset_set; /* (negative measures from right edge) */
540 - JDIMENSION crop_yoffset; /* Y offset of selected region */
541 ---- a/LibJPEG/transupp.c
542 -+++ b/LibJPEG/transupp.c
543 -@@ -1,7 +1,8 @@
544 - /*
545 - * transupp.c
546 - *
547 -- * Copyright (C) 1997-2011, Thomas G. Lane, Guido Vollbeding.
548 -+ * Copyright (C) 1997-2009, Thomas G. Lane, Guido Vollbeding.
549 -+ * Copyright (C) 2010, D. R. Commander.
550 - * This file is part of the Independent JPEG Group's software.
551 - * For conditions of distribution and use, see the accompanying README file.
552 - *
553 -@@ -20,9 +21,19 @@
554 - #include "jinclude.h"
555 - #include "jpeglib.h"
556 - #include "transupp.h" /* My own external interface */
557 -+#include "jpegcomp.h"
558 - #include <ctype.h> /* to declare isdigit() */
559 -
560 -
561 -+#if JPEG_LIB_VERSION >= 70
562 -+#define dstinfo_min_DCT_h_scaled_size dstinfo->min_DCT_h_scaled_size
563 -+#define dstinfo_min_DCT_v_scaled_size dstinfo->min_DCT_v_scaled_size
564 -+#else
565 -+#define dstinfo_min_DCT_h_scaled_size DCTSIZE
566 -+#define dstinfo_min_DCT_v_scaled_size DCTSIZE
567 -+#endif
568 -+
569 -+
570 - #if TRANSFORMS_SUPPORTED
571 -
572 - /*
573 -@@ -134,7 +145,7 @@
574 - * Partial iMCUs at the right edge are left untouched.
575 - */
576 - MCU_cols = srcinfo->output_width /
577 -- (dstinfo->max_h_samp_factor * dstinfo->min_DCT_h_scaled_size);
578 -+ (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
579 -
580 - for (ci = 0; ci < dstinfo->num_components; ci++) {
581 - compptr = dstinfo->comp_info + ci;
582 -@@ -200,7 +211,7 @@
583 - * this is essentially the same as the routine above.
584 - */
585 - MCU_cols = srcinfo->output_width /
586 -- (dstinfo->max_h_samp_factor * dstinfo->min_DCT_h_scaled_size);
587 -+ (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
588 -
589 - for (ci = 0; ci < dstinfo->num_components; ci++) {
590 - compptr = dstinfo->comp_info + ci;
591 -@@ -265,7 +276,7 @@
592 - * Partial iMCUs at the bottom edge are copied verbatim.
593 - */
594 - MCU_rows = srcinfo->output_height /
595 -- (dstinfo->max_v_samp_factor * dstinfo->min_DCT_v_scaled_size);
596 -+ (dstinfo->max_v_samp_factor * dstinfo_min_DCT_v_scaled_size);
597 -
598 - for (ci = 0; ci < dstinfo->num_components; ci++) {
599 - compptr = dstinfo->comp_info + ci;
600 -@@ -393,7 +404,7 @@
601 - * not mirrored.
602 - */
603 - MCU_cols = srcinfo->output_height /
604 -- (dstinfo->max_h_samp_factor * dstinfo->min_DCT_h_scaled_size);
605 -+ (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
606 -
607 - for (ci = 0; ci < dstinfo->num_components; ci++) {
608 - compptr = dstinfo->comp_info + ci;
609 -@@ -474,7 +485,7 @@
610 - * not mirrored.
611 - */
612 - MCU_rows = srcinfo->output_width /
613 -- (dstinfo->max_v_samp_factor * dstinfo->min_DCT_v_scaled_size);
614 -+ (dstinfo->max_v_samp_factor * dstinfo_min_DCT_v_scaled_size);
615 -
616 - for (ci = 0; ci < dstinfo->num_components; ci++) {
617 - compptr = dstinfo->comp_info + ci;
618 -@@ -542,9 +553,9 @@
619 - jpeg_component_info *compptr;
620 -
621 - MCU_cols = srcinfo->output_width /
622 -- (dstinfo->max_h_samp_factor * dstinfo->min_DCT_h_scaled_size);
623 -+ (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
624 - MCU_rows = srcinfo->output_height /
625 -- (dstinfo->max_v_samp_factor * dstinfo->min_DCT_v_scaled_size);
626 -+ (dstinfo->max_v_samp_factor * dstinfo_min_DCT_v_scaled_size);
627 -
628 - for (ci = 0; ci < dstinfo->num_components; ci++) {
629 - compptr = dstinfo->comp_info + ci;
630 -@@ -653,9 +664,9 @@
631 - jpeg_component_info *compptr;
632 -
633 - MCU_cols = srcinfo->output_height /
634 -- (dstinfo->max_h_samp_factor * dstinfo->min_DCT_h_scaled_size);
635 -+ (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
636 - MCU_rows = srcinfo->output_width /
637 -- (dstinfo->max_v_samp_factor * dstinfo->min_DCT_v_scaled_size);
638 -+ (dstinfo->max_v_samp_factor * dstinfo_min_DCT_v_scaled_size);
639 -
640 - for (ci = 0; ci < dstinfo->num_components; ci++) {
641 - compptr = dstinfo->comp_info + ci;
642 -@@ -771,7 +782,7 @@
643 - * The routine returns TRUE if the spec string is valid, FALSE if not.
644 - *
645 - * The crop spec string should have the format
646 -- * <width>[f]x<height>[f]{+-}<xoffset>{+-}<yoffset>
647 -+ * <width>x<height>{+-}<xoffset>{+-}<yoffset>
648 - * where width, height, xoffset, and yoffset are unsigned integers.
649 - * Each of the elements can be omitted to indicate a default value.
650 - * (A weakness of this style is that it is not possible to omit xoffset
651 -@@ -793,22 +804,14 @@
652 - /* fetch width */
653 - if (! jt_read_integer(&spec, &info->crop_width))
654 - return FALSE;
655 -- if (*spec == 'f' || *spec == 'F') {
656 -- spec++;
657 -- info->crop_width_set = JCROP_FORCE;
658 -- } else
659 -- info->crop_width_set = JCROP_POS;
660 -+ info->crop_width_set = JCROP_POS;
661 - }
662 -- if (*spec == 'x' || *spec == 'X') {
663 -+ if (*spec == 'x' || *spec == 'X') {
664 - /* fetch height */
665 - spec++;
666 - if (! jt_read_integer(&spec, &info->crop_height))
667 - return FALSE;
668 -- if (*spec == 'f' || *spec == 'F') {
669 -- spec++;
670 -- info->crop_height_set = JCROP_FORCE;
671 -- } else
672 -- info->crop_height_set = JCROP_POS;
673 -+ info->crop_height_set = JCROP_POS;
674 - }
675 - if (*spec == '+' || *spec == '-') {
676 - /* fetch xoffset */
677 -@@ -897,7 +900,12 @@
678 - info->num_components = srcinfo->num_components;
679 -
680 - /* Compute output image dimensions and related values. */
681 -+#if JPEG_LIB_VERSION >= 80
682 - jpeg_core_output_dimensions(srcinfo);
683 -+#else
684 -+ srcinfo->output_width = srcinfo->image_width;
685 -+ srcinfo->output_height = srcinfo->image_height;
686 -+#endif
687 -
688 - /* Return right away if -perfect is given and transformation is not perfect.
689 - */
690 -@@ -905,15 +913,15 @@
691 - if (info->num_components == 1) {
692 - if (!jtransform_perfect_transform(srcinfo->output_width,
693 - srcinfo->output_height,
694 -- srcinfo->min_DCT_h_scaled_size,
695 -- srcinfo->min_DCT_v_scaled_size,
696 -+ srcinfo->_min_DCT_h_scaled_size,
697 -+ srcinfo->_min_DCT_v_scaled_size,
698 - info->transform))
699 - return FALSE;
700 - } else {
701 - if (!jtransform_perfect_transform(srcinfo->output_width,
702 - srcinfo->output_height,
703 -- srcinfo->max_h_samp_factor * srcinfo->min_DCT_h_scaled_size,
704 -- srcinfo->max_v_samp_factor * srcinfo->min_DCT_v_scaled_size,
705 -+ srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size,
706 -+ srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size,
707 - info->transform))
708 - return FALSE;
709 - }
710 -@@ -932,26 +940,26 @@
711 - info->output_width = srcinfo->output_height;
712 - info->output_height = srcinfo->output_width;
713 - if (info->num_components == 1) {
714 -- info->iMCU_sample_width = srcinfo->min_DCT_v_scaled_size;
715 -- info->iMCU_sample_height = srcinfo->min_DCT_h_scaled_size;
716 -+ info->iMCU_sample_width = srcinfo->_min_DCT_v_scaled_size;
717 -+ info->iMCU_sample_height = srcinfo->_min_DCT_h_scaled_size;
718 - } else {
719 - info->iMCU_sample_width =
720 -- srcinfo->max_v_samp_factor * srcinfo->min_DCT_v_scaled_size;
721 -+ srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size;
722 - info->iMCU_sample_height =
723 -- srcinfo->max_h_samp_factor * srcinfo->min_DCT_h_scaled_size;
724 -+ srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size;
725 - }
726 - break;
727 - default:
728 - info->output_width = srcinfo->output_width;
729 - info->output_height = srcinfo->output_height;
730 - if (info->num_components == 1) {
731 -- info->iMCU_sample_width = srcinfo->min_DCT_h_scaled_size;
732 -- info->iMCU_sample_height = srcinfo->min_DCT_v_scaled_size;
733 -+ info->iMCU_sample_width = srcinfo->_min_DCT_h_scaled_size;
734 -+ info->iMCU_sample_height = srcinfo->_min_DCT_v_scaled_size;
735 - } else {
736 - info->iMCU_sample_width =
737 -- srcinfo->max_h_samp_factor * srcinfo->min_DCT_h_scaled_size;
738 -+ srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size;
739 - info->iMCU_sample_height =
740 -- srcinfo->max_v_samp_factor * srcinfo->min_DCT_v_scaled_size;
741 -+ srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size;
742 - }
743 - break;
744 - }
745 -@@ -988,16 +996,10 @@
746 - else
747 - yoffset = info->crop_yoffset;
748 - /* Now adjust so that upper left corner falls at an iMCU boundary */
749 -- if (info->crop_width_set == JCROP_FORCE)
750 -- info->output_width = info->crop_width;
751 -- else
752 -- info->output_width =
753 -- info->crop_width + (xoffset % info->iMCU_sample_width);
754 -- if (info->crop_height_set == JCROP_FORCE)
755 -- info->output_height = info->crop_height;
756 -- else
757 -- info->output_height =
758 -- info->crop_height + (yoffset % info->iMCU_sample_height);
759 -+ info->output_width =
760 -+ info->crop_width + (xoffset % info->iMCU_sample_width);
761 -+ info->output_height =
762 -+ info->crop_height + (yoffset % info->iMCU_sample_height);
763 - /* Save x/y offsets measured in iMCUs */
764 - info->x_crop_offset = xoffset / info->iMCU_sample_width;
765 - info->y_crop_offset = yoffset / info->iMCU_sample_height;
766 -@@ -1020,7 +1022,7 @@
767 - case JXFORM_FLIP_H:
768 - if (info->trim)
769 - trim_right_edge(info, srcinfo->output_width);
770 -- if (info->y_crop_offset != 0)
771 -+ if (info->y_crop_offset != 0 || info->slow_hflip)
772 - need_workspace = TRUE;
773 - /* do_flip_h_no_crop doesn't need a workspace array */
774 - break;
775 -@@ -1124,9 +1126,11 @@
776 - jtemp = dstinfo->image_width;
777 - dstinfo->image_width = dstinfo->image_height;
778 - dstinfo->image_height = jtemp;
779 -+#if JPEG_LIB_VERSION >= 70
780 - itemp = dstinfo->min_DCT_h_scaled_size;
781 - dstinfo->min_DCT_h_scaled_size = dstinfo->min_DCT_v_scaled_size;
782 - dstinfo->min_DCT_v_scaled_size = itemp;
783 -+#endif
784 -
785 - /* Transpose sampling factors */
786 - for (ci = 0; ci < dstinfo->num_components; ci++) {
787 -@@ -1362,8 +1366,10 @@
788 - /* Correct the destination's image dimensions as necessary
789 - * for rotate/flip, resize, and crop operations.
790 - */
791 -+#if JPEG_LIB_VERSION >= 70
792 - dstinfo->jpeg_width = info->output_width;
793 - dstinfo->jpeg_height = info->output_height;
794 -+#endif
795 -
796 - /* Transpose destination image parameters */
797 - switch (info->transform) {
798 -@@ -1371,9 +1377,17 @@
799 - case JXFORM_TRANSVERSE:
800 - case JXFORM_ROT_90:
801 - case JXFORM_ROT_270:
802 -+#if JPEG_LIB_VERSION < 70
803 -+ dstinfo->image_width = info->output_height;
804 -+ dstinfo->image_height = info->output_width;
805 -+#endif
806 - transpose_critical_parameters(dstinfo);
807 - break;
808 - default:
809 -+#if JPEG_LIB_VERSION < 70
810 -+ dstinfo->image_width = info->output_width;
811 -+ dstinfo->image_height = info->output_height;
812 -+#endif
813 - break;
814 - }
815 -
816 -@@ -1389,6 +1403,7 @@
817 - GETJOCTET(srcinfo->marker_list->data[5]) == 0) {
818 - /* Suppress output of JFIF marker */
819 - dstinfo->write_JFIF_header = FALSE;
820 -+#if JPEG_LIB_VERSION >= 70
821 - /* Adjust Exif image parameters */
822 - if (dstinfo->jpeg_width != srcinfo->image_width ||
823 - dstinfo->jpeg_height != srcinfo->image_height)
824 -@@ -1396,6 +1411,7 @@
825 - adjust_exif_parameters(srcinfo->marker_list->data + 6,
826 - srcinfo->marker_list->data_length - 6,
827 - dstinfo->jpeg_width, dstinfo->jpeg_height);
828 -+#endif
829 - }
830 -
831 - /* Return the appropriate output data set */
832 -@@ -1432,7 +1448,7 @@
833 - src_coef_arrays, dst_coef_arrays);
834 - break;
835 - case JXFORM_FLIP_H:
836 -- if (info->y_crop_offset != 0)
837 -+ if (info->y_crop_offset != 0 || info->slow_hflip)
838 - do_flip_h(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
839 - src_coef_arrays, dst_coef_arrays);
840 - else
841
842 diff --git a/media-libs/freeimage/files/freeimage-3.15.4-libjpeg9.patch b/media-libs/freeimage/files/freeimage-3.15.4-libjpeg9.patch
843 deleted file mode 100644
844 index 24eb9e010fc..00000000000
845 --- a/media-libs/freeimage/files/freeimage-3.15.4-libjpeg9.patch
846 +++ /dev/null
847 @@ -1,45 +0,0 @@
848 -Bug: https://bugs.gentoo.org/647422
849 -Upstream Patch: https://sourceforge.net/p/freeimage/patches/130/
850 -
851 -diff -Naur a/Source/FreeImage/PluginJPEG.cpp b/Source/FreeImage/PluginJPEG.cpp
852 ---- a/Source/FreeImage/PluginJPEG.cpp 2018-03-24 23:24:11.062695375 -0400
853 -+++ b/Source/FreeImage/PluginJPEG.cpp 2018-03-24 23:25:39.451124161 -0400
854 -@@ -1586,14 +1586,14 @@
855 -
856 - // thumbnail support (JFIF 1.02 extension markers)
857 - if(FreeImage_GetThumbnail(dib) != NULL) {
858 -- cinfo.write_JFIF_header = 1; //<### force it, though when color is CMYK it will be incorrect
859 -+ cinfo.write_JFIF_header = static_cast<boolean>(1); //<### force it, though when color is CMYK it will be incorrect
860 - cinfo.JFIF_minor_version = 2;
861 - }
862 -
863 - // baseline JPEG support
864 - if ((flags & JPEG_BASELINE) == JPEG_BASELINE) {
865 -- cinfo.write_JFIF_header = 0; // No marker for non-JFIF colorspaces
866 -- cinfo.write_Adobe_marker = 0; // write no Adobe marker by default
867 -+ cinfo.write_JFIF_header = static_cast<boolean>(0); // No marker for non-JFIF colorspaces
868 -+ cinfo.write_Adobe_marker = static_cast<boolean>(0); // write no Adobe marker by default
869 - }
870 -
871 - // set subsampling options if required
872 -diff -Naur a/Source/FreeImage.h b/Source/FreeImage.h
873 ---- a/Source/FreeImage.h 2018-03-24 23:24:11.066695395 -0400
874 -+++ b/Source/FreeImage.h 2018-03-24 23:26:35.945391182 -0400
875 -@@ -117,12 +117,17 @@
876 - #ifndef _WINDOWS_
877 - #define _WINDOWS_
878 -
879 -+#if JPEG_LIB_VERSION < 90
880 -+
881 - #ifndef FALSE
882 - #define FALSE 0
883 - #endif
884 - #ifndef TRUE
885 - #define TRUE 1
886 - #endif
887 -+
888 -+#endif
889 -+
890 - #ifndef NULL
891 - #define NULL 0
892 - #endif
893
894 diff --git a/media-libs/freeimage/files/freeimage-3.15.4-raw.patch b/media-libs/freeimage/files/freeimage-3.15.4-raw.patch
895 deleted file mode 100644
896 index 44f566627e2..00000000000
897 --- a/media-libs/freeimage/files/freeimage-3.15.4-raw.patch
898 +++ /dev/null
899 @@ -1,16 +0,0 @@
900 -https://bugs.gentoo.org/show_bug.cgi?id=458516
901 -
902 ---- FreeImage/Source/FreeImage.h
903 -+++ FreeImage/Source/FreeImage.h
904 -@@ -141,8 +141,10 @@
905 - typedef uint16_t WORD;
906 - typedef uint32_t DWORD;
907 - typedef int32_t LONG;
908 -+#ifndef _LIBRAW_TYPES_H
909 - typedef int64_t INT64;
910 - typedef uint64_t UINT64;
911 -+#endif
912 - #else
913 - // MS is not C99 ISO compliant
914 - typedef long BOOL;
915 -
916
917 diff --git a/media-libs/freeimage/files/freeimage-3.15.4-unbundling.patch b/media-libs/freeimage/files/freeimage-3.15.4-unbundling.patch
918 deleted file mode 100644
919 index ac2ac54ce5c..00000000000
920 --- a/media-libs/freeimage/files/freeimage-3.15.4-unbundling.patch
921 +++ /dev/null
922 @@ -1,639 +0,0 @@
923 -lots of fixes here:
924 - - use system graphics libraries
925 - - make all of them optional
926 - - drop root users from install (fix user installs)
927 - - make static lib build optional
928 - - link with CXX and CXXFLAGS (since this is C++ code)
929 -
930 ---- a/Makefile.gnu
931 -+++ b/Makefile.gnu
932 -@@ -11,7 +11,24 @@
933 - # Converts cr/lf to just lf
934 - DOS2UNIX = dos2unix
935 -
936 --LIBRARIES = -lstdc++
937 -+PKG_CONFIG ?= pkg-config
938 -+
939 -+USE_EXR ?= yes
940 -+USE_JPEG ?= yes
941 -+USE_JPEG2K ?= yes
942 -+USE_MNG ?= yes
943 -+USE_PNG ?= yes
944 -+USE_TIFF ?= yes
945 -+USE_RAW ?= yes
946 -+
947 -+LIBRARIES-yes = $(shell $(PKG_CONFIG) --libs zlib)
948 -+LIBRARIES-$(USE_EXR) += $(shell $(PKG_CONFIG) --libs OpenEXR)
949 -+LIBRARIES-$(USE_JPEG) += -ljpeg
950 -+LIBRARIES-$(USE_JPEG2K) += $(shell $(PKG_CONFIG) --libs libopenjpeg)
951 -+LIBRARIES-$(USE_MNG) += -lmng
952 -+LIBRARIES-$(USE_PNG) += $(shell $(PKG_CONFIG) --libs libpng)
953 -+LIBRARIES-$(USE_TIFF) += $(shell $(PKG_CONFIG) --libs libtiff-4 IlmBase)
954 -+LIBRARIES-$(USE_RAW) += $(shell $(PKG_CONFIG) --libs libraw)
955 -
956 - MODULES = $(SRCS:.c=.o)
957 - MODULES := $(MODULES:.cpp=.o)
958 -@@ -64,13 +81,15 @@
959 - $(AR) r $@ $(MODULES)
960 -
961 - $(SHAREDLIB): $(MODULES)
962 -- $(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
963 -+ $(CXX) $(CXXFLAGS) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES-yes)
964 -
965 - install:
966 - install -d $(INCDIR) $(INSTALLDIR)
967 -- install -m 644 -o root -g root $(HEADER) $(INCDIR)
968 -- install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
969 -- install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
970 -+ install -m 644 $(HEADER) $(INCDIR)
971 -+ifneq ($(STATICLIB),)
972 -+ install -m 644 $(STATICLIB) $(INSTALLDIR)
973 -+endif
974 -+ install -m 755 $(SHAREDLIB) $(INSTALLDIR)
975 - ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
976 - ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
977 - # ldconfig
978 ---- a/Source/FreeImage/J2KHelper.cpp
979 -+++ b/Source/FreeImage/J2KHelper.cpp
980 -@@ -21,7 +21,7 @@
981 -
982 - #include "FreeImage.h"
983 - #include "Utilities.h"
984 --#include "../LibOpenJPEG/openjpeg.h"
985 -+#include <openjpeg.h>
986 -
987 - /**
988 - Divide an integer by a power of 2 and round upwards
989 ---- a/Source/FreeImage/PluginEXR.cpp
990 -+++ b/Source/FreeImage/PluginEXR.cpp
991 -@@ -22,16 +22,16 @@
992 -
993 - #include "FreeImage.h"
994 - #include "Utilities.h"
995 --#include "../OpenEXR/IlmImf/ImfIO.h"
996 --#include "../OpenEXR/Iex/Iex.h"
997 --#include "../OpenEXR/IlmImf/ImfOutputFile.h"
998 --#include "../OpenEXR/IlmImf/ImfInputFile.h"
999 --#include "../OpenEXR/IlmImf/ImfRgbaFile.h"
1000 --#include "../OpenEXR/IlmImf/ImfChannelList.h"
1001 --#include "../OpenEXR/IlmImf/ImfRgba.h"
1002 --#include "../OpenEXR/IlmImf/ImfArray.h"
1003 --#include "../OpenEXR/IlmImf/ImfPreviewImage.h"
1004 --#include "../OpenEXR/Half/half.h"
1005 -+#include <ImfIO.h>
1006 -+#include <Iex.h>
1007 -+#include <ImfOutputFile.h>
1008 -+#include <ImfInputFile.h>
1009 -+#include <ImfRgbaFile.h>
1010 -+#include <ImfChannelList.h>
1011 -+#include <ImfRgba.h>
1012 -+#include <ImfArray.h>
1013 -+#include <ImfPreviewImage.h>
1014 -+#include <half.h>
1015 -
1016 -
1017 - // ==========================================================
1018 ---- a/Source/FreeImage/PluginJ2K.cpp
1019 -+++ b/Source/FreeImage/PluginJ2K.cpp
1020 -@@ -21,7 +21,7 @@
1021 -
1022 - #include "FreeImage.h"
1023 - #include "Utilities.h"
1024 --#include "../LibOpenJPEG/openjpeg.h"
1025 -+#include <openjpeg.h>
1026 -
1027 - // ==========================================================
1028 - // Plugin Interface
1029 ---- a/Source/FreeImage/PluginJP2.cpp
1030 -+++ b/Source/FreeImage/PluginJP2.cpp
1031 -@@ -21,7 +21,7 @@
1032 -
1033 - #include "FreeImage.h"
1034 - #include "Utilities.h"
1035 --#include "../LibOpenJPEG/openjpeg.h"
1036 -+#include <openjpeg.h>
1037 -
1038 - // ==========================================================
1039 - // Plugin Interface
1040 ---- a/Source/FreeImage/PluginPNG.cpp
1041 -+++ b/Source/FreeImage/PluginPNG.cpp
1042 -@@ -37,8 +37,8 @@
1043 -
1044 - // ----------------------------------------------------------
1045 -
1046 --#include "../ZLib/zlib.h"
1047 --#include "../LibPNG/png.h"
1048 -+#include <zlib.h>
1049 -+#include <png.h>
1050 -
1051 - // ----------------------------------------------------------
1052 -
1053 ---- a/Source/transupp.c
1054 -+++ b/Source/transupp.c
1055 -@@ -15,8 +15,7 @@
1056 - /* Although this file really shouldn't have access to the library internals,
1057 - * it's helpful to let it call jround_up() and jcopy_block_row().
1058 - */
1059 --#define JPEG_INTERNALS
1060 --
1061 -+#include <jerror.h>
1062 - #include "jinclude.h"
1063 - #include "jpeglib.h"
1064 - #include "transupp.h" /* My own external interface */
1065 ---- a/Source/FreeImage/ZLibInterface.cpp
1066 -+++ b/Source/FreeImage/ZLibInterface.cpp
1067 -@@ -19,10 +19,10 @@
1068 - // Use at your own risk!
1069 - // ==========================================================
1070 -
1071 --#include "../ZLib/zlib.h"
1072 -+#include <zlib.h>
1073 - #include "FreeImage.h"
1074 - #include "Utilities.h"
1075 --#include "../ZLib/zutil.h" /* must be the last header because of error C3163 in VS2008 (_vsnprintf defined in stdio.h) */
1076 -+#define OS_CODE 0x03
1077 -
1078 - /**
1079 - Compresses a source buffer into a target buffer, using the ZLib library.
1080 ---- a/Source/FreeImage/PluginG3.cpp
1081 -+++ b/Source/FreeImage/PluginG3.cpp
1082 -@@ -20,7 +20,7 @@
1083 - // Use at your own risk!
1084 - // ==========================================================
1085 -
1086 --#include "../LibTIFF4/tiffiop.h"
1087 -+#include "tiffiop.h"
1088 -
1089 - #include "FreeImage.h"
1090 - #include "Utilities.h"
1091 ---- a/Source/FreeImage/PluginJPEG.cpp
1092 -+++ b/Source/FreeImage/PluginJPEG.cpp
1093 -@@ -35,11 +35,15 @@
1094 - #undef FAR
1095 - #include <setjmp.h>
1096 -
1097 --#include "../LibJPEG/jinclude.h"
1098 --#include "../LibJPEG/jpeglib.h"
1099 --#include "../LibJPEG/jerror.h"
1100 -+#include <string.h>
1101 -+#include <stdio.h>
1102 -+#include <jconfig.h>
1103 -+#include <jpeglib.h>
1104 -+#include <jerror.h>
1105 - }
1106 -
1107 -+#define SIZEOF(object) ((size_t) sizeof(object))
1108 -+
1109 - #include "FreeImage.h"
1110 - #include "Utilities.h"
1111 -
1112 ---- a/Source/FreeImageToolkit/JPEGTransform.cpp
1113 -+++ b/Source/FreeImageToolkit/JPEGTransform.cpp
1114 -@@ -25,10 +25,11 @@
1115 - #undef FAR
1116 - #include <setjmp.h>
1117 -
1118 --#include "../LibJPEG/jinclude.h"
1119 --#include "../LibJPEG/jpeglib.h"
1120 --#include "../LibJPEG/jerror.h"
1121 --#include "../LibJPEG/transupp.h"
1122 -+#include <string.h>
1123 -+#include <stdio.h>
1124 -+#include <jpeglib.h>
1125 -+#include <jerror.h>
1126 -+#include "transupp.h"
1127 - }
1128 -
1129 - #include "FreeImage.h"
1130 ---- a/Makefile.fip
1131 -+++ b/Makefile.fip
1132 -@@ -11,7 +11,24 @@
1133 - # Converts cr/lf to just lf
1134 - DOS2UNIX = dos2unix
1135 -
1136 --LIBRARIES = -lstdc++
1137 -+PKG_CONFIG ?= pkg-config
1138 -+
1139 -+USE_EXR ?= yes
1140 -+USE_JPEG ?= yes
1141 -+USE_JPEG2K ?= yes
1142 -+USE_MNG ?= yes
1143 -+USE_PNG ?= yes
1144 -+USE_TIFF ?= yes
1145 -+USE_RAW ?= yes
1146 -+
1147 -+LIBRARIES-yes = $(shell $(PKG_CONFIG) --libs zlib)
1148 -+LIBRARIES-$(USE_EXR) += $(shell $(PKG_CONFIG) --libs OpenEXR)
1149 -+LIBRARIES-$(USE_JPEG) += -ljpeg
1150 -+LIBRARIES-$(USE_JPEG2K) += $(shell $(PKG_CONFIG) --libs libopenjpeg)
1151 -+LIBRARIES-$(USE_MNG) += -lmng
1152 -+LIBRARIES-$(USE_PNG) += $(shell $(PKG_CONFIG) --libs libpng)
1153 -+LIBRARIES-$(USE_TIFF) += $(shell $(PKG_CONFIG) --libs libtiff-4 IlmBase)
1154 -+LIBRARIES-$(USE_RAW) += $(shell $(PKG_CONFIG) --libs libraw)
1155 -
1156 - MODULES = $(SRCS:.c=.o)
1157 - MODULES := $(MODULES:.cpp=.o)
1158 -@@ -65,14 +82,18 @@
1159 - $(AR) r $@ $(MODULES)
1160 -
1161 - $(SHAREDLIB): $(MODULES)
1162 -- $(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
1163 -+ $(CXX) $(CXXFLAGS) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES-yes)
1164 -
1165 - install:
1166 - install -d $(INCDIR) $(INSTALLDIR)
1167 -- install -m 644 -o root -g root $(HEADER) $(INCDIR)
1168 -- install -m 644 -o root -g root $(HEADERFIP) $(INCDIR)
1169 -- install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
1170 -- install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
1171 -+ install -m 644 $(HEADER) $(INCDIR)
1172 -+ install -m 644 $(HEADERFIP) $(INCDIR)
1173 -+ifneq ($(STATICLIB),)
1174 -+ install -m 644 $(STATICLIB) $(INSTALLDIR)
1175 -+endif
1176 -+ install -m 755 $(SHAREDLIB) $(INSTALLDIR)
1177 -+ ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
1178 -+ ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
1179 -
1180 - clean:
1181 - rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
1182 ---- a/Makefile.srcs
1183 -+++ b/Makefile.srcs
1184 -@@ -1,6 +1,14 @@
1185 -+USE_EXR ?= yes
1186 -+USE_JPEG ?= yes
1187 -+USE_JPEG2K ?= yes
1188 -+USE_MNG ?= yes
1189 -+USE_PNG ?= yes
1190 -+USE_TIFF ?= yes
1191 -+USE_RAW ?= yes
1192 -+
1193 - VER_MAJOR = 3
1194 - VER_MINOR = 15.4
1195 --SRCS = \
1196 -+SRCS-yes = \
1197 - Source/FreeImage/BitmapAccess.cpp \
1198 - Source/FreeImage/ColorLookup.cpp \
1199 - Source/FreeImage/FreeImage.cpp \
1200 -@@ -17,36 +25,74 @@ SRCS = \
1201 - Source/FreeImage/GetType.cpp \
1202 - Source/FreeImage/MemoryIO.cpp \
1203 - Source/FreeImage/PixelAccess.cpp \
1204 -+
1205 -+SRCS-$(USE_JPEG2K) += \
1206 - Source/FreeImage/J2KHelper.cpp \
1207 -+
1208 -+SRCS-$(USE_MNG) += \
1209 - Source/FreeImage/MNGHelper.cpp \
1210 -+
1211 -+SRCS-yes += \
1212 - Source/FreeImage/Plugin.cpp \
1213 - Source/FreeImage/PluginBMP.cpp \
1214 - Source/FreeImage/PluginCUT.cpp \
1215 - Source/FreeImage/PluginDDS.cpp \
1216 -+
1217 -+SRCS-$(USE_EXR) += \
1218 - Source/FreeImage/PluginEXR.cpp \
1219 -+
1220 -+SRCS-$(USE_TIFF) += \
1221 - Source/FreeImage/PluginG3.cpp \
1222 -+
1223 -+SRCS-yes += \
1224 - Source/FreeImage/PluginGIF.cpp \
1225 - Source/FreeImage/PluginHDR.cpp \
1226 - Source/FreeImage/PluginICO.cpp \
1227 - Source/FreeImage/PluginIFF.cpp \
1228 -+
1229 -+SRCS-$(USE_JPEG2K) += \
1230 - Source/FreeImage/PluginJ2K.cpp \
1231 -+
1232 -+SRCS-$(USE_MNG) += \
1233 - Source/FreeImage/PluginJNG.cpp \
1234 -+
1235 -+SRCS-$(USE_JPEG2K) += \
1236 - Source/FreeImage/PluginJP2.cpp \
1237 -+
1238 -+SRCS-$(USE_JPEG) += \
1239 - Source/FreeImage/PluginJPEG.cpp \
1240 -+
1241 -+SRCS-yes += \
1242 - Source/FreeImage/PluginKOALA.cpp \
1243 -+
1244 -+SRCS-$(USE_MNG) += \
1245 - Source/FreeImage/PluginMNG.cpp \
1246 -+
1247 -+SRCS-yes += \
1248 - Source/FreeImage/PluginPCD.cpp \
1249 - Source/FreeImage/PluginPCX.cpp \
1250 - Source/FreeImage/PluginPFM.cpp \
1251 - Source/FreeImage/PluginPICT.cpp \
1252 -+
1253 -+SRCS-$(USE_PNG) += \
1254 - Source/FreeImage/PluginPNG.cpp \
1255 -+
1256 -+SRCS-yes += \
1257 - Source/FreeImage/PluginPNM.cpp \
1258 - Source/FreeImage/PluginPSD.cpp \
1259 - Source/FreeImage/PluginRAS.cpp \
1260 -+
1261 -+SRCS-$(USE_RAW) += \
1262 - Source/FreeImage/PluginRAW.cpp \
1263 -+
1264 -+SRCS-yes += \
1265 - Source/FreeImage/PluginSGI.cpp \
1266 - Source/FreeImage/PluginTARGA.cpp \
1267 -+
1268 -+SRCS-$(USE_TIFF) += \
1269 - Source/FreeImage/PluginTIFF.cpp \
1270 -+
1271 -+SRCS-yes += \
1272 - Source/FreeImage/PluginWBMP.cpp \
1273 - Source/FreeImage/PluginXBM.cpp \
1274 - Source/FreeImage/PluginXPM.cpp \
1275 -@@ -83,7 +129,11 @@ SRCS = \
1276 - Source/Metadata/IPTC.cpp \
1277 - Source/Metadata/TagConversion.cpp \
1278 - Source/Metadata/TagLib.cpp \
1279 -+
1280 -+SRCS-$(USE_TIFF) += \
1281 - Source/Metadata/XTIFF.cpp \
1282 -+
1283 -+SRCS-yes += \
1284 - Source/FreeImageToolkit/Background.cpp \
1285 - Source/FreeImageToolkit/BSplineRotate.cpp \
1286 - Source/FreeImageToolkit/Channels.cpp \
1287 -@@ -92,10 +142,18 @@ SRCS = \
1288 - Source/FreeImageToolkit/CopyPaste.cpp \
1289 - Source/FreeImageToolkit/Display.cpp \
1290 - Source/FreeImageToolkit/Flip.cpp \
1291 -+
1292 -+SRCS-$(USE_JPEG) += \
1293 - Source/FreeImageToolkit/JPEGTransform.cpp \
1294 -+
1295 -+SRCS-yes += \
1296 - Source/FreeImageToolkit/MultigridPoissonSolver.cpp \
1297 - Source/FreeImageToolkit/Rescale.cpp \
1298 - Source/FreeImageToolkit/Resize.cpp \
1299 -+
1300 -+SRCS-$(USE_JPEG) += \
1301 -+ Source/transupp.c
1302 -+SRCS = $(SRCS-yes)
1303 - INCLS = \
1304 - Examples/OpenGL/TextureManager/TextureManager.h \
1305 - Examples/Plugin/PluginCradle.h \
1306 -@@ -116,7 +174,17 @@
1307 - Wrapper/FreeImagePlus/test/fipTest.h \
1308 - TestAPI/TestSuite.h
1309 -
1310 --INCLUDE = -I. \
1311 -+INCLUDE-yes = -I. \
1312 - -ISource \
1313 - -ISource/Metadata \
1314 - -ISource/FreeImageToolkit \
1315 -+
1316 -+INCLUDE-yes += $(shell $(PKG_CONFIG) --cflags-only-I zlib)
1317 -+INCLUDE-$(USE_EXR) += -DUSE_EXR $(shell $(PKG_CONFIG) --cflags-only-I OpenEXR)
1318 -+INCLUDE-$(USE_JPEG) += -DUSE_JPEG
1319 -+INCLUDE-$(USE_JPEG2K) += -DUSE_JPEG2K $(shell $(PKG_CONFIG) --cflags-only-I libopenjpeg)
1320 -+INCLUDE-$(USE_MNG) += -DUSE_MNG
1321 -+INCLUDE-$(USE_PNG) += -DUSE_PNG $(shell $(PKG_CONFIG) --cflags-only-I libpng)
1322 -+INCLUDE-$(USE_TIFF) += -DUSE_TIFF $(shell $(PKG_CONFIG) --cflags-only-I libtiff-4 IlmBase)
1323 -+INCLUDE-$(USE_RAW) += -DUSE_RAW $(shell $(PKG_CONFIG) --cflags-only-I libraw)
1324 -+INCLUDE = $(INCLUDE-yes)
1325 ---- a/fipMakefile.srcs
1326 -+++ b/fipMakefile.srcs
1327 -@@ -1,6 +1,14 @@
1328 -+USE_EXR ?= yes
1329 -+USE_JPEG ?= yes
1330 -+USE_JPEG2K ?= yes
1331 -+USE_MNG ?= yes
1332 -+USE_PNG ?= yes
1333 -+USE_TIFF ?= yes
1334 -+USE_RAW ?= yes
1335 -+
1336 - VER_MAJOR = 3
1337 - VER_MINOR = 15.4
1338 --SRCS = \
1339 -+SRCS-yes = \
1340 - Source/FreeImage/BitmapAccess.cpp \
1341 - Source/FreeImage/ColorLookup.cpp \
1342 - Source/FreeImage/FreeImage.cpp \
1343 -@@ -9,36 +17,74 @@
1344 - Source/FreeImage/GetType.cpp \
1345 - Source/FreeImage/MemoryIO.cpp \
1346 - Source/FreeImage/PixelAccess.cpp \
1347 -+
1348 -+SRCS-$(USE_JPEG2K) += \
1349 - Source/FreeImage/J2KHelper.cpp \
1350 -+
1351 -+SRCS-$(USE_MNG) += \
1352 - Source/FreeImage/MNGHelper.cpp \
1353 -+
1354 -+SRCS-yes += \
1355 - Source/FreeImage/Plugin.cpp \
1356 - Source/FreeImage/PluginBMP.cpp \
1357 - Source/FreeImage/PluginCUT.cpp \
1358 - Source/FreeImage/PluginDDS.cpp \
1359 -+
1360 -+SRCS-$(USE_EXR) += \
1361 - Source/FreeImage/PluginEXR.cpp \
1362 -+
1363 -+SRCS-$(USE_TIFF) += \
1364 - Source/FreeImage/PluginG3.cpp \
1365 -+
1366 -+SRCS-yes += \
1367 - Source/FreeImage/PluginGIF.cpp \
1368 - Source/FreeImage/PluginHDR.cpp \
1369 - Source/FreeImage/PluginICO.cpp \
1370 - Source/FreeImage/PluginIFF.cpp \
1371 -+
1372 -+SRCS-$(USE_JPEG2K) += \
1373 - Source/FreeImage/PluginJ2K.cpp \
1374 -+
1375 -+SRCS-$(USE_MNG) += \
1376 - Source/FreeImage/PluginJNG.cpp \
1377 -+
1378 -+SRCS-$(USE_JPEG2K) += \
1379 - Source/FreeImage/PluginJP2.cpp \
1380 -+
1381 -+SRCS-$(USE_JPEG) += \
1382 - Source/FreeImage/PluginJPEG.cpp \
1383 -+
1384 -+SRCS-yes += \
1385 - Source/FreeImage/PluginKOALA.cpp \
1386 -+
1387 -+SRCS-$(USE_MNG) += \
1388 - Source/FreeImage/PluginMNG.cpp \
1389 -+
1390 -+SRCS-yes += \
1391 - Source/FreeImage/PluginPCD.cpp \
1392 - Source/FreeImage/PluginPCX.cpp \
1393 - Source/FreeImage/PluginPFM.cpp \
1394 - Source/FreeImage/PluginPICT.cpp \
1395 -+
1396 -+SRCS-$(USE_PNG) += \
1397 - Source/FreeImage/PluginPNG.cpp \
1398 -+
1399 -+SRCS-yes += \
1400 - Source/FreeImage/PluginPNM.cpp \
1401 - Source/FreeImage/PluginPSD.cpp \
1402 - Source/FreeImage/PluginRAS.cpp \
1403 -+
1404 -+SRCS-$(USE_RAW) += \
1405 - Source/FreeImage/PluginRAW.cpp \
1406 -+
1407 -+SRCS-yes += \
1408 - Source/FreeImage/PluginSGI.cpp \
1409 - Source/FreeImage/PluginTARGA.cpp \
1410 -+
1411 -+SRCS-$(USE_TIFF) += \
1412 - Source/FreeImage/PluginTIFF.cpp \
1413 -+
1414 -+SRCS-yes += \
1415 - Source/FreeImage/PluginWBMP.cpp \
1416 - Source/FreeImage/PluginXBM.cpp \
1417 - Source/FreeImage/PluginXPM.cpp \
1418 -@@ -75,7 +121,11 @@
1419 - Source/Metadata/IPTC.cpp \
1420 - Source/Metadata/TagConversion.cpp \
1421 - Source/Metadata/TagLib.cpp \
1422 -+
1423 -+SRCS-$(USE_TIFF) += \
1424 - Source/Metadata/XTIFF.cpp \
1425 -+
1426 -+SRCS-yes += \
1427 - Source/FreeImageToolkit/Background.cpp \
1428 - Source/FreeImageToolkit/BSplineRotate.cpp \
1429 - Source/FreeImageToolkit/Channels.cpp \
1430 -@@ -84,7 +134,11 @@
1431 - Source/FreeImageToolkit/CopyPaste.cpp \
1432 - Source/FreeImageToolkit/Display.cpp \
1433 - Source/FreeImageToolkit/Flip.cpp \
1434 -+
1435 -+SRCS-$(USE_JPEG) += \
1436 - Source/FreeImageToolkit/JPEGTransform.cpp \
1437 -+
1438 -+SRCS-yes += \
1439 - Source/FreeImageToolkit/MultigridPoissonSolver.cpp \
1440 - Source/FreeImageToolkit/Rescale.cpp \
1441 - Source/FreeImageToolkit/Resize.cpp \
1442 -@@ -95,6 +149,11 @@
1443 - Wrapper/FreeImagePlus/src/fipTag.cpp \
1444 - Wrapper/FreeImagePlus/src/fipWinImage.cpp \
1445 - Wrapper/FreeImagePlus/src/FreeImagePlus.cpp
1446 -+
1447 -+SRCS-$(USE_JPEG) += \
1448 -+ Source/transupp.c
1449 -+
1450 -+SRCS = $(SRCS-yes)
1451 - INCLUDE = -I. \
1452 - -ISource \
1453 - -ISource/Metadata \
1454 ---- a/Source/FreeImage/PluginRAW.cpp
1455 -+++ b/Source/FreeImage/PluginRAW.cpp
1456 -@@ -19,7 +19,7 @@
1457 - // Use at your own risk!
1458 - // ==========================================================
1459 -
1460 --#include "../LibRawLite/libraw/libraw.h"
1461 -+#include <libraw.h>
1462 -
1463 - #include "FreeImage.h"
1464 - #include "Utilities.h"
1465 ---- a/Source/Metadata/XTIFF.cpp
1466 -+++ b/Source/Metadata/XTIFF.cpp
1467 -@@ -29,7 +29,7 @@
1468 - #pragma warning (disable : 4786) // identifier was truncated to 'number' characters
1469 - #endif
1470 -
1471 --#include "../LibTIFF4/tiffiop.h"
1472 -+#include "tiffiop.h"
1473 -
1474 - #include "FreeImage.h"
1475 - #include "Utilities.h"
1476 ---- a/Source/FreeImage/PluginTIFF.cpp
1477 -+++ b/Source/FreeImage/PluginTIFF.cpp
1478 -@@ -37,9 +37,9 @@
1479 -
1480 - #include "FreeImage.h"
1481 - #include "Utilities.h"
1482 --#include "../LibTIFF4/tiffiop.h"
1483 -+#include "tiffiop.h"
1484 - #include "../Metadata/FreeImageTag.h"
1485 --#include "../OpenEXR/Half/half.h"
1486 -+#include <half.h>
1487 -
1488 - #include "FreeImageIO.h"
1489 - #include "PSDParser.h"
1490 ---- a/Source/tiffiop.h
1491 -+++ b/Source/tiffiop.h
1492 -@@ -30,7 +30,9 @@
1493 - * ``Library-private'' definitions.
1494 - */
1495 -
1496 --#include "tif_config.h"
1497 -+#include <tiffconf.h>
1498 -+#define HAVE_SEARCH_H
1499 -+#define HAVE_FCNTL_H
1500 -
1501 - #ifdef HAVE_FCNTL_H
1502 - # include <fcntl.h>
1503 ---- a/Source/FreeImage/Plugin.cpp
1504 -+++ b/Source/FreeImage/Plugin.cpp
1505 -@@ -223,23 +223,33 @@
1506 - */
1507 - s_plugins->AddNode(InitBMP);
1508 - s_plugins->AddNode(InitICO);
1509 -+#ifdef USE_JPEG
1510 - s_plugins->AddNode(InitJPEG);
1511 -+#endif
1512 -+#ifdef USE_MNG
1513 - s_plugins->AddNode(InitJNG);
1514 -+#endif
1515 - s_plugins->AddNode(InitKOALA);
1516 - s_plugins->AddNode(InitIFF);
1517 -+#ifdef USE_MNG
1518 - s_plugins->AddNode(InitMNG);
1519 -+#endif
1520 - s_plugins->AddNode(InitPNM, NULL, "PBM", "Portable Bitmap (ASCII)", "pbm", "^P1");
1521 - s_plugins->AddNode(InitPNM, NULL, "PBMRAW", "Portable Bitmap (RAW)", "pbm", "^P4");
1522 - s_plugins->AddNode(InitPCD);
1523 - s_plugins->AddNode(InitPCX);
1524 - s_plugins->AddNode(InitPNM, NULL, "PGM", "Portable Greymap (ASCII)", "pgm", "^P2");
1525 - s_plugins->AddNode(InitPNM, NULL, "PGMRAW", "Portable Greymap (RAW)", "pgm", "^P5");
1526 -+#ifdef USE_PNG
1527 - s_plugins->AddNode(InitPNG);
1528 -+#endif
1529 - s_plugins->AddNode(InitPNM, NULL, "PPM", "Portable Pixelmap (ASCII)", "ppm", "^P3");
1530 - s_plugins->AddNode(InitPNM, NULL, "PPMRAW", "Portable Pixelmap (RAW)", "ppm", "^P6");
1531 - s_plugins->AddNode(InitRAS);
1532 - s_plugins->AddNode(InitTARGA);
1533 -+#ifdef USE_TIFF
1534 - s_plugins->AddNode(InitTIFF);
1535 -+#endif
1536 - s_plugins->AddNode(InitWBMP);
1537 - s_plugins->AddNode(InitPSD);
1538 - s_plugins->AddNode(InitCUT);
1539 -@@ -248,14 +258,22 @@
1540 - s_plugins->AddNode(InitDDS);
1541 - s_plugins->AddNode(InitGIF);
1542 - s_plugins->AddNode(InitHDR);
1543 -+#ifdef USE_TIFF
1544 - s_plugins->AddNode(InitG3);
1545 -+#endif
1546 - s_plugins->AddNode(InitSGI);
1547 -+#ifdef USE_EXR
1548 - s_plugins->AddNode(InitEXR);
1549 -+#endif
1550 -+#ifdef USE_JPEG2K
1551 - s_plugins->AddNode(InitJ2K);
1552 - s_plugins->AddNode(InitJP2);
1553 -+#endif
1554 - s_plugins->AddNode(InitPFM);
1555 - s_plugins->AddNode(InitPICT);
1556 -+#ifdef USE_RAW
1557 - s_plugins->AddNode(InitRAW);
1558 -+#endif
1559 -
1560 - // external plugin initialization
1561 -
1562
1563 diff --git a/media-libs/freeimage/freeimage-3.15.4-r1.ebuild b/media-libs/freeimage/freeimage-3.15.4-r1.ebuild
1564 deleted file mode 100644
1565 index f79cd6ac5c1..00000000000
1566 --- a/media-libs/freeimage/freeimage-3.15.4-r1.ebuild
1567 +++ /dev/null
1568 @@ -1,116 +0,0 @@
1569 -# Copyright 1999-2018 Gentoo Foundation
1570 -# Distributed under the terms of the GNU General Public License v2
1571 -
1572 -EAPI=6
1573 -
1574 -inherit eutils toolchain-funcs
1575 -
1576 -MY_PN=FreeImage
1577 -MY_PV=${PV//.}
1578 -MY_P=${MY_PN}${MY_PV}
1579 -
1580 -DESCRIPTION="Image library supporting many formats"
1581 -HOMEPAGE="http://freeimage.sourceforge.net/"
1582 -SRC_URI="mirror://sourceforge/${PN}/${MY_P}.zip
1583 - mirror://sourceforge/${PN}/${MY_P}.pdf"
1584 -
1585 -LICENSE="|| ( GPL-2 FIPL-1.0 )"
1586 -SLOT="0"
1587 -KEYWORDS="amd64 ~arm x86 ~amd64-linux ~x86-linux"
1588 -IUSE="jpeg jpeg2k mng openexr png raw static-libs tiff"
1589 -
1590 -# The tiff/ilmbase isn't a typo. The TIFF plugin cheats and
1591 -# uses code from it to handle 16bit<->float conversions.
1592 -RDEPEND="
1593 - sys-libs/zlib
1594 - jpeg? ( virtual/jpeg:0 )
1595 - jpeg2k? ( media-libs/openjpeg:0= )
1596 - mng? ( media-libs/libmng:= )
1597 - openexr? ( media-libs/openexr:= )
1598 - png? ( media-libs/libpng:0= )
1599 - raw? ( media-libs/libraw:= )
1600 - tiff? (
1601 - media-libs/ilmbase:=
1602 - media-libs/tiff:0
1603 - )"
1604 -DEPEND="${RDEPEND}
1605 - virtual/pkgconfig
1606 - app-arch/unzip"
1607 -
1608 -S=${WORKDIR}/${MY_PN}
1609 -
1610 -DOCS=( "${DISTDIR}"/${MY_P}.pdf README.linux Whatsnew.txt )
1611 -PATCHES=(
1612 - "${FILESDIR}"/${PN}-3.15.4-{unbundling,raw}.patch
1613 - "${FILESDIR}"/${PN}-3.15.4-CVE-2016-5684-1.patch
1614 - "${FILESDIR}"/${PN}-3.15.4-CVE-2016-5684-2.patch
1615 - "${FILESDIR}"/${PN}-3.15.4-CVE-2015-0852.patch
1616 - "${FILESDIR}"/${PN}-3.15.4-libjpeg9.patch
1617 -)
1618 -
1619 -src_prepare() {
1620 - pushd Source >/dev/null || die
1621 - if has_version ">=media-libs/libjpeg-turbo-1.2.1"; then
1622 - # Patch from Christian Heimes's fork (thanks)
1623 - # https://bitbucket.org/tiran/freeimageturbo
1624 - eapply "${FILESDIR}"/${PN}-3.15.4-libjpeg-turbo.patch
1625 - cp LibJPEG/{jpegcomp.h,jpegint.h} . || die
1626 - fi
1627 - cp LibJPEG/{transupp.c,transupp.h,jinclude.h} . || die
1628 - cp LibTIFF4/{tiffiop,tif_dir}.h . || die
1629 - rm -rf LibPNG LibMNG LibOpenJPEG ZLib OpenEXR LibRawLite LibTIFF4 LibJPEG || die
1630 - popd >/dev/null || die
1631 -
1632 - edos2unix Makefile.{gnu,fip,srcs} fipMakefile.srcs */*.h */*/*.cpp
1633 - sed -i \
1634 - -e "s:/./:/:g" \
1635 - -e "s: ./: :g" \
1636 - -e 's: Source: \\\n\tSource:g' \
1637 - -e 's: Wrapper: \\\n\tWrapper:g' \
1638 - -e 's: Examples: \\\n\tExamples:g' \
1639 - -e 's: TestAPI: \\\n\tTestAPI:g' \
1640 - -e 's: -ISource: \\\n\t-ISource:g' \
1641 - -e 's: -IWrapper: \\\n\t-IWrapper:g' \
1642 - Makefile.srcs fipMakefile.srcs || die
1643 - sed -i \
1644 - -e "/LibJPEG/d" \
1645 - -e "/LibPNG/d" \
1646 - -e "/LibTIFF/d" \
1647 - -e "/Source\/ZLib/d" \
1648 - -e "/LibOpenJPEG/d" \
1649 - -e "/OpenEXR/d" \
1650 - -e "/LibRawLite/d" \
1651 - -e "/LibMNG/d" \
1652 - Makefile.srcs fipMakefile.srcs || die
1653 -
1654 - default
1655 -}
1656 -
1657 -foreach_make() {
1658 - local m
1659 - for m in Makefile.{gnu,fip} ; do
1660 - emake -f ${m} \
1661 - USE_EXR=$(usex openexr) \
1662 - USE_JPEG=$(usex jpeg) \
1663 - USE_JPEG2K=$(usex jpeg2k) \
1664 - USE_MNG=$(usex mng) \
1665 - USE_PNG=$(usex png) \
1666 - USE_TIFF=$(usex tiff) \
1667 - USE_RAW=$(usex raw) \
1668 - $(usex static-libs '' STATICLIB=) \
1669 - "$@"
1670 - done
1671 -}
1672 -
1673 -src_compile() {
1674 - tc-export AR PKG_CONFIG
1675 - foreach_make \
1676 - CXX="$(tc-getCXX) -fPIC" \
1677 - CC="$(tc-getCC) -fPIC" \
1678 - ${MY_PN}
1679 -}
1680 -
1681 -src_install() {
1682 - foreach_make install DESTDIR="${ED}" INSTALLDIR="${ED%/}"/usr/$(get_libdir)
1683 - einstalldocs
1684 -}