Skip to content

Commit b86721d

Browse files
jwendellclaude
andcommitted
Configure Bazel build system for OpenSSL and multi-architecture support
This commit adapts the Bazel build configuration to support building Envoy with OpenSSL instead of BoringSSL, and adds support for s390x and ppc64le architectures. Build system changes: - Add bssl-compat as local_repository in WORKSPACE - Configure OpenSSL as external dependency (bazel/external/openssl.BUILD) - Disable QUIC/HTTP3 support (uses boringssl=fips mode to exclude QUIC) - Add nofips tag filtering to exclude QUIC tests and code Multi-architecture support: - s390x patches: BoringSSL, Quiche, gRPC, proxy-wasm, rules_foreign_cc - ppc64le patches: V8, luajit2 support - Architecture-specific build flags for missing headers (hwcap.h) Dependency patches: - jwt_verify_lib: Handle OpenSSL opaque structures - proxy_wasm_cpp_host: Remove hardcoded -lcrypto on s390x - rules_foreign_cc: Build fixes for s390x - rules_go: ppc64le build support OpenSSL-specific configuration (openssl/bazelrc): - Test environment limited to IPv4 only - QUIC excluded via boringssl=fips define - LLVM/Clang paths for bssl-compat prefixer tool 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Jonh Wendell <jwendell@redhat.com>
1 parent 4428b96 commit b86721d

26 files changed

Lines changed: 1607 additions & 55 deletions

.bazelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,3 +599,5 @@ try-import %workspace%/repo.bazelrc
599599
try-import %workspace%/clang.bazelrc
600600
try-import %workspace%/user.bazelrc
601601
try-import %workspace%/local_tsan.bazelrc
602+
603+
import %workspace%/openssl/bazelrc

.gitmodules

Whitespace-only changes.

WORKSPACE

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
workspace(name = "envoy")
22

3+
local_repository(
4+
name = "bssl-compat",
5+
path = "bssl-compat",
6+
)
7+
38
load("//bazel:api_binding.bzl", "envoy_api_binding")
49

510
envoy_api_binding()

bazel/BUILD

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -547,25 +547,14 @@ config_setting(
547547
)
548548

549549
# Alias pointing to the selected version of BoringSSL:
550-
# - BoringSSL FIPS from @boringssl_fips//:ssl,
551-
# - non-FIPS BoringSSL from @boringssl//:ssl.
552-
# - aws-lc from @aws_lc//:ssl
553550
alias(
554551
name = "boringssl",
555-
actual = select({
556-
"//bazel:boringssl_fips_ppc": "@aws_lc//:ssl",
557-
"//bazel:boringssl_fips_not_ppc": "@boringssl_fips//:ssl",
558-
"//conditions:default": "@boringssl//:ssl",
559-
}),
552+
actual = "@envoy//bssl-compat:ssl"
560553
)
561554

562555
alias(
563556
name = "boringcrypto",
564-
actual = select({
565-
"//bazel:boringssl_fips_ppc": "@aws_lc//:crypto",
566-
"//bazel:boringssl_fips_not_ppc": "@boringssl_fips//:crypto",
567-
"//conditions:default": "@boringssl//:crypto",
568-
}),
557+
actual = "@envoy//bssl-compat:crypto"
569558
)
570559

571560
config_setting(

bazel/envoy_build_system.bzl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,14 @@ def envoy_contrib_package():
9292
def _envoy_directory_genrule_impl(ctx):
9393
tree = ctx.actions.declare_directory(ctx.attr.name + ".outputs")
9494
ctx.actions.run_shell(
95-
inputs = ctx.files.srcs,
95+
inputs = ctx.files.srcs + ctx.files._openssl_libs,
9696
tools = ctx.files.tools,
9797
outputs = [tree],
9898
command = "mkdir -p " + tree.path + " && " + ctx.expand_location(ctx.attr.cmd),
99-
env = {"GENRULE_OUTPUT_DIR": tree.path},
99+
env = {
100+
"GENRULE_OUTPUT_DIR": tree.path,
101+
"LD_LIBRARY_PATH": ":".join([f.dirname for f in ctx.files._openssl_libs]),
102+
},
100103
use_default_shell_env = True,
101104
toolchain = None,
102105
)
@@ -108,6 +111,10 @@ envoy_directory_genrule = rule(
108111
"srcs": attr.label_list(),
109112
"cmd": attr.string(),
110113
"tools": attr.label_list(),
114+
"_openssl_libs": attr.label(
115+
default = Label("@openssl//:libs"),
116+
allow_files = True,
117+
),
111118
},
112119
)
113120

bazel/envoy_select.bzl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ def envoy_cc_platform_dep(name):
1111
"//conditions:default": [name + "_posix"],
1212
})
1313

14+
# When building on bssl-compat, ignore whether we are building with BoringSSL
15+
# in FIPS or non FIPS mode, and just pretend it's in the default non-FIPS mode.
1416
def envoy_select_boringssl(if_fips, default = None, if_disabled = None):
1517
return select({
16-
"@envoy//bazel:boringssl_fips": if_fips,
18+
"@envoy//bazel:boringssl_fips": default or [],
1719
"@envoy//bazel:boringssl_disabled": if_disabled or [],
1820
"//conditions:default": default or [],
1921
})

bazel/external/openssl.BUILD

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
load("@rules_foreign_cc//foreign_cc:configure.bzl", "configure_make")
2+
3+
licenses(["notice"]) # Apache 2
4+
5+
filegroup(
6+
name = "all",
7+
srcs = glob(["**"]),
8+
visibility = ["//visibility:public"],
9+
)
10+
11+
configure_make(
12+
name = "openssl",
13+
lib_source = ":all",
14+
configure_in_place = True,
15+
configure_command = "Configure",
16+
configure_options = ["--libdir=lib"],
17+
targets = ["build_sw", "install_sw"],
18+
args = ["-j"],
19+
out_lib_dir = "lib",
20+
out_shared_libs = ["libssl.so.3", "libcrypto.so.3"],
21+
visibility = ["//visibility:public"],
22+
)
23+
24+
filegroup(
25+
name = "libssl",
26+
srcs = [":openssl"],
27+
output_group = "libssl.so.3",
28+
visibility = ["//visibility:private"],
29+
)
30+
31+
filegroup(
32+
name = "libcrypto",
33+
srcs = [":openssl"],
34+
output_group = "libcrypto.so.3",
35+
visibility = ["//visibility:private"],
36+
)
37+
38+
filegroup(
39+
name = "libs",
40+
srcs = [":libssl", ":libcrypto"],
41+
visibility = ["//visibility:public"],
42+
)

0 commit comments

Comments
 (0)