From 895c361480d489b620c96966ea653bb91db2628a Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 28 Jun 2017 14:11:08 -0400 Subject: [PATCH] WIP: optipng: cc-wrapper can be relied on to export these env vars --- pkgs/tools/graphics/optipng/default.nix | 26 ++++++++++++------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/pkgs/tools/graphics/optipng/default.nix b/pkgs/tools/graphics/optipng/default.nix index 0f7f7e2da2a2..471e8ee8df47 100644 --- a/pkgs/tools/graphics/optipng/default.nix +++ b/pkgs/tools/graphics/optipng/default.nix @@ -1,4 +1,6 @@ -{ stdenv, fetchurl, libpng, static ? false }: +{ stdenv, fetchurl, libpng, static ? false +, buildPlatform, hostPlatform +}: # This package comes with its own copy of zlib, libpng and pngxtern @@ -15,20 +17,16 @@ stdenv.mkDerivation rec { buildInputs = [ libpng ]; LDFLAGS = optional static "-static"; - configureFlags = "--with-system-zlib --with-system-libpng"; + configureFlags = [ + "--with-system-zlib" + "--with-system-libpng" + ] ++ stdenv.lib.optionals (hostPlatform != buildPlatform) [ + #"-prefix=$out" + ]; - crossAttrs = { - CC="${stdenv.cross.config}-gcc"; - LD="${stdenv.cross.config}-gcc"; - AR="${stdenv.cross.config}-ar"; - RANLIB="${stdenv.cross.config}-ranlib"; - configurePhase = '' - ./configure -prefix="$out" --with-system-zlib --with-system-libpng - ''; - postInstall = optional (stdenv.cross.libc == "msvcrt") '' - mv "$out"/bin/optipng "$out"/bin/optipng.exe - ''; - }; + postInstall = if hostPlatform != buildPlatform && hostPlatform.isWindows then '' + mv "$out"/bin/optipng{,.exe} + '' else null; meta = with stdenv.lib; { homepage = http://optipng.sourceforge.net/;