Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 23.11-beta 48 lines 1.3 kB view raw
1{ lib, stdenv, fetchFromGitHub, fetchurl, rust, rustPlatform, cargo-c, python3 }: 2 3rustPlatform.buildRustPackage rec { 4 pname = "libimagequant"; 5 version = "4.2.2"; 6 7 src = fetchFromGitHub { 8 owner = "ImageOptim"; 9 repo = pname; 10 rev = version; 11 hash = "sha256-cZgnJOmj+xJDcewsxH2Jp5AAnFZKVuYxKPtoGeN03g4="; 12 }; 13 14 cargoLock = { 15 lockFile = ./Cargo.lock; 16 }; 17 18 postPatch = '' 19 ln -s ${./Cargo.lock} Cargo.lock 20 ''; 21 22 nativeBuildInputs = [ cargo-c ]; 23 24 postBuild = '' 25 pushd imagequant-sys 26 ${rust.envVars.setEnv} cargo cbuild --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget} 27 popd 28 ''; 29 30 postInstall = '' 31 pushd imagequant-sys 32 ${rust.envVars.setEnv} cargo cinstall --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget} 33 popd 34 ''; 35 36 passthru.tests = { 37 inherit (python3.pkgs) pillow; 38 }; 39 40 meta = with lib; { 41 homepage = "https://pngquant.org/lib/"; 42 description = "Image quantization library"; 43 longDescription = "Small, portable C library for high-quality conversion of RGBA images to 8-bit indexed-color (palette) images."; 44 license = licenses.gpl3Plus; 45 platforms = platforms.unix; 46 maintainers = with maintainers; [ ma9e marsam ]; 47 }; 48}