Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 rustPlatform,
4 fetchFromGitHub,
5 pkg-config,
6 libpng,
7 zlib,
8 lcms2,
9}:
10
11rustPlatform.buildRustPackage rec {
12 pname = "pngquant";
13 version = "3.0.3";
14
15 outputs = [
16 "out"
17 "man"
18 ];
19
20 src = fetchFromGitHub {
21 owner = "kornelski";
22 repo = "pngquant";
23 rev = version;
24 hash = "sha256-u2zEp9Llo+c/+1QGW4V4r40KQn/ATHCTEsrpy7bRf/I=";
25 fetchSubmodules = true;
26 };
27
28 cargoHash = "sha256-W+/y79KkSVHqBybouUazGVfTQAuelXvn6EXtu+TW7j4=";
29 cargoPatches = [
30 # https://github.com/kornelski/pngquant/issues/347
31 ./add-Cargo.lock.patch
32 ];
33
34 nativeBuildInputs = [ pkg-config ];
35 buildInputs = [
36 libpng
37 zlib
38 lcms2
39 ];
40
41 doCheck = false; # Has no Rust-based tests
42
43 postInstall = ''
44 install -Dpm0444 pngquant.1 $man/share/man/man1/pngquant.1
45 '';
46
47 meta = {
48 homepage = "https://pngquant.org/";
49 description = "Tool to convert 24/32-bit RGBA PNGs to 8-bit palette with alpha channel preserved";
50 changelog = "https://github.com/kornelski/pngquant/raw/${version}/CHANGELOG";
51 platforms = lib.platforms.unix;
52 license = with lib.licenses; [
53 gpl3Plus
54 hpnd
55 bsd2
56 ];
57 mainProgram = "pngquant";
58 maintainers = with lib.maintainers; [ ];
59 };
60}