blob: 8fb6c0fbf4b10567f0539e0346d2ddfce91ae076 [file] [log] [blame]
load("@io_bazel_rules_docker//container:container.bzl", "container_push")
load("@io_bazel_rules_docker//docker/util:run.bzl", "container_run_and_commit")
##################################
# Linux RBE toolchain container. #
##################################
# Generates a Linux RBE toolchain container image for SkCMS.
#
# This container can be pushed to GCR via the //:push_rbe_container_skcms_linux rule.
#
# To debug this image:
#
# # Build the container image.
# $ bazel build //:rbe_container_skcms_linux
#
# # Load the container.
# $ docker load -i bazel-bin/rbe_container_skcms_linux_commit.tar
# Loaded image: bazel-bin/default:rbe_container_skcms_linux
#
# # Run the container.
# $ docker run -it bazel/default:rbe_container_skcms_linux /bin/bash
container_run_and_commit(
name = "rbe_container_skcms_linux",
commands = [
# Install the packages needed to build SkCMS.
"apt-get update",
"apt-get install -y clang"
],
image = "@ubuntu1804//image",
tags = [
"manual", # Exclude it from wildcard queries, e.g. "bazel build //...".
"no-remote",
],
)
# This target can be used to upload the custom RBE container toolchain to GCR. It will be available
# as gcr.io/skia-public/rbe-container-skcms-linux.
#
# Note: this can take several minutes to finish because it will upload a >3GB .tar file to GCR.
container_push(
name = "push_rbe_container_skcms_linux",
format = "Docker",
image = ":rbe_container_skcms_linux_commit.tar", # Generated by //:rbe_container_skcms_linux.
registry = "gcr.io",
repository = "skia-public/rbe-container-skcms-linux",
tag = "{STABLE_DOCKER_TAG}",
tags = [
"manual", # Exclude it from wildcard queries, e.g. "bazel build //...".
"no-remote", # We cannot build containers on RBE.
],
)
#########
# SkCMS #
#########
cc_library(
name = "skcms",
srcs = [
"skcms.cc",
"skcms_internal.h",
"src/Transform_inl.h",
],
hdrs = ["skcms.h"],
visibility = ["//visibility:public"],
)
cc_library(
name = "test_only",
testonly = True,
srcs = ["test_only.c"],
hdrs = ["test_only.h"],
deps = [":skcms"],
)
cc_test(
name = "tests",
size = "small",
srcs = ["tests.c"],
data = glob(["profiles/**"]),
deps = [
":skcms",
":test_only",
],
)
cc_binary(
name = "iccdump",
testonly = True,
srcs = ["iccdump.c"],
linkopts = ["-ldl"],
deps = [
":skcms",
":test_only",
],
)
cc_binary(
name = "bench",
srcs = ["bench.c"],
deps = [":skcms"],
)