Gentoo Archives: gentoo-commits

From: "Vadim A. Misbakh-Soloviov" <mva@×××.name>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gamerlay:master commit in: media-libs/freeimage/, media-libs/freeimage/files/, games-sports/stuntrally/
Date: Wed, 06 Feb 2019 08:39:08
Message-Id: 1549442335.b2b14ab99ae8273cf4cf1cf15458294663d444c5.mva@gentoo
1 commit: b2b14ab99ae8273cf4cf1cf15458294663d444c5
2 Author: Vadim A. Misbakh-Soloviov <git <AT> mva <DOT> name>
3 AuthorDate: Wed Feb 6 08:32:55 2019 +0000
4 Commit: Vadim A. Misbakh-Soloviov <mva <AT> mva <DOT> name>
5 CommitDate: Wed Feb 6 08:38:55 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/gamerlay.git/commit/?id=b2b14ab9
7
8 stuntrally: fix mygui dep (thanks to Graham for report). Beware, project developed is stopped
9
10 Signed-off-by: Vadim A. Misbakh-Soloviov <git <AT> mva.name>
11
12 games-sports/stuntrally/stuntrally-2.6.ebuild | 2 +-
13 games-sports/stuntrally/stuntrally-9999.ebuild | 6 +-
14 .../files/freeimage-3.18.0-libjpeg-turbo.patch | 481 ++++++++++++++++
15 .../freeimage/files/freeimage-3.18.0-raw.patch | 16 +
16 .../files/freeimage-3.18.0-unbundling.patch | 639 +++++++++++++++++++++
17 media-libs/freeimage/freeimage-3.18.0.ebuild | 112 ++++
18 media-libs/freeimage/metadata.xml | 11 +
19 7 files changed, 1265 insertions(+), 2 deletions(-)
20
21 diff --git a/games-sports/stuntrally/stuntrally-2.6.ebuild b/games-sports/stuntrally/stuntrally-2.6.ebuild
22 index 5d2f22d..73b57fb 100644
23 --- a/games-sports/stuntrally/stuntrally-2.6.ebuild
24 +++ b/games-sports/stuntrally/stuntrally-2.6.ebuild
25 @@ -27,7 +27,7 @@ fi
26 DEPEND="
27 game? (
28 dev-games/ogre[cg,boost,ois,freeimage,opengl,zip,-double-precision]
29 - dev-games/mygui[ogre]
30 + dev-games/mygui[ogre,plugins]
31 media-libs/libsdl2[haptic]
32 media-libs/libvorbis
33 media-libs/libogg
34
35 diff --git a/games-sports/stuntrally/stuntrally-9999.ebuild b/games-sports/stuntrally/stuntrally-9999.ebuild
36 index 0bd380b..bbf601b 100644
37 --- a/games-sports/stuntrally/stuntrally-9999.ebuild
38 +++ b/games-sports/stuntrally/stuntrally-9999.ebuild
39 @@ -18,6 +18,10 @@ if [[ ${PV} = 9999* ]]; then
40 SRC_URI=""
41 KEYWORDS=""
42 EGIT_REPO_URI="https://github.com/stuntrally/stuntrally"
43 +# ^ dead
44 +# EGIT_REPO_URI="https://github.com/akien-mga/stuntrally"
45 +# EGIT_BRANCH="ogre-1.11"
46 +# ^ TODO (ogre-1.11 is hardmasked for now)
47 LIVE_PDEPEND="~${CATEGORY}/${PN}-tracks-${PV}"
48 else
49 KEYWORDS="~amd64 ~x86"
50 @@ -27,7 +31,7 @@ fi
51 DEPEND="
52 game? (
53 dev-games/ogre[cg,boost,ois,freeimage,opengl,zip,-double-precision]
54 - dev-games/mygui[ogre]
55 + dev-games/mygui[ogre,plugins]
56 media-libs/libsdl2[haptic]
57 media-libs/libvorbis
58 media-libs/libogg
59
60 diff --git a/media-libs/freeimage/files/freeimage-3.18.0-libjpeg-turbo.patch b/media-libs/freeimage/files/freeimage-3.18.0-libjpeg-turbo.patch
61 new file mode 100644
62 index 0000000..3e152e0
63 --- /dev/null
64 +++ b/media-libs/freeimage/files/freeimage-3.18.0-libjpeg-turbo.patch
65 @@ -0,0 +1,481 @@
66 +--- /dev/null
67 ++++ b/LibJPEG/jpegcomp.h
68 +@@ -0,0 +1,26 @@
69 ++/*
70 ++ * jpegcomp.h
71 ++ *
72 ++ * Copyright (C) 2010, D. R. Commander
73 ++ * For conditions of distribution and use, see the accompanying README file.
74 ++ *
75 ++ * JPEG compatibility macros
76 ++ * These declarations are considered internal to the JPEG library; most
77 ++ * applications using the library shouldn't need to include this file.
78 ++ */
79 ++
80 ++#if JPEG_LIB_VERSION >= 70
81 ++#define _DCT_scaled_size DCT_h_scaled_size
82 ++#define _min_DCT_scaled_size min_DCT_h_scaled_size
83 ++#define _min_DCT_h_scaled_size min_DCT_h_scaled_size
84 ++#define _min_DCT_v_scaled_size min_DCT_v_scaled_size
85 ++#define _jpeg_width jpeg_width
86 ++#define _jpeg_height jpeg_height
87 ++#else
88 ++#define _DCT_scaled_size DCT_scaled_size
89 ++#define _min_DCT_scaled_size min_DCT_scaled_size
90 ++#define _min_DCT_h_scaled_size min_DCT_scaled_size
91 ++#define _min_DCT_v_scaled_size min_DCT_scaled_size
92 ++#define _jpeg_width image_width
93 ++#define _jpeg_height image_height
94 ++#endif
95 +--- a/LibJPEG/jpegint.h
96 ++++ b/LibJPEG/jpegint.h
97 +@@ -100,16 +100,14 @@
98 + };
99 +
100 + /* Forward DCT (also controls coefficient quantization) */
101 +-typedef JMETHOD(void, forward_DCT_ptr,
102 +- (j_compress_ptr cinfo, jpeg_component_info * compptr,
103 +- JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
104 +- JDIMENSION start_row, JDIMENSION start_col,
105 +- JDIMENSION num_blocks));
106 +-
107 + struct jpeg_forward_dct {
108 + JMETHOD(void, start_pass, (j_compress_ptr cinfo));
109 +- /* It is useful to allow each component to have a separate FDCT method. */
110 +- forward_DCT_ptr forward_DCT[MAX_COMPONENTS];
111 ++ /* perhaps this should be an array??? */
112 ++ JMETHOD(void, forward_DCT, (j_compress_ptr cinfo,
113 ++ jpeg_component_info * compptr,
114 ++ JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
115 ++ JDIMENSION start_row, JDIMENSION start_col,
116 ++ JDIMENSION num_blocks));
117 + };
118 +
119 + /* Entropy encoding */
120 +@@ -213,6 +211,10 @@
121 + JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
122 + JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo, JBLOCKROW *MCU_data));
123 + JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));
124 ++
125 ++ /* This is here to share code between baseline and progressive decoders; */
126 ++ /* other modules probably should not use it */
127 ++ boolean insufficient_data; /* set TRUE after emitting warning */
128 + };
129 +
130 + /* Inverse DCT (also performs dequantization) */
131 +@@ -302,6 +304,7 @@
132 + #define jinit_downsampler jIDownsampler
133 + #define jinit_forward_dct jIFDCT
134 + #define jinit_huff_encoder jIHEncoder
135 ++#define jinit_phuff_encoder jIPHEncoder
136 + #define jinit_arith_encoder jIAEncoder
137 + #define jinit_marker_writer jIMWriter
138 + #define jinit_master_decompress jIDMaster
139 +@@ -311,6 +314,7 @@
140 + #define jinit_input_controller jIInCtlr
141 + #define jinit_marker_reader jIMReader
142 + #define jinit_huff_decoder jIHDecoder
143 ++#define jinit_phuff_decoder jIPHDecoder
144 + #define jinit_arith_decoder jIADecoder
145 + #define jinit_inverse_dct jIIDCT
146 + #define jinit_upsampler jIUpsampler
147 +@@ -321,41 +325,15 @@
148 + #define jinit_memory_mgr jIMemMgr
149 + #define jdiv_round_up jDivRound
150 + #define jround_up jRound
151 +-#define jzero_far jZeroFar
152 + #define jcopy_sample_rows jCopySamples
153 + #define jcopy_block_row jCopyBlocks
154 ++#define jzero_far jZeroFar
155 + #define jpeg_zigzag_order jZIGTable
156 + #define jpeg_natural_order jZAGTable
157 +-#define jpeg_natural_order7 jZAG7Table
158 +-#define jpeg_natural_order6 jZAG6Table
159 +-#define jpeg_natural_order5 jZAG5Table
160 +-#define jpeg_natural_order4 jZAG4Table
161 +-#define jpeg_natural_order3 jZAG3Table
162 +-#define jpeg_natural_order2 jZAG2Table
163 + #define jpeg_aritab jAriTab
164 + #endif /* NEED_SHORT_EXTERNAL_NAMES */
165 +
166 +
167 +-/* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays
168 +- * and coefficient-block arrays. This won't work on 80x86 because the arrays
169 +- * are FAR and we're assuming a small-pointer memory model. However, some
170 +- * DOS compilers provide far-pointer versions of memcpy() and memset() even
171 +- * in the small-model libraries. These will be used if USE_FMEM is defined.
172 +- * Otherwise, the routines in jutils.c do it the hard way.
173 +- */
174 +-
175 +-#ifndef NEED_FAR_POINTERS /* normal case, same as regular macro */
176 +-#define FMEMZERO(target,size) MEMZERO(target,size)
177 +-#else /* 80x86 case */
178 +-#ifdef USE_FMEM
179 +-#define FMEMZERO(target,size) _fmemset((void FAR *)(target), 0, (size_t)(size))
180 +-#else
181 +-EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero));
182 +-#define FMEMZERO(target,size) jzero_far(target, size)
183 +-#endif
184 +-#endif
185 +-
186 +-
187 + /* Compression module initialization routines */
188 + EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo));
189 + EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo,
190 +@@ -370,6 +348,7 @@
191 + EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo));
192 + EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo));
193 + EXTERN(void) jinit_huff_encoder JPP((j_compress_ptr cinfo));
194 ++EXTERN(void) jinit_phuff_encoder JPP((j_compress_ptr cinfo));
195 + EXTERN(void) jinit_arith_encoder JPP((j_compress_ptr cinfo));
196 + EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo));
197 + /* Decompression module initialization routines */
198 +@@ -383,6 +362,7 @@
199 + EXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo));
200 + EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo));
201 + EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo));
202 ++EXTERN(void) jinit_phuff_decoder JPP((j_decompress_ptr cinfo));
203 + EXTERN(void) jinit_arith_decoder JPP((j_decompress_ptr cinfo));
204 + EXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo));
205 + EXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo));
206 +@@ -401,17 +381,12 @@
207 + int num_rows, JDIMENSION num_cols));
208 + EXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row,
209 + JDIMENSION num_blocks));
210 ++EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero));
211 + /* Constant tables in jutils.c */
212 + #if 0 /* This table is not actually needed in v6a */
213 + extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */
214 + #endif
215 + extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */
216 +-extern const int jpeg_natural_order7[]; /* zz to natural order for 7x7 block */
217 +-extern const int jpeg_natural_order6[]; /* zz to natural order for 6x6 block */
218 +-extern const int jpeg_natural_order5[]; /* zz to natural order for 5x5 block */
219 +-extern const int jpeg_natural_order4[]; /* zz to natural order for 4x4 block */
220 +-extern const int jpeg_natural_order3[]; /* zz to natural order for 3x3 block */
221 +-extern const int jpeg_natural_order2[]; /* zz to natural order for 2x2 block */
222 +
223 + /* Arithmetic coding probability estimation tables in jaricom.c */
224 + extern const INT32 jpeg_aritab[];
225 +--- a/LibJPEG/transupp.h
226 ++++ b/LibJPEG/transupp.h
227 +@@ -107,15 +106,13 @@
228 +
229 + /*
230 + * Codes for crop parameters, which can individually be unspecified,
231 +- * positive or negative for xoffset or yoffset,
232 +- * positive or forced for width or height.
233 ++ * positive, or negative. (Negative width or height makes no sense, though.)
234 + */
235 +
236 + typedef enum {
237 +- JCROP_UNSET,
238 +- JCROP_POS,
239 +- JCROP_NEG,
240 +- JCROP_FORCE
241 ++ JCROP_UNSET,
242 ++ JCROP_POS,
243 ++ JCROP_NEG
244 + } JCROP_CODE;
245 +
246 + /*
247 +@@ -133,6 +133,13 @@ typedef struct {
248 + boolean trim; /* if TRUE, trim partial MCUs as needed */
249 + boolean force_grayscale; /* if TRUE, convert color image to grayscale */
250 + boolean crop; /* if TRUE, crop or wipe source image */
251 ++ boolean slow_hflip; /* For best performance, the JXFORM_FLIP_H transform
252 ++ normally modifies the source coefficients in place.
253 ++ Setting this to TRUE will instead use a slower,
254 ++ double-buffered algorithm, which leaves the source
255 ++ coefficients in tact (necessary if other transformed
256 ++ images must be generated from the same set of
257 ++ coefficients. */
258 +
259 + /* Crop parameters: application need not set these unless crop is TRUE.
260 + * These can be filled in by jtransform_parse_crop_spec().
261 +--- a/LibJPEG/transupp.c
262 ++++ b/LibJPEG/transupp.c
263 +@@ -20,9 +21,19 @@
264 + #include "jinclude.h"
265 + #include "jpeglib.h"
266 + #include "transupp.h" /* My own external interface */
267 ++#include "jpegcomp.h"
268 + #include <ctype.h> /* to declare isdigit() */
269 +
270 +
271 ++#if JPEG_LIB_VERSION >= 70
272 ++#define dstinfo_min_DCT_h_scaled_size dstinfo->min_DCT_h_scaled_size
273 ++#define dstinfo_min_DCT_v_scaled_size dstinfo->min_DCT_v_scaled_size
274 ++#else
275 ++#define dstinfo_min_DCT_h_scaled_size DCTSIZE
276 ++#define dstinfo_min_DCT_v_scaled_size DCTSIZE
277 ++#endif
278 ++
279 ++
280 + #if TRANSFORMS_SUPPORTED
281 +
282 + /*
283 +@@ -134,7 +145,7 @@
284 + * Partial iMCUs at the right edge are left untouched.
285 + */
286 + MCU_cols = srcinfo->output_width /
287 +- (dstinfo->max_h_samp_factor * dstinfo->min_DCT_h_scaled_size);
288 ++ (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
289 +
290 + for (ci = 0; ci < dstinfo->num_components; ci++) {
291 + compptr = dstinfo->comp_info + ci;
292 +@@ -200,7 +211,7 @@
293 + * this is essentially the same as the routine above.
294 + */
295 + MCU_cols = srcinfo->output_width /
296 +- (dstinfo->max_h_samp_factor * dstinfo->min_DCT_h_scaled_size);
297 ++ (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
298 +
299 + for (ci = 0; ci < dstinfo->num_components; ci++) {
300 + compptr = dstinfo->comp_info + ci;
301 +@@ -265,7 +276,7 @@
302 + * Partial iMCUs at the bottom edge are copied verbatim.
303 + */
304 + MCU_rows = srcinfo->output_height /
305 +- (dstinfo->max_v_samp_factor * dstinfo->min_DCT_v_scaled_size);
306 ++ (dstinfo->max_v_samp_factor * dstinfo_min_DCT_v_scaled_size);
307 +
308 + for (ci = 0; ci < dstinfo->num_components; ci++) {
309 + compptr = dstinfo->comp_info + ci;
310 +@@ -393,7 +404,7 @@
311 + * not mirrored.
312 + */
313 + MCU_cols = srcinfo->output_height /
314 +- (dstinfo->max_h_samp_factor * dstinfo->min_DCT_h_scaled_size);
315 ++ (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
316 +
317 + for (ci = 0; ci < dstinfo->num_components; ci++) {
318 + compptr = dstinfo->comp_info + ci;
319 +@@ -474,7 +485,7 @@
320 + * not mirrored.
321 + */
322 + MCU_rows = srcinfo->output_width /
323 +- (dstinfo->max_v_samp_factor * dstinfo->min_DCT_v_scaled_size);
324 ++ (dstinfo->max_v_samp_factor * dstinfo_min_DCT_v_scaled_size);
325 +
326 + for (ci = 0; ci < dstinfo->num_components; ci++) {
327 + compptr = dstinfo->comp_info + ci;
328 +@@ -542,9 +553,9 @@
329 + jpeg_component_info *compptr;
330 +
331 + MCU_cols = srcinfo->output_width /
332 +- (dstinfo->max_h_samp_factor * dstinfo->min_DCT_h_scaled_size);
333 ++ (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
334 + MCU_rows = srcinfo->output_height /
335 +- (dstinfo->max_v_samp_factor * dstinfo->min_DCT_v_scaled_size);
336 ++ (dstinfo->max_v_samp_factor * dstinfo_min_DCT_v_scaled_size);
337 +
338 + for (ci = 0; ci < dstinfo->num_components; ci++) {
339 + compptr = dstinfo->comp_info + ci;
340 +@@ -653,9 +664,9 @@
341 + jpeg_component_info *compptr;
342 +
343 + MCU_cols = srcinfo->output_height /
344 +- (dstinfo->max_h_samp_factor * dstinfo->min_DCT_h_scaled_size);
345 ++ (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
346 + MCU_rows = srcinfo->output_width /
347 +- (dstinfo->max_v_samp_factor * dstinfo->min_DCT_v_scaled_size);
348 ++ (dstinfo->max_v_samp_factor * dstinfo_min_DCT_v_scaled_size);
349 +
350 + for (ci = 0; ci < dstinfo->num_components; ci++) {
351 + compptr = dstinfo->comp_info + ci;
352 +@@ -771,7 +782,7 @@
353 + * The routine returns TRUE if the spec string is valid, FALSE if not.
354 + *
355 + * The crop spec string should have the format
356 +- * <width>[f]x<height>[f]{+-}<xoffset>{+-}<yoffset>
357 ++ * <width>x<height>{+-}<xoffset>{+-}<yoffset>
358 + * where width, height, xoffset, and yoffset are unsigned integers.
359 + * Each of the elements can be omitted to indicate a default value.
360 + * (A weakness of this style is that it is not possible to omit xoffset
361 +@@ -793,22 +804,14 @@
362 + /* fetch width */
363 + if (! jt_read_integer(&spec, &info->crop_width))
364 + return FALSE;
365 +- if (*spec == 'f' || *spec == 'F') {
366 +- spec++;
367 +- info->crop_width_set = JCROP_FORCE;
368 +- } else
369 +- info->crop_width_set = JCROP_POS;
370 ++ info->crop_width_set = JCROP_POS;
371 + }
372 +- if (*spec == 'x' || *spec == 'X') {
373 ++ if (*spec == 'x' || *spec == 'X') {
374 + /* fetch height */
375 + spec++;
376 + if (! jt_read_integer(&spec, &info->crop_height))
377 + return FALSE;
378 +- if (*spec == 'f' || *spec == 'F') {
379 +- spec++;
380 +- info->crop_height_set = JCROP_FORCE;
381 +- } else
382 +- info->crop_height_set = JCROP_POS;
383 ++ info->crop_height_set = JCROP_POS;
384 + }
385 + if (*spec == '+' || *spec == '-') {
386 + /* fetch xoffset */
387 +@@ -897,7 +900,12 @@
388 + info->num_components = srcinfo->num_components;
389 +
390 + /* Compute output image dimensions and related values. */
391 ++#if JPEG_LIB_VERSION >= 80
392 + jpeg_core_output_dimensions(srcinfo);
393 ++#else
394 ++ srcinfo->output_width = srcinfo->image_width;
395 ++ srcinfo->output_height = srcinfo->image_height;
396 ++#endif
397 +
398 + /* Return right away if -perfect is given and transformation is not perfect.
399 + */
400 +@@ -905,15 +913,15 @@
401 + if (info->num_components == 1) {
402 + if (!jtransform_perfect_transform(srcinfo->output_width,
403 + srcinfo->output_height,
404 +- srcinfo->min_DCT_h_scaled_size,
405 +- srcinfo->min_DCT_v_scaled_size,
406 ++ srcinfo->_min_DCT_h_scaled_size,
407 ++ srcinfo->_min_DCT_v_scaled_size,
408 + info->transform))
409 + return FALSE;
410 + } else {
411 + if (!jtransform_perfect_transform(srcinfo->output_width,
412 + srcinfo->output_height,
413 +- srcinfo->max_h_samp_factor * srcinfo->min_DCT_h_scaled_size,
414 +- srcinfo->max_v_samp_factor * srcinfo->min_DCT_v_scaled_size,
415 ++ srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size,
416 ++ srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size,
417 + info->transform))
418 + return FALSE;
419 + }
420 +@@ -932,26 +940,26 @@
421 + info->output_width = srcinfo->output_height;
422 + info->output_height = srcinfo->output_width;
423 + if (info->num_components == 1) {
424 +- info->iMCU_sample_width = srcinfo->min_DCT_v_scaled_size;
425 +- info->iMCU_sample_height = srcinfo->min_DCT_h_scaled_size;
426 ++ info->iMCU_sample_width = srcinfo->_min_DCT_v_scaled_size;
427 ++ info->iMCU_sample_height = srcinfo->_min_DCT_h_scaled_size;
428 + } else {
429 + info->iMCU_sample_width =
430 +- srcinfo->max_v_samp_factor * srcinfo->min_DCT_v_scaled_size;
431 ++ srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size;
432 + info->iMCU_sample_height =
433 +- srcinfo->max_h_samp_factor * srcinfo->min_DCT_h_scaled_size;
434 ++ srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size;
435 + }
436 + break;
437 + default:
438 + info->output_width = srcinfo->output_width;
439 + info->output_height = srcinfo->output_height;
440 + if (info->num_components == 1) {
441 +- info->iMCU_sample_width = srcinfo->min_DCT_h_scaled_size;
442 +- info->iMCU_sample_height = srcinfo->min_DCT_v_scaled_size;
443 ++ info->iMCU_sample_width = srcinfo->_min_DCT_h_scaled_size;
444 ++ info->iMCU_sample_height = srcinfo->_min_DCT_v_scaled_size;
445 + } else {
446 + info->iMCU_sample_width =
447 +- srcinfo->max_h_samp_factor * srcinfo->min_DCT_h_scaled_size;
448 ++ srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size;
449 + info->iMCU_sample_height =
450 +- srcinfo->max_v_samp_factor * srcinfo->min_DCT_v_scaled_size;
451 ++ srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size;
452 + }
453 + break;
454 + }
455 +@@ -988,16 +996,8 @@
456 + (long) info->iMCU_sample_height);
457 + } else {
458 + /* Ensure the effective crop region will cover the requested */
459 +- if (info->crop_width_set == JCROP_FORCE ||
460 +- info->crop_width > info->output_width)
461 +- info->output_width = info->crop_width;
462 +- else
463 + info->output_width =
464 + info->crop_width + (xoffset % info->iMCU_sample_width);
465 +- if (info->crop_height_set == JCROP_FORCE ||
466 +- info->crop_height > info->output_height)
467 +- info->output_height = info->crop_height;
468 +- else
469 + info->output_height =
470 + info->crop_height + (yoffset % info->iMCU_sample_height);
471 + }
472 +@@ -1020,7 +1022,7 @@
473 + case JXFORM_FLIP_H:
474 + if (info->trim)
475 + trim_right_edge(info, srcinfo->output_width);
476 +- if (info->y_crop_offset != 0)
477 ++ if (info->y_crop_offset != 0 || info->slow_hflip)
478 + need_workspace = TRUE;
479 + /* do_flip_h_no_crop doesn't need a workspace array */
480 + break;
481 +@@ -1124,9 +1126,11 @@
482 + jtemp = dstinfo->image_width;
483 + dstinfo->image_width = dstinfo->image_height;
484 + dstinfo->image_height = jtemp;
485 ++#if JPEG_LIB_VERSION >= 70
486 + itemp = dstinfo->min_DCT_h_scaled_size;
487 + dstinfo->min_DCT_h_scaled_size = dstinfo->min_DCT_v_scaled_size;
488 + dstinfo->min_DCT_v_scaled_size = itemp;
489 ++#endif
490 +
491 + /* Transpose sampling factors */
492 + for (ci = 0; ci < dstinfo->num_components; ci++) {
493 +@@ -1362,8 +1366,10 @@
494 + /* Correct the destination's image dimensions as necessary
495 + * for rotate/flip, resize, and crop operations.
496 + */
497 ++#if JPEG_LIB_VERSION >= 70
498 + dstinfo->jpeg_width = info->output_width;
499 + dstinfo->jpeg_height = info->output_height;
500 ++#endif
501 +
502 + /* Transpose destination image parameters */
503 + switch (info->transform) {
504 +@@ -1371,9 +1377,17 @@
505 + case JXFORM_TRANSVERSE:
506 + case JXFORM_ROT_90:
507 + case JXFORM_ROT_270:
508 ++#if JPEG_LIB_VERSION < 70
509 ++ dstinfo->image_width = info->output_height;
510 ++ dstinfo->image_height = info->output_width;
511 ++#endif
512 + transpose_critical_parameters(dstinfo);
513 + break;
514 + default:
515 ++#if JPEG_LIB_VERSION < 70
516 ++ dstinfo->image_width = info->output_width;
517 ++ dstinfo->image_height = info->output_height;
518 ++#endif
519 + break;
520 + }
521 +
522 +@@ -1389,6 +1403,7 @@
523 + GETJOCTET(srcinfo->marker_list->data[5]) == 0) {
524 + /* Suppress output of JFIF marker */
525 + dstinfo->write_JFIF_header = FALSE;
526 ++#if JPEG_LIB_VERSION >= 70
527 + /* Adjust Exif image parameters */
528 + if (dstinfo->jpeg_width != srcinfo->image_width ||
529 + dstinfo->jpeg_height != srcinfo->image_height)
530 +@@ -1396,6 +1411,7 @@
531 + adjust_exif_parameters(srcinfo->marker_list->data + 6,
532 + srcinfo->marker_list->data_length - 6,
533 + dstinfo->jpeg_width, dstinfo->jpeg_height);
534 ++#endif
535 + }
536 +
537 + /* Return the appropriate output data set */
538 +@@ -1432,7 +1448,7 @@
539 + src_coef_arrays, dst_coef_arrays);
540 + break;
541 + case JXFORM_FLIP_H:
542 +- if (info->y_crop_offset != 0)
543 ++ if (info->y_crop_offset != 0 || info->slow_hflip)
544 + do_flip_h(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
545 + src_coef_arrays, dst_coef_arrays);
546 + else
547
548 diff --git a/media-libs/freeimage/files/freeimage-3.18.0-raw.patch b/media-libs/freeimage/files/freeimage-3.18.0-raw.patch
549 new file mode 100644
550 index 0000000..44f5666
551 --- /dev/null
552 +++ b/media-libs/freeimage/files/freeimage-3.18.0-raw.patch
553 @@ -0,0 +1,16 @@
554 +https://bugs.gentoo.org/show_bug.cgi?id=458516
555 +
556 +--- FreeImage/Source/FreeImage.h
557 ++++ FreeImage/Source/FreeImage.h
558 +@@ -141,8 +141,10 @@
559 + typedef uint16_t WORD;
560 + typedef uint32_t DWORD;
561 + typedef int32_t LONG;
562 ++#ifndef _LIBRAW_TYPES_H
563 + typedef int64_t INT64;
564 + typedef uint64_t UINT64;
565 ++#endif
566 + #else
567 + // MS is not C99 ISO compliant
568 + typedef long BOOL;
569 +
570
571 diff --git a/media-libs/freeimage/files/freeimage-3.18.0-unbundling.patch b/media-libs/freeimage/files/freeimage-3.18.0-unbundling.patch
572 new file mode 100644
573 index 0000000..8f76d59
574 --- /dev/null
575 +++ b/media-libs/freeimage/files/freeimage-3.18.0-unbundling.patch
576 @@ -0,0 +1,639 @@
577 +lots of fixes here:
578 + - use system graphics libraries
579 + - make all of them optional
580 + - drop root users from install (fix user installs)
581 + - make static lib build optional
582 + - link with CXX and CXXFLAGS (since this is C++ code)
583 +
584 +--- a/Makefile.gnu
585 ++++ b/Makefile.gnu
586 +@@ -11,7 +11,24 @@
587 + # Converts cr/lf to just lf
588 + DOS2UNIX = dos2unix
589 +
590 +-LIBRARIES = -lstdc++
591 ++PKG_CONFIG ?= pkg-config
592 ++
593 ++USE_EXR ?= yes
594 ++USE_JPEG ?= yes
595 ++USE_JPEG2K ?= yes
596 ++USE_MNG ?= yes
597 ++USE_PNG ?= yes
598 ++USE_TIFF ?= yes
599 ++USE_RAW ?= yes
600 ++
601 ++LIBRARIES-yes = $(shell $(PKG_CONFIG) --libs zlib)
602 ++LIBRARIES-$(USE_EXR) += $(shell $(PKG_CONFIG) --libs OpenEXR)
603 ++LIBRARIES-$(USE_JPEG) += -ljpeg
604 ++LIBRARIES-$(USE_JPEG2K) += $(shell $(PKG_CONFIG) --libs libopenjpeg)
605 ++LIBRARIES-$(USE_MNG) += -lmng
606 ++LIBRARIES-$(USE_PNG) += $(shell $(PKG_CONFIG) --libs libpng)
607 ++LIBRARIES-$(USE_TIFF) += $(shell $(PKG_CONFIG) --libs libtiff-4 IlmBase)
608 ++LIBRARIES-$(USE_RAW) += $(shell $(PKG_CONFIG) --libs libraw)
609 +
610 + MODULES = $(SRCS:.c=.o)
611 + MODULES := $(MODULES:.cpp=.o)
612 +@@ -64,13 +81,15 @@
613 + $(AR) r $@ $(MODULES)
614 +
615 + $(SHAREDLIB): $(MODULES)
616 +- $(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
617 ++ $(CXX) $(CXXFLAGS) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES-yes)
618 +
619 + install:
620 + install -d $(INCDIR) $(INSTALLDIR)
621 +- install -m 644 -o root -g root $(HEADER) $(INCDIR)
622 +- install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
623 +- install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
624 ++ install -m 644 $(HEADER) $(INCDIR)
625 ++ifneq ($(STATICLIB),)
626 ++ install -m 644 $(STATICLIB) $(INSTALLDIR)
627 ++endif
628 ++ install -m 755 $(SHAREDLIB) $(INSTALLDIR)
629 + ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
630 + ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
631 + # ldconfig
632 +--- a/Source/FreeImage/J2KHelper.cpp
633 ++++ b/Source/FreeImage/J2KHelper.cpp
634 +@@ -21,7 +21,7 @@
635 +
636 + #include "FreeImage.h"
637 + #include "Utilities.h"
638 +-#include "../LibOpenJPEG/openjpeg.h"
639 ++#include <openjpeg.h>
640 + #include "J2KHelper.h"
641 +
642 + // --------------------------------------------------------------------------
643 +--- a/Source/FreeImage/PluginEXR.cpp
644 ++++ b/Source/FreeImage/PluginEXR.cpp
645 +@@ -28,16 +28,16 @@
646 + #pragma warning (disable : 4800) // ImfVersion.h - 'const int' : forcing value to bool 'true' or 'false' (performance warning)
647 + #endif
648 +
649 +-#include "../OpenEXR/IlmImf/ImfIO.h"
650 +-#include "../OpenEXR/Iex/Iex.h"
651 +-#include "../OpenEXR/IlmImf/ImfOutputFile.h"
652 +-#include "../OpenEXR/IlmImf/ImfInputFile.h"
653 +-#include "../OpenEXR/IlmImf/ImfRgbaFile.h"
654 +-#include "../OpenEXR/IlmImf/ImfChannelList.h"
655 +-#include "../OpenEXR/IlmImf/ImfRgba.h"
656 +-#include "../OpenEXR/IlmImf/ImfArray.h"
657 +-#include "../OpenEXR/IlmImf/ImfPreviewImage.h"
658 +-#include "../OpenEXR/Half/half.h"
659 ++#include <ImfIO.h>
660 ++#include <Iex.h>
661 ++#include <ImfOutputFile.h>
662 ++#include <ImfInputFile.h>
663 ++#include <ImfRgbaFile.h>
664 ++#include <ImfChannelList.h>
665 ++#include <ImfRgba.h>
666 ++#include <ImfArray.h>
667 ++#include <ImfPreviewImage.h>
668 ++#include <half.h>
669 +
670 +
671 + // ==========================================================
672 +--- a/Source/FreeImage/PluginJ2K.cpp
673 ++++ b/Source/FreeImage/PluginJ2K.cpp
674 +@@ -21,7 +21,7 @@
675 +
676 + #include "FreeImage.h"
677 + #include "Utilities.h"
678 +-#include "../LibOpenJPEG/openjpeg.h"
679 ++#include <openjpeg.h>
680 + #include "J2KHelper.h"
681 +
682 + // ==========================================================
683 +--- a/Source/FreeImage/PluginJP2.cpp
684 ++++ b/Source/FreeImage/PluginJP2.cpp
685 +@@ -21,7 +21,7 @@
686 +
687 + #include "FreeImage.h"
688 + #include "Utilities.h"
689 +-#include "../LibOpenJPEG/openjpeg.h"
690 ++#include <openjpeg.h>
691 + #include "J2KHelper.h"
692 +
693 + // ==========================================================
694 +--- a/Source/FreeImage/PluginPNG.cpp
695 ++++ b/Source/FreeImage/PluginPNG.cpp
696 +@@ -37,8 +37,8 @@
697 +
698 + // ----------------------------------------------------------
699 +
700 +-#include "../ZLib/zlib.h"
701 +-#include "../LibPNG/png.h"
702 ++#include <zlib.h>
703 ++#include <png.h>
704 +
705 + // ----------------------------------------------------------
706 +
707 +--- a/Source/transupp.c
708 ++++ b/Source/transupp.c
709 +@@ -15,8 +15,7 @@
710 + /* Although this file really shouldn't have access to the library internals,
711 + * it's helpful to let it call jround_up() and jcopy_block_row().
712 + */
713 +-#define JPEG_INTERNALS
714 +-
715 ++#include <jerror.h>
716 + #include "jinclude.h"
717 + #include "jpeglib.h"
718 + #include "transupp.h" /* My own external interface */
719 +--- a/Source/FreeImage/ZLibInterface.cpp
720 ++++ b/Source/FreeImage/ZLibInterface.cpp
721 +@@ -19,10 +19,10 @@
722 + // Use at your own risk!
723 + // ==========================================================
724 +
725 +-#include "../ZLib/zlib.h"
726 ++#include <zlib.h>
727 + #include "FreeImage.h"
728 + #include "Utilities.h"
729 +-#include "../ZLib/zutil.h" /* must be the last header because of error C3163 in VS2008 (_vsnprintf defined in stdio.h) */
730 ++#define OS_CODE 0x03
731 +
732 + /**
733 + Compresses a source buffer into a target buffer, using the ZLib library.
734 +--- a/Source/FreeImage/PluginG3.cpp
735 ++++ b/Source/FreeImage/PluginG3.cpp
736 +@@ -20,7 +20,7 @@
737 + // Use at your own risk!
738 + // ==========================================================
739 +
740 +-#include "../LibTIFF4/tiffiop.h"
741 ++#include "tiffiop.h"
742 +
743 + #include "FreeImage.h"
744 + #include "Utilities.h"
745 +--- a/Source/FreeImage/PluginJPEG.cpp
746 ++++ b/Source/FreeImage/PluginJPEG.cpp
747 +@@ -35,11 +35,15 @@
748 + #undef FAR
749 + #include <setjmp.h>
750 +
751 +-#include "../LibJPEG/jinclude.h"
752 +-#include "../LibJPEG/jpeglib.h"
753 +-#include "../LibJPEG/jerror.h"
754 ++#include <string.h>
755 ++#include <stdio.h>
756 ++#include <jconfig.h>
757 ++#include <jpeglib.h>
758 ++#include <jerror.h>
759 + }
760 +
761 ++#define SIZEOF(object) ((size_t) sizeof(object))
762 ++
763 + #include "FreeImage.h"
764 + #include "Utilities.h"
765 +
766 +--- a/Source/FreeImageToolkit/JPEGTransform.cpp
767 ++++ b/Source/FreeImageToolkit/JPEGTransform.cpp
768 +@@ -25,10 +25,11 @@
769 + #undef FAR
770 + #include <setjmp.h>
771 +
772 +-#include "../LibJPEG/jinclude.h"
773 +-#include "../LibJPEG/jpeglib.h"
774 +-#include "../LibJPEG/jerror.h"
775 +-#include "../LibJPEG/transupp.h"
776 ++#include <string.h>
777 ++#include <stdio.h>
778 ++#include <jpeglib.h>
779 ++#include <jerror.h>
780 ++#include "transupp.h"
781 + }
782 +
783 + #include "FreeImage.h"
784 +--- a/Makefile.fip
785 ++++ b/Makefile.fip
786 +@@ -11,7 +11,24 @@
787 + # Converts cr/lf to just lf
788 + DOS2UNIX = dos2unix
789 +
790 +-LIBRARIES = -lstdc++
791 ++PKG_CONFIG ?= pkg-config
792 ++
793 ++USE_EXR ?= yes
794 ++USE_JPEG ?= yes
795 ++USE_JPEG2K ?= yes
796 ++USE_MNG ?= yes
797 ++USE_PNG ?= yes
798 ++USE_TIFF ?= yes
799 ++USE_RAW ?= yes
800 ++
801 ++LIBRARIES-yes = $(shell $(PKG_CONFIG) --libs zlib)
802 ++LIBRARIES-$(USE_EXR) += $(shell $(PKG_CONFIG) --libs OpenEXR)
803 ++LIBRARIES-$(USE_JPEG) += -ljpeg
804 ++LIBRARIES-$(USE_JPEG2K) += $(shell $(PKG_CONFIG) --libs libopenjpeg)
805 ++LIBRARIES-$(USE_MNG) += -lmng
806 ++LIBRARIES-$(USE_PNG) += $(shell $(PKG_CONFIG) --libs libpng)
807 ++LIBRARIES-$(USE_TIFF) += $(shell $(PKG_CONFIG) --libs libtiff-4 IlmBase)
808 ++LIBRARIES-$(USE_RAW) += $(shell $(PKG_CONFIG) --libs libraw)
809 +
810 + MODULES = $(SRCS:.c=.o)
811 + MODULES := $(MODULES:.cpp=.o)
812 +@@ -65,14 +82,16 @@
813 + $(AR) r $@ $(MODULES)
814 +
815 + $(SHAREDLIB): $(MODULES)
816 +- $(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
817 ++ $(CXX) $(CXXFLAGS) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES-yes)
818 +
819 + install:
820 + install -d $(INCDIR) $(INSTALLDIR)
821 +- install -m 644 -o root -g root $(HEADER) $(INCDIR)
822 +- install -m 644 -o root -g root $(HEADERFIP) $(INCDIR)
823 +- install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
824 +- install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
825 ++ install -m 644 $(HEADER) $(INCDIR)
826 ++ install -m 644 $(HEADERFIP) $(INCDIR)
827 ++ifneq ($(STATICLIB),)
828 ++ install -m 644 $(STATICLIB) $(INSTALLDIR)
829 ++endif
830 ++ install -m 755 $(SHAREDLIB) $(INSTALLDIR)
831 + ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
832 + ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
833 +
834 +--- a/Makefile.srcs
835 ++++ b/Makefile.srcs
836 +@@ -1,6 +1,14 @@
837 ++USE_EXR ?= yes
838 ++USE_JPEG ?= yes
839 ++USE_JPEG2K ?= yes
840 ++USE_MNG ?= yes
841 ++USE_PNG ?= yes
842 ++USE_TIFF ?= yes
843 ++USE_RAW ?= yes
844 ++
845 + VER_MAJOR = 3
846 + VER_MINOR = 18.0
847 +-SRCS = \
848 ++SRCS-yes = \
849 + Source/FreeImage/BitmapAccess.cpp \
850 + Source/FreeImage/ColorLookup.cpp \
851 + Source/FreeImage/ConversionRGBA16.cpp \
852 +@@ -17,36 +25,74 @@ SRCS = \
853 + Source/FreeImage/LFPQuantizer.cpp \
854 + Source/FreeImage/MemoryIO.cpp \
855 + Source/FreeImage/PixelAccess.cpp \
856 ++
857 ++SRCS-$(USE_JPEG2K) += \
858 + Source/FreeImage/J2KHelper.cpp \
859 ++
860 ++SRCS-$(USE_MNG) += \
861 + Source/FreeImage/MNGHelper.cpp \
862 ++
863 ++SRCS-yes += \
864 + Source/FreeImage/Plugin.cpp \
865 + Source/FreeImage/PluginBMP.cpp \
866 + Source/FreeImage/PluginCUT.cpp \
867 + Source/FreeImage/PluginDDS.cpp \
868 ++
869 ++SRCS-$(USE_EXR) += \
870 + Source/FreeImage/PluginEXR.cpp \
871 ++
872 ++SRCS-$(USE_TIFF) += \
873 + Source/FreeImage/PluginG3.cpp \
874 ++
875 ++SRCS-yes += \
876 + Source/FreeImage/PluginGIF.cpp \
877 + Source/FreeImage/PluginHDR.cpp \
878 + Source/FreeImage/PluginICO.cpp \
879 + Source/FreeImage/PluginIFF.cpp \
880 ++
881 ++SRCS-$(USE_JPEG2K) += \
882 + Source/FreeImage/PluginJ2K.cpp \
883 ++
884 ++SRCS-$(USE_MNG) += \
885 + Source/FreeImage/PluginJNG.cpp \
886 ++
887 ++SRCS-$(USE_JPEG2K) += \
888 + Source/FreeImage/PluginJP2.cpp \
889 ++
890 ++SRCS-$(USE_JPEG) += \
891 + Source/FreeImage/PluginJPEG.cpp \
892 ++
893 ++SRCS-yes += \
894 + Source/FreeImage/PluginJXR.cpp \
895 + Source/FreeImage/PluginKOALA.cpp \
896 ++
897 ++SRCS-$(USE_MNG) += \
898 + Source/FreeImage/PluginMNG.cpp \
899 ++
900 ++SRCS-yes += \
901 + Source/FreeImage/PluginPCD.cpp \
902 + Source/FreeImage/PluginPCX.cpp \
903 + Source/FreeImage/PluginPFM.cpp \
904 + Source/FreeImage/PluginPICT.cpp \
905 ++
906 ++SRCS-$(USE_PNG) += \
907 + Source/FreeImage/PluginPNG.cpp \
908 ++
909 ++SRCS-yes += \
910 + Source/FreeImage/PluginPNM.cpp \
911 + Source/FreeImage/PluginPSD.cpp \
912 + Source/FreeImage/PluginRAS.cpp \
913 ++
914 ++SRCS-$(USE_RAW) += \
915 + Source/FreeImage/PluginRAW.cpp \
916 ++
917 ++SRCS-yes += \
918 + Source/FreeImage/PluginSGI.cpp \
919 + Source/FreeImage/PluginTARGA.cpp \
920 ++
921 ++SRCS-$(USE_TIFF) += \
922 + Source/FreeImage/PluginTIFF.cpp \
923 ++
924 ++SRCS-yes += \
925 + Source/FreeImage/PluginWBMP.cpp \
926 + Source/FreeImage/PluginXBM.cpp \
927 + Source/FreeImage/PluginXPM.cpp \
928 +@@ -83,7 +129,11 @@ SRCS = \
929 + Source/Metadata/IPTC.cpp \
930 + Source/Metadata/TagConversion.cpp \
931 + Source/Metadata/TagLib.cpp \
932 ++
933 ++SRCS-$(USE_TIFF) += \
934 + Source/Metadata/XTIFF.cpp \
935 ++
936 ++SRCS-yes += \
937 + Source/FreeImageToolkit/Background.cpp \
938 + Source/FreeImageToolkit/BSplineRotate.cpp \
939 + Source/FreeImageToolkit/Channels.cpp \
940 +@@ -92,10 +142,18 @@ SRCS = \
941 + Source/FreeImageToolkit/CopyPaste.cpp \
942 + Source/FreeImageToolkit/Display.cpp \
943 + Source/FreeImageToolkit/Flip.cpp \
944 ++
945 ++SRCS-$(USE_JPEG) += \
946 + Source/FreeImageToolkit/JPEGTransform.cpp \
947 ++
948 ++SRCS-yes += \
949 + Source/FreeImageToolkit/MultigridPoissonSolver.cpp \
950 + Source/FreeImageToolkit/Rescale.cpp \
951 + Source/FreeImageToolkit/Resize.cpp \
952 ++
953 ++SRCS-$(USE_JPEG) += \
954 ++ Source/transupp.c
955 ++SRCS = $(SRCS-yes)
956 + INCLS = \
957 + Examples/OpenGL/TextureManager/TextureManager.h \
958 + Examples/Plugin/PluginCradle.h \
959 +@@ -116,7 +174,17 @@
960 + Wrapper/FreeImagePlus/test/fipTest.h \
961 + TestAPI/TestSuite.h
962 +
963 +-INCLUDE = -I. \
964 ++INCLUDE-yes = -I. \
965 + -ISource \
966 + -ISource/Metadata \
967 + -ISource/FreeImageToolkit \
968 ++
969 ++INCLUDE-yes += $(shell $(PKG_CONFIG) --cflags-only-I zlib)
970 ++INCLUDE-$(USE_EXR) += -DUSE_EXR $(shell $(PKG_CONFIG) --cflags-only-I OpenEXR)
971 ++INCLUDE-$(USE_JPEG) += -DUSE_JPEG
972 ++INCLUDE-$(USE_JPEG2K) += -DUSE_JPEG2K $(shell $(PKG_CONFIG) --cflags-only-I libopenjpeg)
973 ++INCLUDE-$(USE_MNG) += -DUSE_MNG
974 ++INCLUDE-$(USE_PNG) += -DUSE_PNG $(shell $(PKG_CONFIG) --cflags-only-I libpng)
975 ++INCLUDE-$(USE_TIFF) += -DUSE_TIFF $(shell $(PKG_CONFIG) --cflags-only-I libtiff-4 IlmBase)
976 ++INCLUDE-$(USE_RAW) += -DUSE_RAW $(shell $(PKG_CONFIG) --cflags-only-I libraw)
977 ++INCLUDE = $(INCLUDE-yes)
978 +--- a/fipMakefile.srcs
979 ++++ b/fipMakefile.srcs
980 +@@ -1,6 +1,14 @@
981 ++USE_EXR ?= yes
982 ++USE_JPEG ?= yes
983 ++USE_JPEG2K ?= yes
984 ++USE_MNG ?= yes
985 ++USE_PNG ?= yes
986 ++USE_TIFF ?= yes
987 ++USE_RAW ?= yes
988 ++
989 + VER_MAJOR = 3
990 + VER_MINOR = 18.0
991 +-SRCS = \
992 ++SRCS-yes = \
993 + Source/FreeImage/BitmapAccess.cpp \
994 + Source/FreeImage/ColorLookup.cpp \
995 + Source/FreeImage/ConversionRGBA16.cpp \
996 +@@ -9,36 +17,74 @@
997 + Source/FreeImage/LFPQuantizer.cpp \
998 + Source/FreeImage/MemoryIO.cpp \
999 + Source/FreeImage/PixelAccess.cpp \
1000 ++
1001 ++SRCS-$(USE_JPEG2K) += \
1002 + Source/FreeImage/J2KHelper.cpp \
1003 ++
1004 ++SRCS-$(USE_MNG) += \
1005 + Source/FreeImage/MNGHelper.cpp \
1006 ++
1007 ++SRCS-yes += \
1008 + Source/FreeImage/Plugin.cpp \
1009 + Source/FreeImage/PluginBMP.cpp \
1010 + Source/FreeImage/PluginCUT.cpp \
1011 + Source/FreeImage/PluginDDS.cpp \
1012 ++
1013 ++SRCS-$(USE_EXR) += \
1014 + Source/FreeImage/PluginEXR.cpp \
1015 ++
1016 ++SRCS-$(USE_TIFF) += \
1017 + Source/FreeImage/PluginG3.cpp \
1018 ++
1019 ++SRCS-yes += \
1020 + Source/FreeImage/PluginGIF.cpp \
1021 + Source/FreeImage/PluginHDR.cpp \
1022 + Source/FreeImage/PluginICO.cpp \
1023 + Source/FreeImage/PluginIFF.cpp \
1024 ++
1025 ++SRCS-$(USE_JPEG2K) += \
1026 + Source/FreeImage/PluginJ2K.cpp \
1027 ++
1028 ++SRCS-$(USE_MNG) += \
1029 + Source/FreeImage/PluginJNG.cpp \
1030 ++
1031 ++SRCS-$(USE_JPEG2K) += \
1032 + Source/FreeImage/PluginJP2.cpp \
1033 ++
1034 ++SRCS-$(USE_JPEG) += \
1035 + Source/FreeImage/PluginJPEG.cpp \
1036 ++
1037 ++SRCS-yes += \
1038 + Source/FreeImage/PluginJXR.cpp \
1039 + Source/FreeImage/PluginKOALA.cpp \
1040 ++
1041 ++SRCS-$(USE_MNG) += \
1042 + Source/FreeImage/PluginMNG.cpp \
1043 ++
1044 ++SRCS-yes += \
1045 + Source/FreeImage/PluginPCD.cpp \
1046 + Source/FreeImage/PluginPCX.cpp \
1047 + Source/FreeImage/PluginPFM.cpp \
1048 + Source/FreeImage/PluginPICT.cpp \
1049 ++
1050 ++SRCS-$(USE_PNG) += \
1051 + Source/FreeImage/PluginPNG.cpp \
1052 ++
1053 ++SRCS-yes += \
1054 + Source/FreeImage/PluginPNM.cpp \
1055 + Source/FreeImage/PluginPSD.cpp \
1056 + Source/FreeImage/PluginRAS.cpp \
1057 ++
1058 ++SRCS-$(USE_RAW) += \
1059 + Source/FreeImage/PluginRAW.cpp \
1060 ++
1061 ++SRCS-yes += \
1062 + Source/FreeImage/PluginSGI.cpp \
1063 + Source/FreeImage/PluginTARGA.cpp \
1064 ++
1065 ++SRCS-$(USE_TIFF) += \
1066 + Source/FreeImage/PluginTIFF.cpp \
1067 ++
1068 ++SRCS-yes += \
1069 + Source/FreeImage/PluginWBMP.cpp \
1070 + Source/FreeImage/PluginXBM.cpp \
1071 + Source/FreeImage/PluginXPM.cpp \
1072 +@@ -75,7 +121,11 @@
1073 + Source/Metadata/IPTC.cpp \
1074 + Source/Metadata/TagConversion.cpp \
1075 + Source/Metadata/TagLib.cpp \
1076 ++
1077 ++SRCS-$(USE_TIFF) += \
1078 + Source/Metadata/XTIFF.cpp \
1079 ++
1080 ++SRCS-yes += \
1081 + Source/FreeImageToolkit/Background.cpp \
1082 + Source/FreeImageToolkit/BSplineRotate.cpp \
1083 + Source/FreeImageToolkit/Channels.cpp \
1084 +@@ -84,7 +134,11 @@
1085 + Source/FreeImageToolkit/CopyPaste.cpp \
1086 + Source/FreeImageToolkit/Display.cpp \
1087 + Source/FreeImageToolkit/Flip.cpp \
1088 ++
1089 ++SRCS-$(USE_JPEG) += \
1090 + Source/FreeImageToolkit/JPEGTransform.cpp \
1091 ++
1092 ++SRCS-yes += \
1093 + Source/FreeImageToolkit/MultigridPoissonSolver.cpp \
1094 + Source/FreeImageToolkit/Rescale.cpp \
1095 + Source/FreeImageToolkit/Resize.cpp \
1096 +@@ -95,6 +149,11 @@
1097 + Wrapper/FreeImagePlus/src/fipTag.cpp \
1098 + Wrapper/FreeImagePlus/src/fipWinImage.cpp \
1099 + Wrapper/FreeImagePlus/src/FreeImagePlus.cpp
1100 ++
1101 ++SRCS-$(USE_JPEG) += \
1102 ++ Source/transupp.c
1103 ++
1104 ++SRCS = $(SRCS-yes)
1105 + INCLUDE = -I. \
1106 + -ISource \
1107 + -ISource/Metadata \
1108 +--- a/Source/FreeImage/PluginRAW.cpp
1109 ++++ b/Source/FreeImage/PluginRAW.cpp
1110 +@@ -19,7 +19,7 @@
1111 + // Use at your own risk!
1112 + // ==========================================================
1113 +
1114 +-#include "../LibRawLite/libraw/libraw.h"
1115 ++#include <libraw.h>
1116 +
1117 + #include "FreeImage.h"
1118 + #include "Utilities.h"
1119 +--- a/Source/Metadata/XTIFF.cpp
1120 ++++ b/Source/Metadata/XTIFF.cpp
1121 +@@ -29,7 +29,7 @@
1122 + #pragma warning (disable : 4786) // identifier was truncated to 'number' characters
1123 + #endif
1124 +
1125 +-#include "../LibTIFF4/tiffiop.h"
1126 ++#include "tiffiop.h"
1127 +
1128 + #include "FreeImage.h"
1129 + #include "Utilities.h"
1130 +--- a/Source/FreeImage/PluginTIFF.cpp
1131 ++++ b/Source/FreeImage/PluginTIFF.cpp
1132 +@@ -37,9 +37,9 @@
1133 +
1134 + #include "FreeImage.h"
1135 + #include "Utilities.h"
1136 +-#include "../LibTIFF4/tiffiop.h"
1137 ++#include "tiffiop.h"
1138 + #include "../Metadata/FreeImageTag.h"
1139 +-#include "../OpenEXR/Half/half.h"
1140 ++#include <half.h>
1141 +
1142 + #include "FreeImageIO.h"
1143 + #include "PSDParser.h"
1144 +--- a/Source/tiffiop.h
1145 ++++ b/Source/tiffiop.h
1146 +@@ -30,7 +30,9 @@
1147 + * ``Library-private'' definitions.
1148 + */
1149 +
1150 +-#include "tif_config.h"
1151 ++#include <tiffconf.h>
1152 ++#define HAVE_SEARCH_H
1153 ++#define HAVE_FCNTL_H
1154 +
1155 + #ifdef HAVE_FCNTL_H
1156 + # include <fcntl.h>
1157 +--- a/Source/FreeImage/Plugin.cpp
1158 ++++ b/Source/FreeImage/Plugin.cpp
1159 +@@ -223,23 +223,33 @@
1160 + */
1161 + s_plugins->AddNode(InitBMP);
1162 + s_plugins->AddNode(InitICO);
1163 ++#ifdef USE_JPEG
1164 + s_plugins->AddNode(InitJPEG);
1165 ++#endif
1166 ++#ifdef USE_MNG
1167 + s_plugins->AddNode(InitJNG);
1168 ++#endif
1169 + s_plugins->AddNode(InitKOALA);
1170 + s_plugins->AddNode(InitIFF);
1171 ++#ifdef USE_MNG
1172 + s_plugins->AddNode(InitMNG);
1173 ++#endif
1174 + s_plugins->AddNode(InitPNM, NULL, "PBM", "Portable Bitmap (ASCII)", "pbm", "^P1");
1175 + s_plugins->AddNode(InitPNM, NULL, "PBMRAW", "Portable Bitmap (RAW)", "pbm", "^P4");
1176 + s_plugins->AddNode(InitPCD);
1177 + s_plugins->AddNode(InitPCX);
1178 + s_plugins->AddNode(InitPNM, NULL, "PGM", "Portable Greymap (ASCII)", "pgm", "^P2");
1179 + s_plugins->AddNode(InitPNM, NULL, "PGMRAW", "Portable Greymap (RAW)", "pgm", "^P5");
1180 ++#ifdef USE_PNG
1181 + s_plugins->AddNode(InitPNG);
1182 ++#endif
1183 + s_plugins->AddNode(InitPNM, NULL, "PPM", "Portable Pixelmap (ASCII)", "ppm", "^P3");
1184 + s_plugins->AddNode(InitPNM, NULL, "PPMRAW", "Portable Pixelmap (RAW)", "ppm", "^P6");
1185 + s_plugins->AddNode(InitRAS);
1186 + s_plugins->AddNode(InitTARGA);
1187 ++#ifdef USE_TIFF
1188 + s_plugins->AddNode(InitTIFF);
1189 ++#endif
1190 + s_plugins->AddNode(InitWBMP);
1191 + s_plugins->AddNode(InitPSD);
1192 + s_plugins->AddNode(InitCUT);
1193 +@@ -248,14 +258,22 @@
1194 + s_plugins->AddNode(InitDDS);
1195 + s_plugins->AddNode(InitGIF);
1196 + s_plugins->AddNode(InitHDR);
1197 ++#ifdef USE_TIFF
1198 + s_plugins->AddNode(InitG3);
1199 ++#endif
1200 + s_plugins->AddNode(InitSGI);
1201 ++#ifdef USE_EXR
1202 + s_plugins->AddNode(InitEXR);
1203 ++#endif
1204 ++#ifdef USE_JPEG2K
1205 + s_plugins->AddNode(InitJ2K);
1206 + s_plugins->AddNode(InitJP2);
1207 ++#endif
1208 + s_plugins->AddNode(InitPFM);
1209 + s_plugins->AddNode(InitPICT);
1210 ++#ifdef USE_RAW
1211 + s_plugins->AddNode(InitRAW);
1212 ++#endif
1213 + s_plugins->AddNode(InitWEBP);
1214 + #if !(defined(_MSC_VER) && (_MSC_VER <= 1310))
1215 + s_plugins->AddNode(InitJXR);
1216
1217 diff --git a/media-libs/freeimage/freeimage-3.18.0.ebuild b/media-libs/freeimage/freeimage-3.18.0.ebuild
1218 new file mode 100644
1219 index 0000000..ddaae13
1220 --- /dev/null
1221 +++ b/media-libs/freeimage/freeimage-3.18.0.ebuild
1222 @@ -0,0 +1,112 @@
1223 +# Copyright 1999-2018 Gentoo Foundation
1224 +# Distributed under the terms of the GNU General Public License v2
1225 +
1226 +EAPI=6
1227 +
1228 +inherit eutils toolchain-funcs
1229 +
1230 +MY_PN=FreeImage
1231 +MY_PV=${PV//.}
1232 +MY_P=${MY_PN}${MY_PV}
1233 +
1234 +DESCRIPTION="Image library supporting many formats"
1235 +HOMEPAGE="http://freeimage.sourceforge.net/"
1236 +SRC_URI="mirror://sourceforge/${PN}/${MY_P}.zip
1237 + mirror://sourceforge/${PN}/${MY_P}.pdf"
1238 +
1239 +LICENSE="|| ( GPL-2 FIPL-1.0 )"
1240 +SLOT="0"
1241 +KEYWORDS="amd64 ~arm ~arm64 x86 ~amd64-linux ~x86-linux"
1242 +IUSE="jpeg jpeg2k mng openexr png raw static-libs tiff"
1243 +
1244 +# The tiff/ilmbase isn't a typo. The TIFF plugin cheats and
1245 +# uses code from it to handle 16bit<->float conversions.
1246 +RDEPEND="
1247 + sys-libs/zlib
1248 + jpeg? ( virtual/jpeg:0 )
1249 + jpeg2k? ( media-libs/openjpeg:0= )
1250 + mng? ( media-libs/libmng:= )
1251 + openexr? ( media-libs/openexr:= )
1252 + png? ( media-libs/libpng:0= )
1253 + raw? ( media-libs/libraw:= )
1254 + tiff? (
1255 + media-libs/ilmbase:=
1256 + media-libs/tiff:0
1257 + )"
1258 +DEPEND="${RDEPEND}
1259 + virtual/pkgconfig
1260 + app-arch/unzip"
1261 +
1262 +S=${WORKDIR}/${MY_PN}
1263 +
1264 +DOCS=( "${DISTDIR}"/${MY_P}.pdf README.linux Whatsnew.txt )
1265 +PATCHES=(
1266 + "${FILESDIR}"/${P}-{unbundling,raw}.patch
1267 +)
1268 +
1269 +src_prepare() {
1270 + pushd Source >/dev/null || die
1271 + if has_version ">=media-libs/libjpeg-turbo-1.2.1"; then
1272 + # Patch from Christian Heimes's fork (thanks)
1273 + # https://bitbucket.org/tiran/freeimageturbo
1274 + eapply "${FILESDIR}"/${P}-libjpeg-turbo.patch
1275 + cp LibJPEG/{jpegcomp.h,jpegint.h} . || die
1276 + fi
1277 + cp LibJPEG/{transupp.c,transupp.h,jinclude.h} . || die
1278 + cp LibTIFF4/{tiffiop,tif_dir}.h . || die
1279 + rm -rf LibPNG LibMNG LibOpenJPEG ZLib OpenEXR LibRawLite LibTIFF4 LibJPEG || die
1280 + popd >/dev/null || die
1281 +
1282 + edos2unix Makefile.{gnu,fip,srcs} fipMakefile.srcs */*.h */*/*.cpp
1283 + sed -i \
1284 + -e "s:/./:/:g" \
1285 + -e "s: ./: :g" \
1286 + -e 's: Source: \\\n\tSource:g' \
1287 + -e 's: Wrapper: \\\n\tWrapper:g' \
1288 + -e 's: Examples: \\\n\tExamples:g' \
1289 + -e 's: TestAPI: \\\n\tTestAPI:g' \
1290 + -e 's: -ISource: \\\n\t-ISource:g' \
1291 + -e 's: -IWrapper: \\\n\t-IWrapper:g' \
1292 + Makefile.srcs fipMakefile.srcs || die
1293 + sed -i \
1294 + -e "/LibJPEG/d" \
1295 + -e "/LibPNG/d" \
1296 + -e "/LibTIFF/d" \
1297 + -e "/Source\/ZLib/d" \
1298 + -e "/LibOpenJPEG/d" \
1299 + -e "/OpenEXR/d" \
1300 + -e "/LibRawLite/d" \
1301 + -e "/LibMNG/d" \
1302 + Makefile.srcs fipMakefile.srcs || die
1303 +
1304 + default
1305 +}
1306 +
1307 +foreach_make() {
1308 + local m
1309 + for m in Makefile.{gnu,fip} ; do
1310 + emake -f ${m} \
1311 + USE_EXR=$(usex openexr) \
1312 + USE_JPEG=$(usex jpeg) \
1313 + USE_JPEG2K=$(usex jpeg2k) \
1314 + USE_MNG=$(usex mng) \
1315 + USE_PNG=$(usex png) \
1316 + USE_TIFF=$(usex tiff) \
1317 + USE_RAW=$(usex raw) \
1318 + $(usex static-libs '' STATICLIB=) \
1319 + "$@"
1320 + done
1321 +}
1322 +
1323 +src_compile() {
1324 + tc-export AR PKG_CONFIG
1325 + foreach_make \
1326 + CXX="$(tc-getCXX) -fPIC" \
1327 + CC="$(tc-getCC) -fPIC" \
1328 + ${MY_PN}
1329 +}
1330 +
1331 +src_install() {
1332 + foreach_make install DESTDIR="${ED}" INSTALLDIR="${ED%/}"/usr/$(get_libdir)
1333 + einstalldocs
1334 +}
1335
1336 diff --git a/media-libs/freeimage/metadata.xml b/media-libs/freeimage/metadata.xml
1337 new file mode 100644
1338 index 0000000..fec6409
1339 --- /dev/null
1340 +++ b/media-libs/freeimage/metadata.xml
1341 @@ -0,0 +1,11 @@
1342 +<?xml version="1.0" encoding="UTF-8"?>
1343 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
1344 +<pkgmetadata>
1345 + <maintainer type="project">
1346 + <email>games@g.o</email>
1347 + <name>Gentoo Games Project</name>
1348 + </maintainer>
1349 + <upstream>
1350 + <remote-id type="sourceforge">freeimage</remote-id>
1351 + </upstream>
1352 +</pkgmetadata>