envoy: init at 1.16.2

This commit is contained in:
Luke Granger-Brown 2021-01-08 01:35:50 +00:00
parent c7102b26ce
commit 6e684ca91e
4 changed files with 3192 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,91 @@
From 8b531c41f956b27e4be32b430db2e7a44e0cdd3e Mon Sep 17 00:00:00 2001
From: Luke Granger-Brown <git@lukegb.com>
Date: Thu, 7 Jan 2021 11:09:18 +0000
Subject: [PATCH] Add upb patch to make it compile under GCC10
---
bazel/repositories.bzl | 5 +++-
bazel/upb2.patch | 55 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 1 deletion(-)
create mode 100644 bazel/upb2.patch
diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl
index 64d61ea49..c6cadc9df 100644
--- a/bazel/repositories.bzl
+++ b/bazel/repositories.bzl
@@ -811,7 +811,10 @@ def _com_github_grpc_grpc():
def _upb():
_repository_impl(
name = "upb",
- patches = ["@envoy//bazel:upb.patch"],
+ patches = [
+ "@envoy//bazel:upb.patch",
+ "@envoy//bazel:upb2.patch",
+ ],
patch_args = ["-p1"],
)
diff --git a/bazel/upb2.patch b/bazel/upb2.patch
new file mode 100644
index 000000000..6e436c61b
--- /dev/null
+++ b/bazel/upb2.patch
@@ -0,0 +1,55 @@
+From 9bd23dab4240b015321a53c45b3c9e4847fbf020 Mon Sep 17 00:00:00 2001
+From: Joshua Haberman <jhaberman@gmail.com>
+Date: Tue, 7 Apr 2020 15:22:11 -0700
+Subject: [PATCH] Changed upb status to suit GCC10's warning about strncpy().
+ (#268)
+
+Added tests for all cases. Also removed ellipses from truncated
+messages, they were more trouble than they are worth.
+---
+ tests/test_generated_code.c | 33 +++++++++++++++++++++++++++++++++
+ upb/upb.c | 17 +++--------------
+ 2 files changed, 36 insertions(+), 14 deletions(-)
+
+diff --git a/upb/upb.c b/upb/upb.c
+index cb2cdfd9d..258192d79 100644
+--- a/upb/upb.c
++++ b/upb/upb.c
+@@ -11,17 +11,6 @@
+
+ #include "upb/port_def.inc"
+
+-/* Guarantee null-termination and provide ellipsis truncation.
+- * It may be tempting to "optimize" this by initializing these final
+- * four bytes up-front and then being careful never to overwrite them,
+- * this is safer and simpler. */
+-static void nullz(upb_status *status) {
+- const char *ellipsis = "...";
+- size_t len = strlen(ellipsis);
+- UPB_ASSERT(sizeof(status->msg) > len);
+- memcpy(status->msg + sizeof(status->msg) - len, ellipsis, len);
+-}
+-
+ /* upb_status *****************************************************************/
+
+ void upb_status_clear(upb_status *status) {
+@@ -37,8 +26,8 @@ const char *upb_status_errmsg(const upb_status *status) { return status->msg; }
+ void upb_status_seterrmsg(upb_status *status, const char *msg) {
+ if (!status) return;
+ status->ok = false;
+- strncpy(status->msg, msg, sizeof(status->msg));
+- nullz(status);
++ strncpy(status->msg, msg, UPB_STATUS_MAX_MESSAGE - 1);
++ status->msg[UPB_STATUS_MAX_MESSAGE - 1] = '\0';
+ }
+
+ void upb_status_seterrf(upb_status *status, const char *fmt, ...) {
+@@ -52,7 +41,7 @@ void upb_status_vseterrf(upb_status *status, const char *fmt, va_list args) {
+ if (!status) return;
+ status->ok = false;
+ _upb_vsnprintf(status->msg, sizeof(status->msg), fmt, args);
+- nullz(status);
++ status->msg[UPB_STATUS_MAX_MESSAGE - 1] = '\0';
+ }
+
+ /* upb_alloc ******************************************************************/
--
2.29.2

View File

@ -0,0 +1,119 @@
{ buildBazelPackage
, fetchFromGitHub
, stdenv
, cmake
, go
, ninja
, python3
}:
let
srcVer = {
# We need the commit hash, since Bazel stamps the build with it.
# However, the version string is more useful for end-users.
# These are contained in a attrset of their own to make it obvious that
# people should update both.
version = "1.16.2";
commit = "e98e41a8e168af7acae8079fc0cd68155f699aa3";
};
in
buildBazelPackage rec {
pname = "envoy";
version = srcVer.version;
src = fetchFromGitHub {
owner = "envoyproxy";
repo = "envoy";
rev = srcVer.commit;
hash = "sha256-aWVMRKFCZzf9/96NRPCP4jiW38DJhXyi0gEqW7uIpnQ=";
extraPostFetch = ''
chmod -R +w $out
rm $out/.bazelversion
echo ${srcVer.commit} > $out/SOURCE_VERSION
sed -i 's/GO_VERSION = ".*"/GO_VERSION = "host"/g' $out/bazel/dependency_imports.bzl
'';
};
patches = [
# Quiche needs to be updated to compile under newer GCC.
# This is a manual backport of http://github.com/envoyproxy/envoy/pull/13949.
./0001-quiche-update-QUICHE-tar-13949.patch
# upb needs to be updated to compile under newer GCC.
# This is a manual backport of https://github.com/protocolbuffers/upb/commit/9bd23dab4240b015321a53c45b3c9e4847fbf020.
./0002-Add-upb-patch-to-make-it-compile-under-GCC10.patch
];
postPatch = ''
sed -i 's,#!/usr/bin/env python3,#!${python3}/bin/python,' bazel/foreign_cc/luajit.patch
'';
nativeBuildInputs = [
cmake
python3
go
ninja
];
fetchAttrs = {
sha256 = "sha256-mct7anzErY9eSujZyGORfRJqzAO9XuFAv04DS8VRZKM=";
dontUseCmakeConfigure = true;
preInstall = ''
# Strip out the path to the build location (by deleting the comment line).
find $bazelOut/external -name requirements.bzl | while read requirements; do
sed -i '/# Generated from /d' "$requirements"
done
# Remove references to paths in the Nix store.
sed -i \
-e 's,${python3},__NIXPYTHON__,' \
-e 's,${stdenv.shellPackage},__NIXSHELL__,' \
$bazelOut/external/com_github_luajit_luajit/build.py \
$bazelOut/external/local_config_sh/BUILD
rm -r $bazelOut/external/go_sdk
# Replace some wheels which are only used for tests with empty files;
# they're nondeterministically built and packed.
>$bazelOut/external/config_validation_pip3/PyYAML-5.3.1-cp38-cp38-linux_x86_64.whl
>$bazelOut/external/protodoc_pip3/PyYAML-5.3.1-cp38-cp38-linux_x86_64.whl
>$bazelOut/external/thrift_pip3/thrift-0.13.0-cp38-cp38-linux_x86_64.whl
'';
};
buildAttrs = {
dontUseCmakeConfigure = true;
dontUseNinjaInstall = true;
preConfigure = ''
sed -i 's,#!/usr/bin/env bash,#!${stdenv.shell},' $bazelOut/external/rules_foreign_cc/tools/build_defs/framework.bzl
# Add paths to Nix store back.
sed -i \
-e 's,__NIXPYTHON__,${python3},' \
-e 's,__NIXSHELL__,${stdenv.shellPackage},' \
$bazelOut/external/com_github_luajit_luajit/build.py \
$bazelOut/external/local_config_sh/BUILD
'';
installPhase = ''
install -Dm0755 bazel-bin/source/exe/envoy-static $out/bin/envoy
'';
};
fetchConfigured = true;
removeRulesCC = false;
removeLocalConfigCc = true;
removeLocal = false;
bazelTarget = "//source/exe:envoy-static";
bazelBuildFlags = [
"-c opt"
"--spawn_strategy=standalone"
"--noexperimental_strict_action_env"
"--cxxopt=-Wno-maybe-uninitialized"
"--cxxopt=-Wno-uninitialized"
];
meta = with stdenv.lib; {
homepage = "https://envoyproxy.io";
description = "Cloud-native edge and service proxy";
license = licenses.asl20;
maintainers = with maintainers; [ lukegb ];
platforms = [ "x86_64-linux" ]; # Other platforms will generate different fetch hashes.
};
}

View File

@ -17401,6 +17401,8 @@ in
engelsystem = callPackage ../servers/web-apps/engelsystem { };
envoy = callPackage ../servers/http/envoy { };
etcd = callPackage ../servers/etcd { };
etcd_3_4 = callPackage ../servers/etcd/3.4.nix { };