summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2019-08-13 09:14:04 +0200
committerRemi Collet <remi@remirepo.net>2019-08-13 09:14:04 +0200
commitb74dfd5479b12dd702294fbd3c6ad1a86a11f48a (patch)
tree72aadb666f55ce824cbc214ac65d207214051c44
import from 7.6
-rw-r--r--libkdcraw-4.10.0-libjpeg-turbo.patch132
-rw-r--r--libkdcraw-4.10.5-CVE-2013-2126.patch24
-rw-r--r--libkdcraw-4.10.5-use-system-libraw.patch195
-rw-r--r--libkdcraw.spec266
4 files changed, 617 insertions, 0 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..7cd2777
--- /dev/null
+++ b/libkdcraw-4.10.0-libjpeg-turbo.patch
@@ -0,0 +1,132 @@
+diff -Nur libkdcraw-4.10.0/libraw/CMakeLists.txt libkdcraw-4.10.0-libjpeg-turbo/libraw/CMakeLists.txt
+--- libkdcraw-4.10.0/libraw/CMakeLists.txt 2013-01-23 23:00:43.000000000 +0100
++++ libkdcraw-4.10.0-libjpeg-turbo/libraw/CMakeLists.txt 2013-03-09 23:58:25.000000000 +0100
+@@ -88,29 +88,26 @@
+
+ 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}")
++ INCLUDE(CheckSymbolExists)
+
+- 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)")
+- SET(JPEG_FOUND FALSE)
+- ENDIF()
++ # check for the jpeg_mem_src function
++ SET(OLD_CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
++ LIST(APPEND CMAKE_REQUIRED_INCLUDES "${JPEG_INCLUDE_DIR}")
++ SET(OLD_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
++ LIST(APPEND CMAKE_REQUIRED_LIBRARIES "${JPEG_LIBRARY}")
++ CHECK_SYMBOL_EXISTS(jpeg_mem_src "stddef.h;stdio.h;jpeglib.h" HAVE_JPEG_MEM_SRC)
++ SET(CMAKE_REQUIRED_INCLUDES "${OLD_CMAKE_REQUIRED_INCLUDES}")
++ SET(CMAKE_REQUIRED_LIBRARIES "${OLD_CMAKE_REQUIRED_LIBRARIES}")
+ 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 "" "needed for the LibRaw DNG lossy codec")
+
+ # Flag to use libjpeg with LibRaw DNG lossy codec
+ IF(JPEG_FOUND)
+ ADD_DEFINITIONS(-DUSE_JPEG)
+- ADD_DEFINITIONS(-DUSE_JPEG8)
++ IF(HAVE_JPEG_MEM_SRC)
++ ADD_DEFINITIONS(-DUSE_JPEG8)
++ ENDIF(HAVE_JPEG_MEM_SRC)
+ INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR})
+ ENDIF()
+
+diff -Nur libkdcraw-4.10.0/libraw/RawSpeed/DngDecoderSlices.cpp libkdcraw-4.10.0-libjpeg-turbo/libraw/RawSpeed/DngDecoderSlices.cpp
+--- libkdcraw-4.10.0/libraw/RawSpeed/DngDecoderSlices.cpp 2013-01-23 23:00:43.000000000 +0100
++++ libkdcraw-4.10.0-libjpeg-turbo/libraw/RawSpeed/DngDecoderSlices.cpp 2013-03-09 23:48:29.000000000 +0100
+@@ -88,7 +88,7 @@
+
+ }
+
+-#if JPEG_LIB_VERSION < 80
++#ifndef USE_JPEG8
+ /* Read JPEG image from a memory segment */
+
+ static void init_source (j_decompress_ptr cinfo) {}
+diff -Nur libkdcraw-4.10.0/libraw/RawSpeed/rawspeed.jpeg-version.patch libkdcraw-4.10.0-libjpeg-turbo/libraw/RawSpeed/rawspeed.jpeg-version.patch
+--- libkdcraw-4.10.0/libraw/RawSpeed/rawspeed.jpeg-version.patch 1970-01-01 01:00:00.000000000 +0100
++++ libkdcraw-4.10.0-libjpeg-turbo/libraw/RawSpeed/rawspeed.jpeg-version.patch 2013-03-09 23:48:29.000000000 +0100
+@@ -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) {}
+diff -Nur libkdcraw-4.10.0/libraw/src/libraw_datastream.cpp libkdcraw-4.10.0-libjpeg-turbo/libraw/src/libraw_datastream.cpp
+--- libkdcraw-4.10.0/libraw/src/libraw_datastream.cpp 2013-01-23 23:00:44.000000000 +0100
++++ libkdcraw-4.10.0-libjpeg-turbo/libraw/src/libraw_datastream.cpp 2013-03-10 00:22:15.000000000 +0100
+@@ -443,9 +443,52 @@
+ #endif
+ }
+
++#if !defined(NO_JPEG) && !defined(USE_JPEG8)
++/* Read JPEG image from a memory segment
++ (from libraw/RawSpeed/DngDecoderSlices.cpp, LGPLv2+) */
++
++static void init_source (j_decompress_ptr cinfo) {}
++static boolean fill_input_buffer (j_decompress_ptr cinfo)
++{
++ struct jpeg_source_mgr* src = (struct jpeg_source_mgr*) cinfo->src;
++ return !!src->bytes_in_buffer;
++}
++static void skip_input_data (j_decompress_ptr cinfo, long num_bytes)
++{
++ struct jpeg_source_mgr* src = (struct jpeg_source_mgr*) cinfo->src;
++
++ if (num_bytes > (int)src->bytes_in_buffer)
++ throw LIBRAW_EXCEPTION_IO_EOF;
++ if (num_bytes > 0) {
++ src->next_input_byte += (size_t) num_bytes;
++ src->bytes_in_buffer -= (size_t) num_bytes;
++ }
++}
++static void term_source (j_decompress_ptr cinfo) {}
++static void jpeg_mem_src (j_decompress_ptr cinfo, unsigned char* buffer, long nbytes)
++{
++ struct jpeg_source_mgr* src;
++
++ if (cinfo->src == NULL) { /* first time for this JPEG object? */
++ cinfo->src = (struct jpeg_source_mgr *)
++ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
++ sizeof(struct jpeg_source_mgr));
++ }
++
++ src = (struct jpeg_source_mgr*) cinfo->src;
++ src->init_source = init_source;
++ src->fill_input_buffer = fill_input_buffer;
++ src->skip_input_data = skip_input_data;
++ src->resync_to_restart = jpeg_resync_to_restart; /* use default method */
++ src->term_source = term_source;
++ src->bytes_in_buffer = nbytes;
++ src->next_input_byte = (JOCTET*)buffer;
++}
++#endif
++
+ int LibRaw_buffer_datastream::jpeg_src(void *jpegdata)
+ {
+-#if defined(NO_JPEG) || !defined (USE_JPEG8)
++#if defined(NO_JPEG)
+ return -1;
+ #else
+ j_decompress_ptr cinfo = (j_decompress_ptr) jpegdata;
diff --git a/libkdcraw-4.10.5-CVE-2013-2126.patch b/libkdcraw-4.10.5-CVE-2013-2126.patch
new file mode 100644
index 0000000..221da0a
--- /dev/null
+++ b/libkdcraw-4.10.5-CVE-2013-2126.patch
@@ -0,0 +1,24 @@
+diff -up libkdcraw-4.10.5/libraw/src/libraw_cxx.cpp.CVE-2013-2126 libkdcraw-4.10.5/libraw/src/libraw_cxx.cpp
+--- libkdcraw-4.10.5/libraw/src/libraw_cxx.cpp.CVE-2013-2126 2013-07-15 14:39:22.000000000 +0200
++++ libkdcraw-4.10.5/libraw/src/libraw_cxx.cpp 2013-07-15 14:45:31.000000000 +0200
+@@ -1055,8 +1055,8 @@ int LibRaw::unpack(void)
+ S.iheight= S.height;
+ IO.shrink = 0;
+ // allocate image as temporary buffer, size
+- imgdata.rawdata.raw_alloc = calloc(S.iwidth*S.iheight,sizeof(*imgdata.image));
+- imgdata.image = (ushort (*)[4]) imgdata.rawdata.raw_alloc;
++ imgdata.rawdata.raw_alloc = 0;
++ imgdata.image = (ushort (*)[4]) calloc(S.iwidth*S.iheight,sizeof(*imgdata.image));
+ }
+ ID.input->seek(libraw_internal_data.unpacker_data.data_offset, SEEK_SET);
+ (this->*load_raw)();
+@@ -1073,8 +1073,8 @@ int LibRaw::unpack(void)
+ // recover saved
+ if( decoder_info.decoder_flags & LIBRAW_DECODER_LEGACY)
+ {
++ imgdata.rawdata.raw_alloc = imgdata.rawdata.color_image = imgdata.image;
+ imgdata.image = 0;
+- imgdata.rawdata.color_image = (ushort (*)[4]) imgdata.rawdata.raw_alloc;
+ }
+
+ // recover image sizes
diff --git a/libkdcraw-4.10.5-use-system-libraw.patch b/libkdcraw-4.10.5-use-system-libraw.patch
new file mode 100644
index 0000000..fec1888
--- /dev/null
+++ b/libkdcraw-4.10.5-use-system-libraw.patch
@@ -0,0 +1,195 @@
+diff -up libkdcraw-4.10.5/CMakeLists.txt.using-system-libraw libkdcraw-4.10.5/CMakeLists.txt
+--- libkdcraw-4.10.5/CMakeLists.txt.using-system-libraw 2013-06-28 19:36:41.947766793 +0200
++++ libkdcraw-4.10.5/CMakeLists.txt 2018-04-18 17:06:45.478621145 +0200
+@@ -29,15 +29,22 @@ SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SO
+ MESSAGE(STATUS "----------------------------------------------------------------------------------")
+ MESSAGE(STATUS "Starting CMake configuration for: libkdcraw")
+
+-OPTION(ENABLE_LCMS2 "Link libraw to LCMS2 else LCMS1 (default=OFF)" OFF)
+-OPTION(ENABLE_RAWSPEED "Compile libraw with RawSpeed codec (default=OFF)" OFF)
+-
+ FIND_PACKAGE(KDE4 REQUIRED)
+ INCLUDE(KDE4Defaults)
+ INCLUDE(MacroLibrary)
+ INCLUDE(MacroOptionalAddSubdirectory)
+ INCLUDE(FindPackageHandleStandardArgs)
+
++FIND_PACKAGE(LibRaw 0.14 REQUIRED)
++
++#Check LibRaw Major and Minor version to rules compilation.
++MACRO_ENSURE_VERSION("0.16.0" "${LibRaw_VERSION_STRING}" VERSION_LIBRAW_WITH_CMAKE_SUPPORT)
++MESSAGE(STATUS "LibRaw version: ${LibRaw_VERSION_STRING} - has config file: ${VERSION_LIBRAW_WITH_CMAKE_SUPPORT}")
++
++IF(VERSION_LIBRAW_WITH_CMAKE_SUPPORT)
++ ADD_DEFINITIONS(-DLIBRAW_HAS_CONFIG)
++ENDIF()
++
+ ADD_DEFINITIONS (${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS} ${KDE4_DEFINITIONS})
+ INCLUDE_DIRECTORIES (${QDBUS_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
+
+@@ -106,7 +113,6 @@ ENDIF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C
+
+ # ==================================================================================================
+
+-ADD_SUBDIRECTORY(libraw)
+ ADD_SUBDIRECTORY(libkdcraw)
+ ADD_SUBDIRECTORY(test)
+ ADD_SUBDIRECTORY(icons)
+diff -up libkdcraw-4.10.5/cmake/modules/FindLibRaw.cmake.using-system-libraw libkdcraw-4.10.5/cmake/modules/FindLibRaw.cmake
+--- libkdcraw-4.10.5/cmake/modules/FindLibRaw.cmake.using-system-libraw 2018-04-18 16:57:12.966314267 +0200
++++ libkdcraw-4.10.5/cmake/modules/FindLibRaw.cmake 2018-04-18 17:08:34.597629174 +0200
+@@ -0,0 +1,79 @@
++# - Find LibRaw
++# Find the LibRaw library <http://www.libraw.org>
++# This module defines
++# LibRaw_VERSION_STRING, the version string of LibRaw
++# LibRaw_INCLUDE_DIR, where to find libraw.h
++# LibRaw_LIBRARIES, the libraries needed to use LibRaw (non-thread-safe)
++# LibRaw_r_LIBRARIES, the libraries needed to use LibRaw (thread-safe)
++# LibRaw_DEFINITIONS, the definitions needed to use LibRaw (non-thread-safe)
++# LibRaw_r_DEFINITIONS, the definitions needed to use LibRaw (thread-safe)
++#
++# Copyright (c) 2013, Pino Toscano <pino at kde dot org>
++# Copyright (c) 2013, Gilles Caulier <caulier dot gilles at gmail dot com>
++#
++# Redistribution and use is allowed according to the terms of the BSD license.
++# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
++
++FIND_PACKAGE(PkgConfig)
++
++IF(PKG_CONFIG_FOUND)
++ PKG_CHECK_MODULES(PC_LIBRAW libraw)
++ SET(LibRaw_DEFINITIONS ${PC_LIBRAW_CFLAGS_OTHER})
++
++ PKG_CHECK_MODULES(PC_LIBRAW_R libraw_r)
++ SET(LibRaw_r_DEFINITIONS ${PC_LIBRAW_R_CFLAGS_OTHER})
++ENDIF()
++
++FIND_PATH(LibRaw_INCLUDE_DIR libraw.h
++ HINTS
++ ${PC_LIBRAW_INCLUDEDIR}
++ ${PC_LibRaw_INCLUDE_DIRS}
++ PATH_SUFFIXES libraw
++ )
++
++FIND_LIBRARY(LibRaw_LIBRARIES NAMES raw
++ HINTS
++ ${PC_LIBRAW_LIBDIR}
++ ${PC_LIBRAW_LIBRARY_DIRS}
++ )
++
++FIND_LIBRARY(LibRaw_r_LIBRARIES NAMES raw_r
++ HINTS
++ ${PC_LIBRAW_R_LIBDIR}
++ ${PC_LIBRAW_R_LIBRARY_DIRS}
++ )
++
++IF(LibRaw_INCLUDE_DIR)
++ FILE(READ ${LibRaw_INCLUDE_DIR}/libraw_version.h _libraw_version_content)
++
++ STRING(REGEX MATCH "#define LIBRAW_MAJOR_VERSION[ \t]*([0-9]*)\n" _version_major_match ${_libraw_version_content})
++ SET(_libraw_version_major "${CMAKE_MATCH_1}")
++
++ STRING(REGEX MATCH "#define LIBRAW_MINOR_VERSION[ \t]*([0-9]*)\n" _version_minor_match ${_libraw_version_content})
++ SET(_libraw_version_minor "${CMAKE_MATCH_1}")
++
++ STRING(REGEX MATCH "#define LIBRAW_PATCH_VERSION[ \t]*([0-9]*)\n" _version_patch_match ${_libraw_version_content})
++ SET(_libraw_version_patch "${CMAKE_MATCH_1}")
++
++ IF(_version_major_match AND _version_minor_match AND _version_patch_match)
++ SET(LibRaw_VERSION_STRING "${_libraw_version_major}.${_libraw_version_minor}.${_libraw_version_patch}")
++ ELSE()
++ IF(NOT LibRaw_FIND_QUIETLY)
++ MESSAGE(STATUS "Failed to get version information from ${LibRaw_INCLUDE_DIR}/libraw_version.h")
++ ENDIF()
++ ENDIF()
++ENDIF()
++
++INCLUDE(FindPackageHandleStandardArgs)
++FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibRaw
++ REQUIRED_VARS LibRaw_LIBRARIES LibRaw_INCLUDE_DIR
++ VERSION_VAR LibRaw_VERSION_STRING
++ )
++
++MARK_AS_ADVANCED(LibRaw_VERSION_STRING
++ LibRaw_INCLUDE_DIR
++ LibRaw_LIBRARIES
++ LibRaw_r_LIBRARIES
++ LibRaw_DEFINITIONS
++ LibRaw_r_DEFINITIONS
++ )
+diff -up libkdcraw-4.10.5/libkdcraw/CMakeLists.txt.using-system-libraw libkdcraw-4.10.5/libkdcraw/CMakeLists.txt
+--- libkdcraw-4.10.5/libkdcraw/CMakeLists.txt.using-system-libraw 2013-06-28 19:36:41.947766793 +0200
++++ libkdcraw-4.10.5/libkdcraw/CMakeLists.txt 2018-04-18 17:04:31.919279255 +0200
+@@ -22,7 +22,27 @@
+ #
+ # ============================================================
+
+-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libraw)
++# In some versions LibRaw is not linked against OpenMP stuff,
++# so manually link libkdcraw against it for now.
++
++IF(NOT APPLE)
++ # OpenMP library detection (requires CMake >= 2.6.3)
++ # NOTE: OpenMP under MacOSX do not support multithreading.
++
++ MACRO_OPTIONAL_FIND_PACKAGE(OpenMP)
++
++ IF(OPENMP_FOUND)
++ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
++ IF("${OpenMP_CXX_FLAGS}" STREQUAL "-fopenmp")
++ SET(OPENMP_LDFLAGS "-lgomp")
++ ENDIF("${OpenMP_CXX_FLAGS}" STREQUAL "-fopenmp")
++ IF("${OpenMP_CXX_FLAGS}" STREQUAL "-xopenmp")
++ SET(OPENMP_LDFLAGS "-xopenmp")
++ ENDIF("${OpenMP_CXX_FLAGS}" STREQUAL "-xopenmp")
++ ENDIF(OPENMP_FOUND)
++ENDIF(NOT APPLE)
++
++INCLUDE_DIRECTORIES(${LibRaw_INCLUDE_DIR})
+
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.h)
+
+@@ -42,15 +62,15 @@ SET(kdcraw_LIB_SRCS kdcraw.cpp
+ KDE4_ADD_LIBRARY(kdcraw SHARED ${kdcraw_LIB_SRCS})
+
+ TARGET_LINK_LIBRARIES(kdcraw
+- libraw
++ ${LibRaw_LIBRARIES}
+ ${KDE4_KDEUI_LIBS}
+ ${KDE4_KIO_LIBS}
+ ${KDE4_SOLID_LIBS}
+ ${KDE4_THREADWEAVER_LIBRARIES}
++ ${OPENMP_LDFLAGS}
+ )
+
+-SET_TARGET_PROPERTIES(kdcraw PROPERTIES VERSION ${DCRAW_LIB_SO_VERSION_STRING} SOVERSION ${DCRAW_LIB_SO_CUR_VERSION}
+- DEFINE_SYMBOL LIBRAW_BUILDLIB)
++SET_TARGET_PROPERTIES(kdcraw PROPERTIES VERSION ${DCRAW_LIB_SO_VERSION_STRING} SOVERSION ${DCRAW_LIB_SO_CUR_VERSION})
+
+ INSTALL(TARGETS kdcraw ${INSTALL_TARGETS_DEFAULT_ARGS})
+
+diff -up libkdcraw-4.10.5/libkdcraw/libkdcraw_export.h.using-system-libraw libkdcraw-4.10.5/libkdcraw/libkdcraw_export.h
+--- libkdcraw-4.10.5/libkdcraw/libkdcraw_export.h.using-system-libraw 2013-06-28 19:36:41.915766633 +0200
++++ libkdcraw-4.10.5/libkdcraw/libkdcraw_export.h 2018-04-18 16:57:12.967314240 +0200
+@@ -31,7 +31,7 @@
+ #include <kdemacros.h>
+
+ #ifndef LIBKDCRAW_EXPORT
+-# if defined(LIBRAW_BUILDLIB)
++# if defined(MAKE_KDCRAW_LIB)
+ /* We are building this library */
+ # define LIBKDCRAW_EXPORT KDE_EXPORT
+ # else
+diff -up libkdcraw-4.10.5/libkdcraw/dcrawsettingswidget.cpp.orig libkdcraw-4.10.5/libkdcraw/dcrawsettingswidget.cpp
+--- libkdcraw-4.10.5/libkdcraw/dcrawsettingswidget.cpp.orig 2018-04-24 11:29:13.968446472 +0200
++++ libkdcraw-4.10.5/libkdcraw/dcrawsettingswidget.cpp 2018-04-24 11:29:53.254558248 +0200
+@@ -1227,6 +1227,7 @@ RawDecodingSettings DcrawSettingsWidget:
+ {
+ prm.NRThreshold = d->NRSpinBox1->value();
+ prm.NRChroThreshold = 0;
++ break;
+ }
+ default: // IMPULSENR
+ {
+diff -up libkdcraw-4.10.5/libraw/src/libraw_cxx.cpp.orig libkdcraw-4.10.5/libraw/src/libraw_cxx.cpp
diff --git a/libkdcraw.spec b/libkdcraw.spec
new file mode 100644
index 0000000..5eb4372
--- /dev/null
+++ b/libkdcraw.spec
@@ -0,0 +1,266 @@
+Name: libkdcraw
+Summary: A C++ interface around LibRaw library
+Version: 4.10.5
+Release: 5%{?dist}
+# libkdcraw is GPLv2+,
+# LibRaw(bundled) is LGPLv2
+# demosaic-pack GPLv2+ GPLv3+ (addons to libraw)
+License: GPLv2+ and LGPLv2 and GPLv3+
+URL: https://projects.kde.org/projects/kde/kdegraphics/libs/libkdcraw
+Source0: https://download.kde.org/Attic/4.10.5/src/%{name}-%{version}.tar.xz
+
+# drop bundled libraw and use the system LibRaw
+Patch1: libkdcraw-4.10.5-use-system-libraw.patch
+
+# fix libjpeg detection for libjpeg-turbo, hopefully upstreamable
+# (the hack to add jpeg_mem_src from RawSpeed to LibRaw might not be though)
+Patch50: libkdcraw-4.10.0-libjpeg-turbo.patch
+
+# upstream patches
+Patch100: libkdcraw-4.10.5-CVE-2013-2126.patch
+
+BuildRequires: kdelibs4-devel
+BuildRequires: libjpeg-turbo-devel
+BuildRequires: pkgconfig(lcms2)
+BuildRequires: pkgconfig(jasper)
+BuildRequires: pkgconfig(libxml-2.0)
+BuildRequires: LibRaw-devel
+
+Requires: kdelibs4%{?_isa} >= %{_kde4_version}
+
+# when split occurred
+Conflicts: kdegraphics-libs < 7:4.6.95-10
+
+%description
+Libkdcraw is a C++ interface around LibRaw library used to decode RAW
+picture files. More information about LibRaw can be found at
+http://www.libraw.org.
+
+%package devel
+Summary: Development files for %{name}
+Requires: %{name}%{?_isa} = %{version}-%{release}
+Requires: kdelibs4-devel
+
+%description devel
+%{summary}.
+
+
+%prep
+%setup -q
+%patch1 -p1 -b .using-system-libraw
+%patch50 -p1 -b .libjpeg-turbo
+
+# upstream patches
+%patch100 -p1 -b .CVE-2013-2126
+
+# drop bundled libraw and use the system LibRaw
+rm -rf libraw
+
+%build
+mkdir -p %{_target_platform}
+pushd %{_target_platform}
+%{cmake_kde4} -DENABLE_LCMS2=ON -DENABLE_RAWSPEED=ON ..
+popd
+
+make %{?_smp_mflags} -C %{_target_platform}
+
+
+%install
+rm -rf %{buildroot}
+
+make install/fast DESTDIR=%{buildroot} -C %{_target_platform}
+
+
+%check
+export PKG_CONFIG_PATH=%{buildroot}%{_datadir}/pkgconfig:%{buildroot}%{_libdir}/pkgconfig
+pkg-config --modversion libkdcraw
+make -C %{_target_platform}/test
+
+
+%post
+/sbin/ldconfig
+touch --no-create %{_kde4_iconsdir}/hicolor &> /dev/null || :
+
+
+%posttrans
+gtk-update-icon-cache %{_kde4_iconsdir}/hicolor &> /dev/null || :
+
+%postun
+/sbin/ldconfig
+if [ $1 -eq 0 ] ; then
+touch --no-create %{_kde4_iconsdir}/hicolor &> /dev/null || :
+gtk-update-icon-cache %{_kde4_iconsdir}/hicolor &> /dev/null || :
+fi
+
+
+%files
+%doc AUTHORS ChangeLog COPYING NEWS README TODO
+%{_kde4_libdir}/libkdcraw.so.22*
+%{_kde4_appsdir}/libkdcraw/
+%{_kde4_iconsdir}/hicolor/*/*/*
+
+%files devel
+%{_kde4_libdir}/libkdcraw.so
+%{_kde4_libdir}/pkgconfig/libkdcraw.pc
+%{_kde4_includedir}/libkdcraw/
+
+
+%changelog
+* Wed Apr 18 2018 Than Ngo <than@redhat.com> - 4.10.5-5
+- Resolves: #1557171, #1557189, #1558954
+ use the system LibRaw
+
+* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 4.10.5-4
+- Mass rebuild 2014-01-24
+
+* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 4.10.5-3
+- Mass rebuild 2013-12-27
+
+* Mon Jul 15 2013 Than Ngo <than@redhat.com> - 4.10.5-2
+- bz#970713, CVE-2013-2126, double-free flaw when handling
+ damaged full-color in Foveon and sRAW files
+
+* Sun Jun 30 2013 Than Ngo <than@redhat.com> - 4.10.5-1
+- 4.10.5
+
+* Sat Jun 01 2013 Rex Dieter <rdieter@fedoraproject.org> - 4.10.4-1
+- 4.10.4
+
+* Mon May 06 2013 Than Ngo <than@redhat.com> - 4.10.3-1
+- 4.10.3
+
+* Sun Mar 31 2013 Rex Dieter <rdieter@fedoraproject.org> - 4.10.2-1
+- 4.10.2
+
+* Sat Mar 09 2013 Kevin Kofler <Kevin@tigcc.ticalc.org> - 4.10.1-1.1
+- make libjpeg support work on Fedora 17
+
+* Sat Mar 02 2013 Rex Dieter <rdieter@fedoraproject.org> - 4.10.1-1
+- 4.10.1
+
+* Fri Feb 08 2013 Rex Dieter <rdieter@fedoraproject.org> 4.10.0-3
+- Requires: libjpeg-turbo >= 1.2.90
+
+* Wed Feb 06 2013 Kevin Kofler <Kevin@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@fedoraproject.org> - 4.10.0-1
+- 4.10.0
+
+* Sat Jan 19 2013 Rex Dieter <rdieter@fedoraproject.org> - 4.9.98-1
+- 4.9.98
+
+* Fri Jan 04 2013 Rex Dieter <rdieter@fedoraproject.org> - 4.9.97-1
+- 4.9.97
+
+* Wed Dec 19 2012 Rex Dieter <rdieter@fedoraproject.org> - 4.9.95-1
+- 4.9.95
+
+* Mon Dec 03 2012 Rex Dieter <rdieter@fedoraproject.org> 4.9.90-1
+- 4.9.90 (4.10 beta2)
+
+* Tue Nov 20 2012 Rex Dieter <rdieter@fedoraproject.org> 4.9.80-1
+- 4.9.80
+
+* Thu Nov 8 2012 Alexey Kurov <nucleo@fedoraproject.org> - 4.9.60-1
+- libkdcraw update from digikam-3.0.0-beta3
+
+* Wed Oct 24 2012 Alexey Kurov <nucleo@fedoraproject.org> - 4.9.50-3
+- rebuild for libjpeg8
+
+* Sat Oct 13 2012 Alexey Kurov <nucleo@fedoraproject.org> - 4.9.50-2
+- BR: pkgconfig(jasper) pkgconfig(libxml-2.0)
+
+* Sat Oct 13 2012 Alexey Kurov <nucleo@fedoraproject.org> - 4.9.50-1
+- libkdcraw update from digikam-3.0.0-beta2
+- enable build against lcms2
+- enable RawSpeed libraw codec
+
+* Fri Sep 28 2012 Rex Dieter <rdieter@fedoraproject.org> - 4.9.2-1
+- 4.9.2
+
+* Mon Sep 03 2012 Than Ngo <than@redhat.com> - 4.9.1-1
+- 4.9.1
+
+* Thu Jul 26 2012 Lukas Tinkl <ltinkl@redhat.com> - 4.9.0-1
+- 4.9.0
+
+* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.8.97-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
+
+* Wed Jul 11 2012 Rex Dieter <rdieter@fedoraproject.org> - 4.8.97-1
+- 4.8.97
+
+* Wed Jun 27 2012 Jaroslav Reznik <jreznik@redhat.com> - 4.8.95-1
+- 4.8.95
+
+* Sat Jun 09 2012 Rex Dieter <rdieter@fedoraproject.org> - 4.8.90-1
+- 4.8.90
+
+* Sat May 26 2012 Jaroslav Reznik <jreznik@redhat.com> - 4.8.80-1
+- 4.8.80
+- bump soname version to 21*
+
+* Mon Apr 30 2012 Jaroslav Reznik <jreznik@redhat.com> - 4.8.3-1
+- 4.8.3
+
+* Fri Mar 30 2012 Jaroslav Reznik <jreznik@redhat.com> - 4.8.2-1
+- 4.8.2
+
+* Mon Mar 05 2012 Jaroslav Reznik <jreznik@redhat.com> - 4.8.1-1
+- 4.8.1
+
+* Tue Feb 28 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.8.0-2
+- Rebuilt for c++ ABI breakage
+
+* Sun Jan 22 2012 Rex Dieter <rdieter@fedoraproject.org> - 4.8.0-1
+- 4.8.0
+
+* Wed Jan 04 2012 Radek Novacek <rnovacek@redhat.com> - 4.7.97-1
+- 4.7.97
+
+* Wed Dec 21 2011 Radek Novacek <rnovacek@redhat.com> - 4.7.95-1
+- 4.7.95
+
+* Sun Dec 04 2011 Rex Dieter <rdieter@fedoraproject.org> - 4.7.90-1
+- 4.7.90
+
+* Fri Nov 25 2011 Jaroslav Reznik <jreznik@redhat.com> 4.7.80-1
+- 4.7.80 (beta 1)
+
+* Sat Oct 29 2011 Rex Dieter <rdieter@fedoraproject.org> 4.7.3-1
+- 4.7.3
+
+* Tue Oct 04 2011 Rex Dieter <rdieter@fedoraproject.org> 4.7.2-1
+- 4.7.2
+
+* Wed Sep 07 2011 Than Ngo <than@redhat.com> - 4.7.1-1
+- 4.7.1
+
+* Tue Jul 26 2011 Jaroslav Reznik <jreznik@redhat.com> 4.7.0-1
+- 4.7.0
+
+* Mon Jul 11 2011 Rex Dieter <rdieter@fedoraproject.org> 4.6.95-1
+- 4.6.95
+
+* Mon Jul 11 2011 Rex Dieter <rdieter@fedoraproject.org> 4.6.90-5
+- License: GPLv2+ and LGPLv2 and GPLv3+
+- Provides: bundled(LibRaw)
+
+* Sun Jul 10 2011 Rex Dieter <rdieter@fedoraproject.org> 4.6.90-4
+- fix URL
+- fix scriptlets
+
+* Sun Jul 10 2011 Rex Dieter <rdieter@fedoraproject.org> 4.6.90-3
+- License: GPLv2+
+- %%doc: +ChangeLog NEWS
+- add %%check section
+
+* Wed Jul 06 2011 Rex Dieter <rdieter@fedoraproject.org> 4.6.90-2
+- fix Source0 URL
+- Conflicts: kdegraphics < 7:4.6.90-10
+
+* Tue Jul 05 2011 Rex Dieter <rdieter@fedoraproject.org> 4.6.90-1
+- first try
+
+