nixpkgs/pkgs/development/libraries/libimagequant/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.3 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchFromGitHub, fetchurl, rust, rustPlatform, cargo-c, python3 }:
2018-09-28 21:18:49 +00:00
2023-01-22 04:20:00 +00:00
let
rustTargetPlatformSpec = rust.toRustTargetSpec stdenv.hostPlatform;
in
rustPlatform.buildRustPackage rec {
2019-06-01 03:13:43 +00:00
pname = "libimagequant";
2023-03-10 04:20:00 +00:00
version = "4.1.1";
2018-09-28 21:18:49 +00:00
2019-06-01 03:13:43 +00:00
src = fetchFromGitHub {
owner = "ImageOptim";
repo = pname;
rev = version;
2023-03-10 04:20:00 +00:00
hash = "sha256-sCxscs4D2p7LNDpcrKfAc315/NbxbQXtsyc33zUmccM=";
2019-06-01 03:13:43 +00:00
};
2018-09-28 21:18:49 +00:00
2023-01-22 04:20:00 +00:00
cargoLock = {
lockFile = ./Cargo.lock;
};
postPatch = ''
cp ${./Cargo.lock} Cargo.lock
'';
cargoHash = "sha256-0HOmItooNsGq6iTIb9M5IPXMwYh2nQ03qfjomkg0d00=";
nativeBuildInputs = [ cargo-c ];
postBuild = ''
pushd imagequant-sys
cargo cbuild --release --frozen --prefix=${placeholder "out"} --target ${rustTargetPlatformSpec}
popd
2019-06-01 03:13:43 +00:00
'';
2018-09-28 21:18:49 +00:00
2023-01-22 04:20:00 +00:00
postInstall = ''
pushd imagequant-sys
cargo cinstall --release --frozen --prefix=${placeholder "out"} --target ${rustTargetPlatformSpec}
popd
'';
passthru.tests = {
inherit (python3.pkgs) pillow;
};
meta = with lib; {
2019-06-01 03:13:43 +00:00
homepage = "https://pngquant.org/lib/";
description = "Image quantization library";
longDescription = "Small, portable C library for high-quality conversion of RGBA images to 8-bit indexed-color (palette) images.";
license = licenses.gpl3Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ ma9e marsam ];
};
}