Blame SOURCES/libkdcraw-4.10.5-use-system-libraw.patch

951c22
diff -up libkdcraw-4.10.5/CMakeLists.txt.using-system-libraw libkdcraw-4.10.5/CMakeLists.txt
951c22
--- libkdcraw-4.10.5/CMakeLists.txt.using-system-libraw	2013-06-28 19:36:41.947766793 +0200
951c22
+++ libkdcraw-4.10.5/CMakeLists.txt	2018-04-18 17:06:45.478621145 +0200
951c22
@@ -29,15 +29,22 @@ SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SO
951c22
 MESSAGE(STATUS "----------------------------------------------------------------------------------")
951c22
 MESSAGE(STATUS "Starting CMake configuration for: libkdcraw")
951c22
 
951c22
-OPTION(ENABLE_LCMS2    "Link libraw to LCMS2 else LCMS1 (default=OFF)"    OFF)
951c22
-OPTION(ENABLE_RAWSPEED "Compile libraw with RawSpeed codec (default=OFF)" OFF)
951c22
-
951c22
 FIND_PACKAGE(KDE4 REQUIRED)
951c22
 INCLUDE(KDE4Defaults)
951c22
 INCLUDE(MacroLibrary)
951c22
 INCLUDE(MacroOptionalAddSubdirectory)
951c22
 INCLUDE(FindPackageHandleStandardArgs)
951c22
 
951c22
+FIND_PACKAGE(LibRaw 0.14 REQUIRED)
951c22
+
951c22
+#Check LibRaw Major and Minor version to rules compilation.
951c22
+MACRO_ENSURE_VERSION("0.16.0" "${LibRaw_VERSION_STRING}" VERSION_LIBRAW_WITH_CMAKE_SUPPORT)
951c22
+MESSAGE(STATUS "LibRaw version: ${LibRaw_VERSION_STRING} - has config file: ${VERSION_LIBRAW_WITH_CMAKE_SUPPORT}")
951c22
+
951c22
+IF(VERSION_LIBRAW_WITH_CMAKE_SUPPORT)
951c22
+    ADD_DEFINITIONS(-DLIBRAW_HAS_CONFIG)
951c22
+ENDIF()
951c22
+
951c22
 ADD_DEFINITIONS (${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS} ${KDE4_DEFINITIONS})
951c22
 INCLUDE_DIRECTORIES (${QDBUS_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
951c22
 
951c22
@@ -106,7 +113,6 @@ ENDIF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C
951c22
 
951c22
 # ==================================================================================================
951c22
 
951c22
-ADD_SUBDIRECTORY(libraw)
951c22
 ADD_SUBDIRECTORY(libkdcraw)
951c22
 ADD_SUBDIRECTORY(test)
951c22
 ADD_SUBDIRECTORY(icons)
951c22
diff -up libkdcraw-4.10.5/cmake/modules/FindLibRaw.cmake.using-system-libraw libkdcraw-4.10.5/cmake/modules/FindLibRaw.cmake
951c22
--- libkdcraw-4.10.5/cmake/modules/FindLibRaw.cmake.using-system-libraw	2018-04-18 16:57:12.966314267 +0200
951c22
+++ libkdcraw-4.10.5/cmake/modules/FindLibRaw.cmake	2018-04-18 17:08:34.597629174 +0200
951c22
@@ -0,0 +1,79 @@
951c22
+# - Find LibRaw
951c22
+# Find the LibRaw library <http://www.libraw.org>
951c22
+# This module defines
951c22
+#  LibRaw_VERSION_STRING, the version string of LibRaw
951c22
+#  LibRaw_INCLUDE_DIR, where to find libraw.h
951c22
+#  LibRaw_LIBRARIES, the libraries needed to use LibRaw (non-thread-safe)
951c22
+#  LibRaw_r_LIBRARIES, the libraries needed to use LibRaw (thread-safe)
951c22
+#  LibRaw_DEFINITIONS, the definitions needed to use LibRaw (non-thread-safe)
951c22
+#  LibRaw_r_DEFINITIONS, the definitions needed to use LibRaw (thread-safe)
951c22
+#
951c22
+# Copyright (c) 2013, Pino Toscano <pino at kde dot org>
951c22
+# Copyright (c) 2013, Gilles Caulier <caulier dot gilles at gmail dot com>
951c22
+#
951c22
+# Redistribution and use is allowed according to the terms of the BSD license.
951c22
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
951c22
+
951c22
+FIND_PACKAGE(PkgConfig)
951c22
+
951c22
+IF(PKG_CONFIG_FOUND)
951c22
+   PKG_CHECK_MODULES(PC_LIBRAW libraw)
951c22
+   SET(LibRaw_DEFINITIONS ${PC_LIBRAW_CFLAGS_OTHER})
951c22
+
951c22
+   PKG_CHECK_MODULES(PC_LIBRAW_R libraw_r)
951c22
+   SET(LibRaw_r_DEFINITIONS ${PC_LIBRAW_R_CFLAGS_OTHER})   
951c22
+ENDIF()
951c22
+
951c22
+FIND_PATH(LibRaw_INCLUDE_DIR libraw.h
951c22
+          HINTS
951c22
+          ${PC_LIBRAW_INCLUDEDIR}
951c22
+          ${PC_LibRaw_INCLUDE_DIRS}
951c22
+          PATH_SUFFIXES libraw
951c22
+         )
951c22
+
951c22
+FIND_LIBRARY(LibRaw_LIBRARIES NAMES raw
951c22
+             HINTS
951c22
+             ${PC_LIBRAW_LIBDIR}
951c22
+             ${PC_LIBRAW_LIBRARY_DIRS}
951c22
+            )
951c22
+
951c22
+FIND_LIBRARY(LibRaw_r_LIBRARIES NAMES raw_r
951c22
+             HINTS
951c22
+             ${PC_LIBRAW_R_LIBDIR}
951c22
+             ${PC_LIBRAW_R_LIBRARY_DIRS}
951c22
+            )
951c22
+
951c22
+IF(LibRaw_INCLUDE_DIR)
951c22
+   FILE(READ ${LibRaw_INCLUDE_DIR}/libraw_version.h _libraw_version_content)
951c22
+   
951c22
+   STRING(REGEX MATCH "#define LIBRAW_MAJOR_VERSION[ \t]*([0-9]*)\n" _version_major_match ${_libraw_version_content})
951c22
+   SET(_libraw_version_major "${CMAKE_MATCH_1}")
951c22
+   
951c22
+   STRING(REGEX MATCH "#define LIBRAW_MINOR_VERSION[ \t]*([0-9]*)\n" _version_minor_match ${_libraw_version_content})
951c22
+   SET(_libraw_version_minor "${CMAKE_MATCH_1}")
951c22
+   
951c22
+   STRING(REGEX MATCH "#define LIBRAW_PATCH_VERSION[ \t]*([0-9]*)\n" _version_patch_match ${_libraw_version_content})
951c22
+   SET(_libraw_version_patch "${CMAKE_MATCH_1}")
951c22
+   
951c22
+   IF(_version_major_match AND _version_minor_match AND _version_patch_match)
951c22
+      SET(LibRaw_VERSION_STRING "${_libraw_version_major}.${_libraw_version_minor}.${_libraw_version_patch}")
951c22
+   ELSE()
951c22
+      IF(NOT LibRaw_FIND_QUIETLY)
951c22
+         MESSAGE(STATUS "Failed to get version information from ${LibRaw_INCLUDE_DIR}/libraw_version.h")
951c22
+      ENDIF()
951c22
+   ENDIF()
951c22
+ENDIF()
951c22
+
951c22
+INCLUDE(FindPackageHandleStandardArgs)
951c22
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibRaw
951c22
+                                  REQUIRED_VARS LibRaw_LIBRARIES LibRaw_INCLUDE_DIR
951c22
+                                  VERSION_VAR LibRaw_VERSION_STRING
951c22
+                                 )
951c22
+
951c22
+MARK_AS_ADVANCED(LibRaw_VERSION_STRING
951c22
+                 LibRaw_INCLUDE_DIR
951c22
+                 LibRaw_LIBRARIES
951c22
+                 LibRaw_r_LIBRARIES
951c22
+                 LibRaw_DEFINITIONS
951c22
+                 LibRaw_r_DEFINITIONS
951c22
+                 )
951c22
diff -up libkdcraw-4.10.5/libkdcraw/CMakeLists.txt.using-system-libraw libkdcraw-4.10.5/libkdcraw/CMakeLists.txt
951c22
--- libkdcraw-4.10.5/libkdcraw/CMakeLists.txt.using-system-libraw	2013-06-28 19:36:41.947766793 +0200
951c22
+++ libkdcraw-4.10.5/libkdcraw/CMakeLists.txt	2018-04-18 17:04:31.919279255 +0200
951c22
@@ -22,7 +22,27 @@
951c22
 #
951c22
 # ============================================================
951c22
 
951c22
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libraw)
951c22
+# In some versions LibRaw is not linked against OpenMP stuff,
951c22
+# so manually link libkdcraw against it for now.
951c22
+
951c22
+IF(NOT APPLE)
951c22
+    # OpenMP library detection (requires CMake >= 2.6.3)
951c22
+    # NOTE: OpenMP under MacOSX do not support multithreading.
951c22
+
951c22
+    MACRO_OPTIONAL_FIND_PACKAGE(OpenMP)
951c22
+
951c22
+    IF(OPENMP_FOUND)
951c22
+        SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
951c22
+        IF("${OpenMP_CXX_FLAGS}" STREQUAL "-fopenmp")
951c22
+            SET(OPENMP_LDFLAGS "-lgomp")
951c22
+        ENDIF("${OpenMP_CXX_FLAGS}" STREQUAL "-fopenmp")
951c22
+        IF("${OpenMP_CXX_FLAGS}" STREQUAL "-xopenmp")
951c22
+            SET(OPENMP_LDFLAGS "-xopenmp")
951c22
+        ENDIF("${OpenMP_CXX_FLAGS}" STREQUAL "-xopenmp")
951c22
+    ENDIF(OPENMP_FOUND)
951c22
+ENDIF(NOT APPLE)
951c22
+
951c22
+INCLUDE_DIRECTORIES(${LibRaw_INCLUDE_DIR})
951c22
 
951c22
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.h)
951c22
 
951c22
@@ -42,15 +62,15 @@ SET(kdcraw_LIB_SRCS kdcraw.cpp
951c22
 KDE4_ADD_LIBRARY(kdcraw SHARED ${kdcraw_LIB_SRCS})
951c22
 
951c22
 TARGET_LINK_LIBRARIES(kdcraw
951c22
-                      libraw
951c22
+                      ${LibRaw_LIBRARIES}
951c22
                       ${KDE4_KDEUI_LIBS}
951c22
                       ${KDE4_KIO_LIBS}
951c22
                       ${KDE4_SOLID_LIBS}
951c22
                       ${KDE4_THREADWEAVER_LIBRARIES}
951c22
+                      ${OPENMP_LDFLAGS}
951c22
                      )
951c22
 
951c22
-SET_TARGET_PROPERTIES(kdcraw PROPERTIES VERSION ${DCRAW_LIB_SO_VERSION_STRING} SOVERSION ${DCRAW_LIB_SO_CUR_VERSION}
951c22
-                                        DEFINE_SYMBOL LIBRAW_BUILDLIB)
951c22
+SET_TARGET_PROPERTIES(kdcraw PROPERTIES VERSION ${DCRAW_LIB_SO_VERSION_STRING} SOVERSION ${DCRAW_LIB_SO_CUR_VERSION})
951c22
 
951c22
 INSTALL(TARGETS kdcraw ${INSTALL_TARGETS_DEFAULT_ARGS})
951c22
 
951c22
diff -up libkdcraw-4.10.5/libkdcraw/libkdcraw_export.h.using-system-libraw libkdcraw-4.10.5/libkdcraw/libkdcraw_export.h
951c22
--- libkdcraw-4.10.5/libkdcraw/libkdcraw_export.h.using-system-libraw	2013-06-28 19:36:41.915766633 +0200
951c22
+++ libkdcraw-4.10.5/libkdcraw/libkdcraw_export.h	2018-04-18 16:57:12.967314240 +0200
951c22
@@ -31,7 +31,7 @@
951c22
 #include <kdemacros.h>
951c22
 
951c22
 #ifndef LIBKDCRAW_EXPORT
951c22
-# if defined(LIBRAW_BUILDLIB)
951c22
+# if defined(MAKE_KDCRAW_LIB)
951c22
    /* We are building this library */ 
951c22
 #  define LIBKDCRAW_EXPORT KDE_EXPORT
951c22
 # else
951c22
diff -up libkdcraw-4.10.5/libkdcraw/dcrawsettingswidget.cpp.orig libkdcraw-4.10.5/libkdcraw/dcrawsettingswidget.cpp
951c22
--- libkdcraw-4.10.5/libkdcraw/dcrawsettingswidget.cpp.orig	2018-04-24 11:29:13.968446472 +0200
951c22
+++ libkdcraw-4.10.5/libkdcraw/dcrawsettingswidget.cpp	2018-04-24 11:29:53.254558248 +0200
951c22
@@ -1227,6 +1227,7 @@ RawDecodingSettings DcrawSettingsWidget:
951c22
         {
951c22
             prm.NRThreshold     = d->NRSpinBox1->value();
951c22
             prm.NRChroThreshold = 0;
951c22
+            break;
951c22
         }
951c22
         default:    // IMPULSENR
951c22
         {
951c22
diff -up libkdcraw-4.10.5/libraw/src/libraw_cxx.cpp.orig libkdcraw-4.10.5/libraw/src/libraw_cxx.cpp