Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchFromGitHub, autoreconfHook, libtool 2, fetchpatch 3, threadingSupport ? true # multi-threading 4, openglSupport ? false, freeglut, libGL, libGLU # OpenGL (required for vwebp) 5, pngSupport ? true, libpng # PNG image format 6, jpegSupport ? true, libjpeg # JPEG image format 7, tiffSupport ? true, libtiff # TIFF image format 8, gifSupport ? true, giflib # GIF image format 9, alignedSupport ? false # Force aligned memory operations 10, swap16bitcspSupport ? false # Byte swap for 16bit color spaces 11, experimentalSupport ? false # Experimental code 12, libwebpmuxSupport ? true # Build libwebpmux 13, libwebpdemuxSupport ? true # Build libwebpdemux 14, libwebpdecoderSupport ? true # Build libwebpdecoder 15 16# for passthru.tests 17, freeimage 18, gd 19, graphicsmagick 20, haskellPackages 21, imagemagick 22, imlib2 23, libjxl 24, opencv 25, python3 26, vips 27}: 28 29stdenv.mkDerivation rec { 30 pname = "libwebp"; 31 version = "1.3.0"; 32 33 src = fetchFromGitHub { 34 owner = "webmproject"; 35 repo = pname; 36 rev = "v${version}"; 37 hash = "sha256-nhXkq+qKpaa75YQB/W/cRozslTIFPdXeqj1y6emQeHk="; 38 }; 39 40 patches = [ 41 # https://www.mozilla.org/en-US/security/advisories/mfsa2023-13/#MFSA-TMP-2023-0001 42 (fetchpatch { 43 url = "https://github.com/webmproject/libwebp/commit/a486d800b60d0af4cc0836bf7ed8f21e12974129.patch"; 44 name = "fix-msfa-tmp-2023-0001.patch"; 45 hash = "sha256-TRKXpNkYVzftBw09mX+WeQRhRoOzBgXFTNZBzSdCKvc="; 46 }) 47 ]; 48 49 configureFlags = [ 50 (lib.enableFeature threadingSupport "threading") 51 (lib.enableFeature openglSupport "gl") 52 (lib.enableFeature pngSupport "png") 53 (lib.enableFeature jpegSupport "jpeg") 54 (lib.enableFeature tiffSupport "tiff") 55 (lib.enableFeature gifSupport "gif") 56 (lib.enableFeature alignedSupport "aligned") 57 (lib.enableFeature swap16bitcspSupport "swap-16bit-csp") 58 (lib.enableFeature experimentalSupport "experimental") 59 (lib.enableFeature libwebpmuxSupport "libwebpmux") 60 (lib.enableFeature libwebpdemuxSupport "libwebpdemux") 61 (lib.enableFeature libwebpdecoderSupport "libwebpdecoder") 62 ]; 63 64 nativeBuildInputs = [ autoreconfHook libtool ]; 65 buildInputs = [ ] 66 ++ lib.optionals openglSupport [ freeglut libGL libGLU ] 67 ++ lib.optionals pngSupport [ libpng ] 68 ++ lib.optionals jpegSupport [ libjpeg ] 69 ++ lib.optionals tiffSupport [ libtiff ] 70 ++ lib.optionals gifSupport [ giflib ]; 71 72 enableParallelBuilding = true; 73 74 passthru.tests = { 75 inherit freeimage gd graphicsmagick imagemagick imlib2 libjxl opencv vips; 76 inherit (python3.pkgs) pillow imread; 77 haskell-webp = haskellPackages.webp; 78 }; 79 80 meta = with lib; { 81 description = "Tools and library for the WebP image format"; 82 homepage = "https://developers.google.com/speed/webp/"; 83 license = licenses.bsd3; 84 platforms = platforms.all; 85 maintainers = with maintainers; [ ajs124 ]; 86 }; 87}