WIP: optipng: cc-wrapper can be relied on to export these env vars
This commit is contained in:
parent
f16ee76ca8
commit
895c361480
|
@ -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
|
# This package comes with its own copy of zlib, libpng and pngxtern
|
||||||
|
|
||||||
|
@ -15,20 +17,16 @@ stdenv.mkDerivation rec {
|
||||||
buildInputs = [ libpng ];
|
buildInputs = [ libpng ];
|
||||||
|
|
||||||
LDFLAGS = optional static "-static";
|
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 = {
|
postInstall = if hostPlatform != buildPlatform && hostPlatform.isWindows then ''
|
||||||
CC="${stdenv.cross.config}-gcc";
|
mv "$out"/bin/optipng{,.exe}
|
||||||
LD="${stdenv.cross.config}-gcc";
|
'' else null;
|
||||||
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
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
homepage = http://optipng.sourceforge.net/;
|
homepage = http://optipng.sourceforge.net/;
|
||||||
|
|
Loading…
Reference in New Issue