nixpkgs-suyu/pkgs/development/libraries/freeimage/default.nix

55 lines
1.6 KiB
Nix
Raw Normal View History

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