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