Skip to content

Add nghttp2 module #4750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions modules/nghttp2/1.65.0/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -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")

102 changes: 102 additions & 0 deletions modules/nghttp2/1.65.0/overlay/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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",
)
1 change: 1 addition & 0 deletions modules/nghttp2/1.65.0/overlay/MODULE.bazel
122 changes: 122 additions & 0 deletions modules/nghttp2/1.65.0/overlay/config/config.h
Original file line number Diff line number Diff line change
@@ -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_
17 changes: 17 additions & 0 deletions modules/nghttp2/1.65.0/presubmit.yml
Original file line number Diff line number Diff line change
@@ -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'
10 changes: 10 additions & 0 deletions modules/nghttp2/1.65.0/source.json
Original file line number Diff line number Diff line change
@@ -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="
}
}
16 changes: 16 additions & 0 deletions modules/nghttp2/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"homepage": "https://nghttp2.org/",
"maintainers": [
{
"email": "[email protected]",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind listing yourself as the maintainer of this module?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are maintainer responsibilities? I have a pretty large list of dependencies that I'm hoping to get in and I'm not sure that I want maintainer on all of them.

See https://github.com/laramiel/tensorstore-registry/tree/main/modules

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"name": "No Maintainer Specified"
}
],
"repository": [
"github:nghttp2/nghttp2"
],
"versions": [
"1.65.0"
],
"yanked_versions": {}
}
Loading