File chessx-use_system_quazip.patch of Package chessx

Index: chessx-1.5.6-lw/CMakeLists.txt
===================================================================
--- chessx-1.5.6-lw.orig/CMakeLists.txt
+++ chessx-1.5.6-lw/CMakeLists.txt
@@ -15,6 +15,7 @@ option(ENABLE_SCID_SUPPORT "Enable suppo
 if(UNIX AND NOT APPLE)
   set(LINUX TRUE)
   include(GNUInstallDirs)
+  include(FindPkgConfig)
 endif()
 
 add_subdirectory(dep)
@@ -45,6 +46,13 @@ find_package(Qt5 REQUIRED
   Test
 ) 
 
+if(LINUX)
+  pkg_search_module(QUAZIP quazip1-qt5 quazip)
+  if(QUAZIP_FOUND)
+    pkg_check_modules(ZLIB REQUIRED zlib)
+  endif()
+endif()
+
 # TODO: enable warnings
 # CONFIG += warn_on
 
@@ -110,13 +118,19 @@ add_executable(chessx WIN32
 
 target_link_libraries(chessx PRIVATE
   qt_config
-  quazip
   bitboard
   board
   eco
   gui
 )
 
+if(NOT QUAZIP_FOUND)
+  target_link_libraries(chessx PRIVATE quazip)
+else()
+  target_link_libraries(chessx PRIVATE ${QUAZIP_LIBRARIES})
+endif()
+
+
 if (CMAKE_HOST_APPLE)
   # Make macOS bundle instead of bare executable
   set_target_properties(chessx PROPERTIES
Index: chessx-1.5.6-lw/src/CMakeLists.txt
===================================================================
--- chessx-1.5.6-lw.orig/src/CMakeLists.txt
+++ chessx-1.5.6-lw/src/CMakeLists.txt
@@ -1,4 +1,6 @@
-add_subdirectory(quazip)
+if(NOT QUAZIP_FOUND)
+  add_subdirectory(quazip)
+endif()
 
 add_library(bitboard STATIC
   database/bitboard.cpp
@@ -433,11 +435,17 @@ target_include_directories(gui
     gui
 )
 
+if(QUAZIP_FOUND)
+  target_include_directories(gui
+  PUBLIC
+    ${QUAZIP_INCLUDE_DIRS}
+  )
+endif()
+
 target_link_libraries(gui
   PRIVATE
     qt_config
     eco
-    quazip
     Qt5::PrintSupport
     Qt5::Svg
   PUBLIC
@@ -446,6 +454,12 @@ target_link_libraries(gui
     Qt5::Xml
 )
 
+if(NOT QUAZIP_FOUND)
+  target_link_libraries(gui PRIVATE quazip)
+else()
+  target_link_libraries(gui PRIVATE ${QUAZIP_LIBRARIES} ${ZLIB_LIBRARIES})
+endif()
+
 if (ENABLE_SOUNDS)
   target_compile_definitions(gui
     PRIVATE
openSUSE Build Service is sponsored by