Skip to content

Commit

Permalink
fix(build): cleanup cross build flags
Browse files Browse the repository at this point in the history
  • Loading branch information
fffonion authored and AndyZhang0707 committed Jul 26, 2024
1 parent 45fe650 commit 0e10023
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 11 deletions.
8 changes: 4 additions & 4 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ platform(
# config_settings define a select() condition based on user-set constraint_values
# see https://bazel.build/docs/configurable-attributes
config_setting(
name = "aarch64-linux-anylibc-cross",
name = "aarch64-linux-glibc-cross",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:aarch64",
Expand All @@ -227,7 +227,7 @@ config_setting(
)

config_setting(
name = "x86_64-linux-anylibc-cross",
name = "x86_64-linux-glibc-cross",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
Expand All @@ -240,9 +240,9 @@ selects.config_setting_group(
# matches all cross build platforms
name = "any-cross",
match_any = [
":aarch64-linux-anylibc-cross",
":aarch64-linux-glibc-cross",
":x86_64-linux-musl-cross",
":x86_64-linux-anylibc-cross",
":x86_64-linux-glibc-cross",
],
visibility = ["//visibility:public"],
)
7 changes: 5 additions & 2 deletions build/cross_deps/libxcrypt/BUILD.libxcrypt.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ configure_make(
configure_command = "configure",
configure_in_place = True,
configure_options = select({
"@kong//:aarch64-linux-anylibc-cross": [
"--host=aarch64-linux",
"@kong//:aarch64-linux-glibc-cross": [
"--host=aarch64-unknown-linux-gnu",
],
"@kong//:x86_64-linux-glibc-cross": [
"--host=x86_64-unknown-linux-gnu",
],
"@kong//:x86_64-linux-musl-cross": [
"--host=x86_64-linux-musl",
Expand Down
7 changes: 5 additions & 2 deletions build/cross_deps/libyaml/BUILD.libyaml.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ configure_make(
configure_command = "configure",
configure_in_place = True,
configure_options = select({
"@kong//:aarch64-linux-anylibc-cross": [
"--host=aarch64-linux",
"@kong//:aarch64-linux-glibc-cross": [
"--host=aarch64-unknown-linux-gnu",
],
"@kong//:x86_64-linux-glibc-cross": [
"--host=x86_64-unknown-linux-gnu",
],
"@kong//:x86_64-linux-musl-cross": [
"--host=x86_64-linux-musl",
Expand Down
17 changes: 15 additions & 2 deletions build/openresty/BUILD.openresty.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ CONFIGURE_OPTIONS = [
"--add-module=$$EXT_BUILD_ROOT$$/external/lua-kong-nginx-module",
"--add-module=$$EXT_BUILD_ROOT$$/external/lua-kong-nginx-module/stream",
] + select({
"@kong//:aarch64-linux-anylibc-cross": [
"@kong//:aarch64-linux-glibc-cross": [
"--crossbuild=Linux:aarch64",
"--with-endian=little",
"--with-int=4",
Expand All @@ -165,6 +165,19 @@ CONFIGURE_OPTIONS = [
"--with-time-t=8",
"--with-sys-nerr=132",
],
"@kong//:x86_64-linux-glibc-cross": [
"--crossbuild=Linux:x86_64",
"--with-endian=little",
"--with-int=4",
"--with-long=8",
"--with-long-long=8",
"--with-ptr-size=8",
"--with-sig-atomic-t=4",
"--with-size-t=8",
"--with-off-t=8",
"--with-time-t=8",
"--with-sys-nerr=132",
],
"@kong//:x86_64-linux-musl-cross": [
"--crossbuild=Linux:x86_64",
"--with-endian=little",
Expand All @@ -188,7 +201,7 @@ CONFIGURE_OPTIONS = [
}) + select({
# any cross build that migrated to use libxcrypt needs those flags
# alpine uses different libc so doesn't need it
"@kong//:aarch64-linux-anylibc-cross": [
"@kong//:aarch64-linux-glibc-cross": [
"--with-cc-opt=\"-I$$EXT_BUILD_DEPS$$/libxcrypt/include\"",
"--with-ld-opt=\"-L$$EXT_BUILD_DEPS$$/libxcrypt/lib\"",
],
Expand Down
5 changes: 4 additions & 1 deletion build/openresty/openssl/openssl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ load("@kong_bindings//:variables.bzl", "KONG_VAR")
# Read https://wiki.openssl.org/index.php/Compilation_and_Installation

CONFIGURE_OPTIONS = select({
"@kong//:aarch64-linux-anylibc-cross": [
"@kong//:aarch64-linux-glibc-cross": [
"linux-aarch64",
],
"@kong//:x86_64-linux-glibc-cross": [
"linux-x86_64",
],
# no extra args needed for "@kong//:x86_64-linux-musl-cross" or non-cross builds
"//conditions:default": [],
}) + [
Expand Down

0 comments on commit 0e10023

Please sign in to comment.