Auto-update libzip to v1.11.1 (#5318)

* Update libzip to v1.11.1

* improve windows build

* patch mingw

* add check

---------

Co-authored-by: star9029 <hengxings783@gmail.com>
pull/5324/head
ruki 2 months ago committed by GitHub
parent 811c965fa8
commit 67f702ff77
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 22
      packages/l/libzip/patches/1.11.1/mingw-shared.patch
  2. 41
      packages/l/libzip/xmake.lua

@ -0,0 +1,22 @@
From 4e6f0344690b747cbca2e183e3837c5044414513 Mon Sep 17 00:00:00 2001
From: Thomas Klausner <wiz@gatalith.at>
Date: Mon, 23 Sep 2024 09:12:28 +0200
Subject: [PATCH] Do not include zip.h from lib/*.c
---
lib/zip_dirent.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/zip_dirent.c b/lib/zip_dirent.c
index 85c4c6dc..6e3e1a46 100644
--- a/lib/zip_dirent.c
+++ b/lib/zip_dirent.c
@@ -39,7 +39,6 @@
#include <time.h>
#include <zlib.h>
-#include "zip.h"
#include "zipint.h"
static zip_string_t *_zip_dirent_process_ef_utf_8(const zip_dirent_t *de, zip_uint16_t id, zip_string_t *str, bool check_consistency);

@ -1,5 +1,4 @@
package("libzip")
set_homepage("https://libzip.org/")
set_description("A C library for reading, creating, and modifying zip archives.")
set_license("BSD-3-Clause")
@ -9,10 +8,13 @@ package("libzip")
return tostring(version):sub(2)
end})
add_urls("https://github.com/nih-at/libzip.git")
add_versions("v1.11.1", "c0e6fa52a62ba11efd30262290dc6970947aef32e0cc294ee50e9005ceac092a")
add_versions("v1.10.1", "9669ae5dfe3ac5b3897536dc8466a874c8cf2c0e3b1fdd08d75b273884299363")
add_versions("v1.8.0", "30ee55868c0a698d3c600492f2bea4eb62c53849bcf696d21af5eb65f3f3839e")
add_versions("v1.9.2", "fd6a7f745de3d69cf5603edc9cb33d2890f0198e415255d0987a0cf10d824c6f")
add_patches("1.11.1", "patches/1.11.1/mingw-shared.patch", "bdd27b2c68ff045160126a6005237105307af06cfc7f89df69e6728ce23fa36a")
add_patches("<=1.10.1", "patches/1.10.1/mingw.patch", "17513dbef5feca0630ad16a2eacb507fd2ee3d3a47a7c9a660eba24b35ea3fa8")
add_deps("cmake", "zlib")
@ -31,24 +33,55 @@ package("libzip")
add_syslinks("advapi32")
end
if on_check then
on_check("android", function (package)
if package:is_arch("armeabi-v7a") then
local ndkver = package:toolchain("ndk"):config("ndkver")
assert(ndkver and tonumber(ndkver) > 22, "package(libzip) require ndk version > 22")
end
end)
end
on_load(function (package)
for config, dep in pairs(configdeps) do
if package:config(config) then
package:add("deps", dep)
end
end
if not package:config("sahred") then
package:add("defines", "ZIP_STATIC")
end
end)
on_install("windows", "macosx", "linux", "mingw", function (package)
on_install(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"))
local configs = {
"-DBUILD_DOC=OFF",
"-DBUILD_EXAMPLES=OFF",
"-DBUILD_REGRESS=OFF",
"-DBUILD_OSSFUZZ=OFF",
"-DBUILD_TOOLS=ON",
}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DENABLE_GNUTLS=OFF")
for config, dep in pairs(configdeps) do
table.insert(configs, "-DENABLE_" .. config:upper() .. "=" .. (package:config(config) and "ON" or "OFF"))
end
if package:is_plat("windows") then
os.mkdir(path.join(package:buildir(), "src/pdb"))
os.mkdir(path.join(package:buildir(), "lib/pdb"))
end
import("package.tools.cmake").install(package, configs)
if package:is_plat("windows") and package:is_debug() then
local dir = package:installdir(package:config("shared") and "bin" or "lib")
os.vcp(path.join(package:buildir(), "src/*.pdb"), dir)
os.vcp(path.join(package:buildir(), "lib/*.pdb"), dir)
end
end)
on_test(function (package)

Loading…
Cancel
Save