From 6c9f743d9209f11ab9eebf760d13727cdf5b572c Mon Sep 17 00:00:00 2001 From: Chi Huu Huynh <73843190+Chi-EEE@users.noreply.github.com> Date: Sat, 17 Feb 2024 13:41:05 +0000 Subject: [PATCH] gzip-hpp: add package (#3303) * gzip-hpp: add package * gzip-hpp: add stdint --- packages/g/gzip-hpp/xmake.lua | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 packages/g/gzip-hpp/xmake.lua diff --git a/packages/g/gzip-hpp/xmake.lua b/packages/g/gzip-hpp/xmake.lua new file mode 100644 index 000000000..33022d851 --- /dev/null +++ b/packages/g/gzip-hpp/xmake.lua @@ -0,0 +1,37 @@ +package("gzip-hpp") + set_kind("library", {headeronly = true}) + set_homepage("https://github.com/mapbox/gzip-hpp") + set_description("Gzip header-only C++ library") + set_license("MIT") + + add_urls("https://github.com/mapbox/gzip-hpp/archive/$(version).tar.gz", + "https://github.com/mapbox/gzip-hpp.git") + + add_versions("v0.1.0", "7ce3908cd13f186987820be97083fc5e62a7c6df0877af44b334a92e868eff06") + + add_deps("zlib") + + on_install(function (package) + io.replace("include/gzip/utils.hpp", "#include ", "#include \n#include ", {plain = true}) + os.cp("include", package:installdir()) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include + #include + #include + #include + + void test() { + const std::string data("Hello World"); + for (int level = Z_BEST_SPEED; level <= Z_BEST_COMPRESSION; ++level) + { + std::string compressed_data = gzip::compress(data.data(), data.size()); + assert(gzip::is_compressed(compressed_data.data(), compressed_data.size())); + std::string new_data = gzip::decompress(compressed_data.data(), compressed_data.size()); + assert(data == new_data); + } + } + ]]}, {configs = {languages = "cxx11"}})) + end) \ No newline at end of file