bazel: use pure Go platform where possible

Before, we specified that the platform has glibc 2.23 under /usr/lib.
This is technically not important for statically linked Go binaries.
This commit is contained in:
Malte Poll 2023-11-23 17:12:54 +01:00
parent cbe08597c3
commit 45879c7360
3 changed files with 17 additions and 18 deletions

View File

@ -1,7 +1,6 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_cross_binary", "go_library")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files")
load("//bazel/go:platform.bzl", "platform_binary")
go_library(
name = "debugd_lib",
@ -38,10 +37,10 @@ go_binary(
visibility = ["//visibility:public"],
)
platform_binary(
go_cross_binary(
name = "debugd_linux_amd64",
platform = "@zig_sdk//libc_aware/platform:linux_amd64_gnu.2.23",
target_file = ":debugd",
platform = "//bazel/platforms:go-pure_x86_64-linux",
target = ":debugd",
visibility = ["//visibility:public"],
)
@ -61,6 +60,6 @@ pkg_tar(
":debugd_unit",
],
mode = "0755",
remap_paths = {"/platform:linux_amd64_gnu.2.23": "/usr/bin/debugd"},
remap_paths = {"/debugd_linux_amd64": "/usr/bin/debugd"},
visibility = ["//visibility:public"],
)

View File

@ -1,6 +1,5 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_cross_binary", "go_library")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("//bazel/go:platform.bzl", "platform_binary")
go_library(
name = "cmd_lib",
@ -22,13 +21,15 @@ go_library(
go_binary(
name = "cmd",
embed = [":cmd_lib"],
# keep
pure = "on",
visibility = ["//visibility:public"],
)
platform_binary(
go_cross_binary(
name = "measurement-reader_linux_amd64",
platform = "@zig_sdk//libc_aware/platform:linux_amd64_gnu.2.23",
target_file = ":cmd",
platform = "//bazel/platforms:go-pure_x86_64-linux",
target = ":cmd",
visibility = ["//visibility:public"],
)
@ -38,6 +39,6 @@ pkg_tar(
":measurement-reader_linux_amd64",
],
mode = "0755",
remap_paths = {"/platform:linux_amd64_gnu.2.23": "/usr/sbin/measurement-reader"},
remap_paths = {"/measurement-reader_linux_amd64": "/usr/sbin/measurement-reader"},
visibility = ["//visibility:public"],
)

View File

@ -1,6 +1,5 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_cross_binary", "go_library")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("//bazel/go:platform.bzl", "platform_binary")
go_library(
name = "cmd_lib",
@ -25,10 +24,10 @@ go_binary(
visibility = ["//visibility:public"],
)
platform_binary(
go_cross_binary(
name = "upgrade_agent_linux_amd64",
platform = "@zig_sdk//libc_aware/platform:linux_amd64_gnu.2.23",
target_file = ":cmd",
platform = "//bazel/platforms:go-pure_x86_64-linux",
target = ":cmd",
visibility = ["//visibility:public"],
)
@ -38,6 +37,6 @@ pkg_tar(
":upgrade_agent_linux_amd64",
],
mode = "0755",
remap_paths = {"/platform:linux_amd64_gnu.2.23": "/usr/bin/upgrade-agent"},
remap_paths = {"/upgrade_agent_linux_amd64": "/usr/bin/upgrade-agent"},
visibility = ["//visibility:public"],
)