mirror of https://github.com/bazelbuild/rules_rust
Add s390x arch support (#2616)
This is continuing of https://github.com/bazelbuild/rules_rust/pull/2557 , added buildifier code changes for s390x arch also.
This commit is contained in:
parent
e97988273b
commit
3d1856b6b6
Binary file not shown.
|
@ -48,6 +48,9 @@ rust_library(
|
||||||
"@rules_rust//rust/platform:i686-unknown-linux-gnu": [
|
"@rules_rust//rust/platform:i686-unknown-linux-gnu": [
|
||||||
"errno", # i686-unknown-linux-gnu
|
"errno", # i686-unknown-linux-gnu
|
||||||
],
|
],
|
||||||
|
"@rules_rust//rust/platform:s390x-unknown-linux-gnu": [
|
||||||
|
"errno",
|
||||||
|
],
|
||||||
"@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [
|
"@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [
|
||||||
"errno", # x86_64-unknown-linux-gnu
|
"errno", # x86_64-unknown-linux-gnu
|
||||||
],
|
],
|
||||||
|
|
|
@ -53,6 +53,10 @@ rust_library(
|
||||||
"elf", # i686-unknown-linux-gnu
|
"elf", # i686-unknown-linux-gnu
|
||||||
"errno", # i686-unknown-linux-gnu
|
"errno", # i686-unknown-linux-gnu
|
||||||
],
|
],
|
||||||
|
"@rules_rust//rust/platform:s390x-unknown-linux-gnu": [
|
||||||
|
"elf", # s390x-unknown-linux-gnu
|
||||||
|
"errno", # s390x-unknown-linux-gnu
|
||||||
|
],
|
||||||
"@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [
|
"@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [
|
||||||
"elf", # x86_64-unknown-linux-gnu
|
"elf", # x86_64-unknown-linux-gnu
|
||||||
"errno", # x86_64-unknown-linux-gnu
|
"errno", # x86_64-unknown-linux-gnu
|
||||||
|
|
|
@ -3,14 +3,15 @@
|
||||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
|
||||||
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
|
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
|
||||||
|
|
||||||
_BUILDIFIER_VERSION = "7.1.1"
|
_BUILDIFIER_VERSION = "7.3.1"
|
||||||
_BUILDIFIER_URL_TEMPLATE = "https://github.com/bazelbuild/buildtools/releases/download/v{version}/{bin}"
|
_BUILDIFIER_URL_TEMPLATE = "https://github.com/bazelbuild/buildtools/releases/download/v{version}/{bin}"
|
||||||
_BUILDIFIER_INTEGRITY = {
|
_BUILDIFIER_INTEGRITY = {
|
||||||
"buildifier-darwin-amd64": "sha256-d0YNlXr3oCi7GK223EP6ZLbgAGTkc+rINoq4pwOzp0M=",
|
"buildifier-darwin-amd64": "sha256-N1+CMQPQFiCq7CCgwpxsvKmfT9ByWuMLk2VcZwT0TXE=",
|
||||||
"buildifier-darwin-arm64": "sha256-yZD0sDsn1qDYb/6TAUcypZwYurDE86TMVjS9OxYp/OM=",
|
"buildifier-darwin-arm64": "sha256-Wmr8asegn1RVuguJvZnVriO0F03F3J1sDtXOjKrD+BM=",
|
||||||
"buildifier-linux-amd64": "sha256-VLfyzo8idhz60mRBbpEgVq6chkX1nrZYO4RrSGSh7oM=",
|
"buildifier-linux-amd64": "sha256-VHTMUSinToBng9VAgfWBZixL6K5lAi9VfpKB7V3IgAk=",
|
||||||
"buildifier-linux-arm64": "sha256-HZrx9pVqQ5/KKHii+/dguXyl3wD2aeXRlTvrDEYHrHE=",
|
"buildifier-linux-arm64": "sha256-C/hsS//69PCO7Xe95bIILkrlA5oR4uiwOYTBc8NKVhw=",
|
||||||
"buildifier-windows-amd64.exe": "sha256-Mx2IPnyjbIu+KKHoUoqccRAvS+Yj+Tn6PSCk2PAEvqs=",
|
"buildifier-linux-s390x": "sha256-4tef9YhdRSdPdlMfGtvHtzoSn1nnZ/d36PveYz2dTi4=",
|
||||||
|
"buildifier-windows-amd64.exe": "sha256-NwzVdgda0pkwqC9d4TLxod5AhMeEqCUUvU2oDIWs9Kg=",
|
||||||
}
|
}
|
||||||
|
|
||||||
def crates_vendor_deps():
|
def crates_vendor_deps():
|
||||||
|
@ -54,6 +55,12 @@ def crates_vendor_deps_targets():
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
native.config_setting(
|
||||||
|
name = "linux_s390x",
|
||||||
|
constraint_values = ["@platforms//os:linux", "@platforms//cpu:s390x"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
native.config_setting(
|
native.config_setting(
|
||||||
name = "macos_amd64",
|
name = "macos_amd64",
|
||||||
constraint_values = ["@platforms//os:macos", "@platforms//cpu:x86_64"],
|
constraint_values = ["@platforms//os:macos", "@platforms//cpu:x86_64"],
|
||||||
|
@ -77,6 +84,7 @@ def crates_vendor_deps_targets():
|
||||||
actual = select({
|
actual = select({
|
||||||
":linux_amd64": "@cargo_bazel.buildifier-linux-amd64//file",
|
":linux_amd64": "@cargo_bazel.buildifier-linux-amd64//file",
|
||||||
":linux_arm64": "@cargo_bazel.buildifier-linux-arm64//file",
|
":linux_arm64": "@cargo_bazel.buildifier-linux-arm64//file",
|
||||||
|
":linux_s390x": "@cargo_bazel.buildifier-linux-s390x//file",
|
||||||
":macos_amd64": "@cargo_bazel.buildifier-darwin-amd64//file",
|
":macos_amd64": "@cargo_bazel.buildifier-darwin-amd64//file",
|
||||||
":macos_arm64": "@cargo_bazel.buildifier-darwin-arm64//file",
|
":macos_arm64": "@cargo_bazel.buildifier-darwin-arm64//file",
|
||||||
":windows": "@cargo_bazel.buildifier-windows-amd64.exe//file",
|
":windows": "@cargo_bazel.buildifier-windows-amd64.exe//file",
|
||||||
|
|
|
@ -114,7 +114,7 @@ def get_host_triple(repository_ctx, abi = None):
|
||||||
# Detect the host's cpu architecture
|
# Detect the host's cpu architecture
|
||||||
|
|
||||||
supported_architectures = {
|
supported_architectures = {
|
||||||
"linux": ["aarch64", "x86_64"],
|
"linux": ["aarch64", "x86_64", "s390x"],
|
||||||
"macos": ["aarch64", "x86_64"],
|
"macos": ["aarch64", "x86_64"],
|
||||||
"windows": ["aarch64", "x86_64"],
|
"windows": ["aarch64", "x86_64"],
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ DEFAULT_TOOLCHAIN_TRIPLES = {
|
||||||
"aarch64-apple-darwin": "rust_darwin_aarch64",
|
"aarch64-apple-darwin": "rust_darwin_aarch64",
|
||||||
"aarch64-pc-windows-msvc": "rust_windows_aarch64",
|
"aarch64-pc-windows-msvc": "rust_windows_aarch64",
|
||||||
"aarch64-unknown-linux-gnu": "rust_linux_aarch64",
|
"aarch64-unknown-linux-gnu": "rust_linux_aarch64",
|
||||||
|
"s390x-unknown-linux-gnu": "rust_linux_s390x",
|
||||||
"x86_64-apple-darwin": "rust_darwin_x86_64",
|
"x86_64-apple-darwin": "rust_darwin_x86_64",
|
||||||
"x86_64-pc-windows-msvc": "rust_windows_x86_64",
|
"x86_64-pc-windows-msvc": "rust_windows_x86_64",
|
||||||
"x86_64-unknown-freebsd": "rust_freebsd_x86_64",
|
"x86_64-unknown-freebsd": "rust_freebsd_x86_64",
|
||||||
|
|
|
@ -161,6 +161,13 @@ def _bin_has_native_dep_and_alwayslink_test_impl(ctx):
|
||||||
"bazel-out/x64_windows-{}/bin/{}test/unit/native_deps/alwayslink.lo.lib".format(compilation_mode, workspace_prefix),
|
"bazel-out/x64_windows-{}/bin/{}test/unit/native_deps/alwayslink.lo.lib".format(compilation_mode, workspace_prefix),
|
||||||
"-Wl,--no-whole-archive",
|
"-Wl,--no-whole-archive",
|
||||||
]
|
]
|
||||||
|
elif toolchain.target_arch == "s390x":
|
||||||
|
want = [
|
||||||
|
"-lstatic=native_dep",
|
||||||
|
"link-arg=-Wl,--whole-archive",
|
||||||
|
"link-arg=bazel-out/s390x-{}/bin/{}test/unit/native_deps/libalwayslink.lo".format(compilation_mode, workspace_prefix),
|
||||||
|
"link-arg=-Wl,--no-whole-archive",
|
||||||
|
]
|
||||||
else:
|
else:
|
||||||
want = [
|
want = [
|
||||||
"-lstatic=native_dep",
|
"-lstatic=native_dep",
|
||||||
|
@ -207,6 +214,13 @@ def _cdylib_has_native_dep_and_alwayslink_test_impl(ctx):
|
||||||
"bazel-out/x64_windows-{}/bin/{}test/unit/native_deps/alwayslink.lo.lib".format(compilation_mode, workspace_prefix),
|
"bazel-out/x64_windows-{}/bin/{}test/unit/native_deps/alwayslink.lo.lib".format(compilation_mode, workspace_prefix),
|
||||||
"-Wl,--no-whole-archive",
|
"-Wl,--no-whole-archive",
|
||||||
]
|
]
|
||||||
|
elif toolchain.target_arch == "s390x":
|
||||||
|
want = [
|
||||||
|
"-lstatic=native_dep{}".format(pic_suffix),
|
||||||
|
"link-arg=-Wl,--whole-archive",
|
||||||
|
"link-arg=bazel-out/s390x-{}/bin/{}test/unit/native_deps/libalwayslink{}.lo".format(compilation_mode, workspace_prefix, pic_suffix),
|
||||||
|
"link-arg=-Wl,--no-whole-archive",
|
||||||
|
]
|
||||||
else:
|
else:
|
||||||
want = [
|
want = [
|
||||||
"-lstatic=native_dep{}".format(pic_suffix),
|
"-lstatic=native_dep{}".format(pic_suffix),
|
||||||
|
|
Loading…
Reference in New Issue