void-packages/srcpkgs/krita/patches/6b6758bb37da4997be36a7e2a83...

281 lines
12 KiB
Diff
Raw Normal View History

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a9cf3e2..c020128 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -592,11 +592,7 @@ set_package_properties(Eigen3 PROPERTIES
##
## Test for exiv2
##
-find_package(Exiv2 0.16 REQUIRED)
-set_package_properties(Exiv2 PROPERTIES
- DESCRIPTION "Image metadata library and tools"
- URL "http://www.exiv2.org"
- PURPOSE "Required by Krita")
+find_package(LibExiv2 0.16 REQUIRED)
##
## Test for lcms
diff --git a/cmake/modules/FindExiv2.cmake b/cmake/modules/FindExiv2.cmake
deleted file mode 100644
index 82cc1c7..0000000
--- a/cmake/modules/FindExiv2.cmake
+++ /dev/null
@@ -1,80 +0,0 @@
-# - Try to find the Exiv2 library
-#
-# EXIV2_MIN_VERSION - You can set this variable to the minimum version you need
-# before doing FIND_PACKAGE(Exiv2). The default is 0.12.
-#
-# Once done this will define
-#
-# EXIV2_FOUND - system has libexiv2
-# EXIV2_INCLUDE_DIR - the libexiv2 include directory
-# EXIV2_LIBRARIES - Link these to use libexiv2
-# EXIV2_DEFINITIONS - Compiler switches required for using libexiv2
-#
-# The minimum required version of Exiv2 can be specified using the
-# standard syntax, e.g. find_package(Exiv2 0.17)
-#
-# For compatibility, also the variable EXIV2_MIN_VERSION can be set to the minimum version
-# you need before doing FIND_PACKAGE(Exiv2). The default is 0.12.
-
-# Copyright (c) 2010, Alexander Neundorf, <neundorf@kde.org>
-# Copyright (c) 2008, Gilles Caulier, <caulier.gilles@gmail.com>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-# Support EXIV2_MIN_VERSION for compatibility:
-if(NOT Exiv2_FIND_VERSION)
- set(Exiv2_FIND_VERSION "${EXIV2_MIN_VERSION}")
-endif(NOT Exiv2_FIND_VERSION)
-
-# the minimum version of exiv2 we require
-if(NOT Exiv2_FIND_VERSION)
- set(Exiv2_FIND_VERSION "0.12")
-endif(NOT Exiv2_FIND_VERSION)
-
-
-if (NOT WIN32)
- # use pkg-config to get the directories and then use these values
- # in the FIND_PATH() and FIND_LIBRARY() calls
- find_package(PkgConfig)
- pkg_check_modules(PC_EXIV2 QUIET exiv2)
- set(EXIV2_DEFINITIONS ${PC_EXIV2_CFLAGS_OTHER})
-endif (NOT WIN32)
-
-
-find_path(EXIV2_INCLUDE_DIR NAMES exiv2/exif.hpp
- HINTS
- ${PC_EXIV2_INCLUDEDIR}
- ${PC_EXIV2_INCLUDE_DIRS}
- )
-
-find_library(EXIV2_LIBRARY NAMES exiv2 libexiv2
- HINTS
- ${PC_EXIV2_LIBDIR}
- ${PC_EXIV2_LIBRARY_DIRS}
- )
-
-
-# Get the version number from exiv2/version.hpp and store it in the cache:
-if(EXIV2_INCLUDE_DIR AND NOT EXIV2_VERSION)
- file(READ ${EXIV2_INCLUDE_DIR}/exiv2/version.hpp EXIV2_VERSION_CONTENT)
- string(REGEX MATCH "#define EXIV2_MAJOR_VERSION +\\( *([0-9]+) *\\)" _dummy "${EXIV2_VERSION_CONTENT}")
- set(EXIV2_VERSION_MAJOR "${CMAKE_MATCH_1}")
-
- string(REGEX MATCH "#define EXIV2_MINOR_VERSION +\\( *([0-9]+) *\\)" _dummy "${EXIV2_VERSION_CONTENT}")
- set(EXIV2_VERSION_MINOR "${CMAKE_MATCH_1}")
-
- string(REGEX MATCH "#define EXIV2_PATCH_VERSION +\\( *([0-9]+) *\\)" _dummy "${EXIV2_VERSION_CONTENT}")
- set(EXIV2_VERSION_PATCH "${CMAKE_MATCH_1}")
-
- set(EXIV2_VERSION "${EXIV2_VERSION_MAJOR}.${EXIV2_VERSION_MINOR}.${EXIV2_VERSION_PATCH}" CACHE STRING "Version number of Exiv2" FORCE)
-endif(EXIV2_INCLUDE_DIR AND NOT EXIV2_VERSION)
-
-set(EXIV2_LIBRARIES "${EXIV2_LIBRARY}")
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Exiv2 REQUIRED_VARS EXIV2_LIBRARY EXIV2_INCLUDE_DIR
- VERSION_VAR EXIV2_VERSION)
-
-mark_as_advanced(EXIV2_INCLUDE_DIR EXIV2_LIBRARY)
-
diff --git a/libs/ui/CMakeLists.txt b/libs/ui/CMakeLists.txt
index 2909398..28822c6 100644
--- a/libs/ui/CMakeLists.txt
+++ b/libs/ui/CMakeLists.txt
@@ -1,6 +1,5 @@
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/qtlockedfile
- ${EXIV2_INCLUDE_DIR}
)
include_directories(SYSTEM
@@ -536,7 +535,7 @@ add_library(kritaui SHARED ${kritaui_HEADERS_MOC} ${kritaui_LIB_SRCS} )
generate_export_header(kritaui BASE_NAME kritaui)
target_link_libraries(kritaui KF5::CoreAddons KF5::Completion KF5::I18n KF5::ItemViews Qt5::Network
- kritaimpex kritacolor kritaimage kritalibbrush kritawidgets kritawidgetutils ${PNG_LIBRARIES} ${EXIV2_LIBRARIES}
+ kritaimpex kritacolor kritaimage kritalibbrush kritawidgets kritawidgetutils ${PNG_LIBRARIES} LibExiv2::LibExiv2
)
if (HAVE_QT_MULTIMEDIA)
diff --git a/libs/ui/kisexiv2/kis_exif_io.cpp b/libs/ui/kisexiv2/kis_exif_io.cpp
index 5bce172..d1e8511 100644
--- a/libs/ui/kisexiv2/kis_exif_io.cpp
+++ b/libs/ui/kisexiv2/kis_exif_io.cpp
@@ -438,11 +438,10 @@ bool KisExifIO::saveTo(KisMetaData::Store* store, QIODevice* ioDevice, HeaderTyp
if (entry.value().asArray().size() > 0) {
creator = entry.value().asArray()[0];
}
-#if EXIV2_MAJOR_VERSION == 0 && EXIV2_MINOR_VERSION <= 20
+#if !EXIV2_TEST_VERSION(0,21,0)
v = kmdValueToExivValue(creator, Exiv2::ExifTags::tagType(exifKey.tag(), exifKey.ifdId()));
#else
v = kmdValueToExivValue(creator, exifKey.defaultTypeId());
-
#endif
} else if (exivKey == "Exif.Photo.OECF") {
v = kmdOECFStructureToExifOECF(entry.value());
@@ -456,13 +455,13 @@ bool KisExifIO::saveTo(KisMetaData::Store* store, QIODevice* ioDevice, HeaderTyp
Q_ASSERT(entry.value().type() == KisMetaData::Value::LangArray);
QMap<QString, KisMetaData::Value> langArr = entry.value().asLangArray();
if (langArr.contains("x-default")) {
-#if EXIV2_MAJOR_VERSION == 0 && EXIV2_MINOR_VERSION <= 20
+#if !EXIV2_TEST_VERSION(0,21,0)
v = kmdValueToExivValue(langArr.value("x-default"), Exiv2::ExifTags::tagType(exifKey.tag(), exifKey.ifdId()));
#else
v = kmdValueToExivValue(langArr.value("x-default"), exifKey.defaultTypeId());
#endif
} else if (langArr.size() > 0) {
-#if EXIV2_MAJOR_VERSION == 0 && EXIV2_MINOR_VERSION <= 20
+#if !EXIV2_TEST_VERSION(0,21,0)
v = kmdValueToExivValue(langArr.begin().value(), Exiv2::ExifTags::tagType(exifKey.tag(), exifKey.ifdId()));
#else
v = kmdValueToExivValue(langArr.begin().value(), exifKey.defaultTypeId());
@@ -470,7 +469,7 @@ bool KisExifIO::saveTo(KisMetaData::Store* store, QIODevice* ioDevice, HeaderTyp
}
} else {
dbgMetaData << exifKey.tag();
-#if EXIV2_MAJOR_VERSION == 0 && EXIV2_MINOR_VERSION <= 20
+#if !EXIV2_TEST_VERSION(0,21,0)
v = kmdValueToExivValue(entry.value(), Exiv2::ExifTags::tagType(exifKey.tag(), exifKey.ifdId()));
#else
v = kmdValueToExivValue(entry.value(), exifKey.defaultTypeId());
@@ -487,7 +486,7 @@ bool KisExifIO::saveTo(KisMetaData::Store* store, QIODevice* ioDevice, HeaderTyp
dbgMetaData << "exiv error " << e.what();
}
}
-#if EXIV2_MAJOR_VERSION == 0 && EXIV2_MINOR_VERSION <= 17
+#if !EXIV2_TEST_VERSION(0,18,0)
Exiv2::DataBuf rawData = exifData.copy();
ioDevice->write((const char*) rawData.pData_, rawData.size_);
#else
@@ -514,7 +513,7 @@ bool KisExifIO::loadFrom(KisMetaData::Store* store, QIODevice* ioDevice) const
QByteArray arr = ioDevice->readAll();
Exiv2::ExifData exifData;
Exiv2::ByteOrder byteOrder;
-#if EXIV2_MAJOR_VERSION == 0 && EXIV2_MINOR_VERSION <= 17
+#if !EXIV2_TEST_VERSION(0,18,0)
exifData.load((const Exiv2::byte*)arr.data(), arr.size());
byteOrder = exifData.byteOrder();
#else
@@ -529,7 +528,6 @@ bool KisExifIO::loadFrom(KisMetaData::Store* store, QIODevice* ioDevice) const
dbgKrita << "Received unknown exception trying to parse exiv data";
return false;
}
-
#endif
dbgMetaData << "Byte order = " << byteOrder << ppVar(Exiv2::bigEndian) << ppVar(Exiv2::littleEndian);
dbgMetaData << "There are" << exifData.count() << " entries in the exif section";
diff --git a/libs/ui/kisexiv2/kis_exiv2.h b/libs/ui/kisexiv2/kis_exiv2.h
index 070f0cb..645876d 100644
--- a/libs/ui/kisexiv2/kis_exiv2.h
+++ b/libs/ui/kisexiv2/kis_exiv2.h
@@ -21,7 +21,7 @@
#include <metadata/kis_meta_data_value.h>
-#include <exiv2/value.hpp>
+#include <exiv2/exiv2.hpp>
#include "kritaui_export.h"
/// Convert an exiv value to a KisMetaData value
diff --git a/libs/ui/kisexiv2/kis_iptc_io.cpp b/libs/ui/kisexiv2/kis_iptc_io.cpp
index dbed46b..a6a4786 100644
--- a/libs/ui/kisexiv2/kis_iptc_io.cpp
+++ b/libs/ui/kisexiv2/kis_iptc_io.cpp
@@ -126,7 +126,7 @@ bool KisIptcIO::saveTo(KisMetaData::Store* store, QIODevice* ioDevice, HeaderTyp
}
}
}
-#if EXIV2_MAJOR_VERSION == 0 && EXIV2_MINOR_VERSION <= 17
+#if !EXIV2_TEST_VERSION(0,18,0)
Exiv2::DataBuf rawData = iptcData.copy();
#else
Exiv2::DataBuf rawData = Exiv2::IptcParser::encode(iptcData);
@@ -167,7 +167,7 @@ bool KisIptcIO::loadFrom(KisMetaData::Store* store, QIODevice* ioDevice) const
ioDevice->open(QIODevice::ReadOnly);
QByteArray arr = ioDevice->readAll();
Exiv2::IptcData iptcData;
-#if EXIV2_MAJOR_VERSION == 0 && EXIV2_MINOR_VERSION <= 17
+#if !EXIV2_TEST_VERSION(0,18,0)
iptcData.load((const Exiv2::byte*)arr.data(), arr.size());
#else
Exiv2::IptcParser::decode(iptcData, (const Exiv2::byte*)arr.data(), arr.size());
diff --git a/libs/ui/kisexiv2/kis_xmp_io.cpp b/libs/ui/kisexiv2/kis_xmp_io.cpp
index 8fe0afc..c0cfae9 100644
--- a/libs/ui/kisexiv2/kis_xmp_io.cpp
+++ b/libs/ui/kisexiv2/kis_xmp_io.cpp
@@ -17,7 +17,6 @@
#include "kis_xmp_io.h"
#include <string>
-#include <exiv2/xmp.hpp>
#include "kis_exiv2.h"
@@ -277,9 +276,8 @@ bool KisXMPIO::loadFrom(KisMetaData::Store* store, QIODevice* ioDevice) const
const Exiv2::XmpArrayValue* xav = dynamic_cast<const Exiv2::XmpArrayValue*>(value.get());
Q_ASSERT(xav);
QList<KisMetaData::Value> array;
- for (std::vector< std::string >::const_iterator it = xav->value_.begin();
- it != xav->value_.end(); ++it) {
- QString value = it->c_str();
+ for (int i = 0; i < xav->size(); ++i) {
+ QString value = QString::fromStdString(xav->toString(i));
if (parser) {
array.push_back(parser->parse(value));
} else {
diff --git a/plugins/impex/jpeg/CMakeLists.txt b/plugins/impex/jpeg/CMakeLists.txt
index 347e46d..50edb05 100644
--- a/plugins/impex/jpeg/CMakeLists.txt
+++ b/plugins/impex/jpeg/CMakeLists.txt
@@ -4,7 +4,6 @@ set(ICCJPEG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/lcms")
include_directories(
${ICCJPEG_SOURCE_DIR}
- ${EXIV2_INCLUDE_DIR}
)
include_directories(SYSTEM
@@ -25,7 +24,7 @@ set(kritajpegimport_SOURCES
add_library(kritajpegimport MODULE ${kritajpegimport_SOURCES})
-target_link_libraries(kritajpegimport kritaui ${JPEG_LIBRARIES} ${LCMS2_LIBRARIES} ${EXIV2_LIBRARIES} )
+target_link_libraries(kritajpegimport kritaui ${JPEG_LIBRARIES} ${LCMS2_LIBRARIES} LibExiv2::LibExiv2 )
install(TARGETS kritajpegimport DESTINATION ${KRITA_PLUGIN_INSTALL_DIR})
@@ -38,7 +37,7 @@ ki18n_wrap_ui(kritajpegexport_SOURCES kis_wdg_options_jpeg.ui )
add_library(kritajpegexport MODULE ${kritajpegexport_SOURCES})
-target_link_libraries(kritajpegexport kritaui kritaimpex ${JPEG_LIBRARIES} ${LCMS2_LIBRARIES} ${EXIV2_LIBRARIES} )
+target_link_libraries(kritajpegexport kritaui kritaimpex ${JPEG_LIBRARIES} ${LCMS2_LIBRARIES} LibExiv2::LibExiv2 )
install(TARGETS kritajpegexport DESTINATION ${KRITA_PLUGIN_INSTALL_DIR})
install( PROGRAMS krita_jpeg.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})