Skip to content

Commit 4817d27

Browse files
clnperezenea-alav
authored andcommitted
ppc64le build (envoyproxy#4183) - skip luajit (AArch64 too)
Build for Linux on Power (ppc64le). There is no luajit support for ppc64le, so this PR puts in logic to not add that recipe to the sandbox speedup that envoy uses for its build. There were already some differences taken into account for Windows, so hopefully this isn't too far out there. Description: Build for Linux on Power (ppc64le). Risk Level: low Testing: manual + have built this into istio/proxy for a few releases now Docs Changes: Would need to add a bit about Power support Release Notes: same [Alexandru.Avadanii@enea.com] - rebase for whitespaces changes; - extend the same mechanism to also apply to AArch64; Signed-off-by: Christy Norman <christy@linux.vnet.ibm.com> Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
1 parent 8b26428 commit 4817d27

File tree

4 files changed

+53
-14
lines changed

4 files changed

+53
-14
lines changed

bazel/BUILD

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ genrule(
3535
stamp = 1,
3636
)
3737

38+
config_setting(
39+
name = "linux_ppc",
40+
values = {"cpu": "ppc"},
41+
)
42+
43+
config_setting(
44+
name = "linux_aarch64",
45+
values = {"cpu": "aarch64"},
46+
)
47+
3848
config_setting(
3949
name = "opt_build",
4050
values = {"compilation_mode": "opt"},

bazel/repositories.bzl

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ load(":patched_http_archive.bzl", "patched_http_archive")
88
load(":repository_locations.bzl", "REPOSITORY_LOCATIONS")
99
load(":target_recipes.bzl", "TARGET_RECIPES")
1010

11+
# dict of {build recipe name: longform extension name,}
12+
PPC_SKIP_TARGETS = {"luajit": "envoy.filters.http.lua"}
13+
1114
def _repository_impl(name, **kwargs):
1215
# `existing_rule_keys` contains the names of repositories that have already
1316
# been defined in the Bazel workspace. By skipping repos with existing keys,
@@ -60,13 +63,16 @@ def _repository_impl(name, **kwargs):
6063
**kwargs)
6164

6265
def _build_recipe_repository_impl(ctxt):
66+
# modify the recipes list based on the build context
67+
recipes = _apply_dep_blacklist(ctxt, ctxt.attr.recipes)
68+
6369
# Setup the build directory with links to the relevant files.
6470
ctxt.symlink(Label("//bazel:repositories.sh"), "repositories.sh")
6571
ctxt.symlink(Label("//ci/build_container:build_and_install_deps.sh"),
6672
"build_and_install_deps.sh")
6773
ctxt.symlink(Label("//ci/build_container:recipe_wrapper.sh"), "recipe_wrapper.sh")
6874
ctxt.symlink(Label("//ci/build_container:Makefile"), "Makefile")
69-
for r in ctxt.attr.recipes:
75+
for r in recipes:
7076
ctxt.symlink(Label("//ci/build_container/build_recipes:" + r + ".sh"),
7177
"build_recipes/" + r + ".sh")
7278
ctxt.symlink(Label("//ci/prebuilt:BUILD"), "BUILD")
@@ -75,7 +81,7 @@ def _build_recipe_repository_impl(ctxt):
7581
environment = {}
7682
print("Fetching external dependencies...")
7783
result = ctxt.execute(
78-
["./repositories.sh"] + ctxt.attr.recipes,
84+
["./repositories.sh"] + recipes,
7985
environment = environment,
8086
quiet = False,
8187
)
@@ -208,6 +214,7 @@ def envoy_dependencies(path = "@envoy_deps//", skip_targets = []):
208214
name = "envoy_deps",
209215
recipes = recipes.to_list(),
210216
)
217+
211218
for t in TARGET_RECIPES:
212219
if t not in skip_targets:
213220
native.bind(
@@ -464,3 +471,19 @@ def _com_github_google_jwt_verify():
464471
name = "jwt_verify_lib",
465472
actual = "@com_github_google_jwt_verify//:jwt_verify_lib",
466473
)
474+
475+
def _apply_dep_blacklist(ctxt, recipes):
476+
newlist = []
477+
skip_list = dict()
478+
if _is_linux_ppc_or_aarch64(ctxt):
479+
skip_list = PPC_SKIP_TARGETS
480+
for t in recipes:
481+
if t not in skip_list.keys():
482+
newlist.append(t)
483+
return newlist
484+
485+
def _is_linux_ppc_or_aarch64(ctxt):
486+
if ctxt.os.name != "linux":
487+
return False
488+
res = ctxt.execute(["uname", "-m"])
489+
return "ppc" in res.stdout or "aarch64" in res.stdout

source/exe/BUILD

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ load(
1010
"//source/extensions:all_extensions.bzl",
1111
"envoy_all_extensions",
1212
)
13+
load("//bazel:repositories.bzl", "PPC_SKIP_TARGETS")
1314

1415
envoy_package()
1516

@@ -37,7 +38,11 @@ envoy_cc_library(
3738
"//source/server:options_lib",
3839
"//source/server:server_lib",
3940
"//source/server:test_hooks_lib",
40-
] + envoy_all_extensions(),
41+
] + select({
42+
"//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS),
43+
"//bazel:linux_aarch64": envoy_all_extensions(PPC_SKIP_TARGETS),
44+
"//conditions:default": envoy_all_extensions(),
45+
}),
4146
)
4247

4348
envoy_cc_library(
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
load("@envoy_build_config//:extensions_build_config.bzl", "EXTENSIONS")
22

33
# Return all extensions to be compiled into Envoy.
4-
def envoy_all_extensions():
5-
# These extensions are registered using the extension system but are required for the core
6-
# Envoy build.
7-
all_extensions = [
8-
"//source/extensions/transport_sockets/raw_buffer:config",
9-
"//source/extensions/transport_sockets/ssl:config",
10-
]
4+
def envoy_all_extensions(blacklist = dict()):
5+
# These extensions are registered using the extension system but are required for the core
6+
# Envoy build.
7+
all_extensions = [
8+
"//source/extensions/transport_sockets/raw_buffer:config",
9+
"//source/extensions/transport_sockets/ssl:config",
10+
]
1111

12-
# These extensions can be removed on a site specific basis.
13-
for path in EXTENSIONS.values():
14-
all_extensions.append(path)
12+
# These extensions can be removed on a site specific basis.
13+
for name, path in EXTENSIONS.items():
14+
if not name in blacklist.values():
15+
all_extensions.append(path)
1516

16-
return all_extensions
17+
return all_extensions

0 commit comments

Comments
 (0)