at 24.11-pre 2.1 kB view raw
1{ lib 2, stdenv 3, fetchurl 4, libjpeg 5, libpng 6, libmng 7, lcms1 8, libtiff 9, openexr 10, libGL 11, libX11 12, pkg-config 13, OpenGL 14, runtimeShell 15, withXorg ? true 16, testers 17}: 18 19stdenv.mkDerivation (finalAttrs: { 20 pname = "libdevil"; 21 version = "1.7.8"; 22 23 outputs = [ "out" "dev" ]; 24 25 src = fetchurl { 26 url = "mirror://sourceforge/openil/DevIL-${finalAttrs.version}.tar.gz"; 27 sha256 = "1zd850nn7nvkkhasrv7kn17kzgslr5ry933v6db62s4lr0zzlbv8"; 28 }; 29 30 nativeBuildInputs = [ pkg-config ]; 31 32 buildInputs = [ libjpeg libpng libmng lcms1 libtiff openexr ] 33 ++ lib.optionals withXorg [ libX11 libGL ] 34 ++ lib.optionals stdenv.isDarwin [ OpenGL ]; 35 36 configureFlags = [ "--enable-ILU" "--enable-ILUT" ]; 37 38 CXXFLAGS = lib.optionalString stdenv.cc.isClang "-Wno-register"; 39 40 preConfigure = '' 41 sed -i 's, -std=gnu99,,g' configure 42 sed -i 's,malloc.h,stdlib.h,g' src-ILU/ilur/ilur.c 43 '' + lib.optionalString stdenv.cc.isClang '' 44 sed -i 's/libIL_la_CXXFLAGS = $(AM_CFLAGS)/libIL_la_CXXFLAGS =/g' lib/Makefile.in 45 ''; 46 47 postConfigure = '' 48 sed -i '/RESTRICT_KEYWORD/d' include/IL/config.h 49 ''; 50 51 patches = [ 52 (fetchurl { 53 url = "https://sources.debian.org/data/main/d/devil/1.7.8-10/debian/patches/03_CVE-2009-3994.diff"; 54 sha256 = "0qkx2qfv02igbrmsn6z5a3lbrbwjfh3rb0c2sj54wy0j1f775hbc"; 55 }) 56 ./ftbfs-libpng15.patch 57 ./il_endian.h.patch 58 ]; 59 60 enableParallelBuilding = true; 61 62 postPatch = '' 63 for a in test/Makefile.in test/format_test/format_checks.sh.in ; do 64 substituteInPlace $a \ 65 --replace /bin/bash ${runtimeShell} 66 done 67 ''; 68 69 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; 70 71 meta = with lib; { 72 homepage = "https://openil.sourceforge.net/"; 73 description = "An image library which can can load, save, convert, manipulate, filter and display a wide variety of image formats"; 74 mainProgram = "ilur"; 75 license = licenses.lgpl2; 76 pkgConfigModules = [ "IL" ]; 77 platforms = platforms.mesaPlatforms; 78 maintainers = with maintainers; [ ]; 79 }; 80})