From 04d5af777d42d02d0ec580373f7a50be1bfb3dac Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Mon, 10 Mar 2025 08:38:47 +0100
Subject: Add libzip as dependency.

---
 configure.ac    | 15 +++++++++++++++
 src/core/logs.h |  9 +++++++++
 2 files changed, 24 insertions(+)

diff --git a/configure.ac b/configure.ac
index 300c970..5acf436 100644
--- a/configure.ac
+++ b/configure.ac
@@ -623,6 +623,20 @@ if test "x$enable_json_glib_support" = "xyes"; then
 fi
 
 
+#--- Checks for libzip
+
+PKG_CHECK_MODULES(LIBZIP,libzip >= 1.7.3,[libzip_found=yes],[libzip_found=no])
+
+if test "$libzip_found" = "yes"; then
+   libzip_version=`pkg-config libzip --modversion`
+else
+   libzip_version='-'
+fi
+
+AC_SUBST(LIBZIP_CFLAGS)
+AC_SUBST(LIBZIP_LIBS)
+
+
 #--- Checks for Python
 
 if test "x$enable_debug" = "xyes"; then
@@ -912,6 +926,7 @@ echo The YAML support library..................... : $libyaml_version
 echo The magic number recognition library......... : $libmagic_version
 echo The high-performance matching library........ : $libhs_version
 echo The JSON Parser for the GLib library......... : $libjsonglib_version
+echo The library for handling ZIP archives........ : $libzip_version
 
 echo
 echo Available Python programming language........ : $python3_version
diff --git a/src/core/logs.h b/src/core/logs.h
index e8df8bd..3719c6b 100644
--- a/src/core/logs.h
+++ b/src/core/logs.h
@@ -162,6 +162,15 @@ void log_variadic_message(LogMessageType, const char *, ...);
     }                                                                                                   \
     while (0)
 
+#define LOG_ERROR_ZIP(func, err)                                                                        \
+    do                                                                                                  \
+    {                                                                                                   \
+        const char *__msg;                                                                              \
+         __msg = zip_error_strerror(err);                                                               \
+        log_variadic_message(LMT_EXT_ERROR, "[%s:%u] %s: %s", __FUNCTION__, __LINE__, func, __msg);     \
+    }                                                                                                   \
+    while (0)
+
 
 
 #endif  /* _CORE_LOGS_H */
-- 
cgit v0.11.2-87-g4458