Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl, libpng 2, static ? stdenv.hostPlatform.isStatic 3}: 4 5# This package comes with its own copy of zlib, libpng and pngxtern 6 7stdenv.mkDerivation rec { 8 pname = "optipng"; 9 version = "0.7.7"; 10 11 src = fetchurl { 12 url = "mirror://sourceforge/optipng/optipng-${version}.tar.gz"; 13 sha256 = "0lj4clb851fzpaq446wgj0sfy922zs5l5misbpwv6w7qrqrz4cjg"; 14 }; 15 16 buildInputs = [ libpng ]; 17 18 LDFLAGS = lib.optional static "-static"; 19 # Workaround for crash in cexcept.h. See 20 # https://github.com/NixOS/nixpkgs/issues/28106 21 preConfigure = '' 22 export LD=$CC 23 ''; 24 25 configureFlags = [ 26 "--with-system-zlib" 27 "--with-system-libpng" 28 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 29 #"-prefix=$out" 30 ]; 31 32 postInstall = if stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.isWindows then '' 33 mv "$out"/bin/optipng{,.exe} 34 '' else null; 35 36 meta = with lib; { 37 homepage = "https://optipng.sourceforge.net/"; 38 description = "A PNG optimizer"; 39 license = licenses.zlib; 40 platforms = platforms.unix; 41 }; 42}