Fixes for Windows bazel build.

Don't pass -Wno-sign-compare on Windows.
Add a #define HAVE_WINDOWS_H if _WIN32 is defined.
Don't assume sys/uio.h is available on Windows.

PiperOrigin-RevId: 524416809
diff --git a/opensource/.bazelrc b/.bazelrc
similarity index 100%
rename from opensource/.bazelrc
rename to .bazelrc
diff --git a/opensource/BUILD.bazel b/BUILD.bazel
similarity index 93%
rename from opensource/BUILD.bazel
rename to BUILD.bazel
index 1c60d28..97c9f3a 100644
--- a/opensource/BUILD.bazel
+++ b/BUILD.bazel
@@ -32,6 +32,11 @@
 
 SNAPPY_VERSION = (1, 1, 10)
 
+config_setting(
+    name = "windows",
+    constraint_values = ["@platforms//os:windows"],
+)
+
 cc_library(
     name = "config",
     hdrs = ["config.h"],
@@ -64,9 +69,11 @@
         "snappy.h",
         "snappy-sinksource.h",
     ],
-    copts = [
+    copts = select({
+      ":windows": [],
+      "//conditions:default": [
         "-Wno-sign-compare",
-    ],
+    ]}),
     deps = [
         ":config",
         ":snappy-stubs-internal",
@@ -153,6 +160,10 @@
 #  endif
 #endif
 
+#if defined(_WIN32) && !defined(HAVE_WINDOWS_H)
+#define HAVE_WINDOWS_H 1
+#endif
+
 #ifdef __has_include
 #  if !defined(HAVE_BYTESWAP_H) && __has_include(<byteswap.h>)
 #    define HAVE_BYTESWAP_H 1
@@ -189,9 +200,9 @@
     name = "snappy_stubs_public_h",
     srcs = ["snappy-stubs-public.h.in"],
     outs = ["snappy-stubs-public.h"],
-    # Define HAVE_SYS_UIO_H_01 to 1; we just assume it's available.
+    # Assume sys/uio.h is available on non-Windows.
     # Set the version numbers.
-    cmd = ("""sed -e 's/$${\\(.*\\)_01}/1/g' \
+    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' \
diff --git a/opensource/WORKSPACE b/WORKSPACE
similarity index 100%
rename from opensource/WORKSPACE
rename to WORKSPACE