Skip to content

Commit 064c396

Browse files
committed
ppc64le build
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. -- Another alternative is to have subproject for Power that has its own WORKSPACE file, like the ci, but in trying that route, I ran into the issue of not being able to read the build_id in the bazel-out directory (up a level). This way also has the advantage that you don't have to know to change directories if you want to build for Power. And hopefully we can do the same checks for ARM. Signed-off-by: Christy Norman <christy@linux.vnet.ibm.com>
1 parent 0c2e998 commit 064c396

File tree

4 files changed

+37
-6
lines changed

4 files changed

+37
-6
lines changed

bazel/BUILD

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ config_setting(
4040
values = {"cpu": "x64_windows"},
4141
)
4242

43+
config_setting(
44+
name = "linux_ppc",
45+
values = {"cpu": "ppc"},
46+
)
47+
4348
config_setting(
4449
name = "windows_opt_build",
4550
values = {

bazel/repositories.bzl

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ load(
1414
)
1515
load("@bazel_tools//tools/cpp:lib_cc_configure.bzl", "get_env_var")
1616

17+
# dict of {build recipe name: longform extension name,}
18+
PPC_SKIP_TARGETS = {"luajit": "envoy.filters.http.lua"}
19+
1720
def _repository_impl(name, **kwargs):
1821
# `existing_rule_keys` contains the names of repositories that have already
1922
# been defined in the Bazel workspace. By skipping repos with existing keys,
@@ -71,6 +74,9 @@ def _repository_impl(name, **kwargs):
7174
)
7275

7376
def _build_recipe_repository_impl(ctxt):
77+
# modify the recipes list based on the build context
78+
recipes = _apply_dep_blacklist(ctxt, ctxt.attr.recipes)
79+
7480
# Setup the build directory with links to the relevant files.
7581
ctxt.symlink(Label("//bazel:repositories.sh"), "repositories.sh")
7682
ctxt.symlink(Label("//bazel:repositories.bat"), "repositories.bat")
@@ -80,7 +86,7 @@ def _build_recipe_repository_impl(ctxt):
8086
)
8187
ctxt.symlink(Label("//ci/build_container:recipe_wrapper.sh"), "recipe_wrapper.sh")
8288
ctxt.symlink(Label("//ci/build_container:Makefile"), "Makefile")
83-
for r in ctxt.attr.recipes:
89+
for r in recipes:
8490
ctxt.symlink(
8591
Label("//ci/build_container/build_recipes:" + r + ".sh"),
8692
"build_recipes/" + r + ".sh",
@@ -99,9 +105,9 @@ def _build_recipe_repository_impl(ctxt):
99105
env["CXX"] = "cl"
100106
env["CXXFLAGS"] = "-DNDEBUG"
101107
env["CFLAGS"] = "-DNDEBUG"
102-
command = ["./repositories.bat"] + ctxt.attr.recipes
108+
command = ["./repositories.bat"] + recipes
103109
else:
104-
command = ["./repositories.sh"] + ctxt.attr.recipes
110+
command = ["./repositories.sh"] + recipes
105111

106112
print("Fetching external dependencies...")
107113
result = ctxt.execute(
@@ -259,6 +265,7 @@ def envoy_dependencies(path = "@envoy_deps//", skip_targets = []):
259265
name = "envoy_deps",
260266
recipes = recipes.to_list(),
261267
)
268+
262269
for t in TARGET_RECIPES:
263270
if t not in skip_targets:
264271
native.bind(
@@ -527,3 +534,19 @@ def _com_github_google_jwt_verify():
527534
name = "jwt_verify_lib",
528535
actual = "@com_github_google_jwt_verify//:jwt_verify_lib",
529536
)
537+
538+
def _apply_dep_blacklist(ctxt, recipes):
539+
newlist = []
540+
skip_list = dict()
541+
if _is_linux_ppc(ctxt):
542+
skip_list = PPC_SKIP_TARGETS
543+
for t in recipes:
544+
if t not in skip_list.keys():
545+
newlist.append(t)
546+
return newlist
547+
548+
def _is_linux_ppc(ctxt):
549+
if ctxt.os.name != "linux":
550+
return False
551+
res = ctxt.execute(["uname", "-m"])
552+
return "ppc" in res.stdout

source/exe/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ load(
1111
"envoy_all_extensions",
1212
"envoy_windows_extensions",
1313
)
14+
load("//bazel:repositories.bzl", "PPC_SKIP_TARGETS")
1415

1516
envoy_package()
1617

@@ -40,6 +41,7 @@ envoy_cc_library(
4041
"//source/server:test_hooks_lib",
4142
] + select({
4243
"//bazel:windows_x86_64": envoy_windows_extensions(),
44+
"//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS),
4345
"//conditions:default": envoy_all_extensions(),
4446
}),
4547
)

source/extensions/all_extensions.bzl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
load("@envoy_build_config//:extensions_build_config.bzl", "EXTENSIONS", "WINDOWS_EXTENSIONS")
22

33
# Return all extensions to be compiled into Envoy.
4-
def envoy_all_extensions():
4+
def envoy_all_extensions(blacklist = dict()):
55
# These extensions are registered using the extension system but are required for the core
66
# Envoy build.
77
all_extensions = [
@@ -10,8 +10,9 @@ def envoy_all_extensions():
1010
]
1111

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

1617
return all_extensions
1718

0 commit comments

Comments
 (0)