optipng: use system libpng & zlib, fix cross builds and add support for static builds

This commit is contained in:
Jaka Hudoklin 2014-04-01 01:37:10 +02:00
parent 4eefc983a2
commit c3524a8dd6
3 changed files with 26 additions and 2 deletions

View File

@ -21,6 +21,8 @@ stdenv.mkDerivation rec {
passthru = {};
};
configureFlags = "--enable-static";
meta = {
description = "The official reference implementation for the PNG file format";
homepage = http://www.libpng.org/pub/png/libpng.html;

View File

@ -1,7 +1,9 @@
{ stdenv, fetchurl }:
{ stdenv, fetchurl, libpng, static ? false }:
# This package comes with its own copy of zlib, libpng and pngxtern
with stdenv.lib;
stdenv.mkDerivation rec {
name = "optipng-0.7.4";
@ -10,6 +12,24 @@ stdenv.mkDerivation rec {
sha256 = "1zrphbz17rhhfl1l95q5s979rrhifbwczl2xj1fdrnq5jid5s2sj";
};
buildInputs = [ libpng ];
LDFLAGS = optional static "-static";
configureFlags = "--with-system-zlib --with-system-libpng";
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
'';
};
meta = {
homepage = http://optipng.sourceforge.net/;
description = "A PNG optimizer";

View File

@ -1596,7 +1596,9 @@ let
openvpn = callPackage ../tools/networking/openvpn { };
optipng = callPackage ../tools/graphics/optipng { };
optipng = callPackage ../tools/graphics/optipng {
libpng = libpng12;
};
oslrd = callPackage ../tools/networking/oslrd { };