Browse Source

enable libzip for mingw (#4677)

* enable libzip for mingw

* fix mingw
ruki 1 year ago
parent
commit
a3999a579f
2 changed files with 18 additions and 2 deletions
  1. 14 0
      packages/l/libzip/patches/1.10.1/mingw.patch
  2. 4 2
      packages/l/libzip/xmake.lua

+ 14 - 0
packages/l/libzip/patches/1.10.1/mingw.patch

@@ -0,0 +1,14 @@
+diff --git a/lib/zip_source_file_win32.h b/lib/zip_source_file_win32.h
+index d86069ec..86ef2651 100644
+--- a/lib/zip_source_file_win32.h
++++ b/lib/zip_source_file_win32.h
+@@ -76,6 +76,9 @@ int _zip_win32_error_to_errno(DWORD win32err);
+ #ifdef __clang__
+ #define DONT_WARN_INCOMPATIBLE_FN_PTR_BEGIN _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wincompatible-function-pointer-types\"")
+ #define DONT_WARN_INCOMPATIBLE_FN_PTR_END _Pragma("GCC diagnostic pop")
++#elif defined(__GNUC__) && __GNUC__ > 13
++#define DONT_WARN_INCOMPATIBLE_FN_PTR_BEGIN _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wincompatible-pointer-types\"")
++#define DONT_WARN_INCOMPATIBLE_FN_PTR_END _Pragma("GCC diagnostic pop")
+ #else
+ #define DONT_WARN_INCOMPATIBLE_FN_PTR_BEGIN
+ #define DONT_WARN_INCOMPATIBLE_FN_PTR_END

+ 4 - 2
packages/l/libzip/xmake.lua

@@ -13,6 +13,8 @@ package("libzip")
     add_versions("v1.8.0", "30ee55868c0a698d3c600492f2bea4eb62c53849bcf696d21af5eb65f3f3839e")
     add_versions("v1.9.2", "fd6a7f745de3d69cf5603edc9cb33d2890f0198e415255d0987a0cf10d824c6f")
 
+    add_patches("<=1.10.1", "patches/1.10.1/mingw.patch", "17513dbef5feca0630ad16a2eacb507fd2ee3d3a47a7c9a660eba24b35ea3fa8")
+
     add_deps("cmake", "zlib")
 
     local configdeps = {-- gnutls = "gnutls",
@@ -29,7 +31,7 @@ package("libzip")
         add_syslinks("advapi32")
     end
 
-    on_load("windows", "macosx", "linux", function (package)
+    on_load(function (package)
         for config, dep in pairs(configdeps) do
             if package:config(config) then
                 package:add("deps", dep)
@@ -37,7 +39,7 @@ package("libzip")
         end
     end)
 
-    on_install("windows", "macosx", "linux", function (package)
+    on_install("windows", "macosx", "linux", "mingw", function (package)
         io.replace("CMakeLists.txt", "Dist(", "#Dist(", {plain = true})
         local configs = {"-DBUILD_DOC=OFF", "-DBUILD_EXAMPLES=OFF", "-DBUILD_REGRESS=OFF", "-DBUILD_TOOLS=ON"}
         table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))