2019-09-08 15:46:03 +01:00
|
|
|
{ lib, stdenv, fetchurl, unzip, darwin }:
|
2017-01-21 13:43:22 +00:00
|
|
|
|
2009-01-12 21:12:07 +00:00
|
|
|
stdenv.mkDerivation {
|
2019-09-08 15:46:03 +01:00
|
|
|
name = "freeimage-3.18.0";
|
2017-01-21 13:43:22 +00:00
|
|
|
|
2009-01-12 21:12:07 +00:00
|
|
|
src = fetchurl {
|
2019-09-08 15:46:03 +01:00
|
|
|
url = mirror://sourceforge/freeimage/FreeImage3180.zip;
|
|
|
|
sha256 = "1z9qwi9mlq69d5jipr3v2jika2g0kszqdzilggm99nls5xl7j4zl";
|
2009-01-12 21:12:07 +00:00
|
|
|
};
|
2017-01-21 13:43:22 +00:00
|
|
|
|
2019-09-08 15:46:03 +01:00
|
|
|
patches = lib.optional stdenv.isDarwin ./dylib.patch;
|
2017-10-10 18:34:30 +01:00
|
|
|
|
2019-09-08 15:46:03 +01:00
|
|
|
buildInputs = [ unzip ] ++ lib.optional stdenv.isDarwin darwin.cctools;
|
2017-01-21 13:43:22 +00:00
|
|
|
|
2019-09-08 15:46:03 +01:00
|
|
|
prePatch = if stdenv.isDarwin then ''
|
|
|
|
sed -e 's/$(shell xcrun -find clang)/clang/g' \
|
|
|
|
-e 's/$(shell xcrun -find clang++)/clang++/g' \
|
2016-11-03 01:16:12 +00:00
|
|
|
-e "s|PREFIX = /usr/local|PREFIX = $out|" \
|
2019-09-08 15:46:03 +01:00
|
|
|
-e 's|-Wl,-syslibroot $(MACOSX_SYSROOT)||g' \
|
|
|
|
-e 's|-isysroot $(MACOSX_SYSROOT)||g' \
|
2016-11-03 01:16:12 +00:00
|
|
|
-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
|
2019-09-08 15:46:03 +01:00
|
|
|
'' else ''
|
2016-11-03 01:16:12 +00:00
|
|
|
sed -e s@/usr/@$out/@ \
|
2009-01-12 21:12:07 +00:00
|
|
|
-e 's@-o root -g root@@' \
|
|
|
|
-e 's@ldconfig@echo not running ldconfig@' \
|
2015-01-23 15:08:05 +00:00
|
|
|
-i Makefile.gnu Makefile.fip
|
2009-01-12 21:12:07 +00:00
|
|
|
'';
|
2015-01-23 15:08:05 +00:00
|
|
|
|
2019-09-08 15:46:03 +01:00
|
|
|
postBuild = lib.optionalString (!stdenv.isDarwin) ''
|
|
|
|
make -f Makefile.fip
|
|
|
|
'';
|
|
|
|
|
|
|
|
preInstall = ''
|
|
|
|
mkdir -p $out/include $out/lib
|
|
|
|
'';
|
2009-01-12 21:12:07 +00:00
|
|
|
|
2019-09-08 15:46:03 +01:00
|
|
|
postInstall = lib.optionalString (!stdenv.isDarwin) ''
|
|
|
|
make -f Makefile.fip install
|
|
|
|
'';
|
2017-01-21 13:43:22 +00:00
|
|
|
|
2018-06-03 21:37:40 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2009-01-12 21:12:07 +00:00
|
|
|
meta = {
|
|
|
|
description = "Open Source library for accessing popular graphics image file formats";
|
|
|
|
homepage = http://freeimage.sourceforge.net/;
|
|
|
|
license = "GPL";
|
2019-09-08 15:46:03 +01:00
|
|
|
maintainers = with lib.maintainers; [viric];
|
|
|
|
platforms = with lib.platforms; unix;
|
2009-01-12 21:12:07 +00:00
|
|
|
};
|
|
|
|
}
|