Add nghttp2 module (#4750)

Adds nghttp2@1.65.0
diff --git a/modules/nghttp2/1.65.0/MODULE.bazel b/modules/nghttp2/1.65.0/MODULE.bazel
new file mode 100644
index 0000000..4fcd08b
--- /dev/null
+++ b/modules/nghttp2/1.65.0/MODULE.bazel
@@ -0,0 +1,9 @@
+module(
+    name = "nghttp2",
+    version = "1.65.0",
+    compatibility_level = 1,
+    bazel_compatibility = [">=7.2.1"],
+)
+bazel_dep(name = "bazel_skylib", version = "1.7.1")
+bazel_dep(name = "rules_cc", version = "0.1.1")
+
diff --git a/modules/nghttp2/1.65.0/overlay/BUILD.bazel b/modules/nghttp2/1.65.0/overlay/BUILD.bazel
new file mode 100644
index 0000000..c537a84
--- /dev/null
+++ b/modules/nghttp2/1.65.0/overlay/BUILD.bazel
@@ -0,0 +1,102 @@
+load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
+load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
+load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
+
+package(default_visibility = ["//visibility:private"])
+
+licenses(["notice"])
+
+exports_files(["COPYING"])
+
+# To enable nghttp2 debug output, specify:
+# bazel build --@nghttp2//:debug
+bool_flag(
+    name = "debug",
+    build_setting_default = False,
+    visibility = ["//visibility:public"],
+)
+
+config_setting(
+    name = "debug_setting",
+    flag_values = {
+        ":debug": "True",
+    },
+)
+
+cc_library(
+    name = "nghttp2",
+    hdrs = [
+        "lib/includes/nghttp2/nghttp2.h",
+        "lib/includes/nghttp2/nghttp2ver.h",
+    ],
+    defines = [
+        "NGHTTP2_STATICLIB",
+    ],
+    strip_include_prefix = "lib/includes",
+    visibility = ["//visibility:public"],
+    deps = [
+        ":nghttp2_impl",
+    ],
+)
+
+cc_library(
+    name = "nghttp2_impl",
+    srcs = glob(["lib/*.c"]),
+    hdrs = glob(["lib/*.h"]),
+    copts = select({
+        "@rules_cc//cc/compiler:msvc-cl": [],
+        "//conditions:default": [
+            "-Wno-string-plus-int",
+        ],
+    }),
+    local_defines = [
+        "BUILDING_NGHTTP2",
+        "HAVE_CONFIG_H",
+    ] + select(
+        {
+            ":debug_setting": ["DEBUGBUILD"],
+            "//conditions:default": [],
+        },
+    ),
+    deps = [
+        ":nghttp2_config",
+        ":nghttp2_headers",
+    ],
+)
+
+cc_library(
+    name = "nghttp2_headers",
+    hdrs = [
+        "lib/includes/nghttp2/nghttp2.h",
+        "lib/includes/nghttp2/nghttp2ver.h",
+    ],
+    defines = [
+        "NGHTTP2_STATICLIB",
+    ],
+    strip_include_prefix = "lib/includes",
+)
+
+cc_library(
+    name = "nghttp2_config",
+    hdrs = [
+        "lib/config.h",
+    ],
+    strip_include_prefix = "lib",
+)
+
+expand_template(
+    name = "nghttp2ver_h",
+    out = "lib/includes/nghttp2/nghttp2ver.h",
+    substitutions = {
+        "@PACKAGE_VERSION@": "1.65.0",
+        "@PACKAGE_VERSION_NUM@": "0x014100",
+    },
+    template = "lib/includes/nghttp2/nghttp2ver.h.in",
+)
+
+# Generated based on running configure on several platforms.
+copy_file(
+    name = "config_h",
+    src = "config/config.h",
+    out = "lib/config.h",
+)
diff --git a/modules/nghttp2/1.65.0/overlay/MODULE.bazel b/modules/nghttp2/1.65.0/overlay/MODULE.bazel
new file mode 120000
index 0000000..9b599e3
--- /dev/null
+++ b/modules/nghttp2/1.65.0/overlay/MODULE.bazel
@@ -0,0 +1 @@
+../MODULE.bazel
\ No newline at end of file
diff --git a/modules/nghttp2/1.65.0/overlay/config/config.h b/modules/nghttp2/1.65.0/overlay/config/config.h
new file mode 100644
index 0000000..9093ec2
--- /dev/null
+++ b/modules/nghttp2/1.65.0/overlay/config/config.h
@@ -0,0 +1,122 @@
+#ifndef EXTERNAL_NGHTTP2_CONFIG_H_
+#define EXTERNAL_NGHTTP2_CONFIG_H_
+
+#if !defined(_WIN32) && !defined(__APPLE__)
+#include <stdint.h>
+#endif
+
+#define HAVE_STD_MAP_EMPLACE 1
+#define HAVE__EXIT 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_FCNTL_H 1
+#define HAVE_TIME_H 1
+#define NGHTTP2_NORETURN __attribute__((noreturn))
+
+#if defined(_WIN32)
+#include <stddef.h>
+#define ssize_t ptrdiff_t
+#define HAVE_DECL_INITGROUPS 0
+
+#elif defined(__APPLE__)
+#define HAVE_ARPA_INET_H 1
+#define HAVE_SOCKADDR_IN6_SIN6_LEN 1
+#define HAVE_SOCKADDR_IN_SIN_LEN 1
+#define SIZEOF_TIME_T 8
+#define STDC_HEADERS 1
+
+#else
+#define HAVE_ACCEPT4 1
+#define HAVE_ARPA_INET_H 1
+#endif
+
+// common linux, apple
+#if !defined(_WIN32)
+#define HAVE_ATOMIC_STD_SHARED_PTR 1
+#define HAVE_CHOWN 1
+#define HAVE_CXX14 1
+#define HAVE_DECL_INITGROUPS 1
+#define HAVE_DECL_STRERROR_R 1
+#define HAVE_DLFCN_H 1
+#define HAVE_DUP2 1
+#define HAVE_FORK 1
+#define HAVE_GETCWD 1
+#define HAVE_GETPWNAM 1
+#define HAVE_LOCALTIME_R 1
+#define HAVE_MEMCHR 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMORY_H 1
+#define HAVE_MEMSET 1
+#define HAVE_MKOSTEMP 1
+#define HAVE_NETDB_H 1
+#define HAVE_NETINET_IN_H 1
+#define HAVE_PTRDIFF_T 1
+#define HAVE_PWD_H 1
+#define HAVE_SOCKET 1
+#define HAVE_SQRT 1
+#define HAVE_STD_FUTURE 1
+#define HAVE_STDDEF_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRCHR 1
+#define HAVE_STRDUP 1
+#define HAVE_STRERROR 1
+#define HAVE_STRERROR_R 1
+#define HAVE_STRING_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRNDUP 1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE_STRUCT_TM_TM_GMTOFF 1
+#define HAVE_SYS_SOCKET_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_TIME_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_SYSLOG_H 1
+#define HAVE_THREAD_LOCAL 1
+#define HAVE_TIMEGM 1
+#define HAVE_UNISTD_H 1
+#define HAVE_VFORK 1
+#define HAVE_WORKING_FORK 1
+#define HAVE_WORKING_VFORK 1
+#endif
+
+#if !defined(_WIN32)
+#ifndef _ALL_SOURCE
+#define _ALL_SOURCE 1
+#endif
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+#ifndef _POSIX_PTHREAD_SEMANTICS
+#define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+#ifndef _TANDEM_SOURCE
+#define _TANDEM_SOURCE 1
+#endif
+#ifndef __EXTENSIONS__
+#define __EXTENSIONS__ 1
+#endif
+#endif
+
+#if defined(__APPLE__)
+#if defined AC_APPLE_UNIVERSAL_BUILD
+#if defined __BIG_ENDIAN__
+#define WORDS_BIGENDIAN 1
+#endif
+#endif
+#ifndef _DARWIN_USE_64_BIT_INODE
+#define _DARWIN_USE_64_BIT_INODE 1
+#endif
+#endif
+
+#if UINTPTR_MAX == UINT64_MAX
+#define SIZEOF_INT_P 8
+#elif UINTPTR_MAX == UINT32_MAX
+#define SIZEOF_INT_P 4
+#else
+#error "Unknown int pointer size"
+#endif
+
+#endif  // EXTERNAL_NGHTTP2_CONFIG_H_
diff --git a/modules/nghttp2/1.65.0/presubmit.yml b/modules/nghttp2/1.65.0/presubmit.yml
new file mode 100644
index 0000000..8c57f49
--- /dev/null
+++ b/modules/nghttp2/1.65.0/presubmit.yml
@@ -0,0 +1,17 @@
+matrix:
+  platform:
+  - debian11
+  - ubuntu2204
+  - macos
+  - macos_arm64
+  - windows
+  bazel:
+  - 8.x
+  - 7.x
+tasks:
+  verify_targets:
+    name: Verify build targets
+    platform: ${{ platform }}
+    bazel: ${{ bazel }}
+    build_targets:
+    - '@nghttp2//:nghttp2'
diff --git a/modules/nghttp2/1.65.0/source.json b/modules/nghttp2/1.65.0/source.json
new file mode 100644
index 0000000..6b48795
--- /dev/null
+++ b/modules/nghttp2/1.65.0/source.json
@@ -0,0 +1,10 @@
+{
+    "url": "https://github.com/nghttp2/nghttp2/releases/download/v1.65.0/nghttp2-1.65.0.tar.gz",
+    "integrity": "sha256-jKTyp3unqsIKyj41F6LJbPz3xrBkq31KCAnn5OnrmRQ=",
+    "strip_prefix": "nghttp2-1.65.0",
+    "overlay": {
+        "BUILD.bazel": "sha256-/BtheCJ2f/XjZtaUjezUnIXFuUSKAIxC503hxI/pXN0=",
+        "MODULE.bazel": "sha256-aV83DVhH5ZJHkSzoDPknM8f64Otq2uhmJSRxUcEda+0=",
+        "config/config.h": "sha256-ionfCCUf7G0RP+Ae+9PyGof5bAGYtcha5tDCEY7wHUQ="
+    }
+}
diff --git a/modules/nghttp2/metadata.json b/modules/nghttp2/metadata.json
new file mode 100644
index 0000000..efeca5c
--- /dev/null
+++ b/modules/nghttp2/metadata.json
@@ -0,0 +1,16 @@
+{
+    "homepage": "https://nghttp2.org/",
+    "maintainers": [
+        {
+            "email": "bcr-maintainers@bazel.build",
+            "name": "No Maintainer Specified"
+        }
+    ],
+    "repository": [
+        "github:nghttp2/nghttp2"
+    ],
+    "versions": [
+        "1.65.0"
+    ],
+    "yanked_versions": {}
+}