From 3656ebca9df070b71bf90a88ac16fc1e7b06b585 Mon Sep 17 00:00:00 2001 From: Li-Yu Yu Date: Mon, 8 Apr 2024 04:40:26 +0800 Subject: [PATCH] zstd@1.5.6 (#1781) --- modules/zstd/1.5.6/MODULE.bazel | 7 + .../zstd/1.5.6/patches/add_build_file.patch | 168 ++++++++++++++++++ .../zstd/1.5.6/patches/module_dot_bazel.patch | 10 ++ modules/zstd/1.5.6/presubmit.yml | 15 ++ modules/zstd/1.5.6/source.json | 10 ++ modules/zstd/metadata.json | 3 +- 6 files changed, 212 insertions(+), 1 deletion(-) create mode 100644 modules/zstd/1.5.6/MODULE.bazel create mode 100644 modules/zstd/1.5.6/patches/add_build_file.patch create mode 100644 modules/zstd/1.5.6/patches/module_dot_bazel.patch create mode 100644 modules/zstd/1.5.6/presubmit.yml create mode 100644 modules/zstd/1.5.6/source.json diff --git a/modules/zstd/1.5.6/MODULE.bazel b/modules/zstd/1.5.6/MODULE.bazel new file mode 100644 index 0000000000..acfc5ff5cb --- /dev/null +++ b/modules/zstd/1.5.6/MODULE.bazel @@ -0,0 +1,7 @@ +module( + name = "zstd", + version = "1.5.6", + compatibility_level = 1, +) +bazel_dep(name = "rules_cc", version = "0.0.9") +bazel_dep(name = "platforms", version = "0.0.8") diff --git a/modules/zstd/1.5.6/patches/add_build_file.patch b/modules/zstd/1.5.6/patches/add_build_file.patch new file mode 100644 index 0000000000..622f3085f3 --- /dev/null +++ b/modules/zstd/1.5.6/patches/add_build_file.patch @@ -0,0 +1,168 @@ +diff --git BUILD.bazel BUILD.bazel +new file mode 100644 +index 00000000..f8b9c939 +--- /dev/null ++++ BUILD.bazel +@@ -0,0 +1,162 @@ ++""" Builds zstd. ++""" ++ ++load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test") ++ ++package(default_visibility = ["//visibility:public"]) ++ ++filegroup( ++ name = "common_sources", ++ srcs = glob([ ++ "lib/common/*.c", ++ "lib/common/*.h", ++ ]), ++) ++ ++filegroup( ++ name = "compress_sources", ++ srcs = glob([ ++ "lib/compress/*.c", ++ "lib/compress/*.h", ++ ]), ++) ++ ++filegroup( ++ name = "decompress_sources", ++ srcs = glob([ ++ "lib/decompress/*.c", ++ "lib/decompress/*.h", ++ ]) + select({ ++ "@platforms//os:windows": [], ++ "//conditions:default": glob(["lib/decompress/*.S"]), ++ }), ++) ++ ++filegroup( ++ name = "dictbuilder_sources", ++ srcs = glob([ ++ "lib/dictBuilder/*.c", ++ "lib/dictBuilder/*.h", ++ ]), ++) ++ ++cc_library( ++ name = "zstd", ++ srcs = [ ++ ":common_sources", ++ ":compress_sources", ++ ":decompress_sources", ++ ":dictbuilder_sources", ++ ], ++ hdrs = [ ++ "lib/zdict.h", ++ "lib/zstd.h", ++ "lib/zstd_errors.h", ++ ], ++ includes = ["lib"], ++ linkopts = ["-pthread"], ++ linkstatic = True, ++ local_defines = [ ++ "XXH_NAMESPACE=ZSTD_", ++ "ZSTD_MULTITHREAD", ++ "ZSTD_BUILD_SHARED=OFF", ++ "ZSTD_BUILD_STATIC=ON", ++ ] + select({ ++ "@platforms//os:windows": ["ZSTD_DISABLE_ASM"], ++ "//conditions:default": [], ++ }), ++) ++ ++cc_binary( ++ name = "zstd_cli", ++ srcs = glob( ++ include = [ ++ "programs/*.c", ++ "programs/*.h", ++ ], ++ exclude = [ ++ "programs/datagen.c", ++ "programs/datagen.h", ++ "programs/platform.h", ++ "programs/util.h", ++ ], ++ ), ++ deps = [ ++ ":datagen", ++ ":util", ++ ":zstd", ++ ], ++) ++ ++cc_library( ++ name = "util", ++ srcs = [ ++ "programs/platform.h", ++ "programs/util.c", ++ ], ++ hdrs = [ ++ "lib/common/compiler.h", ++ "lib/common/debug.h", ++ "lib/common/mem.h", ++ "lib/common/portability_macros.h", ++ "lib/common/zstd_deps.h", ++ "programs/util.h", ++ ], ++) ++ ++cc_library( ++ name = "datagen", ++ srcs = [ ++ "programs/datagen.c", ++ "programs/platform.h", ++ ], ++ hdrs = ["programs/datagen.h"], ++ deps = [":util"], ++) ++ ++cc_binary( ++ name = "datagen_cli", ++ srcs = [ ++ "programs/lorem.c", ++ "programs/lorem.h", ++ "tests/datagencli.c", ++ "tests/loremOut.c", ++ "tests/loremOut.h", ++ ], ++ includes = [ ++ "programs", ++ "tests", ++ ], ++ deps = [":datagen"], ++) ++ ++cc_test( ++ name = "fullbench", ++ srcs = [ ++ "lib/decompress/zstd_decompress_internal.h", ++ "programs/benchfn.c", ++ "programs/benchfn.h", ++ "programs/benchzstd.c", ++ "programs/benchzstd.h", ++ "programs/lorem.c", ++ "programs/lorem.h", ++ "programs/timefn.c", ++ "programs/timefn.h", ++ "tests/fullbench.c", ++ "tests/loremOut.c", ++ "tests/loremOut.h", ++ ], ++ copts = select({ ++ "@platforms//os:windows": [], ++ "//conditions:default": ["-Wno-deprecated-declarations"], ++ }), ++ includes = [ ++ "lib/common", ++ "programs", ++ "tests", ++ ], ++ deps = [ ++ ":datagen", ++ ":zstd", ++ ], ++) diff --git a/modules/zstd/1.5.6/patches/module_dot_bazel.patch b/modules/zstd/1.5.6/patches/module_dot_bazel.patch new file mode 100644 index 0000000000..77ba5c8eab --- /dev/null +++ b/modules/zstd/1.5.6/patches/module_dot_bazel.patch @@ -0,0 +1,10 @@ +--- MODULE.bazel ++++ MODULE.bazel +@@ -0,0 +1,7 @@ ++module( ++ name = "zstd", ++ version = "1.5.6", ++ compatibility_level = 1, ++) ++bazel_dep(name = "rules_cc", version = "0.0.9") ++bazel_dep(name = "platforms", version = "0.0.8") diff --git a/modules/zstd/1.5.6/presubmit.yml b/modules/zstd/1.5.6/presubmit.yml new file mode 100644 index 0000000000..2c897bdeaf --- /dev/null +++ b/modules/zstd/1.5.6/presubmit.yml @@ -0,0 +1,15 @@ +matrix: + platform: + - debian10 + - ubuntu2004 + - macos + - macos_arm64 + - windows + bazel: [6.x, 7.x] +tasks: + run_tests: + name: Run tests + platform: ${{ platform }} + bazel: ${{ bazel }} + test_targets: + - "@zstd//:fullbench" diff --git a/modules/zstd/1.5.6/source.json b/modules/zstd/1.5.6/source.json new file mode 100644 index 0000000000..41dd72adad --- /dev/null +++ b/modules/zstd/1.5.6/source.json @@ -0,0 +1,10 @@ +{ + "url": "https://github.com/facebook/zstd/releases/download/v1.5.6/zstd-1.5.6.tar.gz", + "integrity": "sha256-jCngbPQqrMHq/EB3ri7Gxvy5amJhV+BZPV6Co0/UA8E=", + "strip_prefix": "zstd-1.5.6", + "patches": { + "add_build_file.patch": "sha256-eWyxLXFI3vRjvK572z4lHJdoia96jUfQxzAP+hYY9ck=", + "module_dot_bazel.patch": "sha256-xNLcQox8GjyYhgThGYV16+CcXYkumiPAVXRZlWUqWJM=" + }, + "patch_strip": 0 +} diff --git a/modules/zstd/metadata.json b/modules/zstd/metadata.json index 8a1bb73637..d8963e5f71 100644 --- a/modules/zstd/metadata.json +++ b/modules/zstd/metadata.json @@ -13,7 +13,8 @@ "versions": [ "1.5.5", "1.5.5.bcr.1", - "1.5.5.bcr.2" + "1.5.5.bcr.2", + "1.5.6" ], "yanked_versions": {} }