summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs')
-rw-r--r--media-libs/freeimage/ChangeLog118
-rw-r--r--media-libs/freeimage/Manifest10
-rw-r--r--media-libs/freeimage/files/freeimage-3.15.3-r1-unbundling.patch313
-rw-r--r--media-libs/freeimage/files/freeimage-3.15.3-r2-unbundling.patch639
-rw-r--r--media-libs/freeimage/files/freeimage-3.15.3-unbundling.patch285
-rw-r--r--media-libs/freeimage/files/freeimage-3.15.4-datatypes.patch13
-rw-r--r--media-libs/freeimage/files/freeimage-3.15.4-unbundling.patch639
-rw-r--r--media-libs/freeimage/freeimage-3.15.4-r1.ebuild100
-rw-r--r--media-libs/freeimage/metadata.xml5
9 files changed, 2122 insertions, 0 deletions
diff --git a/media-libs/freeimage/ChangeLog b/media-libs/freeimage/ChangeLog
new file mode 100644
index 0000000..79791c8
--- /dev/null
+++ b/media-libs/freeimage/ChangeLog
@@ -0,0 +1,118 @@
+# ChangeLog for media-libs/freeimage
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/media-libs/freeimage/ChangeLog,v 1.26 2013/03/21 15:48:09 bicatali Exp $
+
+*freeimage-3.15.4-r1 (17 May 2013)
+
+ 19 May 2013; Peter Asplund <peterasplund@gentoo.se> freeimage-3.15.4-r1.ebuild:
+ +files/freeimage-3.15.4-r1-datatypes.patch, +freeimage-3.15.4-r1.ebuild:
+ Fix for building with raw use-flag
+
+ 21 Mar 2013; SĂ©bastien Fabbro <bicatali@gentoo.org> freeimage-3.15.4.ebuild:
+ Keyword amd64-linux and x86-linux
+
+*freeimage-3.15.4 (19 Feb 2013)
+
+ 19 Feb 2013; Mike Frysinger <vapier@gentoo.org>
+ +files/freeimage-3.15.4-unbundling.patch, +freeimage-3.15.4.ebuild:
+ Version bump.
+
+ 14 Feb 2013; Agostino Sarubbo <ago@gentoo.org> freeimage-3.15.3-r2.ebuild:
+ Stable for x86, wrt bug #457120
+
+ 14 Feb 2013; Agostino Sarubbo <ago@gentoo.org> freeimage-3.15.3-r2.ebuild:
+ Stable for amd64, wrt bug #457120
+
+ 22 Jan 2013; Michael Sterrett <mr_bones_@gentoo.org>
+ -freeimage-3.15.3-r1.ebuild:
+ old
+
+*freeimage-3.15.3-r2 (10 Jan 2013)
+
+ 10 Jan 2013; Mike Frysinger <vapier@gentoo.org>
+ +files/freeimage-3.15.3-r2-unbundling.patch, +freeimage-3.15.3-r2.ebuild:
+ Make all the graphics libs optional via USE flags.
+
+*freeimage-3.15.3-r1 (09 Jan 2013)
+
+ 09 Jan 2013; Mike Frysinger <vapier@gentoo.org>
+ +files/freeimage-3.15.3-r1-unbundling.patch, +freeimage-3.15.3-r1.ebuild:
+ Update to EAPI=4. Add IUSE=static-libs support. Respect $PKG_CONFIG. Use
+ $CXX to link rather than $CC -lstdc++ since that does not work for everything.
+ Respect $CXXFLAGS when linking.
+
+ 24 Jul 2012; Tupone Alfredo <tupone@gentoo.org> freeimage-3.15.3.ebuild:
+ Add depend on pkgconfig. Bug #427676 by Julian Ospald
+
+ 08 Jun 2012; Zac Medico <zmedico@gentoo.org> freeimage-3.15.3.ebuild:
+ inherit multilib for get_libdir
+
+ 22 Apr 2012; Markus Meier <maekke@gentoo.org> freeimage-3.15.3.ebuild:
+ x86 stable, bug #412673
+
+ 21 Apr 2012; Agostino Sarubbo <ago@gentoo.org> freeimage-3.15.3.ebuild:
+ Stable for amd64, wrt bug #412673
+
+ 13 Apr 2012; Michael Sterrett <mr_bones_@gentoo.org>
+ -files/freeimage-3.15.2-unbundling.patch, -freeimage-3.15.1.ebuild,
+ -freeimage-3.15.2.ebuild:
+ old
+
+*freeimage-3.15.3 (18 Mar 2012)
+
+ 18 Mar 2012; Tupone Alfredo <tupone@gentoo.org> +freeimage-3.15.3.ebuild,
+ +files/freeimage-3.15.3-unbundling.patch:
+ Version bump to 3.15.3
+
+*freeimage-3.15.2 (06 Mar 2012)
+
+ 06 Mar 2012; Tupone Alfredo <tupone@gentoo.org> +freeimage-3.15.2.ebuild,
+ +files/freeimage-3.15.2-unbundling.patch:
+ Version bump to 3.15.2
+
+*freeimage-3.15.1 (12 Feb 2012)
+
+ 12 Feb 2012; Tupone Alfredo <tupone@gentoo.org> +freeimage-3.15.1.ebuild,
+ +metadata.xml:
+ Reviving package with version 3.15.1
+
+ 24 May 2009; Michael Sterrett <mr_bones_@gentoo.org>
+ freeimage-3.11.0.ebuild:
+ Use append-cflags from flag-o-matic
+
+ 12 May 2009; Michael Sterrett <mr_bones_@gentoo.org>
+ freeimage-3.11.0.ebuild:
+ EAPI=2; Skip calling ldconfig during install (bug #269493); silence gcc warnings
+
+ 02 Apr 2009; Tristan Heaven <nyhm@gentoo.org> freeimage-3.11.0.ebuild:
+ Build with -fPIC, bug #252766
+
+ 01 Apr 2009; Joseph Jezak <josejx@gentoo.org> freeimage-3.11.0.ebuild:
+ Marked ppc stable for bug #252766.
+
+ 25 Nov 2008; Tristan Heaven <nyhm@gentoo.org> freeimage-3.11.0.ebuild:
+ Add cxx USE flag, bug #242888
+
+*freeimage-3.11.0 (02 Sep 2008)
+
+ 02 Sep 2008; Tristan Heaven <nyhm@gentoo.org> +freeimage-3.11.0.ebuild:
+ Version bump, bug #213969
+
+ 04 May 2007; Matti Bickel <mabi@gentoo.org> freeimage-3.9.3-r1.ebuild:
+ keyworded ~ppc (bug #174055)
+
+*freeimage-3.9.3-r1 (22 Apr 2007)
+
+ 22 Apr 2007; Tristan Heaven <nyhm@gentoo.org>
+ +files/freeimage-3.9.3-sys-headers.patch, +freeimage-3.9.3-r1.ebuild:
+ Fix jpeg image loading, bug #175467
+
+ 10 Apr 2007; Peter Weller <welp@gentoo.org> freeimage-3.9.3.ebuild:
+ Keyworded amd64 wrt bug 174055
+
+*freeimage-3.9.3 (31 Mar 2007)
+
+ 31 Mar 2007; Tristan Heaven <nyhm@gentoo.org>
+ +files/freeimage-3.9.3-build.patch, +metadata.xml,
+ +freeimage-3.9.3.ebuild:
+ Initial commit, bug #165938
diff --git a/media-libs/freeimage/Manifest b/media-libs/freeimage/Manifest
new file mode 100644
index 0000000..f460d53
--- /dev/null
+++ b/media-libs/freeimage/Manifest
@@ -0,0 +1,10 @@
+AUX freeimage-3.15.3-r1-unbundling.patch 8855 SHA256 e4fcf7c853ffa8ad59f09e09c53c9eb23eb2589ce16e6facb423ac6c74b6eb71 SHA512 d8b69f8add6016ee0204b4916608d17888f6945e8c67cc89b3e5846bbf945443c58a3b096697e0d3018c993fb6b54f59e95db71619fc481c4f1f54da5c10adb1 WHIRLPOOL f7f916fae38ba5630132b67f343fa9e5b95940864bd2bb12340c0be0c3eaefa1a1c6f279f5e03c09f0add70a9ec949bab2ef10e88fcb5bc132d97814e7faf04e
+AUX freeimage-3.15.3-r2-unbundling.patch 17182 SHA256 8fe72d50ca18b98041d70e8bd53dc681b6c59dbdf1ac142e01233009a5e6e452 SHA512 473d9ede61b1edeac78ff7b460949247f245cda67dc514c96f4bde957aa7f94cb4cad39dd7165719b58a956a1ec754204af5798b41ff0bd9379a06fd2b31a910 WHIRLPOOL f15e13ffefa477434970a3172b3c6a464f77ae390ccff9ae1e089721cf926a78ac17967b11c599d4d80ee31231b070f9e604803e956b4db8d565d46f985b015c
+AUX freeimage-3.15.3-unbundling.patch 9053 SHA256 b98d92187eb34518a6219a45f0a71e0cc7909df7583b886069392264d4cc2ff4 SHA512 02f6bfd62bb54370d65660249bf7fa7e27dea0aeeabea782a47748baad119f6635ac5954449989aa487deda27739ad6dd8db42e287e3e1e70b211495b0643650 WHIRLPOOL ed2b4e7c0208a2d8e1177f3ff09e8d2a108ab57721846ec06ee68546ca591929f8df4130b327d66e384b63eef201ee955eb2fe7a5309a9b302494c5ce0c6878e
+AUX freeimage-3.15.4-datatypes.patch 378 SHA256 e2bdf2d062ae8d9f41dff320e86bf64361589080ed4b9ccb95b3c8b154700ab6 SHA512 851f14e3df7c6b84bf88f285d1c6d4c7898b560446def6ce9efb0734ab25083a24766c8dec0bf0a52880173e543e5c5b162eba4a59162763a8761dc12167a9a9 WHIRLPOOL 365771d807b3d250685f727f2d3ba4dd16e248a8f12fa6b59162bbf06f3fcccfe0c835e03e2242071d2d4ac92603129535184283316fd38fb4631e47b6220990
+AUX freeimage-3.15.4-unbundling.patch 17182 SHA256 929f45e21c5be7751f21b9f4d98a3c2ae248559ac371e053d66e4d8905eecf78 SHA512 b9f7b2f1767eabe3db44a4328d4211ee80ba719d4f2715f7bb7988f19029d5867da068c78a02f50bf513fc7b88da857795fd0fc0eb9b837f3f999e8951b2debd WHIRLPOOL 62137afc748227b98145c7625fe26348c6bfb21dd569e3b9b095a69c7d503ecfc99c52b40dfdd0dd9b83415fc70f9d03aba168bc98025e6b360522073f1d42b4
+DIST FreeImage3154.pdf 1007480 SHA256 455b0ba7cf571f3fc3027681a70abf3c2321d0a4fd7956c5ba58bd7ccb7b5373 SHA512 cebde5e2609c9a0c06b4e07e1c595d7d6714895095cd9935f59c8b2ff9b34116248f5453b41f469f6242d87cae79be82d59f6a9ec0f75b1ea3df61ac1f651b28 WHIRLPOOL a1e8b575d198b61e74db9eb31e9472460158e86989ed822c156cae3f625f6ea0d156e4b7ddffc8b7a1d16a601be39b4cf0e20558d36bb4dd73195fea4faa43e7
+DIST FreeImage3154.zip 5513923 SHA256 eb6361519d33131690a0e726b085a05825e5adf9fb72c752d8d39100e48dc829 SHA512 0db9eb7d0ed8e08e10ff4fa274c4484541ca119c3d437a85fdc3b2d9232bf14a7877c79b1e62c8c99278d7020a9f623c161f2342475f3ee526233404138112cc WHIRLPOOL 2747bb7a35d8de24a1a876616626a9e840495f06da836ce15135aafaa21bc1d8d9cece17f7512424b66edfcc521ed096ea85da5ea5b5b90b4c032bf080356b4d
+EBUILD freeimage-3.15.4-r1.ebuild 2627 SHA256 83ff1e09f774bd936d2b08d938c0988a52b697c76d4ab19eb86af82e11467161 SHA512 e240b85b68e0bc1ab02bc12aeddec71730ed968d2532e839dc5edf4f8f624186e5cf7cb28d1be7ef9413ea6e720512091eb65af00d841c5b30bd18073bba3075 WHIRLPOOL a09f86d8ce6d9965f70a14ffcf8c3cf4d43ae226d11d3398af12a53bcf032ec91de06f145b0ec09513a3e42f577c3e4ddf3f80ff373f6201ad800b8992d8a870
+MISC ChangeLog 3867 SHA256 971b19e6a07d5d2be9a2f0b9a2d94991331c23a487b85822b9f9c351d7d4f70a SHA512 aff7916751f9b676d8e6fb9379b7a3ef4eeda5a78c63d8f75a0aa74994ff705f91aecdfa6257787121b6ae1d63e9ef14bee3b246b1adadd4e226abeb16787569 WHIRLPOOL e90b6b74326e4eb4bc6cc094b6686c744628cbde75ba31a2cd6be65ddf89e00fcd43755f13f6e9556987fbb597f8aada5aeaac9750f288dedb74c6e5fbc56e42
+MISC metadata.xml 158 SHA256 1423a4fdd4a79b1728a2056d9e300f7e1074253095d82726218d9e9b953888a3 SHA512 d954564236b67b6ab97846b73f74e715e8f1bec2dba6595e9a5046c2e8c3b93f4879c293f9d1d02d99a533bee56156dae3f31a485697128c51af14cdbfdada8a WHIRLPOOL d03e7293d09d794d61c095a423f945b3644355a247f270a73ca8d30b4dfe9c98244297536bfd1a4bd6c14794aa1152eca20fd83bfdf3e1e74d4f676152d35ada
diff --git a/media-libs/freeimage/files/freeimage-3.15.3-r1-unbundling.patch b/media-libs/freeimage/files/freeimage-3.15.3-r1-unbundling.patch
new file mode 100644
index 0000000..f0a4ef8
--- /dev/null
+++ b/media-libs/freeimage/files/freeimage-3.15.3-r1-unbundling.patch
@@ -0,0 +1,313 @@
+--- Makefile.gnu
++++ Makefile.gnu
+@@ -11,7 +11,14 @@
+ # Converts cr/lf to just lf
+ DOS2UNIX = dos2unix
+
+-LIBRARIES = -lstdc++
++PKG_CONFIG ?= $(PKG_CONFIG)
++LIBRARIES = -lmng -ljpeg \
++ $(shell $(PKG_CONFIG) --libs libpng) \
++ $(shell $(PKG_CONFIG) --libs libtiff-4) \
++ $(shell $(PKG_CONFIG) --libs zlib) \
++ $(shell $(PKG_CONFIG) --libs libopenjpeg) \
++ $(shell $(PKG_CONFIG) --libs OpenEXR) \
++ $(shell $(PKG_CONFIG) --libs libraw)
+
+ MODULES = $(SRCS:.c=.o)
+ MODULES := $(MODULES:.cpp=.o)
+@@ -64,13 +71,15 @@
+ $(AR) r $@ $(MODULES)
+
+ $(SHAREDLIB): $(MODULES)
+- $(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
++ $(CXX) $(CXXFLAGS) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
+
+ install:
+ install -d $(INCDIR) $(INSTALLDIR)
+- install -m 644 -o root -g root $(HEADER) $(INCDIR)
+- install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
+- install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
++ install -m 644 $(HEADER) $(INCDIR)
++ifneq ($(STATICLIB),)
++ install -m 644 $(STATICLIB) $(INSTALLDIR)
++endif
++ install -m 755 $(SHAREDLIB) $(INSTALLDIR)
+ ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
+ ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
+ # ldconfig
+--- Source/FreeImage/J2KHelper.cpp
++++ Source/FreeImage/J2KHelper.cpp
+@@ -21,7 +21,7 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibOpenJPEG/openjpeg.h"
++#include <openjpeg.h>
+
+ /**
+ Divide an integer by a power of 2 and round upwards
+--- Source/FreeImage/PluginEXR.cpp
++++ Source/FreeImage/PluginEXR.cpp
+@@ -22,16 +22,16 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../OpenEXR/IlmImf/ImfIO.h"
+-#include "../OpenEXR/Iex/Iex.h"
+-#include "../OpenEXR/IlmImf/ImfOutputFile.h"
+-#include "../OpenEXR/IlmImf/ImfInputFile.h"
+-#include "../OpenEXR/IlmImf/ImfRgbaFile.h"
+-#include "../OpenEXR/IlmImf/ImfChannelList.h"
+-#include "../OpenEXR/IlmImf/ImfRgba.h"
+-#include "../OpenEXR/IlmImf/ImfArray.h"
+-#include "../OpenEXR/IlmImf/ImfPreviewImage.h"
+-#include "../OpenEXR/Half/half.h"
++#include <ImfIO.h>
++#include <Iex.h>
++#include <ImfOutputFile.h>
++#include <ImfInputFile.h>
++#include <ImfRgbaFile.h>
++#include <ImfChannelList.h>
++#include <ImfRgba.h>
++#include <ImfArray.h>
++#include <ImfPreviewImage.h>
++#include <half.h>
+
+
+ // ==========================================================
+--- Source/FreeImage/PluginJ2K.cpp
++++ Source/FreeImage/PluginJ2K.cpp
+@@ -21,7 +21,7 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibOpenJPEG/openjpeg.h"
++#include <openjpeg.h>
+
+ // ==========================================================
+ // Plugin Interface
+--- Source/FreeImage/PluginJP2.cpp
++++ Source/FreeImage/PluginJP2.cpp
+@@ -21,7 +21,7 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibOpenJPEG/openjpeg.h"
++#include <openjpeg.h>
+
+ // ==========================================================
+ // Plugin Interface
+--- Source/FreeImage/PluginPNG.cpp
++++ Source/FreeImage/PluginPNG.cpp
+@@ -37,8 +37,8 @@
+
+ // ----------------------------------------------------------
+
+-#include "../ZLib/zlib.h"
+-#include "../LibPNG/png.h"
++#include <zlib.h>
++#include <png.h>
+
+ // ----------------------------------------------------------
+
+--- Source/transupp.c
++++ Source/transupp.c
+@@ -15,8 +15,7 @@
+ /* Although this file really shouldn't have access to the library internals,
+ * it's helpful to let it call jround_up() and jcopy_block_row().
+ */
+-#define JPEG_INTERNALS
+-
++#include <jerror.h>
+ #include "jinclude.h"
+ #include "jpeglib.h"
+ #include "transupp.h" /* My own external interface */
+--- Source/FreeImage/ZLibInterface.cpp
++++ Source/FreeImage/ZLibInterface.cpp
+@@ -19,10 +19,10 @@
+ // Use at your own risk!
+ // ==========================================================
+
+-#include "../ZLib/zlib.h"
++#include <zlib.h>
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../ZLib/zutil.h" /* must be the last header because of error C3163 in VS2008 (_vsnprintf defined in stdio.h) */
++#define OS_CODE 0x03
+
+ /**
+ Compresses a source buffer into a target buffer, using the ZLib library.
+--- Source/FreeImage/PluginG3.cpp
++++ Source/FreeImage/PluginG3.cpp
+@@ -20,7 +20,7 @@
+ // Use at your own risk!
+ // ==========================================================
+
+-#include "../LibTIFF4/tiffiop.h"
++#include "tiffiop.h"
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+--- Source/FreeImage/PluginJPEG.cpp
++++ Source/FreeImage/PluginJPEG.cpp
+@@ -35,11 +35,15 @@
+ #undef FAR
+ #include <setjmp.h>
+
+-#include "../LibJPEG/jinclude.h"
+-#include "../LibJPEG/jpeglib.h"
+-#include "../LibJPEG/jerror.h"
++#include <string.h>
++#include <stdio.h>
++#include <jconfig.h>
++#include <jpeglib.h>
++#include <jerror.h>
+ }
+
++#define SIZEOF(object) ((size_t) sizeof(object))
++
+ #include "FreeImage.h"
+ #include "Utilities.h"
+
+--- Source/FreeImageToolkit/JPEGTransform.cpp
++++ Source/FreeImageToolkit/JPEGTransform.cpp
+@@ -25,10 +25,11 @@
+ #undef FAR
+ #include <setjmp.h>
+
+-#include "../LibJPEG/jinclude.h"
+-#include "../LibJPEG/jpeglib.h"
+-#include "../LibJPEG/jerror.h"
+-#include "../LibJPEG/transupp.h"
++#include <string.h>
++#include <stdio.h>
++#include <jpeglib.h>
++#include <jerror.h>
++#include "transupp.h"
+ }
+
+ #include "FreeImage.h"
+--- Makefile.fip
++++ Makefile.fip
+@@ -11,7 +11,14 @@
+ # Converts cr/lf to just lf
+ DOS2UNIX = dos2unix
+
+-LIBRARIES = -lstdc++
++PKG_CONFIG ?= pkg-config
++LIBRARIES = -lmng -ljpeg \
++ $(shell $(PKG_CONFIG) --libs libpng) \
++ $(shell $(PKG_CONFIG) --libs libtiff-4) \
++ $(shell $(PKG_CONFIG) --libs zlib) \
++ $(shell $(PKG_CONFIG) --libs libopenjpeg) \
++ $(shell $(PKG_CONFIG) --libs OpenEXR) \
++ $(shell $(PKG_CONFIG) --libs libraw)
+
+ MODULES = $(SRCS:.c=.o)
+ MODULES := $(MODULES:.cpp=.o)
+@@ -65,14 +72,18 @@
+ $(AR) r $@ $(MODULES)
+
+ $(SHAREDLIB): $(MODULES)
+- $(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
++ $(CXX) $(CXXFLAGS) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
+
+ install:
+ install -d $(INCDIR) $(INSTALLDIR)
+- install -m 644 -o root -g root $(HEADER) $(INCDIR)
+- install -m 644 -o root -g root $(HEADERFIP) $(INCDIR)
+- install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
+- install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
++ install -m 644 $(HEADER) $(INCDIR)
++ install -m 644 $(HEADERFIP) $(INCDIR)
++ifneq ($(STATICLIB),)
++ install -m 644 $(STATICLIB) $(INSTALLDIR)
++endif
++ install -m 755 $(SHAREDLIB) $(INSTALLDIR)
++ ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
++ ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
+
+ clean:
+ rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
+--- Makefile.srcs
++++ Makefile.srcs
+@@ -88,6 +88,7 @@
+ Source/FreeImageToolkit/MultigridPoissonSolver.cpp \
+ Source/FreeImageToolkit/Rescale.cpp \
+ Source/FreeImageToolkit/Resize.cpp \
++ Source/transupp.c
+ INCLS = \
+ Source/FreeImage.h \
+ Source/CacheFile.h \
+@@ -116,3 +117,9 @@
+ -ISource \
+ -ISource/Metadata \
+ -ISource/FreeImageToolkit \
++ $(shell $(PKG_CONFIG) --cflags-only-I libpng) \
++ $(shell $(PKG_CONFIG) --cflags-only-I libtiff-4) \
++ $(shell $(PKG_CONFIG) --cflags-only-I zlib) \
++ $(shell $(PKG_CONFIG) --cflags-only-I libopenjpeg) \
++ $(shell $(PKG_CONFIG) --cflags-only-I OpenEXR) \
++ $(shell $(PKG_CONFIG) --cflags-only-I libraw)
+--- Source/FreeImage/PluginRAW.cpp
++++ Source/FreeImage/PluginRAW.cpp
+@@ -19,7 +19,7 @@
+ // Use at your own risk!
+ // ==========================================================
+
+-#include "../LibRawLite/libraw/libraw.h"
++#include <libraw.h>
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+--- Source/Metadata/XTIFF.cpp
++++ Source/Metadata/XTIFF.cpp
+@@ -29,7 +29,7 @@
+ #pragma warning (disable : 4786) // identifier was truncated to 'number' characters
+ #endif
+
+-#include "../LibTIFF4/tiffiop.h"
++#include "tiffiop.h"
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+--- Source/FreeImage/PluginTIFF.cpp
++++ Source/FreeImage/PluginTIFF.cpp
+@@ -37,9 +37,9 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibTIFF4/tiffiop.h"
++#include "tiffiop.h"
+ #include "../Metadata/FreeImageTag.h"
+-#include "../OpenEXR/Half/half.h"
++#include <half.h>
+
+ #include "FreeImageIO.h"
+ #include "PSDParser.h"
+--- Source/tiffiop.h
++++ Source/tiffiop.h
+@@ -30,7 +30,9 @@
+ * ``Library-private'' definitions.
+ */
+
+-#include "tif_config.h"
++#include <tiffconf.h>
++#define HAVE_SEARCH_H
++#define HAVE_FCNTL_H
+
+ #ifdef HAVE_FCNTL_H
+ # include <fcntl.h>
+--- fipMakefile.srcs
++++ fipMakefile.srcs
+@@ -94,7 +94,8 @@
+ Wrapper/FreeImagePlus/src/fipMultiPage.cpp \
+ Wrapper/FreeImagePlus/src/fipTag.cpp \
+ Wrapper/FreeImagePlus/src/fipWinImage.cpp \
+- Wrapper/FreeImagePlus/src/FreeImagePlus.cpp
++ Wrapper/FreeImagePlus/src/FreeImagePlus.cpp \
++ Source/transupp.c
+ INCLUDE = -I. \
+ -ISource \
+ -ISource/Metadata \
diff --git a/media-libs/freeimage/files/freeimage-3.15.3-r2-unbundling.patch b/media-libs/freeimage/files/freeimage-3.15.3-r2-unbundling.patch
new file mode 100644
index 0000000..f83d87f
--- /dev/null
+++ b/media-libs/freeimage/files/freeimage-3.15.3-r2-unbundling.patch
@@ -0,0 +1,639 @@
+lots of fixes here:
+ - use system graphics libraries
+ - make all of them optional
+ - drop root users from install (fix user installs)
+ - make static lib build optional
+ - link with CXX and CXXFLAGS (since this is C++ code)
+
+--- Makefile.gnu
++++ Makefile.gnu
+@@ -11,7 +11,24 @@
+ # Converts cr/lf to just lf
+ DOS2UNIX = dos2unix
+
+-LIBRARIES = -lstdc++
++PKG_CONFIG ?= pkg-config
++
++USE_EXR ?= yes
++USE_JPEG ?= yes
++USE_JPEG2K ?= yes
++USE_MNG ?= yes
++USE_PNG ?= yes
++USE_TIFF ?= yes
++USE_RAW ?= yes
++
++LIBRARIES-yes = $(shell $(PKG_CONFIG) --libs zlib)
++LIBRARIES-$(USE_EXR) += $(shell $(PKG_CONFIG) --libs OpenEXR)
++LIBRARIES-$(USE_JPEG) += -ljpeg
++LIBRARIES-$(USE_JPEG2K) += $(shell $(PKG_CONFIG) --libs libopenjpeg)
++LIBRARIES-$(USE_MNG) += -lmng
++LIBRARIES-$(USE_PNG) += $(shell $(PKG_CONFIG) --libs libpng)
++LIBRARIES-$(USE_TIFF) += $(shell $(PKG_CONFIG) --libs libtiff-4 IlmBase)
++LIBRARIES-$(USE_RAW) += $(shell $(PKG_CONFIG) --libs libraw)
+
+ MODULES = $(SRCS:.c=.o)
+ MODULES := $(MODULES:.cpp=.o)
+@@ -64,13 +81,15 @@
+ $(AR) r $@ $(MODULES)
+
+ $(SHAREDLIB): $(MODULES)
+- $(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
++ $(CXX) $(CXXFLAGS) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES-yes)
+
+ install:
+ install -d $(INCDIR) $(INSTALLDIR)
+- install -m 644 -o root -g root $(HEADER) $(INCDIR)
+- install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
+- install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
++ install -m 644 $(HEADER) $(INCDIR)
++ifneq ($(STATICLIB),)
++ install -m 644 $(STATICLIB) $(INSTALLDIR)
++endif
++ install -m 755 $(SHAREDLIB) $(INSTALLDIR)
+ ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
+ ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
+ # ldconfig
+--- Source/FreeImage/J2KHelper.cpp
++++ Source/FreeImage/J2KHelper.cpp
+@@ -21,7 +21,7 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibOpenJPEG/openjpeg.h"
++#include <openjpeg.h>
+
+ /**
+ Divide an integer by a power of 2 and round upwards
+--- Source/FreeImage/PluginEXR.cpp
++++ Source/FreeImage/PluginEXR.cpp
+@@ -22,16 +22,16 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../OpenEXR/IlmImf/ImfIO.h"
+-#include "../OpenEXR/Iex/Iex.h"
+-#include "../OpenEXR/IlmImf/ImfOutputFile.h"
+-#include "../OpenEXR/IlmImf/ImfInputFile.h"
+-#include "../OpenEXR/IlmImf/ImfRgbaFile.h"
+-#include "../OpenEXR/IlmImf/ImfChannelList.h"
+-#include "../OpenEXR/IlmImf/ImfRgba.h"
+-#include "../OpenEXR/IlmImf/ImfArray.h"
+-#include "../OpenEXR/IlmImf/ImfPreviewImage.h"
+-#include "../OpenEXR/Half/half.h"
++#include <ImfIO.h>
++#include <Iex.h>
++#include <ImfOutputFile.h>
++#include <ImfInputFile.h>
++#include <ImfRgbaFile.h>
++#include <ImfChannelList.h>
++#include <ImfRgba.h>
++#include <ImfArray.h>
++#include <ImfPreviewImage.h>
++#include <half.h>
+
+
+ // ==========================================================
+--- Source/FreeImage/PluginJ2K.cpp
++++ Source/FreeImage/PluginJ2K.cpp
+@@ -21,7 +21,7 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibOpenJPEG/openjpeg.h"
++#include <openjpeg.h>
+
+ // ==========================================================
+ // Plugin Interface
+--- Source/FreeImage/PluginJP2.cpp
++++ Source/FreeImage/PluginJP2.cpp
+@@ -21,7 +21,7 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibOpenJPEG/openjpeg.h"
++#include <openjpeg.h>
+
+ // ==========================================================
+ // Plugin Interface
+--- Source/FreeImage/PluginPNG.cpp
++++ Source/FreeImage/PluginPNG.cpp
+@@ -37,8 +37,8 @@
+
+ // ----------------------------------------------------------
+
+-#include "../ZLib/zlib.h"
+-#include "../LibPNG/png.h"
++#include <zlib.h>
++#include <png.h>
+
+ // ----------------------------------------------------------
+
+--- Source/transupp.c
++++ Source/transupp.c
+@@ -15,8 +15,7 @@
+ /* Although this file really shouldn't have access to the library internals,
+ * it's helpful to let it call jround_up() and jcopy_block_row().
+ */
+-#define JPEG_INTERNALS
+-
++#include <jerror.h>
+ #include "jinclude.h"
+ #include "jpeglib.h"
+ #include "transupp.h" /* My own external interface */
+--- Source/FreeImage/ZLibInterface.cpp
++++ Source/FreeImage/ZLibInterface.cpp
+@@ -19,10 +19,10 @@
+ // Use at your own risk!
+ // ==========================================================
+
+-#include "../ZLib/zlib.h"
++#include <zlib.h>
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../ZLib/zutil.h" /* must be the last header because of error C3163 in VS2008 (_vsnprintf defined in stdio.h) */
++#define OS_CODE 0x03
+
+ /**
+ Compresses a source buffer into a target buffer, using the ZLib library.
+--- Source/FreeImage/PluginG3.cpp
++++ Source/FreeImage/PluginG3.cpp
+@@ -20,7 +20,7 @@
+ // Use at your own risk!
+ // ==========================================================
+
+-#include "../LibTIFF4/tiffiop.h"
++#include "tiffiop.h"
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+--- Source/FreeImage/PluginJPEG.cpp
++++ Source/FreeImage/PluginJPEG.cpp
+@@ -35,11 +35,15 @@
+ #undef FAR
+ #include <setjmp.h>
+
+-#include "../LibJPEG/jinclude.h"
+-#include "../LibJPEG/jpeglib.h"
+-#include "../LibJPEG/jerror.h"
++#include <string.h>
++#include <stdio.h>
++#include <jconfig.h>
++#include <jpeglib.h>
++#include <jerror.h>
+ }
+
++#define SIZEOF(object) ((size_t) sizeof(object))
++
+ #include "FreeImage.h"
+ #include "Utilities.h"
+
+--- Source/FreeImageToolkit/JPEGTransform.cpp
++++ Source/FreeImageToolkit/JPEGTransform.cpp
+@@ -25,10 +25,11 @@
+ #undef FAR
+ #include <setjmp.h>
+
+-#include "../LibJPEG/jinclude.h"
+-#include "../LibJPEG/jpeglib.h"
+-#include "../LibJPEG/jerror.h"
+-#include "../LibJPEG/transupp.h"
++#include <string.h>
++#include <stdio.h>
++#include <jpeglib.h>
++#include <jerror.h>
++#include "transupp.h"
+ }
+
+ #include "FreeImage.h"
+--- Makefile.fip
++++ Makefile.fip
+@@ -11,7 +11,24 @@
+ # Converts cr/lf to just lf
+ DOS2UNIX = dos2unix
+
+-LIBRARIES = -lstdc++
++PKG_CONFIG ?= pkg-config
++
++USE_EXR ?= yes
++USE_JPEG ?= yes
++USE_JPEG2K ?= yes
++USE_MNG ?= yes
++USE_PNG ?= yes
++USE_TIFF ?= yes
++USE_RAW ?= yes
++
++LIBRARIES-yes = $(shell $(PKG_CONFIG) --libs zlib)
++LIBRARIES-$(USE_EXR) += $(shell $(PKG_CONFIG) --libs OpenEXR)
++LIBRARIES-$(USE_JPEG) += -ljpeg
++LIBRARIES-$(USE_JPEG2K) += $(shell $(PKG_CONFIG) --libs libopenjpeg)
++LIBRARIES-$(USE_MNG) += -lmng
++LIBRARIES-$(USE_PNG) += $(shell $(PKG_CONFIG) --libs libpng)
++LIBRARIES-$(USE_TIFF) += $(shell $(PKG_CONFIG) --libs libtiff-4 IlmBase)
++LIBRARIES-$(USE_RAW) += $(shell $(PKG_CONFIG) --libs libraw)
+
+ MODULES = $(SRCS:.c=.o)
+ MODULES := $(MODULES:.cpp=.o)
+@@ -65,14 +82,18 @@
+ $(AR) r $@ $(MODULES)
+
+ $(SHAREDLIB): $(MODULES)
+- $(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
++ $(CXX) $(CXXFLAGS) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES-yes)
+
+ install:
+ install -d $(INCDIR) $(INSTALLDIR)
+- install -m 644 -o root -g root $(HEADER) $(INCDIR)
+- install -m 644 -o root -g root $(HEADERFIP) $(INCDIR)
+- install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
+- install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
++ install -m 644 $(HEADER) $(INCDIR)
++ install -m 644 $(HEADERFIP) $(INCDIR)
++ifneq ($(STATICLIB),)
++ install -m 644 $(STATICLIB) $(INSTALLDIR)
++endif
++ install -m 755 $(SHAREDLIB) $(INSTALLDIR)
++ ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
++ ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
+
+ clean:
+ rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
+--- Makefile.srcs
++++ Makefile.srcs
+@@ -1,6 +1,14 @@
++USE_EXR ?= yes
++USE_JPEG ?= yes
++USE_JPEG2K ?= yes
++USE_MNG ?= yes
++USE_PNG ?= yes
++USE_TIFF ?= yes
++USE_RAW ?= yes
++
+ VER_MAJOR = 3
+ VER_MINOR = 15.3
+-SRCS = \
++SRCS-yes = \
+ Source/FreeImage/BitmapAccess.cpp \
+ Source/FreeImage/ColorLookup.cpp \
+ Source/FreeImage/FreeImage.cpp \
+@@ -17,36 +25,74 @@ SRCS = \
+ Source/FreeImage/GetType.cpp \
+ Source/FreeImage/MemoryIO.cpp \
+ Source/FreeImage/PixelAccess.cpp \
++
++SRCS-$(USE_JPEG2K) += \
+ Source/FreeImage/J2KHelper.cpp \
++
++SRCS-$(USE_MNG) += \
+ Source/FreeImage/MNGHelper.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/Plugin.cpp \
+ Source/FreeImage/PluginBMP.cpp \
+ Source/FreeImage/PluginCUT.cpp \
+ Source/FreeImage/PluginDDS.cpp \
++
++SRCS-$(USE_EXR) += \
+ Source/FreeImage/PluginEXR.cpp \
++
++SRCS-$(USE_TIFF) += \
+ Source/FreeImage/PluginG3.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginGIF.cpp \
+ Source/FreeImage/PluginHDR.cpp \
+ Source/FreeImage/PluginICO.cpp \
+ Source/FreeImage/PluginIFF.cpp \
++
++SRCS-$(USE_JPEG2K) += \
+ Source/FreeImage/PluginJ2K.cpp \
++
++SRCS-$(USE_MNG) += \
+ Source/FreeImage/PluginJNG.cpp \
++
++SRCS-$(USE_JPEG2K) += \
+ Source/FreeImage/PluginJP2.cpp \
++
++SRCS-$(USE_JPEG) += \
+ Source/FreeImage/PluginJPEG.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginKOALA.cpp \
++
++SRCS-$(USE_MNG) += \
+ Source/FreeImage/PluginMNG.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginPCD.cpp \
+ Source/FreeImage/PluginPCX.cpp \
+ Source/FreeImage/PluginPFM.cpp \
+ Source/FreeImage/PluginPICT.cpp \
++
++SRCS-$(USE_PNG) += \
+ Source/FreeImage/PluginPNG.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginPNM.cpp \
+ Source/FreeImage/PluginPSD.cpp \
+ Source/FreeImage/PluginRAS.cpp \
++
++SRCS-$(USE_RAW) += \
+ Source/FreeImage/PluginRAW.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginSGI.cpp \
+ Source/FreeImage/PluginTARGA.cpp \
++
++SRCS-$(USE_TIFF) += \
+ Source/FreeImage/PluginTIFF.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginWBMP.cpp \
+ Source/FreeImage/PluginXBM.cpp \
+ Source/FreeImage/PluginXPM.cpp \
+@@ -83,7 +129,11 @@ SRCS = \
+ Source/Metadata/IPTC.cpp \
+ Source/Metadata/TagConversion.cpp \
+ Source/Metadata/TagLib.cpp \
++
++SRCS-$(USE_TIFF) += \
+ Source/Metadata/XTIFF.cpp \
++
++SRCS-yes += \
+ Source/FreeImageToolkit/Background.cpp \
+ Source/FreeImageToolkit/BSplineRotate.cpp \
+ Source/FreeImageToolkit/Channels.cpp \
+@@ -92,10 +142,18 @@ SRCS = \
+ Source/FreeImageToolkit/CopyPaste.cpp \
+ Source/FreeImageToolkit/Display.cpp \
+ Source/FreeImageToolkit/Flip.cpp \
++
++SRCS-$(USE_JPEG) += \
+ Source/FreeImageToolkit/JPEGTransform.cpp \
++
++SRCS-yes += \
+ Source/FreeImageToolkit/MultigridPoissonSolver.cpp \
+ Source/FreeImageToolkit/Rescale.cpp \
+ Source/FreeImageToolkit/Resize.cpp \
++
++SRCS-$(USE_JPEG) += \
++ Source/transupp.c
++SRCS = $(SRCS-yes)
+ INCLS = \
+ Examples/OpenGL/TextureManager/TextureManager.h \
+ Examples/Plugin/PluginCradle.h \
+@@ -116,7 +174,17 @@
+ Wrapper/FreeImagePlus/test/fipTest.h \
+ TestAPI/TestSuite.h
+
+-INCLUDE = -I. \
++INCLUDE-yes = -I. \
+ -ISource \
+ -ISource/Metadata \
+ -ISource/FreeImageToolkit \
++
++INCLUDE-yes += $(shell $(PKG_CONFIG) --cflags-only-I zlib)
++INCLUDE-$(USE_EXR) += -DUSE_EXR $(shell $(PKG_CONFIG) --cflags-only-I OpenEXR)
++INCLUDE-$(USE_JPEG) += -DUSE_JPEG
++INCLUDE-$(USE_JPEG2K) += -DUSE_JPEG2K $(shell $(PKG_CONFIG) --cflags-only-I libopenjpeg)
++INCLUDE-$(USE_MNG) += -DUSE_MNG
++INCLUDE-$(USE_PNG) += -DUSE_PNG $(shell $(PKG_CONFIG) --cflags-only-I libpng)
++INCLUDE-$(USE_TIFF) += -DUSE_TIFF $(shell $(PKG_CONFIG) --cflags-only-I libtiff-4 IlmBase)
++INCLUDE-$(USE_RAW) += -DUSE_RAW $(shell $(PKG_CONFIG) --cflags-only-I libraw)
++INCLUDE = $(INCLUDE-yes)
+--- fipMakefile.srcs
++++ fipMakefile.srcs
+@@ -1,6 +1,14 @@
++USE_EXR ?= yes
++USE_JPEG ?= yes
++USE_JPEG2K ?= yes
++USE_MNG ?= yes
++USE_PNG ?= yes
++USE_TIFF ?= yes
++USE_RAW ?= yes
++
+ VER_MAJOR = 3
+ VER_MINOR = 15.3
+-SRCS = \
++SRCS-yes = \
+ Source/FreeImage/BitmapAccess.cpp \
+ Source/FreeImage/ColorLookup.cpp \
+ Source/FreeImage/FreeImage.cpp \
+@@ -9,36 +17,74 @@
+ Source/FreeImage/GetType.cpp \
+ Source/FreeImage/MemoryIO.cpp \
+ Source/FreeImage/PixelAccess.cpp \
++
++SRCS-$(USE_JPEG2K) += \
+ Source/FreeImage/J2KHelper.cpp \
++
++SRCS-$(USE_MNG) += \
+ Source/FreeImage/MNGHelper.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/Plugin.cpp \
+ Source/FreeImage/PluginBMP.cpp \
+ Source/FreeImage/PluginCUT.cpp \
+ Source/FreeImage/PluginDDS.cpp \
++
++SRCS-$(USE_EXR) += \
+ Source/FreeImage/PluginEXR.cpp \
++
++SRCS-$(USE_TIFF) += \
+ Source/FreeImage/PluginG3.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginGIF.cpp \
+ Source/FreeImage/PluginHDR.cpp \
+ Source/FreeImage/PluginICO.cpp \
+ Source/FreeImage/PluginIFF.cpp \
++
++SRCS-$(USE_JPEG2K) += \
+ Source/FreeImage/PluginJ2K.cpp \
++
++SRCS-$(USE_MNG) += \
+ Source/FreeImage/PluginJNG.cpp \
++
++SRCS-$(USE_JPEG2K) += \
+ Source/FreeImage/PluginJP2.cpp \
++
++SRCS-$(USE_JPEG) += \
+ Source/FreeImage/PluginJPEG.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginKOALA.cpp \
++
++SRCS-$(USE_MNG) += \
+ Source/FreeImage/PluginMNG.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginPCD.cpp \
+ Source/FreeImage/PluginPCX.cpp \
+ Source/FreeImage/PluginPFM.cpp \
+ Source/FreeImage/PluginPICT.cpp \
++
++SRCS-$(USE_PNG) += \
+ Source/FreeImage/PluginPNG.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginPNM.cpp \
+ Source/FreeImage/PluginPSD.cpp \
+ Source/FreeImage/PluginRAS.cpp \
++
++SRCS-$(USE_RAW) += \
+ Source/FreeImage/PluginRAW.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginSGI.cpp \
+ Source/FreeImage/PluginTARGA.cpp \
++
++SRCS-$(USE_TIFF) += \
+ Source/FreeImage/PluginTIFF.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginWBMP.cpp \
+ Source/FreeImage/PluginXBM.cpp \
+ Source/FreeImage/PluginXPM.cpp \
+@@ -75,7 +121,11 @@
+ Source/Metadata/IPTC.cpp \
+ Source/Metadata/TagConversion.cpp \
+ Source/Metadata/TagLib.cpp \
++
++SRCS-$(USE_TIFF) += \
+ Source/Metadata/XTIFF.cpp \
++
++SRCS-yes += \
+ Source/FreeImageToolkit/Background.cpp \
+ Source/FreeImageToolkit/BSplineRotate.cpp \
+ Source/FreeImageToolkit/Channels.cpp \
+@@ -84,7 +134,11 @@
+ Source/FreeImageToolkit/CopyPaste.cpp \
+ Source/FreeImageToolkit/Display.cpp \
+ Source/FreeImageToolkit/Flip.cpp \
++
++SRCS-$(USE_JPEG) += \
+ Source/FreeImageToolkit/JPEGTransform.cpp \
++
++SRCS-yes += \
+ Source/FreeImageToolkit/MultigridPoissonSolver.cpp \
+ Source/FreeImageToolkit/Rescale.cpp \
+ Source/FreeImageToolkit/Resize.cpp \
+@@ -95,6 +149,11 @@
+ Wrapper/FreeImagePlus/src/fipTag.cpp \
+ Wrapper/FreeImagePlus/src/fipWinImage.cpp \
+ Wrapper/FreeImagePlus/src/FreeImagePlus.cpp
++
++SRCS-$(USE_JPEG) += \
++ Source/transupp.c
++
++SRCS = $(SRCS-yes)
+ INCLUDE = -I. \
+ -ISource \
+ -ISource/Metadata \
+--- Source/FreeImage/PluginRAW.cpp
++++ Source/FreeImage/PluginRAW.cpp
+@@ -19,7 +19,7 @@
+ // Use at your own risk!
+ // ==========================================================
+
+-#include "../LibRawLite/libraw/libraw.h"
++#include <libraw.h>
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+--- Source/Metadata/XTIFF.cpp
++++ Source/Metadata/XTIFF.cpp
+@@ -29,7 +29,7 @@
+ #pragma warning (disable : 4786) // identifier was truncated to 'number' characters
+ #endif
+
+-#include "../LibTIFF4/tiffiop.h"
++#include "tiffiop.h"
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+--- Source/FreeImage/PluginTIFF.cpp
++++ Source/FreeImage/PluginTIFF.cpp
+@@ -37,9 +37,9 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibTIFF4/tiffiop.h"
++#include "tiffiop.h"
+ #include "../Metadata/FreeImageTag.h"
+-#include "../OpenEXR/Half/half.h"
++#include <half.h>
+
+ #include "FreeImageIO.h"
+ #include "PSDParser.h"
+--- Source/tiffiop.h
++++ Source/tiffiop.h
+@@ -30,7 +30,9 @@
+ * ``Library-private'' definitions.
+ */
+
+-#include "tif_config.h"
++#include <tiffconf.h>
++#define HAVE_SEARCH_H
++#define HAVE_FCNTL_H
+
+ #ifdef HAVE_FCNTL_H
+ # include <fcntl.h>
+--- Source/FreeImage/Plugin.cpp
++++ Source/FreeImage/Plugin.cpp
+@@ -223,23 +223,33 @@
+ */
+ s_plugins->AddNode(InitBMP);
+ s_plugins->AddNode(InitICO);
++#ifdef USE_JPEG
+ s_plugins->AddNode(InitJPEG);
++#endif
++#ifdef USE_MNG
+ s_plugins->AddNode(InitJNG);
++#endif
+ s_plugins->AddNode(InitKOALA);
+ s_plugins->AddNode(InitIFF);
++#ifdef USE_MNG
+ s_plugins->AddNode(InitMNG);
++#endif
+ s_plugins->AddNode(InitPNM, NULL, "PBM", "Portable Bitmap (ASCII)", "pbm", "^P1");
+ s_plugins->AddNode(InitPNM, NULL, "PBMRAW", "Portable Bitmap (RAW)", "pbm", "^P4");
+ s_plugins->AddNode(InitPCD);
+ s_plugins->AddNode(InitPCX);
+ s_plugins->AddNode(InitPNM, NULL, "PGM", "Portable Greymap (ASCII)", "pgm", "^P2");
+ s_plugins->AddNode(InitPNM, NULL, "PGMRAW", "Portable Greymap (RAW)", "pgm", "^P5");
++#ifdef USE_PNG
+ s_plugins->AddNode(InitPNG);
++#endif
+ s_plugins->AddNode(InitPNM, NULL, "PPM", "Portable Pixelmap (ASCII)", "ppm", "^P3");
+ s_plugins->AddNode(InitPNM, NULL, "PPMRAW", "Portable Pixelmap (RAW)", "ppm", "^P6");
+ s_plugins->AddNode(InitRAS);
+ s_plugins->AddNode(InitTARGA);
++#ifdef USE_TIFF
+ s_plugins->AddNode(InitTIFF);
++#endif
+ s_plugins->AddNode(InitWBMP);
+ s_plugins->AddNode(InitPSD);
+ s_plugins->AddNode(InitCUT);
+@@ -248,14 +258,22 @@
+ s_plugins->AddNode(InitDDS);
+ s_plugins->AddNode(InitGIF);
+ s_plugins->AddNode(InitHDR);
++#ifdef USE_TIFF
+ s_plugins->AddNode(InitG3);
++#endif
+ s_plugins->AddNode(InitSGI);
++#ifdef USE_EXR
+ s_plugins->AddNode(InitEXR);
++#endif
++#ifdef USE_JPEG2K
+ s_plugins->AddNode(InitJ2K);
+ s_plugins->AddNode(InitJP2);
++#endif
+ s_plugins->AddNode(InitPFM);
+ s_plugins->AddNode(InitPICT);
++#ifdef USE_RAW
+ s_plugins->AddNode(InitRAW);
++#endif
+
+ // external plugin initialization
+
diff --git a/media-libs/freeimage/files/freeimage-3.15.3-unbundling.patch b/media-libs/freeimage/files/freeimage-3.15.3-unbundling.patch
new file mode 100644
index 0000000..84c7f19
--- /dev/null
+++ b/media-libs/freeimage/files/freeimage-3.15.3-unbundling.patch
@@ -0,0 +1,285 @@
+--- Makefile.gnu.old 2010-12-06 23:37:20.000000000 +0100
++++ Makefile.gnu 2012-02-07 16:25:00.274896402 +0100
+@@ -11,7 +11,13 @@
+ # Converts cr/lf to just lf
+ DOS2UNIX = dos2unix
+
+-LIBRARIES = -lstdc++
++LIBRARIES = -lstdc++ -lmng -ljpeg \
++ $(shell pkg-config --libs libpng) \
++ $(shell pkg-config --libs libtiff-4) \
++ $(shell pkg-config --libs zlib) \
++ $(shell pkg-config --libs libopenjpeg) \
++ $(shell pkg-config --libs OpenEXR) \
++ $(shell pkg-config --libs libraw)
+
+ MODULES = $(SRCS:.c=.o)
+ MODULES := $(MODULES:.cpp=.o)
+@@ -64,7 +64,7 @@
+ $(AR) r $@ $(MODULES)
+
+ $(SHAREDLIB): $(MODULES)
+- $(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
++ $(CC) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
+
+ install:
+ install -d $(INCDIR) $(INSTALLDIR)
+--- Source/FreeImage/J2KHelper.cpp.old 2012-02-07 16:32:41.814898596 +0100
++++ Source/FreeImage/J2KHelper.cpp 2012-02-07 16:33:06.914898715 +0100
+@@ -21,7 +21,7 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibOpenJPEG/openjpeg.h"
++#include <openjpeg.h>
+
+ /**
+ Divide an integer by a power of 2 and round upwards
+--- Source/FreeImage/PluginEXR.cpp.old 2012-02-07 16:34:01.224898974 +0100
++++ Source/FreeImage/PluginEXR.cpp 2012-02-07 16:35:34.124899415 +0100
+@@ -22,16 +22,16 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../OpenEXR/IlmImf/ImfIO.h"
+-#include "../OpenEXR/Iex/Iex.h"
+-#include "../OpenEXR/IlmImf/ImfOutputFile.h"
+-#include "../OpenEXR/IlmImf/ImfInputFile.h"
+-#include "../OpenEXR/IlmImf/ImfRgbaFile.h"
+-#include "../OpenEXR/IlmImf/ImfChannelList.h"
+-#include "../OpenEXR/IlmImf/ImfRgba.h"
+-#include "../OpenEXR/IlmImf/ImfArray.h"
+-#include "../OpenEXR/IlmImf/ImfPreviewImage.h"
+-#include "../OpenEXR/Half/half.h"
++#include <ImfIO.h>
++#include <Iex.h>
++#include <ImfOutputFile.h>
++#include <ImfInputFile.h>
++#include <ImfRgbaFile.h>
++#include <ImfChannelList.h>
++#include <ImfRgba.h>
++#include <ImfArray.h>
++#include <ImfPreviewImage.h>
++#include <half.h>
+
+
+ // ==========================================================
+--- Source/FreeImage/PluginJ2K.cpp.old 2012-02-07 16:41:39.814901153 +0100
++++ Source/FreeImage/PluginJ2K.cpp 2012-02-07 16:41:59.314901245 +0100
+@@ -21,7 +21,7 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibOpenJPEG/openjpeg.h"
++#include <openjpeg.h>
+
+ // ==========================================================
+ // Plugin Interface
+--- Source/FreeImage/PluginJP2.cpp.old 2012-02-07 16:42:44.034901460 +0100
++++ Source/FreeImage/PluginJP2.cpp 2012-02-07 16:43:08.214901573 +0100
+@@ -21,7 +21,7 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibOpenJPEG/openjpeg.h"
++#include <openjpeg.h>
+
+ // ==========================================================
+ // Plugin Interface
+--- Source/FreeImage/PluginPNG.cpp.old 2012-02-07 16:48:30.874903106 +0100
++++ Source/FreeImage/PluginPNG.cpp 2012-02-07 16:49:07.354903280 +0100
+@@ -37,8 +37,8 @@
+
+ // ----------------------------------------------------------
+
+-#include "../ZLib/zlib.h"
+-#include "../LibPNG/png.h"
++#include <zlib.h>
++#include <png.h>
+
+ // ----------------------------------------------------------
+
+--- Source/transupp.c.old 2012-02-08 12:37:51.605242277 +0100
++++ Source/transupp.c 2012-02-08 12:36:30.055241889 +0100
+@@ -15,8 +15,7 @@
+ /* Although this file really shouldn't have access to the library internals,
+ * it's helpful to let it call jround_up() and jcopy_block_row().
+ */
+-#define JPEG_INTERNALS
+-
++#include <jerror.h>
+ #include "jinclude.h"
+ #include "jpeglib.h"
+ #include "transupp.h" /* My own external interface */
+--- Source/FreeImage/ZLibInterface.cpp.old 2012-02-08 16:01:24.195300325 +0100
++++ Source/FreeImage/ZLibInterface.cpp 2012-02-08 16:01:46.845300430 +0100
+@@ -19,10 +19,10 @@
+ // Use at your own risk!
+ // ==========================================================
+
+-#include "../ZLib/zlib.h"
++#include <zlib.h>
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../ZLib/zutil.h" /* must be the last header because of error C3163 in VS2008 (_vsnprintf defined in stdio.h) */
++#define OS_CODE 0x03
+
+ /**
+ Compresses a source buffer into a target buffer, using the ZLib library.
+--- Source/FreeImage/PluginG3.cpp.old 2012-02-10 12:20:04.396058511 +0100
++++ Source/FreeImage/PluginG3.cpp 2012-02-10 13:00:43.486070102 +0100
+@@ -20,7 +20,7 @@
+ // Use at your own risk!
+ // ==========================================================
+
+-#include "../LibTIFF4/tiffiop.h"
++#include "tiffiop.h"
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+--- Source/FreeImage/PluginJPEG.cpp.old 2012-02-10 13:21:03.816075904 +0100
++++ Source/FreeImage/PluginJPEG.cpp 2012-02-10 13:30:13.236078514 +0100
+@@ -35,11 +35,15 @@
+ #undef FAR
+ #include <setjmp.h>
+
+-#include "../LibJPEG/jinclude.h"
+-#include "../LibJPEG/jpeglib.h"
+-#include "../LibJPEG/jerror.h"
++#include <string.h>
++#include <stdio.h>
++#include <jconfig.h>
++#include <jpeglib.h>
++#include <jerror.h>
+ }
+
++#define SIZEOF(object) ((size_t) sizeof(object))
++
+ #include "FreeImage.h"
+ #include "Utilities.h"
+
+--- Source/FreeImageToolkit/JPEGTransform.cpp.old 2012-02-10 13:29:17.546078251 +0100
++++ Source/FreeImageToolkit/JPEGTransform.cpp 2012-02-10 13:30:20.576078553 +0100
+@@ -25,10 +25,11 @@
+ #undef FAR
+ #include <setjmp.h>
+
+-#include "../LibJPEG/jinclude.h"
+-#include "../LibJPEG/jpeglib.h"
+-#include "../LibJPEG/jerror.h"
+-#include "../LibJPEG/transupp.h"
++#include <string.h>
++#include <stdio.h>
++#include <jpeglib.h>
++#include <jerror.h>
++#include "transupp.h"
+ }
+
+ #include "FreeImage.h"
+--- Makefile.fip.old 2012-02-12 12:21:36.573897004 +0100
++++ Makefile.fip 2012-02-12 12:23:50.612449982 +0100
+@@ -11,7 +11,13 @@
+ # Converts cr/lf to just lf
+ DOS2UNIX = dos2unix
+
+-LIBRARIES = -lstdc++
++LIBRARIES = -lstdc++ -lmng -ljpeg \
++ $(shell pkg-config --libs libpng) \
++ $(shell pkg-config --libs libtiff-4) \
++ $(shell pkg-config --libs zlib) \
++ $(shell pkg-config --libs libopenjpeg) \
++ $(shell pkg-config --libs OpenEXR) \
++ $(shell pkg-config --libs libraw)
+
+ MODULES = $(SRCS:.c=.o)
+ MODULES := $(MODULES:.cpp=.o)
+@@ -65,7 +65,7 @@
+ $(AR) r $@ $(MODULES)
+
+ $(SHAREDLIB): $(MODULES)
+- $(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
++ $(CC) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
+
+ install:
+ install -d $(INCDIR) $(INSTALLDIR)
+--- Makefile.srcs.old 2012-03-05 21:39:31.927571124 +0100
++++ Makefile.srcs 2012-03-05 21:42:25.724317503 +0100
+@@ -88,6 +88,7 @@
+ Source/FreeImageToolkit/MultigridPoissonSolver.cpp \
+ Source/FreeImageToolkit/Rescale.cpp \
+ Source/FreeImageToolkit/Resize.cpp \
++ Source/transupp.c
+ INCLS = \
+ Source/FreeImage.h \
+ Source/CacheFile.h \
+@@ -116,3 +117,9 @@
+ -ISource \
+ -ISource/Metadata \
+ -ISource/FreeImageToolkit \
++ $(shell pkg-config --cflags-only-I libpng) \
++ $(shell pkg-config --cflags-only-I libtiff-4) \
++ $(shell pkg-config --cflags-only-I zlib) \
++ $(shell pkg-config --cflags-only-I libopenjpeg) \
++ $(shell pkg-config --cflags-only-I OpenEXR) \
++ $(shell pkg-config --cflags-only-I libraw)
+--- Source/FreeImage/PluginRAW.cpp.old 2012-03-05 21:51:38.538302182 +0100
++++ Source/FreeImage/PluginRAW.cpp 2012-03-05 21:53:47.384165909 +0100
+@@ -19,7 +19,7 @@
+ // Use at your own risk!
+ // ==========================================================
+
+-#include "../LibRawLite/libraw/libraw.h"
++#include <libraw.h>
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+--- Source/Metadata/XTIFF.cpp.old 2012-03-05 22:13:31.139297475 +0100
++++ Source/Metadata/XTIFF.cpp 2012-03-05 22:15:39.778190233 +0100
+@@ -29,7 +29,7 @@
+ #pragma warning (disable : 4786) // identifier was truncated to 'number' characters
+ #endif
+
+-#include "../LibTIFF4/tiffiop.h"
++#include "tiffiop.h"
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+--- Source/FreeImage/PluginTIFF.cpp.old 2012-03-05 22:26:45.056274217 +0100
++++ Source/FreeImage/PluginTIFF.cpp 2012-03-05 22:27:21.506763949 +0100
+@@ -37,9 +37,9 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibTIFF4/tiffiop.h"
++#include "tiffiop.h"
+ #include "../Metadata/FreeImageTag.h"
+-#include "../OpenEXR/Half/half.h"
++#include <half.h>
+
+ #include "FreeImageIO.h"
+ #include "PSDParser.h"
+--- Source/tiffiop.h.old 2012-03-05 22:30:17.667627310 +0100
++++ Source/tiffiop.h 2012-03-05 22:30:51.815273794 +0100
+@@ -30,7 +30,9 @@
+ * ``Library-private'' definitions.
+ */
+
+-#include "tif_config.h"
++#include <tiffconf.h>
++#define HAVE_SEARCH_H
++#define HAVE_FCNTL_H
+
+ #ifdef HAVE_FCNTL_H
+ # include <fcntl.h>
+--- fipMakefile.srcs.old 2012-03-06 08:45:25.895324156 +0100
++++ fipMakefile.srcs 2012-03-06 08:46:47.895534606 +0100
+@@ -94,7 +94,8 @@
+ Wrapper/FreeImagePlus/src/fipMultiPage.cpp \
+ Wrapper/FreeImagePlus/src/fipTag.cpp \
+ Wrapper/FreeImagePlus/src/fipWinImage.cpp \
+- Wrapper/FreeImagePlus/src/FreeImagePlus.cpp
++ Wrapper/FreeImagePlus/src/FreeImagePlus.cpp \
++ Source/transupp.c
+ INCLUDE = -I. \
+ -ISource \
+ -ISource/Metadata \
diff --git a/media-libs/freeimage/files/freeimage-3.15.4-datatypes.patch b/media-libs/freeimage/files/freeimage-3.15.4-datatypes.patch
new file mode 100644
index 0000000..93cdbaa
--- /dev/null
+++ b/media-libs/freeimage/files/freeimage-3.15.4-datatypes.patch
@@ -0,0 +1,13 @@
+--- FreeImage/Source/FreeImage.h.orig 2013-03-10 21:48:08.000000000 +0400
++++ FreeImage/Source/FreeImage.h 2013-03-10 21:48:29.637324387 +0400
+@@ -141,8 +141,10 @@
+ typedef uint16_t WORD;
+ typedef uint32_t DWORD;
+ typedef int32_t LONG;
++#ifndef _LIBRAW_TYPES_H
+ typedef int64_t INT64;
+ typedef uint64_t UINT64;
++#endif
+ #else
+ // MS is not C99 ISO compliant
+ typedef long BOOL;
diff --git a/media-libs/freeimage/files/freeimage-3.15.4-unbundling.patch b/media-libs/freeimage/files/freeimage-3.15.4-unbundling.patch
new file mode 100644
index 0000000..f770b7e
--- /dev/null
+++ b/media-libs/freeimage/files/freeimage-3.15.4-unbundling.patch
@@ -0,0 +1,639 @@
+lots of fixes here:
+ - use system graphics libraries
+ - make all of them optional
+ - drop root users from install (fix user installs)
+ - make static lib build optional
+ - link with CXX and CXXFLAGS (since this is C++ code)
+
+--- Makefile.gnu
++++ Makefile.gnu
+@@ -11,7 +11,24 @@
+ # Converts cr/lf to just lf
+ DOS2UNIX = dos2unix
+
+-LIBRARIES = -lstdc++
++PKG_CONFIG ?= pkg-config
++
++USE_EXR ?= yes
++USE_JPEG ?= yes
++USE_JPEG2K ?= yes
++USE_MNG ?= yes
++USE_PNG ?= yes
++USE_TIFF ?= yes
++USE_RAW ?= yes
++
++LIBRARIES-yes = $(shell $(PKG_CONFIG) --libs zlib)
++LIBRARIES-$(USE_EXR) += $(shell $(PKG_CONFIG) --libs OpenEXR)
++LIBRARIES-$(USE_JPEG) += -ljpeg
++LIBRARIES-$(USE_JPEG2K) += $(shell $(PKG_CONFIG) --libs libopenjpeg)
++LIBRARIES-$(USE_MNG) += -lmng
++LIBRARIES-$(USE_PNG) += $(shell $(PKG_CONFIG) --libs libpng)
++LIBRARIES-$(USE_TIFF) += $(shell $(PKG_CONFIG) --libs libtiff-4 IlmBase)
++LIBRARIES-$(USE_RAW) += $(shell $(PKG_CONFIG) --libs libraw)
+
+ MODULES = $(SRCS:.c=.o)
+ MODULES := $(MODULES:.cpp=.o)
+@@ -64,13 +81,15 @@
+ $(AR) r $@ $(MODULES)
+
+ $(SHAREDLIB): $(MODULES)
+- $(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
++ $(CXX) $(CXXFLAGS) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES-yes)
+
+ install:
+ install -d $(INCDIR) $(INSTALLDIR)
+- install -m 644 -o root -g root $(HEADER) $(INCDIR)
+- install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
+- install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
++ install -m 644 $(HEADER) $(INCDIR)
++ifneq ($(STATICLIB),)
++ install -m 644 $(STATICLIB) $(INSTALLDIR)
++endif
++ install -m 755 $(SHAREDLIB) $(INSTALLDIR)
+ ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
+ ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
+ # ldconfig
+--- Source/FreeImage/J2KHelper.cpp
++++ Source/FreeImage/J2KHelper.cpp
+@@ -21,7 +21,7 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibOpenJPEG/openjpeg.h"
++#include <openjpeg.h>
+
+ /**
+ Divide an integer by a power of 2 and round upwards
+--- Source/FreeImage/PluginEXR.cpp
++++ Source/FreeImage/PluginEXR.cpp
+@@ -22,16 +22,16 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../OpenEXR/IlmImf/ImfIO.h"
+-#include "../OpenEXR/Iex/Iex.h"
+-#include "../OpenEXR/IlmImf/ImfOutputFile.h"
+-#include "../OpenEXR/IlmImf/ImfInputFile.h"
+-#include "../OpenEXR/IlmImf/ImfRgbaFile.h"
+-#include "../OpenEXR/IlmImf/ImfChannelList.h"
+-#include "../OpenEXR/IlmImf/ImfRgba.h"
+-#include "../OpenEXR/IlmImf/ImfArray.h"
+-#include "../OpenEXR/IlmImf/ImfPreviewImage.h"
+-#include "../OpenEXR/Half/half.h"
++#include <ImfIO.h>
++#include <Iex.h>
++#include <ImfOutputFile.h>
++#include <ImfInputFile.h>
++#include <ImfRgbaFile.h>
++#include <ImfChannelList.h>
++#include <ImfRgba.h>
++#include <ImfArray.h>
++#include <ImfPreviewImage.h>
++#include <half.h>
+
+
+ // ==========================================================
+--- Source/FreeImage/PluginJ2K.cpp
++++ Source/FreeImage/PluginJ2K.cpp
+@@ -21,7 +21,7 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibOpenJPEG/openjpeg.h"
++#include <openjpeg.h>
+
+ // ==========================================================
+ // Plugin Interface
+--- Source/FreeImage/PluginJP2.cpp
++++ Source/FreeImage/PluginJP2.cpp
+@@ -21,7 +21,7 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibOpenJPEG/openjpeg.h"
++#include <openjpeg.h>
+
+ // ==========================================================
+ // Plugin Interface
+--- Source/FreeImage/PluginPNG.cpp
++++ Source/FreeImage/PluginPNG.cpp
+@@ -37,8 +37,8 @@
+
+ // ----------------------------------------------------------
+
+-#include "../ZLib/zlib.h"
+-#include "../LibPNG/png.h"
++#include <zlib.h>
++#include <png.h>
+
+ // ----------------------------------------------------------
+
+--- Source/transupp.c
++++ Source/transupp.c
+@@ -15,8 +15,7 @@
+ /* Although this file really shouldn't have access to the library internals,
+ * it's helpful to let it call jround_up() and jcopy_block_row().
+ */
+-#define JPEG_INTERNALS
+-
++#include <jerror.h>
+ #include "jinclude.h"
+ #include "jpeglib.h"
+ #include "transupp.h" /* My own external interface */
+--- Source/FreeImage/ZLibInterface.cpp
++++ Source/FreeImage/ZLibInterface.cpp
+@@ -19,10 +19,10 @@
+ // Use at your own risk!
+ // ==========================================================
+
+-#include "../ZLib/zlib.h"
++#include <zlib.h>
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../ZLib/zutil.h" /* must be the last header because of error C3163 in VS2008 (_vsnprintf defined in stdio.h) */
++#define OS_CODE 0x03
+
+ /**
+ Compresses a source buffer into a target buffer, using the ZLib library.
+--- Source/FreeImage/PluginG3.cpp
++++ Source/FreeImage/PluginG3.cpp
+@@ -20,7 +20,7 @@
+ // Use at your own risk!
+ // ==========================================================
+
+-#include "../LibTIFF4/tiffiop.h"
++#include "tiffiop.h"
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+--- Source/FreeImage/PluginJPEG.cpp
++++ Source/FreeImage/PluginJPEG.cpp
+@@ -35,11 +35,15 @@
+ #undef FAR
+ #include <setjmp.h>
+
+-#include "../LibJPEG/jinclude.h"
+-#include "../LibJPEG/jpeglib.h"
+-#include "../LibJPEG/jerror.h"
++#include <string.h>
++#include <stdio.h>
++#include <jconfig.h>
++#include <jpeglib.h>
++#include <jerror.h>
+ }
+
++#define SIZEOF(object) ((size_t) sizeof(object))
++
+ #include "FreeImage.h"
+ #include "Utilities.h"
+
+--- Source/FreeImageToolkit/JPEGTransform.cpp
++++ Source/FreeImageToolkit/JPEGTransform.cpp
+@@ -25,10 +25,11 @@
+ #undef FAR
+ #include <setjmp.h>
+
+-#include "../LibJPEG/jinclude.h"
+-#include "../LibJPEG/jpeglib.h"
+-#include "../LibJPEG/jerror.h"
+-#include "../LibJPEG/transupp.h"
++#include <string.h>
++#include <stdio.h>
++#include <jpeglib.h>
++#include <jerror.h>
++#include "transupp.h"
+ }
+
+ #include "FreeImage.h"
+--- Makefile.fip
++++ Makefile.fip
+@@ -11,7 +11,24 @@
+ # Converts cr/lf to just lf
+ DOS2UNIX = dos2unix
+
+-LIBRARIES = -lstdc++
++PKG_CONFIG ?= pkg-config
++
++USE_EXR ?= yes
++USE_JPEG ?= yes
++USE_JPEG2K ?= yes
++USE_MNG ?= yes
++USE_PNG ?= yes
++USE_TIFF ?= yes
++USE_RAW ?= yes
++
++LIBRARIES-yes = $(shell $(PKG_CONFIG) --libs zlib)
++LIBRARIES-$(USE_EXR) += $(shell $(PKG_CONFIG) --libs OpenEXR)
++LIBRARIES-$(USE_JPEG) += -ljpeg
++LIBRARIES-$(USE_JPEG2K) += $(shell $(PKG_CONFIG) --libs libopenjpeg)
++LIBRARIES-$(USE_MNG) += -lmng
++LIBRARIES-$(USE_PNG) += $(shell $(PKG_CONFIG) --libs libpng)
++LIBRARIES-$(USE_TIFF) += $(shell $(PKG_CONFIG) --libs libtiff-4 IlmBase)
++LIBRARIES-$(USE_RAW) += $(shell $(PKG_CONFIG) --libs libraw)
+
+ MODULES = $(SRCS:.c=.o)
+ MODULES := $(MODULES:.cpp=.o)
+@@ -65,14 +82,18 @@
+ $(AR) r $@ $(MODULES)
+
+ $(SHAREDLIB): $(MODULES)
+- $(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
++ $(CXX) $(CXXFLAGS) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES-yes)
+
+ install:
+ install -d $(INCDIR) $(INSTALLDIR)
+- install -m 644 -o root -g root $(HEADER) $(INCDIR)
+- install -m 644 -o root -g root $(HEADERFIP) $(INCDIR)
+- install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
+- install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
++ install -m 644 $(HEADER) $(INCDIR)
++ install -m 644 $(HEADERFIP) $(INCDIR)
++ifneq ($(STATICLIB),)
++ install -m 644 $(STATICLIB) $(INSTALLDIR)
++endif
++ install -m 755 $(SHAREDLIB) $(INSTALLDIR)
++ ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
++ ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
+
+ clean:
+ rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
+--- Makefile.srcs
++++ Makefile.srcs
+@@ -1,6 +1,14 @@
++USE_EXR ?= yes
++USE_JPEG ?= yes
++USE_JPEG2K ?= yes
++USE_MNG ?= yes
++USE_PNG ?= yes
++USE_TIFF ?= yes
++USE_RAW ?= yes
++
+ VER_MAJOR = 3
+ VER_MINOR = 15.4
+-SRCS = \
++SRCS-yes = \
+ Source/FreeImage/BitmapAccess.cpp \
+ Source/FreeImage/ColorLookup.cpp \
+ Source/FreeImage/FreeImage.cpp \
+@@ -17,36 +25,74 @@ SRCS = \
+ Source/FreeImage/GetType.cpp \
+ Source/FreeImage/MemoryIO.cpp \
+ Source/FreeImage/PixelAccess.cpp \
++
++SRCS-$(USE_JPEG2K) += \
+ Source/FreeImage/J2KHelper.cpp \
++
++SRCS-$(USE_MNG) += \
+ Source/FreeImage/MNGHelper.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/Plugin.cpp \
+ Source/FreeImage/PluginBMP.cpp \
+ Source/FreeImage/PluginCUT.cpp \
+ Source/FreeImage/PluginDDS.cpp \
++
++SRCS-$(USE_EXR) += \
+ Source/FreeImage/PluginEXR.cpp \
++
++SRCS-$(USE_TIFF) += \
+ Source/FreeImage/PluginG3.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginGIF.cpp \
+ Source/FreeImage/PluginHDR.cpp \
+ Source/FreeImage/PluginICO.cpp \
+ Source/FreeImage/PluginIFF.cpp \
++
++SRCS-$(USE_JPEG2K) += \
+ Source/FreeImage/PluginJ2K.cpp \
++
++SRCS-$(USE_MNG) += \
+ Source/FreeImage/PluginJNG.cpp \
++
++SRCS-$(USE_JPEG2K) += \
+ Source/FreeImage/PluginJP2.cpp \
++
++SRCS-$(USE_JPEG) += \
+ Source/FreeImage/PluginJPEG.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginKOALA.cpp \
++
++SRCS-$(USE_MNG) += \
+ Source/FreeImage/PluginMNG.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginPCD.cpp \
+ Source/FreeImage/PluginPCX.cpp \
+ Source/FreeImage/PluginPFM.cpp \
+ Source/FreeImage/PluginPICT.cpp \
++
++SRCS-$(USE_PNG) += \
+ Source/FreeImage/PluginPNG.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginPNM.cpp \
+ Source/FreeImage/PluginPSD.cpp \
+ Source/FreeImage/PluginRAS.cpp \
++
++SRCS-$(USE_RAW) += \
+ Source/FreeImage/PluginRAW.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginSGI.cpp \
+ Source/FreeImage/PluginTARGA.cpp \
++
++SRCS-$(USE_TIFF) += \
+ Source/FreeImage/PluginTIFF.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginWBMP.cpp \
+ Source/FreeImage/PluginXBM.cpp \
+ Source/FreeImage/PluginXPM.cpp \
+@@ -83,7 +129,11 @@ SRCS = \
+ Source/Metadata/IPTC.cpp \
+ Source/Metadata/TagConversion.cpp \
+ Source/Metadata/TagLib.cpp \
++
++SRCS-$(USE_TIFF) += \
+ Source/Metadata/XTIFF.cpp \
++
++SRCS-yes += \
+ Source/FreeImageToolkit/Background.cpp \
+ Source/FreeImageToolkit/BSplineRotate.cpp \
+ Source/FreeImageToolkit/Channels.cpp \
+@@ -92,10 +142,18 @@ SRCS = \
+ Source/FreeImageToolkit/CopyPaste.cpp \
+ Source/FreeImageToolkit/Display.cpp \
+ Source/FreeImageToolkit/Flip.cpp \
++
++SRCS-$(USE_JPEG) += \
+ Source/FreeImageToolkit/JPEGTransform.cpp \
++
++SRCS-yes += \
+ Source/FreeImageToolkit/MultigridPoissonSolver.cpp \
+ Source/FreeImageToolkit/Rescale.cpp \
+ Source/FreeImageToolkit/Resize.cpp \
++
++SRCS-$(USE_JPEG) += \
++ Source/transupp.c
++SRCS = $(SRCS-yes)
+ INCLS = \
+ Examples/OpenGL/TextureManager/TextureManager.h \
+ Examples/Plugin/PluginCradle.h \
+@@ -116,7 +174,17 @@
+ Wrapper/FreeImagePlus/test/fipTest.h \
+ TestAPI/TestSuite.h
+
+-INCLUDE = -I. \
++INCLUDE-yes = -I. \
+ -ISource \
+ -ISource/Metadata \
+ -ISource/FreeImageToolkit \
++
++INCLUDE-yes += $(shell $(PKG_CONFIG) --cflags-only-I zlib)
++INCLUDE-$(USE_EXR) += -DUSE_EXR $(shell $(PKG_CONFIG) --cflags-only-I OpenEXR)
++INCLUDE-$(USE_JPEG) += -DUSE_JPEG
++INCLUDE-$(USE_JPEG2K) += -DUSE_JPEG2K $(shell $(PKG_CONFIG) --cflags-only-I libopenjpeg)
++INCLUDE-$(USE_MNG) += -DUSE_MNG
++INCLUDE-$(USE_PNG) += -DUSE_PNG $(shell $(PKG_CONFIG) --cflags-only-I libpng)
++INCLUDE-$(USE_TIFF) += -DUSE_TIFF $(shell $(PKG_CONFIG) --cflags-only-I libtiff-4 IlmBase)
++INCLUDE-$(USE_RAW) += -DUSE_RAW $(shell $(PKG_CONFIG) --cflags-only-I libraw)
++INCLUDE = $(INCLUDE-yes)
+--- fipMakefile.srcs
++++ fipMakefile.srcs
+@@ -1,6 +1,14 @@
++USE_EXR ?= yes
++USE_JPEG ?= yes
++USE_JPEG2K ?= yes
++USE_MNG ?= yes
++USE_PNG ?= yes
++USE_TIFF ?= yes
++USE_RAW ?= yes
++
+ VER_MAJOR = 3
+ VER_MINOR = 15.4
+-SRCS = \
++SRCS-yes = \
+ Source/FreeImage/BitmapAccess.cpp \
+ Source/FreeImage/ColorLookup.cpp \
+ Source/FreeImage/FreeImage.cpp \
+@@ -9,36 +17,74 @@
+ Source/FreeImage/GetType.cpp \
+ Source/FreeImage/MemoryIO.cpp \
+ Source/FreeImage/PixelAccess.cpp \
++
++SRCS-$(USE_JPEG2K) += \
+ Source/FreeImage/J2KHelper.cpp \
++
++SRCS-$(USE_MNG) += \
+ Source/FreeImage/MNGHelper.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/Plugin.cpp \
+ Source/FreeImage/PluginBMP.cpp \
+ Source/FreeImage/PluginCUT.cpp \
+ Source/FreeImage/PluginDDS.cpp \
++
++SRCS-$(USE_EXR) += \
+ Source/FreeImage/PluginEXR.cpp \
++
++SRCS-$(USE_TIFF) += \
+ Source/FreeImage/PluginG3.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginGIF.cpp \
+ Source/FreeImage/PluginHDR.cpp \
+ Source/FreeImage/PluginICO.cpp \
+ Source/FreeImage/PluginIFF.cpp \
++
++SRCS-$(USE_JPEG2K) += \
+ Source/FreeImage/PluginJ2K.cpp \
++
++SRCS-$(USE_MNG) += \
+ Source/FreeImage/PluginJNG.cpp \
++
++SRCS-$(USE_JPEG2K) += \
+ Source/FreeImage/PluginJP2.cpp \
++
++SRCS-$(USE_JPEG) += \
+ Source/FreeImage/PluginJPEG.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginKOALA.cpp \
++
++SRCS-$(USE_MNG) += \
+ Source/FreeImage/PluginMNG.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginPCD.cpp \
+ Source/FreeImage/PluginPCX.cpp \
+ Source/FreeImage/PluginPFM.cpp \
+ Source/FreeImage/PluginPICT.cpp \
++
++SRCS-$(USE_PNG) += \
+ Source/FreeImage/PluginPNG.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginPNM.cpp \
+ Source/FreeImage/PluginPSD.cpp \
+ Source/FreeImage/PluginRAS.cpp \
++
++SRCS-$(USE_RAW) += \
+ Source/FreeImage/PluginRAW.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginSGI.cpp \
+ Source/FreeImage/PluginTARGA.cpp \
++
++SRCS-$(USE_TIFF) += \
+ Source/FreeImage/PluginTIFF.cpp \
++
++SRCS-yes += \
+ Source/FreeImage/PluginWBMP.cpp \
+ Source/FreeImage/PluginXBM.cpp \
+ Source/FreeImage/PluginXPM.cpp \
+@@ -75,7 +121,11 @@
+ Source/Metadata/IPTC.cpp \
+ Source/Metadata/TagConversion.cpp \
+ Source/Metadata/TagLib.cpp \
++
++SRCS-$(USE_TIFF) += \
+ Source/Metadata/XTIFF.cpp \
++
++SRCS-yes += \
+ Source/FreeImageToolkit/Background.cpp \
+ Source/FreeImageToolkit/BSplineRotate.cpp \
+ Source/FreeImageToolkit/Channels.cpp \
+@@ -84,7 +134,11 @@
+ Source/FreeImageToolkit/CopyPaste.cpp \
+ Source/FreeImageToolkit/Display.cpp \
+ Source/FreeImageToolkit/Flip.cpp \
++
++SRCS-$(USE_JPEG) += \
+ Source/FreeImageToolkit/JPEGTransform.cpp \
++
++SRCS-yes += \
+ Source/FreeImageToolkit/MultigridPoissonSolver.cpp \
+ Source/FreeImageToolkit/Rescale.cpp \
+ Source/FreeImageToolkit/Resize.cpp \
+@@ -95,6 +149,11 @@
+ Wrapper/FreeImagePlus/src/fipTag.cpp \
+ Wrapper/FreeImagePlus/src/fipWinImage.cpp \
+ Wrapper/FreeImagePlus/src/FreeImagePlus.cpp
++
++SRCS-$(USE_JPEG) += \
++ Source/transupp.c
++
++SRCS = $(SRCS-yes)
+ INCLUDE = -I. \
+ -ISource \
+ -ISource/Metadata \
+--- Source/FreeImage/PluginRAW.cpp
++++ Source/FreeImage/PluginRAW.cpp
+@@ -19,7 +19,7 @@
+ // Use at your own risk!
+ // ==========================================================
+
+-#include "../LibRawLite/libraw/libraw.h"
++#include <libraw.h>
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+--- Source/Metadata/XTIFF.cpp
++++ Source/Metadata/XTIFF.cpp
+@@ -29,7 +29,7 @@
+ #pragma warning (disable : 4786) // identifier was truncated to 'number' characters
+ #endif
+
+-#include "../LibTIFF4/tiffiop.h"
++#include "tiffiop.h"
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+--- Source/FreeImage/PluginTIFF.cpp
++++ Source/FreeImage/PluginTIFF.cpp
+@@ -37,9 +37,9 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibTIFF4/tiffiop.h"
++#include "tiffiop.h"
+ #include "../Metadata/FreeImageTag.h"
+-#include "../OpenEXR/Half/half.h"
++#include <half.h>
+
+ #include "FreeImageIO.h"
+ #include "PSDParser.h"
+--- Source/tiffiop.h
++++ Source/tiffiop.h
+@@ -30,7 +30,9 @@
+ * ``Library-private'' definitions.
+ */
+
+-#include "tif_config.h"
++#include <tiffconf.h>
++#define HAVE_SEARCH_H
++#define HAVE_FCNTL_H
+
+ #ifdef HAVE_FCNTL_H
+ # include <fcntl.h>
+--- Source/FreeImage/Plugin.cpp
++++ Source/FreeImage/Plugin.cpp
+@@ -223,23 +223,33 @@
+ */
+ s_plugins->AddNode(InitBMP);
+ s_plugins->AddNode(InitICO);
++#ifdef USE_JPEG
+ s_plugins->AddNode(InitJPEG);
++#endif
++#ifdef USE_MNG
+ s_plugins->AddNode(InitJNG);
++#endif
+ s_plugins->AddNode(InitKOALA);
+ s_plugins->AddNode(InitIFF);
++#ifdef USE_MNG
+ s_plugins->AddNode(InitMNG);
++#endif
+ s_plugins->AddNode(InitPNM, NULL, "PBM", "Portable Bitmap (ASCII)", "pbm", "^P1");
+ s_plugins->AddNode(InitPNM, NULL, "PBMRAW", "Portable Bitmap (RAW)", "pbm", "^P4");
+ s_plugins->AddNode(InitPCD);
+ s_plugins->AddNode(InitPCX);
+ s_plugins->AddNode(InitPNM, NULL, "PGM", "Portable Greymap (ASCII)", "pgm", "^P2");
+ s_plugins->AddNode(InitPNM, NULL, "PGMRAW", "Portable Greymap (RAW)", "pgm", "^P5");
++#ifdef USE_PNG
+ s_plugins->AddNode(InitPNG);
++#endif
+ s_plugins->AddNode(InitPNM, NULL, "PPM", "Portable Pixelmap (ASCII)", "ppm", "^P3");
+ s_plugins->AddNode(InitPNM, NULL, "PPMRAW", "Portable Pixelmap (RAW)", "ppm", "^P6");
+ s_plugins->AddNode(InitRAS);
+ s_plugins->AddNode(InitTARGA);
++#ifdef USE_TIFF
+ s_plugins->AddNode(InitTIFF);
++#endif
+ s_plugins->AddNode(InitWBMP);
+ s_plugins->AddNode(InitPSD);
+ s_plugins->AddNode(InitCUT);
+@@ -248,14 +258,22 @@
+ s_plugins->AddNode(InitDDS);
+ s_plugins->AddNode(InitGIF);
+ s_plugins->AddNode(InitHDR);
++#ifdef USE_TIFF
+ s_plugins->AddNode(InitG3);
++#endif
+ s_plugins->AddNode(InitSGI);
++#ifdef USE_EXR
+ s_plugins->AddNode(InitEXR);
++#endif
++#ifdef USE_JPEG2K
+ s_plugins->AddNode(InitJ2K);
+ s_plugins->AddNode(InitJP2);
++#endif
+ s_plugins->AddNode(InitPFM);
+ s_plugins->AddNode(InitPICT);
++#ifdef USE_RAW
+ s_plugins->AddNode(InitRAW);
++#endif
+
+ // external plugin initialization
+
diff --git a/media-libs/freeimage/freeimage-3.15.4-r1.ebuild b/media-libs/freeimage/freeimage-3.15.4-r1.ebuild
new file mode 100644
index 0000000..e7fe915
--- /dev/null
+++ b/media-libs/freeimage/freeimage-3.15.4-r1.ebuild
@@ -0,0 +1,100 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-libs/freeimage/freeimage-3.15.4-r1.ebuild,v 1.2 2013/03/21 15:48:09 bicatali Exp $
+
+EAPI="4"
+
+inherit toolchain-funcs eutils multilib
+
+MY_PN=FreeImage
+MY_PV=${PV//.}
+MY_P=${MY_PN}${MY_PV}
+
+DESCRIPTION="Image library supporting many formats"
+HOMEPAGE="http://freeimage.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.zip
+ mirror://sourceforge/${PN}/${MY_P}.pdf"
+
+LICENSE="|| ( GPL-2 FIPL-1.0 )"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="jpeg jpeg2k mng openexr png raw static-libs tiff"
+
+# The tiff/ilmbase isn't a typo. The TIFF plugin cheats and
+# uses code from it to handle 16bit<->float conversions.
+RDEPEND="sys-libs/zlib
+ jpeg? ( virtual/jpeg )
+ jpeg2k? ( media-libs/openjpeg )
+ mng? ( media-libs/libmng )
+ openexr? ( media-libs/openexr )
+ png? ( media-libs/libpng )
+ raw? ( media-libs/libraw )
+ tiff? (
+ media-libs/ilmbase
+ media-libs/tiff
+ )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ app-arch/unzip"
+
+S=${WORKDIR}/${MY_PN}
+
+src_prepare() {
+ cd Source
+ cp LibJPEG/{transupp.c,transupp.h,jinclude.h} . || die
+ cp LibTIFF4/{tiffiop,tif_dir}.h . || die
+ rm -rf LibPNG LibMNG LibOpenJPEG ZLib OpenEXR LibRawLite LibTIFF4 LibJPEG || die
+ cd ..
+ edos2unix Makefile.{gnu,fip,srcs} fipMakefile.srcs */*.h */*/*.cpp
+ sed -i \
+ -e "s:/./:/:g" \
+ -e "s: ./: :g" \
+ -e 's: Source: \\\n\tSource:g' \
+ -e 's: Wrapper: \\\n\tWrapper:g' \
+ -e 's: Examples: \\\n\tExamples:g' \
+ -e 's: TestAPI: \\\n\tTestAPI:g' \
+ -e 's: -ISource: \\\n\t-ISource:g' \
+ -e 's: -IWrapper: \\\n\t-IWrapper:g' \
+ Makefile.srcs fipMakefile.srcs || die
+ sed -i \
+ -e "/LibJPEG/d" \
+ -e "/LibPNG/d" \
+ -e "/LibTIFF/d" \
+ -e "/Source\/ZLib/d" \
+ -e "/LibOpenJPEG/d" \
+ -e "/OpenEXR/d" \
+ -e "/LibRawLite/d" \
+ -e "/LibMNG/d" \
+ Makefile.srcs fipMakefile.srcs || die
+ epatch "${FILESDIR}"/${PN}-3.15.4-unbundling.patch
+ epatch "${FILESDIR}"/${PN}-3.15.4-datatypes.patch
+}
+
+foreach_make() {
+ local m
+ for m in Makefile.{gnu,fip} ; do
+ emake -f ${m} \
+ USE_EXR=$(usex openexr) \
+ USE_JPEG=$(usex jpeg) \
+ USE_JPEG2K=$(usex jpeg2k) \
+ USE_MNG=$(usex mng) \
+ USE_PNG=$(usex png) \
+ USE_TIFF=$(usex tiff) \
+ USE_RAW=$(usex raw) \
+ $(usex static-libs '' STATICLIB=) \
+ "$@"
+ done
+}
+
+src_compile() {
+ tc-export AR PKG_CONFIG
+ foreach_make \
+ CXX="$(tc-getCXX) -fPIC" \
+ CC="$(tc-getCC) -fPIC" \
+ ${MY_PN}
+}
+
+src_install() {
+ foreach_make install DESTDIR="${ED}" INSTALLDIR="${ED}"/usr/$(get_libdir)
+ dodoc Whatsnew.txt "${DISTDIR}"/${MY_P}.pdf
+}
diff --git a/media-libs/freeimage/metadata.xml b/media-libs/freeimage/metadata.xml
new file mode 100644
index 0000000..d3c2cc9
--- /dev/null
+++ b/media-libs/freeimage/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>