Skip to content

Commit

Permalink
snappy: add 1.2.1 version
Browse files Browse the repository at this point in the history
  • Loading branch information
star-hengxing committed Oct 13, 2024
1 parent 97793f8 commit e9c1c77
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions packages/s/snappy/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package("snappy")
set_homepage("https://github.com/google/snappy")
set_description("A fast compressor/decompressor")

set_urls("https://github.com/google/snappy/archive/$(version).tar.gz",
"https://github.com/google/snappy.git")
set_urls("https://github.com/google/snappy/archive/refs/tags/$(version).tar.gz",
"https://github.com/google/snappy.git", {submodules = false})

add_versions("1.1.8", "16b677f07832a612b0836178db7f374e414f94657c138e6993cbfc5dcc58651f")
add_versions("1.1.9", "75c1fbb3d618dd3a0483bff0e26d0a92b495bbe5059c8b4f1c962b478b6e06e7")
add_versions("1.1.10", "49d831bffcc5f3d01482340fe5af59852ca2fe76c3e05df0e67203ebbe0f1d90")
add_versions("1.2.1", "736aeb64d86566d2236ddffa2865ee5d7a82d26c9016b36218fcc27ea4f09f86")

add_patches("1.1.9", "patches/1.1.9/inline.patch", "ed6b247d19486ab3f08f268269133193d7cdadd779523c5e69b5e653f82d535b")
add_patches("1.1.10", "patches/1.1.10/cmake.patch", "d4883111dcfab81ea35ac1e4e157e55105cec02a0ba804458405be25cbf7b6bb")
Expand All @@ -24,7 +25,12 @@ package("snappy")
if package:version():eq("1.1.10") then
io.replace("snappy.cc", "(op + deferred_length) < op_limit_min_slop);", "static_cast<ptrdiff_t>(op + deferred_length) < op_limit_min_slop);", {plain = true})
end
local configs = {"-DSNAPPY_BUILD_TESTS=OFF", "-DSNAPPY_BUILD_BENCHMARKS=OFF"}

local configs = {
"-DSNAPPY_BUILD_TESTS=OFF",
"-DSNAPPY_BUILD_BENCHMARKS=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"))
table.insert(configs, "-DSNAPPY_REQUIRE_AVX=" .. (package:config("avx") and "ON" or "OFF"))
Expand All @@ -34,9 +40,15 @@ package("snappy")
table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=''")
end
import("package.tools.cmake").install(package, configs)

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(), "snappy.pdb"), dir)
end
end)

on_test(function (package)
assert(package:has_cfuncs("snappy_compress", {includes = "snappy-c.h"}))
assert(package:check_cxxsnippets({test = [[
void test(int args, char** argv) {
snappy::Compress(nullptr, nullptr);
Expand Down

0 comments on commit e9c1c77

Please sign in to comment.