diff --git a/pkgs/development/libraries/libdevil/0001-il_endian.h-Fix-endian-handling.patch b/pkgs/development/libraries/libdevil/0001-il_endian.h-Fix-endian-handling.patch new file mode 100644 index 000000000000..a1826354f88b --- /dev/null +++ b/pkgs/development/libraries/libdevil/0001-il_endian.h-Fix-endian-handling.patch @@ -0,0 +1,35 @@ +From 85ca659a59ae5be6fc0824b0684967ec94727e2a Mon Sep 17 00:00:00 2001 +From: toonn +Date: Wed, 12 Jun 2024 11:39:35 +0000 +Subject: [PATCH] il_endian.h: Fix endian handling + +Based on https://sourceforge.net/p/resil/tickets/8/, which has also been +incorporated in the MacPort for libdevil 1.7.8, +https://trac.macports.org/export/154482/trunk/dports/devel/libdevil/files/patch-src-IL-include-il_endian.h.diff, +but updated for the header included in release 1.8.0 of libdevil. +--- + src-IL/include/il_endian.h | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src-IL/include/il_endian.h b/src-IL/include/il_endian.h +index c4e6d86..a3cd57f 100644 +--- a/src-IL/include/il_endian.h ++++ b/src-IL/include/il_endian.h +@@ -23,9 +23,13 @@ extern "C" { + #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) +-- +2.44.0 + diff --git a/pkgs/development/libraries/libdevil/default.nix b/pkgs/development/libraries/libdevil/default.nix index ea030e9c6359..63ca4877da65 100644 --- a/pkgs/development/libraries/libdevil/default.nix +++ b/pkgs/development/libraries/libdevil/default.nix @@ -1,6 +1,7 @@ { lib , stdenv , fetchurl +, cmake , libjpeg , libpng , libmng @@ -18,16 +19,18 @@ stdenv.mkDerivation (finalAttrs: { pname = "libdevil"; - version = "1.7.8"; + version = "1.8.0"; outputs = [ "out" "dev" ]; src = fetchurl { url = "mirror://sourceforge/openil/DevIL-${finalAttrs.version}.tar.gz"; - sha256 = "1zd850nn7nvkkhasrv7kn17kzgslr5ry933v6db62s4lr0zzlbv8"; + hash = "sha256-AHWXPufdifBQeHPiWArHgzZFLSnTSgcTSyCPROL+twk="; }; - nativeBuildInputs = [ pkg-config ]; + sourceRoot = "DevIL/DevIL"; + + nativeBuildInputs = [ cmake pkg-config ]; buildInputs = [ libjpeg libpng libmng lcms1 libtiff openexr ] ++ lib.optionals withXorg [ libX11 libGL ] @@ -38,29 +41,17 @@ stdenv.mkDerivation (finalAttrs: { CXXFLAGS = lib.optionalString stdenv.cc.isClang "-Wno-register"; 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 + ./0001-il_endian.h-Fix-endian-handling.patch ]; enableParallelBuilding = true; postPatch = '' - for a in test/Makefile.in test/format_test/format_checks.sh.in ; do + for a in test/Makefile.am test/format_test/format_checks.sh.in ; do substituteInPlace $a \ --replace /bin/bash ${runtimeShell} done diff --git a/pkgs/development/libraries/libdevil/ftbfs-libpng15.patch b/pkgs/development/libraries/libdevil/ftbfs-libpng15.patch deleted file mode 100644 index 5fc53c2dc6a7..000000000000 --- a/pkgs/development/libraries/libdevil/ftbfs-libpng15.patch +++ /dev/null @@ -1,31 +0,0 @@ -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/pkgs/development/libraries/libdevil/il_endian.h.patch b/pkgs/development/libraries/libdevil/il_endian.h.patch deleted file mode 100644 index c220e6802fd9..000000000000 --- a/pkgs/development/libraries/libdevil/il_endian.h.patch +++ /dev/null @@ -1,27 +0,0 @@ -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)