Merge pull request #220 from yunfeizhou2025/upload

limit RISC-V FindMatchLength optimizations to 64-bit
diff --git a/BUILD.bazel b/BUILD.bazel
index e6622ff..49db08e 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -26,10 +26,20 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
+load("@bazel_skylib//rules:write_file.bzl", "write_file")
+load("@rules_cc//cc:cc_library.bzl", "cc_library")
+load("@rules_cc//cc:cc_test.bzl", "cc_test")
+
 package(default_visibility = ["//visibility:public"])
 
 licenses(["notice"])
 
+exports_files([
+    "COPYING",
+    "COPYING.notestdata",
+])
+
 SNAPPY_VERSION = (1, 2, 2)
 
 config_setting(
@@ -52,8 +62,10 @@
     name = "snappy-stubs-internal",
     srcs = ["snappy-stubs-internal.cc"],
     hdrs = ["snappy-stubs-internal.h"],
-    deps = [
+    implementation_deps = [
         ":config",
+    ],
+    deps = [
         ":snappy-stubs-public",
     ],
 )
@@ -75,8 +87,10 @@
             "-Wno-sign-compare",
         ],
     }),
-    deps = [
+    implementation_deps = [
         ":config",
+    ],
+    deps = [
         ":snappy-stubs-internal",
         ":snappy-stubs-public",
     ],
@@ -133,10 +147,10 @@
 )
 
 # Generate a config.h similar to what cmake would produce.
-genrule(
+write_file(
     name = "config_h",
-    outs = ["config.h"],
-    cmd = """cat <<EOF >$@
+    out = "config.h",
+    content = """\
 #define HAVE_STDDEF_H 1
 #define HAVE_STDINT_H 1
 #ifdef __has_builtin
@@ -193,19 +207,17 @@
 #    define SNAPPY_IS_BIG_ENDIAN 1
 #  endif
 #endif
-EOF
-""",
+""".splitlines(),
 )
 
-genrule(
+expand_template(
     name = "snappy_stubs_public_h",
-    srcs = ["snappy-stubs-public.h.in"],
-    outs = ["snappy-stubs-public.h"],
-    # Assume sys/uio.h is available on non-Windows.
-    # Set the version numbers.
-    cmd = ("""sed -e 's/$${HAVE_SYS_UIO_H_01}/!_WIN32/g' \
-           -e 's/$${PROJECT_VERSION_MAJOR}/%d/g' \
-           -e 's/$${PROJECT_VERSION_MINOR}/%d/g' \
-           -e 's/$${PROJECT_VERSION_PATCH}/%d/g' \
-    $< >$@""" % SNAPPY_VERSION),
+    out = "snappy-stubs-public.h",
+    substitutions = {
+        "${HAVE_SYS_UIO_H_01}": "!_WIN32",
+        "${PROJECT_VERSION_MAJOR}": str(SNAPPY_VERSION[0]),
+        "${PROJECT_VERSION_MINOR}": str(SNAPPY_VERSION[1]),
+        "${PROJECT_VERSION_PATCH}": str(SNAPPY_VERSION[2]),
+    },
+    template = "snappy-stubs-public.h.in",
 )
diff --git a/COPYING.notestdata b/COPYING.notestdata
new file mode 100644
index 0000000..8d6bd9f
--- /dev/null
+++ b/COPYING.notestdata
@@ -0,0 +1,28 @@
+Copyright 2011, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+    * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/MODULE.bazel b/MODULE.bazel
index 4f80d95..d283a49 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -4,20 +4,23 @@
     compatibility_level = 1,
 )
 
+bazel_dep(name = "rules_cc", version = "0.2.4")
+bazel_dep(name = "bazel_skylib", version = "1.8.2")
+
 bazel_dep(
     name = "googletest",
-    version = "1.14.0.bcr.1",
+    version = "1.17.0.bcr.2",
     dev_dependency = True,
     repo_name = "com_google_googletest",
 )
 bazel_dep(
     name = "google_benchmark",
-    version = "1.9.0",
+    version = "1.9.5",
     dev_dependency = True,
     repo_name = "com_google_benchmark",
 )
 
 bazel_dep(
     name = "platforms",
-    version = "0.0.9",
+    version = "1.0.0",
 )