From 135d2942d4384342ccbc6932a2e83e61b5bc939b Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 19 Nov 2020 11:38:08 +0800 Subject: [PATCH] add zstd (#151) --- packages/z/zstd/xmake.lua | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 packages/z/zstd/xmake.lua diff --git a/packages/z/zstd/xmake.lua b/packages/z/zstd/xmake.lua new file mode 100644 index 000000000..719c4791c --- /dev/null +++ b/packages/z/zstd/xmake.lua @@ -0,0 +1,33 @@ +package("zstd") + + set_homepage("https://www.zstd.net/") + set_description("Zstandard - Fast real-time compression algorithm") + + set_urls("https://github.com/facebook/zstd/archive/$(version).tar.gz", + "https://github.com/facebook/zstd.git") + add_versions("v1.4.5", "734d1f565c42f691f8420c8d06783ad818060fc390dee43ae0a89f86d0a4f8c2") + + on_install(function (package) + io.writefile("xmake.lua", [[ + add_rules("mode.debug", "mode.release") + target("zstd") + set_kind("$(kind)") + add_files("lib/common/*.c") + add_files("lib/compress/*.c") + add_files("lib/decompress/*.c") + add_headerfiles("lib/zstd.h") + if is_kind("shared") and is_plat("windows") then + add_defines("ZSTD_DLL_EXPORT") + end + ]]) + local configs = {} + if package:config("shared") then + configs.kind = "shared" + end + import("package.tools.xmake").install(package, configs) + end) + + on_test(function (package) + assert(package:has_cfuncs("ZSTD_compress", {includes = {"zstd.h"}})) + assert(package:has_cfuncs("ZSTD_decompress", {includes = {"zstd.h"}})) + end)