Subject: bug#26230: [PATCH core-updates] gnu: devil: Update to 1.8.0.

From: Marius Bakke <[email-masked]>
Date: Fri, 24 Mar 2017 00:20:56 +0100

* gnu/packages/patches/devil-CVE-2009-3994.patch,
gnu/packages/patches/devil-fix-libpng.patch: Delete files.
* gnu/local.mk (dist_patch_DATA): Remove them.
* gnu/packages/image.scm (devil): Update to 1.8.0.
[source]: Remove patches and snippet.
[build-system]: Change to CMAKE-BUILD-SYSTEM.
[arguments]: Disable tests. Remove #:configure-flags and add a
'change-directory' phase. Remove 'fix-tests' phase.
[inputs]: Change LIBJPEG to LIBJPEG-TURBO.
---
 gnu/local.mk                                   |  2 --
 gnu/packages/image.scm                         | 34 +++++++-----------------
 gnu/packages/patches/devil-CVE-2009-3994.patch | 24 -----------------
 gnu/packages/patches/devil-fix-libpng.patch    | 36 --------------------------
 4 files changed, 9 insertions(+), 87 deletions(-)
 delete mode 100644 gnu/packages/patches/devil-CVE-2009-3994.patch
 delete mode 100644 gnu/packages/patches/devil-fix-libpng.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index c9e3131c0..6df3e5846 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -526,8 +526,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/cursynth-wave-rand.patch			\
   %D%/packages/patches/cyrus-sasl-CVE-2013-4122.patch		\
   %D%/packages/patches/dbus-helper-search-path.patch		\
-  %D%/packages/patches/devil-CVE-2009-3994.patch		\
-  %D%/packages/patches/devil-fix-libpng.patch			\
   %D%/packages/patches/dfu-programmer-fix-libusb.patch		\
   %D%/packages/patches/diffutils-gets-undeclared.patch		\
   %D%/packages/patches/doc++-include-directives.patch		\
diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 51c465a0c..51b09680a 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -860,44 +860,28 @@ and XMP metadata of images in various formats.")
 (define-public devil
   (package
     (name "devil")
-    (version "1.7.8")
+    (version "1.8.0")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://downloads.sourceforge.net/openil/"
                                   "DevIL-" version ".tar.gz"))
               (sha256
                (base32
-                "1zd850nn7nvkkhasrv7kn17kzgslr5ry933v6db62s4lr0zzlbv8"))
-              ;; Backported from upstream:
-              ;; https://github.com/DentonW/DevIL/commit/724194d7a9a91221a564579f64bdd6f0abd64219.patch
-              (patches (search-patches "devil-fix-libpng.patch"
-                                       "devil-CVE-2009-3994.patch"))
-              (modules '((guix build utils)))
-              (snippet
-               ;; Fix old lcms include directives and lib flags.
-               '(substitute* '("configure" "src-IL/src/il_profiles.c")
-                  (("-llcms") "-llcms2")
-                  (("lcms/lcms\\.h") "lcms2/lcms2.h")
-                  (("lcms\\.h") "lcms2.h")))))
-    (build-system gnu-build-system)
+                "02dpzvi493r09c9hfjnk54nladl3qw55iqkkg18g12fxwwz9fx80"))))
+    (build-system cmake-build-system)
     (arguments
-     '(#:configure-flags '("--enable-ILUT=yes") ; build utility library
+     '(;; XXX: Not supported in the released CMakeLists.txt.
+       ;; Enable this for > 1.8.0.
+       #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (add-before 'check 'fix-tests
-           (lambda* (#:key inputs #:allow-other-keys)
-             ;; Fix hard-coded /bin/bash reference.
-             (substitute* '("test/Makefile")
-               (("TESTS_ENVIRONMENT = /bin/bash")
-                (string-append "TESTS_ENVIRONMENT = "
-                               (assoc-ref inputs "bash")
-                               "/bin/bash")))
-             #t)))))
+         (add-before 'configure 'change-directory
+           (lambda _ (chdir "DevIL") #t)))))
     (native-inputs
      `(("pkg-config" ,pkg-config)))
     (inputs
      `(("lcms" ,lcms)
-       ("libjpeg" ,libjpeg)
+       ("libjpeg" ,libjpeg-turbo)
        ("libmng" ,libmng)
        ("libpng" ,libpng)
        ("libtiff" ,libtiff)
diff --git a/gnu/packages/patches/devil-CVE-2009-3994.patch b/gnu/packages/patches/devil-CVE-2009-3994.patch
deleted file mode 100644
index e009a95c4..000000000
--- a/gnu/packages/patches/devil-CVE-2009-3994.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Fix CVE-2009-3994 (buffer overflow in GetUID() allows remote DOS or
-arbitrary code execution via crafted DICOM file).
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-3994
-
-Copied from Fedora
-https://pkgs.fedoraproject.org/cgit/rpms/DevIL.git/tree/DevIL-1.7.8-CVE-2009-3994.patch?id=9c656a75393d6c455aef9f4968fbbee9c53f4fdb
-
-diff -up devil-1.7.8/src-IL/src/il_dicom.c~ devil-1.7.8/src-IL/src/il_dicom.c
---- devil-1.7.8/src-IL/src/il_dicom.c~	2009-03-08 08:10:09.000000000 +0100
-+++ devil-1.7.8/src-IL/src/il_dicom.c	2009-12-03 12:07:45.000000000 +0100
-@@ -427,9 +427,11 @@ ILboolean GetUID(ILubyte *UID)
- 		return IL_FALSE;
- 
- 	ValLen = GetLittleUShort();
-+	if (ValLen > 64)
-+		return IL_FALSE;
- 	if (iread(UID, ValLen, 1) != 1)
- 		return IL_FALSE;
--	UID[64] = 0;  // Just to make sure that our string is terminated.
-+	UID[ValLen] = 0;  // Just to make sure that our string is terminated.
- 
- 	return IL_TRUE;
- }
diff --git a/gnu/packages/patches/devil-fix-libpng.patch b/gnu/packages/patches/devil-fix-libpng.patch
deleted file mode 100644
index a8e90333a..000000000
--- a/gnu/packages/patches/devil-fix-libpng.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 724194d7a9a91221a564579f64bdd6f0abd64219 Mon Sep 17 00:00:00 2001
-From: Noah Mayr <[email-masked]>
-Date: Sun, 1 Mar 2015 10:10:56 +0100
-Subject: [PATCH] Fixed deprecated libpng API usage.
-
----
- src-IL/src/il_icon.c | 2 +-
- src-IL/src/il_png.c  | 4 ++--
- 2 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/src-IL/src/il_icon.c b/src-IL/src/il_icon.c
-index 2ccb1a3..fd9475d 100644
---- a/src-IL/src/il_icon.c
-+++ b/src-IL/src/il_icon.c
-@@ -525,7 +525,7 @@ ILboolean ico_readpng_get_image(ICOIMAGE *Icon, ILdouble display_exponent)
-
- 	// Expand low-bit-depth grayscale images to 8 bits
- 	if (ico_color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) {
--		png_set_gray_1_2_4_to_8(ico_png_ptr);
-+		png_set_expand_gray_1_2_4_to_8(ico_png_ptr);
- 	}
-
- 	// Expand RGB images with transparency to full alpha channels
-diff --git a/src-IL/src/il_png.c b/src-IL/src/il_png.c
-index da9517d..2866508 100644
---- a/src-IL/src/il_png.c
-+++ b/src-IL/src/il_png.c
-@@ -277,7 +277,7 @@ ILboolean readpng_get_image(ILdouble display_exponent)
-
- 	// Expand low-bit-depth grayscale images to 8 bits
- 	if (png_color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) {
--		png_set_gray_1_2_4_to_8(png_ptr);
-+		png_set_expand_gray_1_2_4_to_8(png_ptr);
- 	}
-
- 	// Expand RGB images with transparency to full alpha channels
-- 
2.12.1