From bbaa9773881d12c3838282f8944e566b4af2988b Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 16 Oct 2024 00:09:44 +0800 Subject: [PATCH] Auto-update ls-qpack to v2.5.5 (#5500) * Update ls-qpack to v2.5.5 * add pkgconf * patch cmake * pkg-config: support msys --------- Co-authored-by: star9029 --- packages/l/ls-qpack/patches/2.5.5/cmake.patch | 30 ++++++++++++++ packages/l/ls-qpack/xmake.lua | 41 +++++++++++++++---- packages/p/pkg-config/xmake.lua | 7 ++++ 3 files changed, 70 insertions(+), 8 deletions(-) create mode 100644 packages/l/ls-qpack/patches/2.5.5/cmake.patch diff --git a/packages/l/ls-qpack/patches/2.5.5/cmake.patch b/packages/l/ls-qpack/patches/2.5.5/cmake.patch new file mode 100644 index 000000000..6f885d661 --- /dev/null +++ b/packages/l/ls-qpack/patches/2.5.5/cmake.patch @@ -0,0 +1,30 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 413b4579..f9f1371d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -42,14 +42,14 @@ else() + set(LSQPACK_DEPENDS "libxxhash") + endif() + +-if(WIN32) ++if(MSVC OR MINGW OR EMSCRIPTEN) + target_include_directories(ls-qpack PUBLIC + $ + $ + ) + endif() + +-if(WIN32) ++if(MSVC) + target_compile_options(ls-qpack PRIVATE + /Wall + /wd4100 # unreffed parameter +@@ -144,7 +144,7 @@ if(LSQPACK_BIN) + DESTINATION ${CMAKE_INSTALL_BINDIR}) + endif() + +-if(WIN32) ++if(MSVC OR MINGW OR EMSCRIPTEN) + install(DIRECTORY wincompat/sys DESTINATION include) + else() + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/lsqpack.pc" diff --git a/packages/l/ls-qpack/xmake.lua b/packages/l/ls-qpack/xmake.lua index c07b94dd3..50c0f7e79 100644 --- a/packages/l/ls-qpack/xmake.lua +++ b/packages/l/ls-qpack/xmake.lua @@ -6,26 +6,51 @@ package("ls-qpack") add_urls("https://github.com/litespeedtech/ls-qpack/archive/refs/tags/$(version).tar.gz", "https://github.com/litespeedtech/ls-qpack.git") + add_versions("v2.5.5", "8770435b81d13616cf952bd361ec0e6e0fd79acff76dd9f6e75c18fd88b4c4f4") add_versions("v2.5.4", "56b96190a1943d75ef8d384b13cd4592a72e3e2d84284f78d7f8adabbc717f3e") add_versions("v2.5.3", "075a05efee27961eac5ac92a12a6e28a61bcd6c122a0276938ef993338577337") - add_patches("v2.5.3", path.join(os.scriptdir(), "patches", "v2.5.3", "fix-cmake-install.patch"), "7d819b620b5e2bd34ef58a91bf20d882883c7525def9f9f80313b64cba5e5239") - - if not is_plat("windows") then - add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) - end + add_patches("2.5.5", "patches/2.5.5/cmake.patch", "23fd785c3db2e1b43ead464b0ee8d12e9f290fbfdf818c3238cba316df295f08") + add_patches("2.5.3", "patches/v2.5.3/fix-cmake-install.patch", "7d819b620b5e2bd34ef58a91bf20d882883c7525def9f9f80313b64cba5e5239") add_deps("cmake") add_deps("xxhash") - on_install("windows", "linux", "macosx", "android", "iphoneos", function (package) - local configs = {"-DLSQPACK_TESTS=OFF", "-DLSQPACK_BIN=OFF", "-DLSQPACK_XXH=OFF",} + on_load(function (package) + if package:gitref() or package:version():ge("2.5.5") then + if is_subhost("windows") then + package:add("deps", "pkgconf") + else + package:add("deps", "pkg-config") + end + end + end) + + on_install(function (package) + local opt = {} + if package:gitref() or package:version():ge("2.5.5") then + io.replace("CMakeLists.txt", "libxxhash", "xxhash", {plain = true}) + else + opt.packagedeps = "xxhash" + end + + local configs = { + "-DLSQPACK_TESTS=OFF", + "-DLSQPACK_BIN=OFF", + "-DLSQPACK_XXH=OFF", + "-DCMAKE_POLICY_DEFAULT_CMP0057=NEW", + } 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")) if package:is_plat("windows") and package:config("shared") then table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON") end - import("package.tools.cmake").install(package, configs, {packagedeps = "xxhash"}) + import("package.tools.cmake").install(package, configs, opt) + + if package:is_plat("windows") and package:is_debug() then + local dir = package:installdir(package:config("shared") and "bin" or "lib") + os.trycp(path.join(package:buildir(), "ls-qpack.pdb"), dir) + end end) on_test(function (package) diff --git a/packages/p/pkg-config/xmake.lua b/packages/p/pkg-config/xmake.lua index f357638c8..f6521c134 100644 --- a/packages/p/pkg-config/xmake.lua +++ b/packages/p/pkg-config/xmake.lua @@ -9,6 +9,13 @@ package("pkg-config") add_versions("0.29.2", "6fc69c01688c9458a57eb9a1664c9aba372ccda420a02bf4429fe610e7e7d591") end + if is_subhost("msys") then + add_deps("pacman::pkg-config") + end + + on_install("@msys", function (package) + end) + on_install("@macosx", "@linux", "@bsd", function (package) local pcpath = {"/usr/local/lib/pkgconfig", "/usr/lib/pkgconfig"} if package:is_plat("linux") and package:is_arch("x86_64") then