2016-11-03 02:16:12 +01:00
|
|
|
{stdenv, fetchurl, unzip, darwin}:
|
2009-01-12 22:12:07 +01:00
|
|
|
stdenv.mkDerivation {
|
2016-03-31 12:35:15 +02:00
|
|
|
name = "freeimage-3.17.0";
|
2009-01-12 22:12:07 +01:00
|
|
|
src = fetchurl {
|
2016-03-31 12:35:15 +02:00
|
|
|
url = mirror://sourceforge/freeimage/FreeImage3170.zip;
|
|
|
|
sha256 = "12bz57asdcfsz3zr9i9nska0fb6h3z2aizy412qjqkixkginbz7v";
|
2009-01-12 22:12:07 +01:00
|
|
|
};
|
2016-11-03 02:16:12 +01:00
|
|
|
buildInputs = [ unzip ] ++ stdenv.lib.optional stdenv.isDarwin darwin.cctools;
|
|
|
|
prePatch = if stdenv.isDarwin
|
|
|
|
then ''
|
|
|
|
sed -e 's/gcc-4.0/clang/g' \
|
|
|
|
-e 's/g++-4.0/clang++/g' \
|
|
|
|
-e 's/COMPILERFLAGS = -Os -fexceptions -fvisibility=hidden -DNO_LCMS/COMPILERFLAGS = -Os -fexceptions -fvisibility=hidden -DNO_LCMS -D__ANSI__/' \
|
|
|
|
-e "s|PREFIX = /usr/local|PREFIX = $out|" \
|
|
|
|
-e 's|-Wl,-syslibroot /Developer/SDKs/MacOSX10.5.sdk||g' \
|
|
|
|
-e 's|-Wl,-syslibroot /Developer/SDKs/MacOSX10.6.sdk||g' \
|
|
|
|
-e 's|-isysroot /Developer/SDKs/MacOSX10.6.sdk||g' \
|
|
|
|
-e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||g' \
|
|
|
|
-e 's| $(STATICLIB)-ppc $(STATICLIB)-i386||g' \
|
|
|
|
-e 's| $(SHAREDLIB)-ppc $(SHAREDLIB)-i386||g' \
|
|
|
|
-e 's| install -d -m 755 -o root -g wheel $(INCDIR) $(INSTALLDIR)||' \
|
|
|
|
-e 's| -m 644 -o root -g wheel||g' \
|
|
|
|
-i ./Makefile.osx
|
|
|
|
# Fix LibJXR performance timers
|
|
|
|
sed 's|^SRCS = \(.*\)$|SRCS = \1 Source/LibJXR/image/sys/perfTimerANSI.c|' -i ./Makefile.srcs
|
|
|
|
''
|
|
|
|
else ''
|
|
|
|
sed -e s@/usr/@$out/@ \
|
2009-01-12 22:12:07 +01:00
|
|
|
-e 's@-o root -g root@@' \
|
|
|
|
-e 's@ldconfig@echo not running ldconfig@' \
|
2015-01-23 16:08:05 +01:00
|
|
|
-i Makefile.gnu Makefile.fip
|
2016-11-03 02:16:12 +01:00
|
|
|
# Fix gcc 5.1 macro problems
|
|
|
|
# https://chromium.googlesource.com/webm/libwebp/+/eebaf97f5a1cb713d81d311308d8a48c124e5aef%5E!/
|
|
|
|
sed -i -e 's/"\(#[^"]*\)"/" \1 "/g' Source/LibWebP/src/dsp/*
|
2009-01-12 22:12:07 +01:00
|
|
|
'';
|
2015-01-23 16:08:05 +01:00
|
|
|
|
2016-11-03 02:16:12 +01:00
|
|
|
postBuild = stdenv.lib.optionalString (!stdenv.isDarwin) "make -f Makefile.fip";
|
2009-01-12 22:12:07 +01:00
|
|
|
preInstall = "mkdir -p $out/include $out/lib";
|
2016-11-03 02:16:12 +01:00
|
|
|
postInstall = stdenv.lib.optionalString (!stdenv.isDarwin) "make -f Makefile.fip install";
|
2009-01-12 22:12:07 +01:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Open Source library for accessing popular graphics image file formats";
|
|
|
|
homepage = http://freeimage.sourceforge.net/;
|
|
|
|
license = "GPL";
|
2009-10-02 09:39:03 +02:00
|
|
|
maintainers = with stdenv.lib.maintainers; [viric];
|
2016-11-03 02:16:12 +01:00
|
|
|
platforms = with stdenv.lib.platforms; unix;
|
2009-01-12 22:12:07 +01:00
|
|
|
};
|
|
|
|
}
|