xmake.lua 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package("ls-qpack")
  2. set_homepage("https://github.com/litespeedtech/ls-qpack")
  3. set_description("QPACK compression library for use with HTTP/3")
  4. set_license("MIT")
  5. add_urls("https://github.com/litespeedtech/ls-qpack/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/litespeedtech/ls-qpack.git")
  7. add_versions("v2.5.5", "8770435b81d13616cf952bd361ec0e6e0fd79acff76dd9f6e75c18fd88b4c4f4")
  8. add_versions("v2.5.4", "56b96190a1943d75ef8d384b13cd4592a72e3e2d84284f78d7f8adabbc717f3e")
  9. add_versions("v2.5.3", "075a05efee27961eac5ac92a12a6e28a61bcd6c122a0276938ef993338577337")
  10. add_patches("2.5.5", "patches/2.5.5/cmake.patch", "23fd785c3db2e1b43ead464b0ee8d12e9f290fbfdf818c3238cba316df295f08")
  11. add_patches("2.5.3", "patches/v2.5.3/fix-cmake-install.patch", "7d819b620b5e2bd34ef58a91bf20d882883c7525def9f9f80313b64cba5e5239")
  12. add_deps("cmake")
  13. add_deps("xxhash")
  14. on_load(function (package)
  15. if package:gitref() or package:version():ge("2.5.5") then
  16. if is_subhost("windows") then
  17. package:add("deps", "pkgconf")
  18. else
  19. package:add("deps", "pkg-config")
  20. end
  21. end
  22. end)
  23. on_install(function (package)
  24. local opt = {}
  25. if package:gitref() or package:version():ge("2.5.5") then
  26. io.replace("CMakeLists.txt", "libxxhash", "xxhash", {plain = true})
  27. else
  28. opt.packagedeps = "xxhash"
  29. end
  30. local configs = {
  31. "-DLSQPACK_TESTS=OFF",
  32. "-DLSQPACK_BIN=OFF",
  33. "-DLSQPACK_XXH=OFF",
  34. "-DCMAKE_POLICY_DEFAULT_CMP0057=NEW",
  35. }
  36. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  37. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  38. if package:is_plat("windows") and package:config("shared") then
  39. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  40. end
  41. import("package.tools.cmake").install(package, configs, opt)
  42. if package:is_plat("windows") and package:is_debug() then
  43. local dir = package:installdir(package:config("shared") and "bin" or "lib")
  44. os.trycp(path.join(package:buildir(), "ls-qpack.pdb"), dir)
  45. end
  46. end)
  47. on_test(function (package)
  48. assert(package:has_cfuncs("lsqpack_enc_init", {includes = "lsqpack.h"}))
  49. end)