about summary refs log tree commit diff
path: root/pkgs/tools/graphics/pngquant/default.nix
blob: 5a2dd5b3006770ba8c094d1533be9d548d69f7c8 (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
{ lib, rustPlatform, fetchFromGitHub, pkg-config, libpng, zlib, lcms2 }:

rustPlatform.buildRustPackage rec {
  pname = "pngquant";
  version = "3.0.3";

  outputs = [ "out" "man" ];

  src = fetchFromGitHub {
    owner = "kornelski";
    repo = "pngquant";
    rev = version;
    hash = "sha256-u2zEp9Llo+c/+1QGW4V4r40KQn/ATHCTEsrpy7bRf/I=";
    fetchSubmodules = true;
  };

  cargoHash = "sha256-mZpg6BRpsvEiMsS6ZJzVYg6wXHLb3Cf72sK1yzTF8y4=";
  cargoPatches = [
    # https://github.com/kornelski/pngquant/issues/347
    ./add-Cargo.lock.patch
  ];

  nativeBuildInputs = [ pkg-config ];
  buildInputs = [ libpng zlib lcms2 ];

  doCheck = false; # Has no Rust-based tests

  postInstall = ''
    install -Dpm0444 pngquant.1 $man/share/man/man1/pngquant.1
  '';

  meta = with lib; {
    homepage = "https://pngquant.org/";
    description = "Tool to convert 24/32-bit RGBA PNGs to 8-bit palette with alpha channel preserved";
    changelog = "https://github.com/kornelski/pngquant/raw/${version}/CHANGELOG";
    platforms = platforms.unix;
    license = with licenses; [ gpl3Plus hpnd bsd2 ];
    mainProgram = "pngquant";
    maintainers = [ ];
  };
}