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

60 lines
1.8 KiB
Nix
Raw Normal View History

2019-09-08 14:46:03 +00:00
{ lib, stdenv, fetchurl, unzip, darwin }:
2017-01-21 13:43:22 +00:00
2020-05-13 19:17:27 +00:00
# TODO: consider unvendoring various dependencies (libpng, libjpeg,
# libwebp, zlib, ...)
stdenv.mkDerivation {
2019-09-08 14:46:03 +00:00
name = "freeimage-3.18.0";
2017-01-21 13:43:22 +00:00
src = fetchurl {
url = "mirror://sourceforge/freeimage/FreeImage3180.zip";
2019-09-08 14:46:03 +00:00
sha256 = "1z9qwi9mlq69d5jipr3v2jika2g0kszqdzilggm99nls5xl7j4zl";
};
2017-01-21 13:43:22 +00:00
2019-09-08 14:46:03 +00:00
patches = lib.optional stdenv.isDarwin ./dylib.patch;
2019-09-08 14:46:03 +00:00
buildInputs = [ unzip ] ++ lib.optional stdenv.isDarwin darwin.cctools;
2017-01-21 13:43:22 +00:00
2019-09-08 14:46:03 +00: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 14:46:03 +00: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 14:46:03 +00:00
'' else ''
2016-11-03 01:16:12 +00: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 14:46:03 +00:00
postBuild = lib.optionalString (!stdenv.isDarwin) ''
make -f Makefile.fip
'';
preInstall = ''
mkdir -p $out/include $out/lib
'';
2019-09-08 14:46:03 +00:00
postInstall = lib.optionalString (!stdenv.isDarwin) ''
make -f Makefile.fip install
'';
2017-01-21 13:43:22 +00:00
2018-06-03 20:37:40 +00: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 14:46:03 +00:00
maintainers = with lib.maintainers; [viric];
platforms = with lib.platforms; unix;
2020-05-13 19:17:27 +00:00
# see https://github.com/NixOS/nixpkgs/issues/77653
broken = stdenv.isAarch64;
};
}