diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libdevil')
3 files changed, 135 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libdevil/default.nix b/nixpkgs/pkgs/development/libraries/libdevil/default.nix new file mode 100644 index 000000000000..0cba50c3a924 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/libdevil/default.nix @@ -0,0 +1,77 @@ +{ lib +, stdenv +, fetchurl +, libjpeg +, libpng +, libmng +, lcms1 +, libtiff +, openexr +, libGL +, libX11 +, pkg-config +, OpenGL +, runtimeShell +, withXorg ? true +, testers +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "libdevil"; + version = "1.7.8"; + + outputs = [ "out" "dev" ]; + + src = fetchurl { + url = "mirror://sourceforge/openil/DevIL-${finalAttrs.version}.tar.gz"; + sha256 = "1zd850nn7nvkkhasrv7kn17kzgslr5ry933v6db62s4lr0zzlbv8"; + }; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ libjpeg libpng libmng lcms1 libtiff openexr ] + ++ lib.optionals withXorg [ libX11 libGL ] + ++ lib.optionals stdenv.isDarwin [ OpenGL ]; + + configureFlags = [ "--enable-ILU" "--enable-ILUT" ]; + + preConfigure = '' + sed -i 's, -std=gnu99,,g' configure + sed -i 's,malloc.h,stdlib.h,g' src-ILU/ilur/ilur.c + '' + lib.optionalString stdenv.cc.isClang '' + sed -i 's/libIL_la_CXXFLAGS = $(AM_CFLAGS)/libIL_la_CXXFLAGS =/g' lib/Makefile.in + ''; + + postConfigure = '' + sed -i '/RESTRICT_KEYWORD/d' include/IL/config.h + ''; + + patches = [ + (fetchurl { + url = "https://sources.debian.org/data/main/d/devil/1.7.8-10/debian/patches/03_CVE-2009-3994.diff"; + sha256 = "0qkx2qfv02igbrmsn6z5a3lbrbwjfh3rb0c2sj54wy0j1f775hbc"; + }) + ./ftbfs-libpng15.patch + ./il_endian.h.patch + ]; + + enableParallelBuilding = true; + + postPatch = '' + for a in test/Makefile.in test/format_test/format_checks.sh.in ; do + substituteInPlace $a \ + --replace /bin/bash ${runtimeShell} + done + ''; + + passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; + + meta = with lib; { + homepage = "https://openil.sourceforge.net/"; + description = "An image library which can can load, save, convert, manipulate, filter and display a wide variety of image formats"; + license = licenses.lgpl2; + pkgConfigModules = [ "IL" ]; + platforms = platforms.mesaPlatforms; + maintainers = with maintainers; [ ]; + }; +}) diff --git a/nixpkgs/pkgs/development/libraries/libdevil/ftbfs-libpng15.patch b/nixpkgs/pkgs/development/libraries/libdevil/ftbfs-libpng15.patch new file mode 100644 index 000000000000..5fc53c2dc6a7 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/libdevil/ftbfs-libpng15.patch @@ -0,0 +1,31 @@ +Source: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=649554 +--- devil-1.7.8.orig/src-IL/src/il_icon.c ++++ devil-1.7.8/src-IL/src/il_icon.c +@@ -525,7 +525,11 @@ + + // Expand low-bit-depth grayscale images to 8 bits + if (ico_color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) { ++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4 ++ png_set_expand_gray_1_2_4_to_8(ico_png_ptr); ++#else + png_set_gray_1_2_4_to_8(ico_png_ptr); ++#endif + } + + // Expand RGB images with transparency to full alpha channels +only in patch2: +unchanged: +--- devil-1.7.8.orig/src-IL/src/il_png.c ++++ devil-1.7.8/src-IL/src/il_png.c +@@ -278,7 +278,11 @@ + + // Expand low-bit-depth grayscale images to 8 bits + if (png_color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) { ++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4 ++ png_set_expand_gray_1_2_4_to_8(png_ptr); ++#else + png_set_gray_1_2_4_to_8(png_ptr); ++#endif + } + + // Expand RGB images with transparency to full alpha channels diff --git a/nixpkgs/pkgs/development/libraries/libdevil/il_endian.h.patch b/nixpkgs/pkgs/development/libraries/libdevil/il_endian.h.patch new file mode 100644 index 000000000000..c220e6802fd9 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/libdevil/il_endian.h.patch @@ -0,0 +1,27 @@ +Source: http://sourceforge.net/p/resil/tickets/8/ +--- devil-1.7.8.orig/src-IL/include/il_endian.h.orig 2009-03-08 01:10:08.000000000 -0600 ++++ devil-1.7.8/src-IL/include/il_endian.h 2013-11-03 01:52:37.000000000 -0600 +@@ -19,9 +19,13 @@ + #ifndef __BIG_ENDIAN__ + #define __BIG_ENDIAN__ 1 + #endif ++#else ++ #ifndef __LITTLE_ENDIAN__ ++ #define __LITTLE_ENDIAN__ 1 ++ #endif + #endif + +-#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __BIG_ENDIAN__) \ ++#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) \ + || (defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)) + #undef __LITTLE_ENDIAN__ + #define Short(s) iSwapShort(s) +@@ -39,8 +43,6 @@ + #define BigDouble(d) + #else + #undef __BIG_ENDIAN__ +- #undef __LITTLE_ENDIAN__ // Not sure if it's defined by any compiler... +- #define __LITTLE_ENDIAN__ + #define Short(s) + #define UShort(s) + #define Int(i) |