Skip to content

Commit

Permalink
enable libzip for mingw (#4677)
Browse files Browse the repository at this point in the history
* enable libzip for mingw

* fix mingw
  • Loading branch information
waruqi committed Jul 17, 2024
1 parent e9d2254 commit a3999a5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
14 changes: 14 additions & 0 deletions packages/l/libzip/patches/1.10.1/mingw.patch
Original file line number Diff line number Diff line change
@@ -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
6 changes: 4 additions & 2 deletions packages/l/libzip/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -29,15 +31,15 @@ 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)
end
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"))
Expand Down

0 comments on commit a3999a5

Please sign in to comment.