From 59901b1699a9129c81a95003651d94117f76787e Mon Sep 17 00:00:00 2001 From: Wangchong Zhou Date: Tue, 21 May 2024 16:30:52 +0800 Subject: [PATCH] fix(build): cleanup cross build flags --- BUILD.bazel | 8 ++++---- build/cross_deps/libxcrypt/BUILD.libxcrypt.bazel | 7 +++++-- build/cross_deps/libyaml/BUILD.libyaml.bazel | 7 +++++-- build/openresty/BUILD.openresty.bazel | 15 ++++++++++++++- build/openresty/openssl/openssl.bzl | 5 ++++- 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 1e38ea695cfb5..38ff5cafa7fd2 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -208,7 +208,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", @@ -229,7 +229,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", @@ -242,9 +242,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"], ) diff --git a/build/cross_deps/libxcrypt/BUILD.libxcrypt.bazel b/build/cross_deps/libxcrypt/BUILD.libxcrypt.bazel index 933172eec78fc..88880868add44 100644 --- a/build/cross_deps/libxcrypt/BUILD.libxcrypt.bazel +++ b/build/cross_deps/libxcrypt/BUILD.libxcrypt.bazel @@ -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", diff --git a/build/cross_deps/libyaml/BUILD.libyaml.bazel b/build/cross_deps/libyaml/BUILD.libyaml.bazel index ad4e48560df32..57139745a48f7 100644 --- a/build/cross_deps/libyaml/BUILD.libyaml.bazel +++ b/build/cross_deps/libyaml/BUILD.libyaml.bazel @@ -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", diff --git a/build/openresty/BUILD.openresty.bazel b/build/openresty/BUILD.openresty.bazel index cc4107cabc7cf..4aa563f43eed2 100644 --- a/build/openresty/BUILD.openresty.bazel +++ b/build/openresty/BUILD.openresty.bazel @@ -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", @@ -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", diff --git a/build/openresty/openssl/openssl.bzl b/build/openresty/openssl/openssl.bzl index 62aa72f34dc8b..400e2e880ef6e 100644 --- a/build/openresty/openssl/openssl.bzl +++ b/build/openresty/openssl/openssl.bzl @@ -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": [], }) + [