#4 Backport patch to add proper QuaZip 1.x support
Opened 2 years ago by omos. Modified 2 years ago
rpms/ omos/nomacs quazip1-support  into  rawhide

@@ -0,0 +1,127 @@ 

+ From b4a1e98a83598072ea6d720ae4d56d380bee5a75 Mon Sep 17 00:00:00 2001

+ From: Petr Vanek <petr@yarpen.cz>

+ Date: Sun, 15 Nov 2020 19:15:59 +0100

+ Subject: [PATCH] fixed #569 Build fails with quazip 1.0 (#576)

+ 

+ ---

+  ImageLounge/cmake/Unix.cmake                | 28 +++++++++++++++------

+  ImageLounge/src/DkCore/DkBasicLoader.cpp    |  4 +++

+  ImageLounge/src/DkCore/DkImageContainer.cpp |  4 +++

+  ImageLounge/src/DkCore/DkImageLoader.cpp    |  6 ++++-

+  ImageLounge/src/DkGui/DkDialog.cpp          |  4 +++

+  5 files changed, 37 insertions(+), 9 deletions(-)

+ 

+ diff --git a/ImageLounge/cmake/Unix.cmake b/ImageLounge/cmake/Unix.cmake

+ index 5567084b..c90ba320 100644

+ --- a/ImageLounge/cmake/Unix.cmake

+ +++ b/ImageLounge/cmake/Unix.cmake

+ @@ -102,14 +102,26 @@ unset(QT_ROOT CACHE)

+  

+  if(ENABLE_QUAZIP)

+    if(USE_SYSTEM_QUAZIP)

+ -    SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

+ -

+ -    find_package(QuaZip5 QUIET)

+ -    if(NOT QUAZIP_FOUND)

+ -	    message(FATAL_ERROR "QUAZIP not found. It's mandatory when used with ENABLE_QUAZIP enabled, you can also disable USE_SYSTEM_QUAZIP")

+ -    else()

+ -	    add_definitions(-DWITH_QUAZIP)

+ -    endif()

+ +    # Let's try QuaZip1 first (it's the bright future)

+ +    find_package(QuaZip-Qt5 QUIET)

+ +    if (QuaZip-Qt5_FOUND)

+ +      message(STATUS "QUAZIP: QuaZip-1 for Qt5 found")

+ +      set(QUAZIP_LIBRARIES QuaZip::QuaZip)

+ +      add_definitions(-DWITH_QUAZIP1)

+ +    else ()

+ +      message(WARNING "QUAZIP: 1.x not found. Trying to find 0.x")

+ +      # QuaZip < 1.0. This leg can be removed (including cmake/FindQuaZip5.cmake)

+ +      # ater the final migration to 1.x in Linux distros

+ +      SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

+ +

+ +      find_package(QuaZip5 QUIET)

+ +      if(NOT QUAZIP_FOUND)

+ +        message(FATAL_ERROR "QUAZIP: even 0.x not found. It's mandatory when used with ENABLE_QUAZIP enabled, you can also disable USE_SYSTEM_QUAZIP")

+ +      endif()

+ +

+ +    endif (QuaZip-Qt5_FOUND)

+ +    # we have any QuaZip after all

+ +    add_definitions(-DWITH_QUAZIP)

+    else()

+      find_package(ZLIB REQUIRED)

+      set(QUAZIP_INCLUDE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/quazip-0.7/quazip ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/quazip-0.7/)

+ diff --git a/ImageLounge/src/DkCore/DkBasicLoader.cpp b/ImageLounge/src/DkCore/DkBasicLoader.cpp

+ index 7f9e889c..b7edfd43 100644

+ --- a/ImageLounge/src/DkCore/DkBasicLoader.cpp

+ +++ b/ImageLounge/src/DkCore/DkBasicLoader.cpp

+ @@ -54,8 +54,12 @@

+  

+  // quazip

+  #ifdef WITH_QUAZIP

+ +#ifdef WITH_QUAZIP1

+ +#include <quazip/JlCompress.h>

+ +#else

+  #include <quazip5/JlCompress.h>

+  #endif

+ +#endif

+  

+  // opencv

+  #ifdef WITH_OPENCV

+ diff --git a/ImageLounge/src/DkCore/DkImageContainer.cpp b/ImageLounge/src/DkCore/DkImageContainer.cpp

+ index 810994d3..150da9c2 100644

+ --- a/ImageLounge/src/DkCore/DkImageContainer.cpp

+ +++ b/ImageLounge/src/DkCore/DkImageContainer.cpp

+ @@ -41,8 +41,12 @@

+  

+  // quazip

+  #ifdef WITH_QUAZIP

+ +#ifdef WITH_QUAZIP1

+ +#include <quazip/JlCompress.h>

+ +#else

+  #include <quazip5/JlCompress.h>

+  #endif

+ +#endif

+  #pragma warning(pop)		// no warnings from includes - end

+  

+  #pragma warning(disable: 4251)	// TODO: remove

+ diff --git a/ImageLounge/src/DkCore/DkImageLoader.cpp b/ImageLounge/src/DkCore/DkImageLoader.cpp

+ index 09d25d23..e4186f2b 100644

+ --- a/ImageLounge/src/DkCore/DkImageLoader.cpp

+ +++ b/ImageLounge/src/DkCore/DkImageLoader.cpp

+ @@ -79,8 +79,12 @@

+  

+  // quazip

+  #ifdef WITH_QUAZIP

+ +#ifdef WITH_QUAZIP1

+ +#include <quazip/JlCompress.h>

+ +#else

+  #include <quazip5/JlCompress.h>

+  #endif

+ +#endif

+  

+  // opencv

+  #ifdef WITH_OPENCV

+ @@ -2212,4 +2216,4 @@ QString DkImageLoader::fileName() const {

+  	return mCurrentImage->fileName();

+  }

+  

+ -}

+ \ No newline at end of file

+ +}

+ diff --git a/ImageLounge/src/DkGui/DkDialog.cpp b/ImageLounge/src/DkGui/DkDialog.cpp

+ index 008c9a3b..85842eca 100644

+ --- a/ImageLounge/src/DkGui/DkDialog.cpp

+ +++ b/ImageLounge/src/DkGui/DkDialog.cpp

+ @@ -97,8 +97,12 @@

+  

+  // quazip

+  #ifdef WITH_QUAZIP

+ +#ifdef WITH_QUAZIP1

+ +#include <quazip/JlCompress.h>

+ +#else

+  #include <quazip5/JlCompress.h>

+  #endif

+ +#endif

+  

+  #pragma warning(pop)		// no warnings from includes - end

+  

file modified
+11 -4
@@ -5,17 +5,20 @@ 

  Name:		nomacs

  Summary:	Lightweight image viewer

  Version:	3.16

- Release:	5%{?dist}

+ Release:	6%{?dist}

  License:	GPLv3+ and CC-BY

  Url:		http://nomacs.org

- Source0:	https://github.com/%{github_owner}/%{name}/archive/%{version}.%{build}.tar.gz/%{name}-%{version}.%{git_build}.tar.gz

- Source1:	https://github.com/%{github_owner}/%{name}-plugins/archive/%{version}.tar.gz/%{name}-plugins-%{version}.tar.gz

+ Source0:	https://github.com/%{github_owner}/%{name}/archive/refs/tags/%{version}.%{git_build}.tar.gz#/%{name}-%{version}.%{git_build}.tar.gz

+ Source1:	https://github.com/%{github_owner}/%{name}-plugins/archive/refs/tags/%{version}.tar.gz#/%{name}-plugins-%{version}.tar.gz

  # desktop entries rename (https://github.com/nomacs/nomacs/issues/528)

  Patch0:		%{name}-%{version}.%{git_build}-desktop.diff

  # plugins search path (https://github.com/nomacs/nomacs/issues/531)

  Patch1:		%{name}-%{version}.%{git_build}-pluginspath.diff

  # plugins install path (https://github.com/nomacs/nomacs-plugins/issues/34)

  Patch2:		%{name}-plugins-%{version}-instpath.diff

+ 

+ Patch3:		https://github.com/%{github_owner}/%{name}/commit/b4a1e98a83598072ea6d720ae4d56d380bee5a75.patch#/%{name}-%{version}.%{git_build}-quazip1.patch

+ 

  BuildRequires:	gcc-c++

  BuildRequires:	cmake

  BuildRequires:	desktop-file-utils
@@ -34,7 +37,7 @@ 

  # libwebp-devel >= 0.3.1

  BuildRequires:	pkgconfig(libwebp)

  # quazip-qt5-devel >= 0.7

- BuildRequires:	quazip-qt5-devel

+ BuildRequires:	cmake(QuaZip-Qt5)

  # libheif-devel (rpmfusion-free)

  # BuildRequires:	pkgconfig(libheif)

  BuildRequires:	lcov
@@ -64,6 +67,7 @@ 

  %setup -n %{name}-%{version}.%{git_build}

  %patch0

  %patch1

+ %patch3 -p1

  %setup -T -D -a 1 -n %{name}-%{version}.%{git_build}

  # plug them in

  mv nomacs-plugins-%{version}/* ImageLounge/plugins/
@@ -116,6 +120,9 @@ 

  

  

  %changelog

+ * Sat Aug 21 2021 Ondrej Mosnacek <omosnace@redhat.com> - 3.16-6

+ - Backport patch to add proper QuaZip 1.x support

+ 

  * Thu Aug 19 2021 Björn Esser <besser82@fedoraproject.org> - 3.16-5

  - Rebuild (quazip)

  

This patch is needed for the build to find QuaZip in the new 1.x
locations. This is one of the steps needed to remove backwards
compatibility hacks from the quazip Fedora package.

While there also fix source URLs so that spectool -g can be used to
download them automatically.