Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ppc64le build #4183

Merged
merged 1 commit into from
Sep 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ config_setting(
values = {"cpu": "x64_windows"},
)

config_setting(
name = "linux_ppc",
values = {"cpu": "ppc"},
)

config_setting(
name = "windows_opt_build",
values = {
Expand Down
29 changes: 26 additions & 3 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ load(
)
load("@bazel_tools//tools/cpp:lib_cc_configure.bzl", "get_env_var")

# dict of {build recipe name: longform extension name,}
PPC_SKIP_TARGETS = {"luajit": "envoy.filters.http.lua"}

def _repository_impl(name, **kwargs):
# `existing_rule_keys` contains the names of repositories that have already
# been defined in the Bazel workspace. By skipping repos with existing keys,
Expand Down Expand Up @@ -71,6 +74,9 @@ def _repository_impl(name, **kwargs):
)

def _build_recipe_repository_impl(ctxt):
# modify the recipes list based on the build context
recipes = _apply_dep_blacklist(ctxt, ctxt.attr.recipes)

# Setup the build directory with links to the relevant files.
ctxt.symlink(Label("//bazel:repositories.sh"), "repositories.sh")
ctxt.symlink(Label("//bazel:repositories.bat"), "repositories.bat")
Expand All @@ -80,7 +86,7 @@ def _build_recipe_repository_impl(ctxt):
)
ctxt.symlink(Label("//ci/build_container:recipe_wrapper.sh"), "recipe_wrapper.sh")
ctxt.symlink(Label("//ci/build_container:Makefile"), "Makefile")
for r in ctxt.attr.recipes:
for r in recipes:
ctxt.symlink(
Label("//ci/build_container/build_recipes:" + r + ".sh"),
"build_recipes/" + r + ".sh",
Expand All @@ -99,9 +105,9 @@ def _build_recipe_repository_impl(ctxt):
env["CXX"] = "cl"
env["CXXFLAGS"] = "-DNDEBUG"
env["CFLAGS"] = "-DNDEBUG"
command = ["./repositories.bat"] + ctxt.attr.recipes
command = ["./repositories.bat"] + recipes
else:
command = ["./repositories.sh"] + ctxt.attr.recipes
command = ["./repositories.sh"] + recipes

print("Fetching external dependencies...")
result = ctxt.execute(
Expand Down Expand Up @@ -259,6 +265,7 @@ def envoy_dependencies(path = "@envoy_deps//", skip_targets = []):
name = "envoy_deps",
recipes = recipes.to_list(),
)

for t in TARGET_RECIPES:
if t not in skip_targets:
native.bind(
Expand Down Expand Up @@ -527,3 +534,19 @@ def _com_github_google_jwt_verify():
name = "jwt_verify_lib",
actual = "@com_github_google_jwt_verify//:jwt_verify_lib",
)

def _apply_dep_blacklist(ctxt, recipes):
newlist = []
skip_list = dict()
if _is_linux_ppc(ctxt):
skip_list = PPC_SKIP_TARGETS
for t in recipes:
if t not in skip_list.keys():
newlist.append(t)
return newlist

def _is_linux_ppc(ctxt):
if ctxt.os.name != "linux":
return False
res = ctxt.execute(["uname", "-m"])
return "ppc" in res.stdout
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dslomov is this the best practice we can use right now for achieving this? Any thoughts on how we can condition external dependencies in a cleaner way?

2 changes: 2 additions & 0 deletions source/exe/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ load(
"envoy_all_extensions",
"envoy_windows_extensions",
)
load("//bazel:repositories.bzl", "PPC_SKIP_TARGETS")

envoy_package()

Expand Down Expand Up @@ -40,6 +41,7 @@ envoy_cc_library(
"//source/server:test_hooks_lib",
] + select({
"//bazel:windows_x86_64": envoy_windows_extensions(),
"//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS),
"//conditions:default": envoy_all_extensions(),
}),
)
Expand Down
7 changes: 4 additions & 3 deletions source/extensions/all_extensions.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@envoy_build_config//:extensions_build_config.bzl", "EXTENSIONS", "WINDOWS_EXTENSIONS")

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

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

return all_extensions

Expand Down