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