2023-01-09 20:42:51 +03:00
|
|
|
load("//bazel:common_settings.bzl", "string_flag")
|
2023-01-09 22:02:35 +03:00
|
|
|
load("@io_bazel_rules_docker//cc:image.bzl", "cc_image")
|
|
|
|
load("@io_bazel_rules_docker//container:container.bzl", "container_push")
|
2023-01-09 20:42:51 +03:00
|
|
|
|
2023-01-09 19:28:47 +03:00
|
|
|
#
|
|
|
|
# OS-CPU CONFIG SETTINGS
|
|
|
|
#
|
|
|
|
|
|
|
|
config_setting(
|
2023-01-09 22:52:35 +03:00
|
|
|
name = "linux_aarch64",
|
2023-01-09 19:28:47 +03:00
|
|
|
constraint_values = [
|
|
|
|
"@platforms//os:linux",
|
2023-01-09 22:52:35 +03:00
|
|
|
"@platforms//cpu:aarch64",
|
2023-01-09 19:28:47 +03:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
config_setting(
|
2023-01-09 20:42:51 +03:00
|
|
|
name = "linux_x86_64",
|
2023-01-09 19:28:47 +03:00
|
|
|
constraint_values = [
|
|
|
|
"@platforms//os:linux",
|
|
|
|
"@platforms//cpu:x86_64",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
config_setting(
|
2023-01-09 22:52:35 +03:00
|
|
|
name = "macos_aarch64",
|
2023-01-09 19:28:47 +03:00
|
|
|
constraint_values = [
|
|
|
|
"@platforms//os:macos",
|
2023-01-09 22:52:35 +03:00
|
|
|
"@platforms//cpu:aarch64",
|
2023-01-09 19:28:47 +03:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
config_setting(
|
2023-01-09 20:42:51 +03:00
|
|
|
name = "macos_x86_64",
|
2023-01-09 19:28:47 +03:00
|
|
|
constraint_values = [
|
|
|
|
"@platforms//os:macos",
|
|
|
|
"@platforms//cpu:x86_64",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
#
|
2023-01-09 20:42:51 +03:00
|
|
|
# COMPILERS
|
2023-01-09 19:28:47 +03:00
|
|
|
#
|
|
|
|
|
2023-01-09 20:42:51 +03:00
|
|
|
# Version flag for clang.
|
|
|
|
string_flag(
|
|
|
|
name = "clang_version",
|
2023-01-09 21:54:11 +03:00
|
|
|
# macOS uses `clang-14.0.0` by default.
|
|
|
|
build_setting_default = "14.0.0",
|
2023-01-09 20:42:51 +03:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
# Version flag for gcc.
|
|
|
|
string_flag(
|
|
|
|
name = "gcc_version",
|
2023-01-09 21:54:11 +03:00
|
|
|
# musl-cross-make uses `gcc-9.4.0` by default.
|
|
|
|
build_setting_default = "9.4.0",
|
2023-01-09 20:42:51 +03:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2023-01-09 19:28:47 +03:00
|
|
|
#
|
|
|
|
# PLATFORMS
|
|
|
|
#
|
2023-01-09 20:42:51 +03:00
|
|
|
# A platform takes one of two formats: `<compiler>-<os>-<cpu>` or `<os>-<cpu>`
|
|
|
|
# if the compiler is unspecified.
|
|
|
|
|
2023-01-09 22:52:35 +03:00
|
|
|
# Linux aarch64 platform with unspecified compiler.
|
2023-01-09 20:42:51 +03:00
|
|
|
platform(
|
2023-01-09 22:52:35 +03:00
|
|
|
name = "linux-aarch64",
|
2023-01-09 20:42:51 +03:00
|
|
|
constraint_values = [
|
|
|
|
"@platforms//os:linux",
|
2023-01-09 22:52:35 +03:00
|
|
|
"@platforms//cpu:aarch64",
|
2023-01-09 20:42:51 +03:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
# Linux x86_64 platform with unspecified compiler.
|
|
|
|
platform(
|
|
|
|
name = "linux-x86_64",
|
|
|
|
constraint_values = [
|
|
|
|
"@platforms//os:linux",
|
|
|
|
"@platforms//cpu:x86_64",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
# Linux x86_64 platform with gcc.
|
2023-01-09 19:28:47 +03:00
|
|
|
platform(
|
|
|
|
name = "gcc-linux-x86_64",
|
|
|
|
constraint_values = [
|
|
|
|
":gcc",
|
|
|
|
"@platforms//os:linux",
|
|
|
|
"@platforms//cpu:x86_64",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2023-01-09 21:05:24 +03:00
|
|
|
platform(
|
2023-01-09 22:52:35 +03:00
|
|
|
name = "macos-aarch64",
|
2023-01-09 21:05:24 +03:00
|
|
|
constraint_values = [
|
|
|
|
"@platforms//os:macos",
|
2023-01-09 22:52:35 +03:00
|
|
|
"@platforms//cpu:aarch64",
|
2023-01-09 21:05:24 +03:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2023-01-09 21:03:58 +03:00
|
|
|
platform(
|
2023-01-09 22:52:35 +03:00
|
|
|
name = "clang-macos-aarch64",
|
2023-01-09 21:03:58 +03:00
|
|
|
constraint_values = [
|
|
|
|
":clang",
|
|
|
|
"@platforms//os:macos",
|
2023-01-09 22:52:35 +03:00
|
|
|
"@platforms//cpu:aarch64",
|
2023-01-09 21:03:58 +03:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
platform(
|
2023-01-09 21:05:24 +03:00
|
|
|
name = "macos-x86_64",
|
2023-01-09 21:03:58 +03:00
|
|
|
constraint_values = [
|
|
|
|
"@platforms//os:macos",
|
2023-01-09 21:05:24 +03:00
|
|
|
"@platforms//cpu:x86_64",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
platform(
|
|
|
|
name = "clang-macos-x86_64",
|
|
|
|
constraint_values = [
|
|
|
|
":clang",
|
|
|
|
"@platforms//os:macos",
|
|
|
|
"@platforms//cpu:x86_64",
|
2023-01-09 21:03:58 +03:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2023-01-09 19:28:47 +03:00
|
|
|
alias(
|
|
|
|
name = "urbit",
|
|
|
|
actual = "//pkg/vere:urbit",
|
|
|
|
)
|
2023-01-09 22:02:35 +03:00
|
|
|
|
|
|
|
#
|
|
|
|
# DOCKER IMAGE
|
|
|
|
#
|
|
|
|
|
|
|
|
cc_image(
|
|
|
|
name = "docker",
|
|
|
|
binary = "//pkg/vere:urbit",
|
|
|
|
)
|
|
|
|
|
2023-01-10 22:05:38 +03:00
|
|
|
genrule(
|
|
|
|
name = "docker_tag",
|
|
|
|
visibility = ["//visibility:private"],
|
|
|
|
srcs = [
|
|
|
|
"//pkg/vere:PACE",
|
|
|
|
"//pkg/vere:VERSION",
|
|
|
|
],
|
|
|
|
outs = ["DOCKER_TAG"],
|
|
|
|
cmd = """
|
|
|
|
pace=`tr -d '\n' < $(execpath //pkg/vere:PACE)`
|
|
|
|
version=v`tr -d '\n' < $(execpath //pkg/vere:VERSION)`
|
|
|
|
echo "$$version-$$pace" > $@
|
|
|
|
""",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-01-09 22:02:35 +03:00
|
|
|
container_push(
|
|
|
|
name = "upload_docker",
|
|
|
|
format = "Docker",
|
|
|
|
image = ":docker",
|
|
|
|
registry = "docker.io",
|
|
|
|
repository = "tloncorp/vere-test",
|
2023-01-10 22:05:38 +03:00
|
|
|
tag_file = ":docker_tag",
|
2023-01-09 22:02:35 +03:00
|
|
|
)
|