Просмотр исходного кода

ls-qpack: add package (#2803)

* ls-qpack: add package

* fix patch name

* disable plat

* disable plat
star9029 1 год назад
Родитель
Сommit
e49eabae33

+ 26 - 0
packages/l/ls-qpack/patches/v2.5.3/fix-cmake-install.patch

@@ -0,0 +1,26 @@
+From 79c136923681d7187feade455225543335525c3f Mon Sep 17 00:00:00 2001
+From: Biagio Festa <[email protected]>
+Date: Fri, 26 May 2023 14:37:58 +0200
+Subject: [PATCH 1/1] CMakeLists.txt: install library target (#50)
+
+---
+ CMakeLists.txt | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7f7cd40..61e2e6d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -101,3 +101,9 @@ endif()
+ if(LSQPACK_BIN)
+     add_subdirectory(bin)
+ endif()
++
++install(TARGETS ls-qpack)
++install(FILES lsqpack.h lsxpack_header.h DESTINATION include)
++if(MSVC)
++    install(DIRECTORY wincompat/sys DESTINATION include)
++endif()
+-- 
+2.42.0.windows.2
+

+ 32 - 0
packages/l/ls-qpack/xmake.lua

@@ -0,0 +1,32 @@
+package("ls-qpack")
+    set_homepage("https://github.com/litespeedtech/ls-qpack")
+    set_description("QPACK compression library for use with HTTP/3")
+    set_license("MIT")
+
+    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.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_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",}
+        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"})
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("lsqpack_enc_init", {includes = "lsqpack.h"}))
+    end)