Skip to content

Commit

Permalink
feat(build): cross build for amazonlinux:2 x86_64
Browse files Browse the repository at this point in the history
  • Loading branch information
fffonion authored and AndyZhang0707 committed Jul 26, 2024
1 parent cdb8c25 commit 45fe650
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/matrix-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ build-packages:

# Amazon Linux
- label: amazonlinux-2
image: amazonlinux:2
package: rpm
package-type: aws2
check-manifest-suite: amazonlinux-2-amd64
bazel-args: --platforms=//:aws2-crossbuild-x86_64
- label: amazonlinux-2023
image: amazonlinux:2023
package: rpm
Expand Down
21 changes: 21 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,16 @@ platform(
for vendor in aarch64_glibc_distros
]

platform(
name = "aws2-crossbuild-x86_64",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
"//build/platforms/distro:aws2",
":cross_build",
],
)

# config_settings define a select() condition based on user-set constraint_values
# see https://bazel.build/docs/configurable-attributes
config_setting(
Expand All @@ -216,12 +226,23 @@ config_setting(
visibility = ["//visibility:public"],
)

config_setting(
name = "x86_64-linux-anylibc-cross",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
":cross_build",
],
visibility = ["//visibility:public"],
)

selects.config_setting_group(
# matches all cross build platforms
name = "any-cross",
match_any = [
":aarch64-linux-anylibc-cross",
":x86_64-linux-musl-cross",
":x86_64-linux-anylibc-cross",
],
visibility = ["//visibility:public"],
)
8 changes: 8 additions & 0 deletions build/toolchain/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ define_managed_toolchain(
vendor = "alpine",
)

define_managed_toolchain(
arch = "x86_64",
gcc_version = aarch64_glibc_distros["aws2"],
libc = "gnu",
target_compatible_with = ["//build/platforms/distro:aws2"],
vendor = "aws2",
)

[
define_managed_toolchain(
arch = "aarch64",
Expand Down
7 changes: 7 additions & 0 deletions build/toolchain/managed_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ def register_all_toolchains(name = None):
vendor = "alpine",
)

register_managed_toolchain(
arch = "x86_64",
gcc_version = "7",
libc = "gnu",
vendor = "aws2",
)

for vendor in aarch64_glibc_distros:
register_managed_toolchain(
arch = "aarch64",
Expand Down
8 changes: 8 additions & 0 deletions build/toolchain/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,11 @@ def toolchain_repositories():
strip_prefix = "aarch64-aws2-linux-gnu",
build_file_content = build_file_content,
)

http_archive(
name = "x86_64-aws2-linux-gnu-gcc-7",
url = "https://github.com/Kong/crosstool-ng-actions/releases/download/0.7.0/x86_64-aws2-linux-gnu-glibc-2.26-gcc-7.tar.gz",
sha256 = "645c242d13bf456ca59a7e9701e9d2f53336fd0497ccaff2b151da9921469985",
strip_prefix = "x86_64-aws2-linux-gnu",
build_file_content = build_file_content,
)
20 changes: 5 additions & 15 deletions scripts/explain_manifest/fixtures/amazonlinux-2-amd64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,37 @@

- Path : /usr/local/kong/lib/engines-1.1/afalg.so
Needed :
- libstdc++.so.6
- libm.so.6
- libcrypto.so.1.1
- libdl.so.2
- libc.so.6
Runpath : /usr/local/kong/lib
Rpath : /usr/local/kong/lib

- Path : /usr/local/kong/lib/engines-1.1/capi.so
Needed :
- libstdc++.so.6
- libm.so.6
- libcrypto.so.1.1
- libdl.so.2
- libc.so.6
Runpath : /usr/local/kong/lib
Rpath : /usr/local/kong/lib

- Path : /usr/local/kong/lib/engines-1.1/padlock.so
Needed :
- libstdc++.so.6
- libm.so.6
- libcrypto.so.1.1
- libdl.so.2
- libc.so.6
Runpath : /usr/local/kong/lib
Rpath : /usr/local/kong/lib

- Path : /usr/local/kong/lib/libcrypto.so.1.1
Needed :
- libstdc++.so.6
- libm.so.6
- libdl.so.2
- libc.so.6
Runpath : /usr/local/kong/lib
Rpath : /usr/local/kong/lib

- Path : /usr/local/kong/lib/libssl.so.1.1
Needed :
- libstdc++.so.6
- libm.so.6
- libcrypto.so.1.1
- libdl.so.2
- libc.so.6
Runpath : /usr/local/kong/lib
Rpath : /usr/local/kong/lib

- Path : /usr/local/lib/lua/5.1/lfs.so
Needed :
Expand Down

0 comments on commit 45fe650

Please sign in to comment.