about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/graphics/apngopt/default.nix
blob: e0c09773245293902a3fe6f9f8f434c3a6abe8e2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ lib
, stdenv
, fetchzip
, libpng
, zlib
, zopfli
}:

stdenv.mkDerivation rec {
  pname = "apngopt";
  version = "1.4";

  src = fetchzip {
    url = "mirror://sourceforge/apng/apngopt-${version}-src.zip";
    stripRoot = false;
    hash = "sha256-MAqth5Yt7+SabY6iEgSFcaBmuHvA0ZkNdXSgvhKao1Y=";
  };

  patches = [
    ./remove-7z.patch
  ];

  # Remove bundled libs
  postPatch = ''
    rm -r 7z libpng zlib zopfli
  '';

  buildInputs = [
    libpng
    zlib
    zopfli
  ];

  preBuild = ''
    buildFlagsArray+=("LIBS=-lzopfli -lstdc++ -lpng -lz")
  '';

  makeFlags = [ "CC=${stdenv.cc.targetPrefix}c++" ];

  installPhase = ''
    runHook preInstall
    install -Dm755 apngopt $out/bin/apngopt
    runHook postInstall
  '';

  meta = with lib; {
    homepage = "https://sourceforge.net/projects/apng/";
    description = "Optimizes APNG animations";
    license = licenses.zlib;
    maintainers = with maintainers; [ fgaz ];
    platforms = platforms.all;
  };
}