Skip to content

Commit f598632

Browse files
committed
envoy: fix build
Signed-off-by: Paul Meyer <[email protected]>
1 parent 6663da5 commit f598632

6 files changed

+224
-29
lines changed

pkgs/by-name/en/envoy/0001-nixpkgs-use-system-Python.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From 47406ebaf0260e5b66a92baac3717936c8386b69 Mon Sep 17 00:00:00 2001
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: Paul Meyer <[email protected]>
33
Date: Mon, 22 Apr 2024 11:52:59 +0200
44
Subject: [PATCH] nixpkgs: use system Python
@@ -10,7 +10,7 @@ Signed-off-by: Paul Meyer <[email protected]>
1010
2 files changed, 5 insertions(+), 23 deletions(-)
1111

1212
diff --git a/bazel/python_dependencies.bzl b/bazel/python_dependencies.bzl
13-
index 9f2b336b1a..53a2c93c59 100644
13+
index 9f2b336b1a36ca0d2f04a40ac1809b30ff21df27..53a2c93c59492a12ef4a6ecfc0c8a679f0df73f7 100644
1414
--- a/bazel/python_dependencies.bzl
1515
+++ b/bazel/python_dependencies.bzl
1616
@@ -1,28 +1,25 @@
@@ -47,7 +47,7 @@ index 9f2b336b1a..53a2c93c59 100644
4747
extra_pip_args = ["--require-hashes"],
4848
)
4949
diff --git a/bazel/repositories_extra.bzl b/bazel/repositories_extra.bzl
50-
index b92dd461ba..cef32b3140 100644
50+
index b92dd461ba7037d2f1c079f283ff2c466686f7a4..cef32b3140588cb7668d47d0c08528f131184fe4 100644
5151
--- a/bazel/repositories_extra.bzl
5252
+++ b/bazel/repositories_extra.bzl
5353
@@ -2,19 +2,11 @@ load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies")

pkgs/by-name/en/envoy/0002-nixpkgs-use-system-Go.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From 4be181e96199529a36e9a93c837af7173c827493 Mon Sep 17 00:00:00 2001
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: Paul Meyer <[email protected]>
33
Date: Mon, 22 Apr 2024 11:58:00 +0200
44
Subject: [PATCH] nixpkgs: use system Go
@@ -9,7 +9,7 @@ Signed-off-by: Paul Meyer <[email protected]>
99
1 file changed, 1 insertion(+), 1 deletion(-)
1010

1111
diff --git a/bazel/dependency_imports.bzl b/bazel/dependency_imports.bzl
12-
index c68eb4bf3e..addee4f6af 100644
12+
index c68eb4bf3ed2d39d46d38d7bd0eeab2c74a507fa..addee4f6af74ea78ae778b73384e01db83ac6694 100644
1313
--- a/bazel/dependency_imports.bzl
1414
+++ b/bazel/dependency_imports.bzl
1515
@@ -20,7 +20,7 @@ load("@rules_rust//rust:defs.bzl", "rust_common")

pkgs/by-name/en/envoy/0003-nixpkgs-use-system-C-C-toolchains.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From 3ecb08a7603a07310d1a38c0f47bc54bbe1f11c8 Mon Sep 17 00:00:00 2001
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: Paul Meyer <[email protected]>
33
Date: Mon, 22 Apr 2024 11:59:22 +0200
44
Subject: [PATCH] nixpkgs: use system C/C++ toolchains
@@ -9,7 +9,7 @@ Signed-off-by: Paul Meyer <[email protected]>
99
1 file changed, 5 insertions(+), 1 deletion(-)
1010

1111
diff --git a/bazel/dependency_imports.bzl b/bazel/dependency_imports.bzl
12-
index addee4f6af..dc1967e43b 100644
12+
index addee4f6af74ea78ae778b73384e01db83ac6694..dc1967e43b2b71358d2767a3d83b52819987290d 100644
1313
--- a/bazel/dependency_imports.bzl
1414
+++ b/bazel/dependency_imports.bzl
1515
@@ -26,7 +26,11 @@ JQ_VERSION = "1.7"
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Paul Meyer <[email protected]>
3+
Date: Thu, 2 Jan 2025 09:32:41 +0100
4+
Subject: [PATCH] nixpkgs: patch boringssl for gcc14
5+
6+
Signed-off-by: Paul Meyer <[email protected]>
7+
---
8+
bazel/boringssl-gcc14.patch | 25 +++++++++++++++++++++++++
9+
bazel/repositories.bzl | 1 +
10+
2 files changed, 26 insertions(+)
11+
create mode 100644 bazel/boringssl-gcc14.patch
12+
13+
diff --git a/bazel/boringssl-gcc14.patch b/bazel/boringssl-gcc14.patch
14+
new file mode 100644
15+
index 0000000000000000000000000000000000000000..8dcad4cc11f691eec93efa29075c1d356732e58b
16+
--- /dev/null
17+
+++ b/bazel/boringssl-gcc14.patch
18+
@@ -0,0 +1,25 @@
19+
+diff --git a/crypto/internal.h b/crypto/internal.h
20+
+index a77102d..a45f97b 100644
21+
+--- a/crypto/internal.h
22+
++++ b/crypto/internal.h
23+
+@@ -1174,6 +1174,11 @@
24+
+
25+
+ // Arithmetic functions.
26+
+
27+
++// The most efficient versions of these functions on GCC and Clang depend on C11
28+
++// |_Generic|. If we ever need to call these from C++, we'll need to add a
29+
++// variant that uses C++ overloads instead.
30+
++#if !defined(__cplusplus)
31+
++
32+
+ // CRYPTO_addc_* returns |x + y + carry|, and sets |*out_carry| to the carry
33+
+ // bit. |carry| must be zero or one.
34+
+ #if OPENSSL_HAS_BUILTIN(__builtin_addc)
35+
+@@ -1275,6 +1280,8 @@
36+
+ #define CRYPTO_subc_w CRYPTO_subc_u32
37+
+ #endif
38+
+
39+
++#endif // !__cplusplus
40+
++
41+
+
42+
+ // FIPS functions.
43+
+
44+
diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl
45+
index 5cb573770f0aeac7b42d803673c8c520b5e35131..e864ef24db4bf837ef50d90c8eca316eba939d74 100644
46+
--- a/bazel/repositories.bzl
47+
+++ b/bazel/repositories.bzl
48+
@@ -264,6 +264,7 @@ def _boringssl():
49+
patch_args = ["-p1"],
50+
patches = [
51+
"@envoy//bazel:boringssl_static.patch",
52+
+ "@envoy//bazel:boringssl-gcc14.patch",
53+
],
54+
)
55+
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: "dependency-envoy[bot]"
3+
<148525496+dependency-envoy[bot]@users.noreply.github.com>
4+
Date: Fri, 8 Nov 2024 21:09:22 +0000
5+
Subject: [PATCH] deps: Bump `rules_rust` -> 0.54.1 (#37056)
6+
7+
Fix #37054
8+
9+
Signed-off-by: dependency-envoy[bot] <148525496+dependency-envoy[bot]@users.noreply.github.com>
10+
Signed-off-by: Ryan Northey <[email protected]>
11+
---
12+
bazel/repository_locations.bzl | 10 ++++++---
13+
.../dynamic_modules/sdk/rust/Cargo.Bazel.lock | 21 +++++++++++--------
14+
2 files changed, 19 insertions(+), 12 deletions(-)
15+
16+
diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl
17+
index 85a125d44ece6c655f94aab3d986d96ab837897f..cfe7d145b59b691f6455b58b1baaae48276b7e9f 100644
18+
--- a/bazel/repository_locations.bzl
19+
+++ b/bazel/repository_locations.bzl
20+
@@ -1465,12 +1465,16 @@ REPOSITORY_LOCATIONS_SPEC = dict(
21+
license = "Emscripten SDK",
22+
license_url = "https://github.com/emscripten-core/emsdk/blob/{version}/LICENSE",
23+
),
24+
+ # After updating you may need to run:
25+
+ #
26+
+ # CARGO_BAZEL_REPIN=1 bazel sync --only=crate_index
27+
+ #
28+
rules_rust = dict(
29+
project_name = "Bazel rust rules",
30+
project_desc = "Bazel rust rules (used by Wasm)",
31+
project_url = "https://github.com/bazelbuild/rules_rust",
32+
- version = "0.51.0",
33+
- sha256 = "042acfb73469b2d1848fe148d81c3422c61ea47a9e1900f1c9ec36f51e8e7193",
34+
+ version = "0.54.1",
35+
+ sha256 = "af4f56caae50a99a68bfce39b141b509dd68548c8204b98ab7a1cafc94d5bb02",
36+
# Note: rules_rust should point to the releases, not archive to avoid the hassle of bootstrapping in crate_universe.
37+
# This is described in https://bazelbuild.github.io/rules_rust/crate_universe.html#setup, otherwise bootstrap
38+
# is required which in turn requires a system CC toolchains, not the bazel controlled ones.
39+
@@ -1482,7 +1486,7 @@ REPOSITORY_LOCATIONS_SPEC = dict(
40+
],
41+
implied_untracked_deps = ["rules_cc"],
42+
extensions = ["envoy.wasm.runtime.wasmtime"],
43+
- release_date = "2024-09-19",
44+
+ release_date = "2024-11-07",
45+
cpe = "N/A",
46+
license = "Apache-2.0",
47+
license_url = "https://github.com/bazelbuild/rules_rust/blob/{version}/LICENSE.txt",
48+
diff --git a/source/extensions/dynamic_modules/sdk/rust/Cargo.Bazel.lock b/source/extensions/dynamic_modules/sdk/rust/Cargo.Bazel.lock
49+
index fa6012f406464428b37d548eecd6cec3fdaf901b..6af752304b65af39aa621fa201a8c0108931dad0 100644
50+
--- a/source/extensions/dynamic_modules/sdk/rust/Cargo.Bazel.lock
51+
+++ b/source/extensions/dynamic_modules/sdk/rust/Cargo.Bazel.lock
52+
@@ -1,5 +1,5 @@
53+
{
54+
- "checksum": "96b309ddded40cf6f46a62829d15a02d7253b4cc94af2ac1890e492f9c07e93f",
55+
+ "checksum": "b550022ca979d6b55c6dbee950bbf18368e4b8da16973c4e88e292b4d6f28e81",
56+
"crates": {
57+
"aho-corasick 1.1.3": {
58+
"name": "aho-corasick",
59+
@@ -2149,9 +2149,6 @@
60+
"aarch64-apple-ios-sim": [
61+
"aarch64-apple-ios-sim"
62+
],
63+
- "aarch64-fuchsia": [
64+
- "aarch64-fuchsia"
65+
- ],
66+
"aarch64-linux-android": [
67+
"aarch64-linux-android"
68+
],
69+
@@ -2159,6 +2156,9 @@
70+
"aarch64-pc-windows-msvc": [
71+
"aarch64-pc-windows-msvc"
72+
],
73+
+ "aarch64-unknown-fuchsia": [
74+
+ "aarch64-unknown-fuchsia"
75+
+ ],
76+
"aarch64-unknown-linux-gnu": [
77+
"aarch64-unknown-linux-gnu"
78+
],
79+
@@ -2197,8 +2197,8 @@
80+
"aarch64-apple-darwin",
81+
"aarch64-apple-ios",
82+
"aarch64-apple-ios-sim",
83+
- "aarch64-fuchsia",
84+
"aarch64-linux-android",
85+
+ "aarch64-unknown-fuchsia",
86+
"aarch64-unknown-linux-gnu",
87+
"aarch64-unknown-nixos-gnu",
88+
"aarch64-unknown-nto-qnx710",
89+
@@ -2213,9 +2213,9 @@
90+
"s390x-unknown-linux-gnu",
91+
"x86_64-apple-darwin",
92+
"x86_64-apple-ios",
93+
- "x86_64-fuchsia",
94+
"x86_64-linux-android",
95+
"x86_64-unknown-freebsd",
96+
+ "x86_64-unknown-fuchsia",
97+
"x86_64-unknown-linux-gnu",
98+
"x86_64-unknown-nixos-gnu"
99+
],
100+
@@ -2264,15 +2264,15 @@
101+
"wasm32-wasi": [
102+
"wasm32-wasi"
103+
],
104+
+ "wasm32-wasip1": [
105+
+ "wasm32-wasip1"
106+
+ ],
107+
"x86_64-apple-darwin": [
108+
"x86_64-apple-darwin"
109+
],
110+
"x86_64-apple-ios": [
111+
"x86_64-apple-ios"
112+
],
113+
- "x86_64-fuchsia": [
114+
- "x86_64-fuchsia"
115+
- ],
116+
"x86_64-linux-android": [
117+
"x86_64-linux-android"
118+
],
119+
@@ -2283,6 +2283,9 @@
120+
"x86_64-unknown-freebsd": [
121+
"x86_64-unknown-freebsd"
122+
],
123+
+ "x86_64-unknown-fuchsia": [
124+
+ "x86_64-unknown-fuchsia"
125+
+ ],
126+
"x86_64-unknown-linux-gnu": [
127+
"x86_64-unknown-linux-gnu"
128+
],

pkgs/by-name/en/envoy/package.nix

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
bazel-gazelle,
55
buildBazelPackage,
66
fetchFromGitHub,
7+
applyPatches,
78
stdenv,
89
cacert,
910
cargo,
@@ -31,30 +32,52 @@ let
3132
# people should update both.
3233
version = "1.32.0";
3334
rev = "86dc7ef91ca15fb4957a74bd599397413fc26a24";
34-
hash = "sha256-Wcbt62RfaNcTntmPjaAM0cP3LJangm4ht7Q0bzEpu5A=";
35+
hash = "sha256-Sb87yQXtNbKrqPVujPbfOE+Y8ARmW+HyqMmLLa5tPmA=";
3536
};
3637

3738
# these need to be updated for any changes to fetchAttrs
3839
depsHash =
3940
{
40-
x86_64-linux = "sha256-LkDNPFT7UUCsGPG1dMnwzdIw0lzc5+3JYDoblF5oZVk=";
41+
x86_64-linux = "sha256-KQ0ZxLC/ZLLcypmb1UlVXvLWErLmxuednjKRFaBgKuQ=";
4142
aarch64-linux = "sha256-DkibjmY1YND9Q2aQ41bhNdch0SKM5ghY2mjYSQfV30M=";
4243
}
4344
.${stdenv.system} or (throw "unsupported system ${stdenv.system}");
45+
4446
in
4547
buildBazelPackage rec {
4648
pname = "envoy";
4749
inherit (srcVer) version;
4850
bazel = bazel_6;
49-
src = fetchFromGitHub {
50-
owner = "envoyproxy";
51-
repo = "envoy";
52-
inherit (srcVer) hash rev;
53-
54-
postFetch = ''
55-
chmod -R +w $out
56-
rm $out/.bazelversion
57-
echo ${srcVer.rev} > $out/SOURCE_VERSION
51+
52+
src = applyPatches {
53+
src = fetchFromGitHub {
54+
owner = "envoyproxy";
55+
repo = "envoy";
56+
inherit (srcVer) hash rev;
57+
};
58+
patches = [
59+
# use system Python, not bazel-fetched binary Python
60+
./0001-nixpkgs-use-system-Python.patch
61+
62+
# use system Go, not bazel-fetched binary Go
63+
./0002-nixpkgs-use-system-Go.patch
64+
65+
# use system C/C++ tools
66+
./0003-nixpkgs-use-system-C-C-toolchains.patch
67+
68+
# patch boringssl to work with GCC 14
69+
# vendored patch from https://boringssl.googlesource.com/boringssl/+/c70190368c7040c37c1d655f0690bcde2b109a0d
70+
./0004-nixpkgs-patch-boringssl-for-gcc14.patch
71+
72+
# update rust rules to work with rustc v1.83
73+
# cherry-pick of https://github.com/envoyproxy/envoy/commit/019f589da2cc8da7673edd077478a100b4d99436
74+
# drop with v1.33.x
75+
./0005-deps-Bump-rules_rust-0.54.1-37056.patch
76+
];
77+
postPatch = ''
78+
chmod -R +w .
79+
rm ./.bazelversion
80+
echo ${srcVer.rev} > ./SOURCE_VERSION
5881
'';
5982
};
6083

@@ -80,17 +103,6 @@ buildBazelPackage rec {
80103
mv bazel/nix/rules_rust.patch bazel/rules_rust.patch
81104
'';
82105

83-
patches = [
84-
# use system Python, not bazel-fetched binary Python
85-
./0001-nixpkgs-use-system-Python.patch
86-
87-
# use system Go, not bazel-fetched binary Go
88-
./0002-nixpkgs-use-system-Go.patch
89-
90-
# use system C/C++ tools
91-
./0003-nixpkgs-use-system-C-C-toolchains.patch
92-
];
93-
94106
nativeBuildInputs = [
95107
cmake
96108
python3

0 commit comments

Comments
 (0)