[libkdcraw] BR libjpeg-turbo-devel >= 1.2.90, fix libjpeg detection for libjpeg-turbo

Kevin Kofler kkofler at fedoraproject.org
Wed Feb 6 16:20:05 UTC 2013


commit 95b3662fcb3fef5102d5959b3fcf613d61afbabb
Author: Kevin Kofler <Kevin at tigcc.ticalc.org>
Date:   Wed Feb 6 17:19:54 2013 +0100

    BR libjpeg-turbo-devel >= 1.2.90, fix libjpeg detection for libjpeg-turbo
    
    * Wed Feb 06 2013 Kevin Kofler <Kevin at tigcc.ticalc.org> - 4.10.0-2
    - BR libjpeg-turbo-devel >= 1.2.90, fix libjpeg detection for libjpeg-turbo

 libkdcraw-4.10.0-libjpeg-turbo.patch |  103 ++++++++++++++++++++++++++++++++++
 libkdcraw.spec                       |   12 +++-
 2 files changed, 112 insertions(+), 3 deletions(-)
---
diff --git a/libkdcraw-4.10.0-libjpeg-turbo.patch b/libkdcraw-4.10.0-libjpeg-turbo.patch
new file mode 100644
index 0000000..4b66e14
--- /dev/null
+++ b/libkdcraw-4.10.0-libjpeg-turbo.patch
@@ -0,0 +1,103 @@
+From c0cd7aef053a288dc6bd1fb8a9b5a5e11ebd2982 Mon Sep 17 00:00:00 2001
+Message-Id: <c0cd7aef053a288dc6bd1fb8a9b5a5e11ebd2982.1360167127.git.kevin.kofler at chello.at>
+From: Kevin Kofler <kevin.kofler at chello.at>
+Date: Wed, 6 Feb 2013 17:11:58 +0100
+Subject: [PATCH] fix libjpeg detection for libjpeg-turbo
+
+This fixes the libjpeg detection to check for the availability of
+jpeg_mem_src rather than for JPEG_LIB_VERSION, allowing to build the
+JPEG functionality with libjpeg-turbo >= 1.2.90.
+
+RawSpeed/DngDecoderSlices.cpp tries to define its own jpeg_mem_src
+function if JPEG_LIB_VERSION < 80, so patch it to use the detected
+USE_JPEG8 instead to avoid the redefinition and the resulting compiler
+error.
+---
+ libraw/CMakeLists.txt                       | 29 +++++++++++++++--------------
+ libraw/RawSpeed/DngDecoderSlices.cpp        |  2 +-
+ libraw/RawSpeed/rawspeed.jpeg-version.patch | 13 +++++++++++++
+ 3 Dateien geändert, 29 Zeilen hinzugefügt(+), 15 Zeilen entfernt(-)
+
+diff --git a/libraw/CMakeLists.txt b/libraw/CMakeLists.txt
+index 581e7b1..6f92fe7 100644
+--- a/libraw/CMakeLists.txt
++++ b/libraw/CMakeLists.txt
+@@ -88,28 +88,29 @@ ENDIF (ENABLE_LCMS2)
+ 
+ FIND_PACKAGE(JPEG)
+ IF(JPEG_FOUND)
+-    # check version of libjpeg
+-    # inspired from digikam/CMakeLists.txt
+-    SET(_jpeglib_version_source "#include <stddef.h>\n#include<stdio.h>\n#include <jpeglib.h>\n int main()\n {\n #if (JPEG_LIB_VERSION >= 80) \n #error JPEG_LIB_VERSION >= 80 found \n #endif \n }\n")
+-    SET(_jpeglib_version_source_file ${CMAKE_BINARY_DIR}/CMakeTmp/cmake_jpeglib_version_check.cpp)
+-    FILE(WRITE "${_jpeglib_version_source_file}" "${_jpeglib_version_source}")
+-    SET(_jpeglib_version_include_dirs "-DINCLUDE_DIRECTORIES:STRING=${JPEG_INCLUDE_DIR}")
+-
+-    TRY_COMPILE(_jpeglib_version_compile_result ${CMAKE_BINARY_DIR} ${_jpeglib_version_source_file}
+-                CMAKE_FLAGS "${_jpeglib_version_include_dirs}"
+-                COMPILE_OUTPUT_VARIABLE _jpeglib_version_compile_output_var
+-               )
+-    IF(_jpeglib_version_compile_result)
+-        MESSAGE(STATUS "Identified libjpeg version less than 80 (too low)")
++    INCLUDE(CheckSymbolExists)
++
++    # check for the jpeg_mem_src function
++    SET(OLD_CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
++    SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES} ${JPEG_INCLUDE_DIR}")
++    SET(OLD_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
++    SET(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES} ${JPEG_LIBRARY}")
++    CHECK_SYMBOL_EXISTS(jpeg_mem_src jpeglib.h HAVE_JPEG_MEM_SRC)
++    SET(CMAKE_REQUIRED_INCLUDES "${OLD_CMAKE_REQUIRED_INCLUDES}")
++    SET(CMAKE_REQUIRED_LIBRARIES "${OLD_CMAKE_REQUIRED_LIBRARIES}")
++
++    IF(NOT HAVE_JPEG_MEM_SRC)
++        MESSAGE(STATUS "libjpeg too old (need IJG libjpeg >= 8 or libjpeg-turbo >= 1.2.90)")
+         SET(JPEG_FOUND FALSE)
+     ENDIF()
+ ENDIF(JPEG_FOUND)
+ 
+-MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "JPEG image format support" "http://www.ijg.org" FALSE "80" "needed for the LibRaw DNG lossy codec")
++MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "JPEG image format support" "http://www.ijg.org" FALSE "8" "needed for the LibRaw DNG lossy codec")
+ 
+ # Flag to use libjpeg with LibRaw DNG lossy codec
+ IF(JPEG_FOUND)
+     ADD_DEFINITIONS(-DUSE_JPEG)
++    # always claim JPEG8, all that's needed is jpeg_mem_src we just checked for
+     ADD_DEFINITIONS(-DUSE_JPEG8)
+     INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR})
+ ENDIF()
+diff --git a/libraw/RawSpeed/DngDecoderSlices.cpp b/libraw/RawSpeed/DngDecoderSlices.cpp
+index 28a137e..617b4b3 100644
+--- a/libraw/RawSpeed/DngDecoderSlices.cpp
++++ b/libraw/RawSpeed/DngDecoderSlices.cpp
+@@ -88,7 +88,7 @@ void DngDecoderSlices::startDecoding() {
+ 
+ }
+ 
+-#if JPEG_LIB_VERSION < 80
++#ifndef USE_JPEG8
+ /* Read JPEG image from a memory segment */
+ 
+ static void init_source (j_decompress_ptr cinfo) {}
+diff --git a/libraw/RawSpeed/rawspeed.jpeg-version.patch b/libraw/RawSpeed/rawspeed.jpeg-version.patch
+new file mode 100644
+index 0000000..3a012d1
+--- /dev/null
++++ b/libraw/RawSpeed/rawspeed.jpeg-version.patch
+@@ -0,0 +1,13 @@
++diff --git a/RawSpeed/DngDecoderSlices.cpp b/RawSpeed/DngDecoderSlices.cpp
++index 28a137e..617b4b3 100644
++--- a/RawSpeed/DngDecoderSlices.cpp
+++++ b/RawSpeed/DngDecoderSlices.cpp
++@@ -88,7 +88,7 @@ void DngDecoderSlices::startDecoding() {
++ 
++ }
++ 
++-#if JPEG_LIB_VERSION < 80
+++#ifndef USE_JPEG8
++ /* Read JPEG image from a memory segment */
++ 
++ static void init_source (j_decompress_ptr cinfo) {}
+-- 
+1.7.11.7
+
diff --git a/libkdcraw.spec b/libkdcraw.spec
index a1ae2f9..8b0f49c 100644
--- a/libkdcraw.spec
+++ b/libkdcraw.spec
@@ -1,7 +1,7 @@
 Name:    libkdcraw
-Summary: A C++ interface around LibRaw library 
+Summary: A C++ interface around LibRaw library
 Version: 4.10.0
-Release: 1%{?dist}
+Release: 2%{?dist}
 
 # libkdcraw is GPLv2+,
 # LibRaw(bundled) is LGPLv2
@@ -15,10 +15,12 @@ URL:     https://projects.kde.org/projects/kde/kdegraphics/libs/libkdcraw
 %global stable stable
 %endif
 Source0: http://download.kde.org/%{stable}/%{version}/src/%{name}-%{version}.tar.xz
+# fix libjpeg detection for libjpeg-turbo, hopefully upstreamable
+Patch50: libkdcraw-4.10.0-libjpeg-turbo.patch
 
 BuildRequires: kdelibs4-devel
 # libjpeg 80 or higher needed for the LibRaw DNG lossy codec
-BuildRequires: libjpeg-devel
+BuildRequires: libjpeg-turbo-devel >= 1.2.90
 BuildRequires: pkgconfig(lcms2)
 BuildRequires: pkgconfig(jasper)
 BuildRequires: pkgconfig(libxml-2.0)
@@ -50,6 +52,7 @@ Requires: kdelibs4-devel
 
 %prep
 %setup -q
+%patch50 -p1 -b .libjpeg-turbo
 
 # copy/rename a few things for easier inclusion as %%doc
 cp -a libraw/README README.libraw
@@ -107,6 +110,9 @@ fi
 
 
 %changelog
+* Wed Feb 06 2013 Kevin Kofler <Kevin at tigcc.ticalc.org> - 4.10.0-2
+- BR libjpeg-turbo-devel >= 1.2.90, fix libjpeg detection for libjpeg-turbo
+
 * Thu Jan 31 2013 Rex Dieter <rdieter at fedoraproject.org> - 4.10.0-1
 - 4.10.0
 


More information about the scm-commits mailing list