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

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

68 lines
1.5 KiB
Nix
Raw Normal View History

2024-01-23 04:20:00 +00:00
{ lib
, stdenv
, fetchFromGitHub
, fetchurl
, rust
, rustPlatform
, cargo-c
, python3
# tests
, testers
, vips
, libimagequant
}:
2018-09-28 21:18:49 +00:00
2023-01-22 04:20:00 +00:00
rustPlatform.buildRustPackage rec {
2019-06-01 03:13:43 +00:00
pname = "libimagequant";
version = "4.3.0";
2018-09-28 21:18:49 +00:00
2019-06-01 03:13:43 +00:00
src = fetchFromGitHub {
owner = "ImageOptim";
repo = "libimagequant";
2019-06-01 03:13:43 +00:00
rev = version;
hash = "sha256-/gHe3LQaBWOQImBesKvHK46T42TtRld988wgxbut4i0=";
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 = ''
ln -s ${./Cargo.lock} Cargo.lock
2023-01-22 04:20:00 +00:00
'';
nativeBuildInputs = [ cargo-c ];
postBuild = ''
pushd imagequant-sys
${rust.envVars.setEnv} cargo cbuild --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
2023-01-22 04:20:00 +00:00
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
${rust.envVars.setEnv} cargo cinstall --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
2023-01-22 04:20:00 +00:00
popd
'';
passthru.tests = {
2024-01-23 04:20:00 +00:00
inherit vips;
inherit (python3.pkgs) pillow;
2024-01-23 04:20:00 +00:00
pkg-config = testers.hasPkgConfigModules {
package = libimagequant;
moduleNames = [ "imagequant" ];
};
};
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 ];
};
}