vere/WORKSPACE.bazel
2023-04-11 18:03:57 -06:00

426 lines
16 KiB
Plaintext

# BUMPING A DEPENDENCY VERSION
#
# The general process for bumping the version of a dependency is as follows:
#
# (1) Update the `version` attribute in the dependency's repository rule (likely
# `versioned_http_archive()` or `versioned_http_file()`.
# (2) Download the source code of the new version of the dependency using
# the specified `url` attribute (substituting `{version}` with the actual
# version you're updating to in the URL).
# (3) Compute the SHA-256 hash of the new version's tarball (or zip archive)
# using `openssl`:
# ```
# $ openssl dgst -sha256 <path_to_compressed_depedency>
# ```
# (4) Update the `sha256` attribute in the dependency's repository rule with the
# SHA-256 hash from (3).
# (5) Run `bazel clean` to ensure that Bazel removes the old version of the
# dependency.
#
# If a dependency has documention specific to that dependency that conflicts
# with the process described above, adhere to the dependency-specific
# documentation.
#
# UPDATING A DEPENDENCY'S BUILD FILE
#
# It's unlikely that you'll need to update a dependency's build file, but if you
# do, you presumably know what you're doing. Nonetheless, here are a few useful
# bits of non-obvious information:
#
# - Build logic for a dependency resides within its `<dependency>.BUILD` file.
# `BUILD.bazel` is also present in the dependency's directory in
# `third_party/` to mark the directory as a package. Ideally, the logic in
# `<dependency>.BUILD` would live in `BUILD.bazel`, but Bazel 5.3.1 cannot
# find the source files of the dependency when `BUILD.bazel` holds the build
# logic (at least on my machine - ThinkPad X1 Carbon Gen 9, Arch Linux).
# - Whenever possible, avoid delegating to foreign build systems. Delegating is
# inevitable when a third party dependency has a particularly complicated
# build system that would be too difficult to replicate in Bazel (i.e.
# OpenSSL). However, delegate only as a last resort.
#
# PATCHING A DEPENDENCY
#
# If a dependency has a bug that prevents it from being used in the project,
# you can patch the dependency to fix it. We recommend the process below:
#
# (1) Make a change to the source of the dependency. If the change is
# platform-specific, wrap it in the appropriate URBIT_RUNTIME_* macro.
# We "gate" source patches with these macros so that we only ever need
# at most one patch per dependency.
# (a) CPU architecture macros: `URBIT_RUNTIME_CPU_{X86_64,AARCH64}`.
# (b) OS macros: `URBIT_RUNTIME_OS_{LINUX,DARWIN,BSD,MINGW}`.
# (2) Generate a patch file named <dependency_version>.patch and save it in
# `bazel/third_party/<dependency>`.
# (3) Update the dependency's targets to locally define the platform-specific
# patch macro(s). `select()` statements should be used to define the
# correct macro for the current platform.
# (4) Update the dependency's repository rule in WORKSPACE.bazel to include
# `patch_args = ["-p1"]` (assuming the patch was generated with `git diff`)
# and `patches = ["//bazel/third_party/<dependency>:<version>.patch"]`.
load("//bazel:repo.bzl", "versioned_http_archive", "versioned_http_file")
#
# RULES REPOSITORIES
#
versioned_http_archive(
name = "bazel_skylib",
sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
url = "https://github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz",
version = "1.3.0",
)
versioned_http_archive(
name = "rules_cc",
sha256 = "af6cc82d87db94585bceeda2561cb8a9d55ad435318ccb4ddfee18a43580fb5d",
strip_prefix = "rules_cc-{version}",
url = "https://github.com/bazelbuild/rules_cc/releases/download/{version}/rules_cc-{version}.tar.gz",
version = "0.0.4",
)
versioned_http_archive(
name = "rules_foreign_cc",
sha256 = "2a4d07cd64b0719b39a7c12218a3e507672b82a97b98c6a89d38565894cf7c51",
strip_prefix = "rules_foreign_cc-{version}",
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/refs/tags/{version}.tar.gz",
version = "0.9.0",
)
#
# TOOLCHAINS SETUP
#
# Use the toolchains we've configured.
register_toolchains(
"//bazel/toolchain:gcc-linux-aarch64-toolchain",
"//bazel/toolchain:clang-macos-aarch64-toolchain",
"//bazel/toolchain:clang-macos-x86_64-toolchain",
"//bazel/toolchain:gcc-linux-x86_64-toolchain",
)
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
# See https://bazelbuild.github.io/rules_foreign_cc/0.9.0/flatten.html#rules_foreign_cc_dependencies.
rules_foreign_cc_dependencies(
register_built_tools = False,
register_default_tools = False,
register_preinstalled_tools = True,
)
#
# THIRD PARTY DEPENDENCIES
#
versioned_http_archive(
name = "aes_siv",
build_file = "//bazel/third_party/aes_siv:aes_siv.BUILD",
sha256 = "1916a428dff480e06b09dc0fb1c9d849c048f838dc9b8d141452233b508f6bb1",
strip_prefix = "libaes_siv-{version}",
url = "https://github.com/dfoxfranke/libaes_siv/archive/{version}.tar.gz",
version = "9681279cfaa6e6399bb7ca3afbbc27fc2e19df4b",
)
versioned_http_archive(
name = "argon2",
build_file = "//bazel/third_party/argon2:argon2.BUILD",
sha256 = "40850e6e6324be10f14228d17b617ad2074bb926eeddd6fe40ad5df833833949",
strip_prefix = "argon2-{version}",
url = "https://github.com/urbit/argon2/archive/{version}.tar.gz",
version = "a4c1e3f7138c2e577376beb99f964cf71e1c8b1b",
)
versioned_http_archive(
name = "bazel_gazelle",
sha256 = "efbbba6ac1a4fd342d5122cbdfdb82aeb2cf2862e35022c752eaddffada7c3f3",
url = "https://github.com/bazelbuild/bazel-gazelle/releases/download/v{version}/bazel-gazelle-v{version}.tar.gz",
version = "0.27.0",
)
# See https://curl.se/docs/caextract.html.
versioned_http_file(
name = "ca_bundle",
sha256 = "2cff03f9efdaf52626bd1b451d700605dc1ea000c5da56bd0fc59f8f43071040",
url = "https://curl.se/ca/cacert-{version}.pem",
version = "2022-10-11",
)
versioned_http_archive(
name = "curl",
build_file = "//bazel/third_party/curl:curl.BUILD",
sha256 = "78a06f918bd5fde3c4573ef4f9806f56372b32ec1829c9ec474799eeee641c27",
strip_prefix = "curl-{version}",
url = "https://curl.se/download/curl-{version}.tar.gz",
version = "7.85.0",
)
versioned_http_archive(
name = "ed25519",
build_file = "//bazel/third_party/ed25519:ed25519.BUILD",
sha256 = "373923c85f61276e3cad2c0ae7a5d5cd4809ffe46c5abc1dc8276683a55782a0",
strip_prefix = "ed25519-{version}",
url = "https://github.com/orlp/ed25519/archive/{version}.tar.gz",
version = "7fa6712ef5d581a6981ec2b08ee623314cd1d1c4",
)
versioned_http_archive(
name = "gmp",
build_file = "//bazel/third_party/gmp:gmp.BUILD",
sha256 = "fd4829912cddd12f84181c3451cc752be224643e87fac497b69edddadc49b4f2",
strip_prefix = "gmp-{version}",
url = "https://gmplib.org/download/gmp/gmp-{version}.tar.xz",
version = "6.2.1",
)
versioned_http_archive(
name = "h2o",
build_file = "//bazel/third_party/h2o:h2o.BUILD",
patch_args = ["-p1"],
patches = ["//bazel/third_party/h2o:{version}.patch"],
sha256 = "f8cbc1b530d85ff098f6efc2c3fdbc5e29baffb30614caac59d5c710f7bda201",
strip_prefix = "h2o-{version}",
url = "https://github.com/h2o/h2o/archive/refs/tags/v{version}.tar.gz",
# When bumping the version, compare `CMakeLists.txt` in the `h2o` repo to
# {build_file} and confirm that {build_file} remains an accurate description
# of the h2o build process.
version = "2.2.6",
)
versioned_http_archive(
name = "io_bazel_rules_docker",
sha256 = "b1e80761a8a8243d03ebca8845e9cc1ba6c82ce7c5179ce2b295cd36f7e394bf",
url = "https://github.com/bazelbuild/rules_docker/releases/download/v{version}/rules_docker-v{version}.tar.gz",
version = "0.25.0",
)
versioned_http_archive(
name = "io_bazel_rules_go",
sha256 = "f2dcd210c7095febe54b804bb1cd3a58fe8435a909db2ec04e31542631cf715c",
url = "https://github.com/bazelbuild/rules_go/releases/download/v{version}/rules_go-v{version}.zip",
version = "0.31.0",
)
versioned_http_file(
name = "ivory_pill",
sha256 = "26ff86808886beb831e4a135f478e42ce83ef4a09ad24808b3fe97248ce7a6b7",
url = "https://github.com/urbit/urbit/blob/{version}/bin/ivory.pill?raw=true",
version = "721fa05",
)
versioned_http_file(
name = "solid_pill",
sha256 = "8b658fcee6978e2b19004a54233cab953e77ea0bb6c3a04d1bfda4ddc6be63c5",
url = "https://github.com/urbit/urbit/raw/{version}/bin/solid.pill",
version = "255fb1ca8206072f1d09425f0db61ecfe7ff5b17",
)
versioned_http_archive(
name = "keccak_tiny",
build_file = "//bazel/third_party/keccak_tiny:keccak_tiny.BUILD",
patch_args = ["-p1"],
patches = ["//bazel/third_party/keccak_tiny:{version}.patch"],
sha256 = "6d4717f96b84805886c74bad89e911076664d992f197634fd7cdfca2ac0f62ef",
strip_prefix = "keccak-tiny-{version}",
url = "https://github.com/coruus/keccak-tiny/archive/{version}.tar.gz",
version = "64b6647514212b76ae7bca0dea9b7b197d1d8186",
)
versioned_http_archive(
name = "lmdb",
build_file = "//bazel/third_party/lmdb:lmdb.BUILD",
patch_args = ["-p1"],
patches = ["//bazel/third_party/lmdb:{version}.patch"],
sha256 = "22054926b426c66d8f2bc22071365df6e35f3aacf19ad943bc6167d4cae3bebb",
strip_prefix = "lmdb-LMDB_{version}/libraries/liblmdb",
url = "https://github.com/LMDB/lmdb/archive/refs/tags/LMDB_{version}.tar.gz",
# When bumping the version, compare `libraries/liblmdb/Makefile` in the
# `lmdb` repo to {build_file} and confirm that {build_file} remains an
# accurate description of the lmdb build process.
version = "0.9.29",
)
versioned_http_archive(
name = "murmur3",
build_file = "//bazel/third_party/murmur3:murmur3.BUILD",
sha256 = "d81836605204df2db9e0c095423b2856073d1b2ef900463151d0663b7ca3164f",
strip_prefix = "murmur3-{version}",
url = "https://github.com/PeterScott/murmur3/archive/{version}.tar.gz",
# When bumping the version, compare `makefile` in the `murmur3` repo to
# {build_file} and confirm that {build_file} remains an accurate description
# of the murmur3 build process.
version = "dae94be0c0f54a399d23ea6cbe54bca5a4e93ce4",
)
versioned_http_archive(
name = "openssl",
build_file = "//bazel/third_party/openssl:openssl.BUILD",
sha256 = "8dee9b24bdb1dcbf0c3d1e9b02fb8f6bf22165e807f45adeb7c9677536859d3b",
strip_prefix = "openssl-{version}",
url = "https://www.openssl.org/source/openssl-{version}.tar.gz",
version = "1.1.1t",
)
versioned_http_archive(
name = "pdjson",
build_file = "//bazel/third_party/pdjson:pdjson.BUILD",
sha256 = "928913d44d9021d69c0d23a8f59ed67028e5abf1ae7910f79c23a7af4e779b92",
strip_prefix = "pdjson-{version}",
url = "https://github.com/skeeto/pdjson/archive/{version}.tar.gz",
# When bumping the version, compare `Makefile` in the `pdjson` repo to
# {build_file} and confirm that {build_file} remains an accurate description
# of the pdjson build process.
version = "67108d883061043e55d0fb13961ac1b6fc8a485c",
)
versioned_http_archive(
name = "scrypt",
build_file = "//bazel/third_party/scrypt:scrypt.BUILD",
sha256 = "df681fb19b653b1a12970ebb6091bb2b58411b9e7baf01143870f6be3f099541",
strip_prefix = "libscrypt-{version}",
url = "https://github.com/technion/libscrypt/archive/{version}.tar.gz",
# When bumping the version, compare `Makefile` in the `scrypt` repo to
# {build_file} and confirm that {build_file} remains an accurate description
# of the scrypt build process.
version = "60e585cdd752262b22ed4113eca41c0461a61608",
)
versioned_http_archive(
name = "secp256k1",
build_file = "//bazel/third_party/secp256k1:secp256k1.BUILD",
sha256 = "5f6e4a66bf8f3c318d91eacbf3262d1cd81a3fda6bb9af267b54cf38ffd44b1c",
strip_prefix = "secp256k1-{version}",
url = "https://github.com/bitcoin-core/secp256k1/archive/{version}.tar.gz",
version = "694ce8fb2d1fd8a3d641d7c33705691d41a2a860",
patch_args = ["-p1"],
patches = ["//bazel/third_party/secp256k1:{version}.patch"],
)
versioned_http_archive(
name = "sigsegv",
build_file = "//bazel/third_party/sigsegv:sigsegv.BUILD",
sha256 = "cdac3941803364cf81a908499beb79c200ead60b6b5b40cad124fd1e06caa295",
strip_prefix = "libsigsegv-{version}",
url = "https://ftp.gnu.org/gnu/libsigsegv/libsigsegv-{version}.tar.gz",
version = "2.14",
)
versioned_http_archive(
name = "softfloat",
build_file = "//bazel/third_party/softfloat:softfloat.BUILD",
patch_args = ["-p1"],
patches = ["//bazel/third_party/softfloat:{version}.patch"],
sha256 = "15ad5841e88fe09422a8e31a0ef3fe126ecf678f52c9a3882f3373d47752aebe",
strip_prefix = "berkeley-softfloat-3-{version}",
url = "https://github.com/ucb-bar/berkeley-softfloat-3/archive/{version}.tar.gz",
# When bumping the version, compare `build/<target>/Makefile` in the
# `softfloat` repo to {build_file} and compare that {build_file} remains an
# accurate description of the softfloat process for *all* supported
# `<target>`s.
version = "5c06db33fc1e2130f67c045327b0ec949032df1d",
)
versioned_http_archive(
name = "sse2neon",
build_file = "//bazel/third_party/sse2neon:sse2neon.BUILD",
sha256 = "4001e2dfb14fcf3831211581ed83bcc83cf6a3a69f638dcbaa899044a351bb2a",
strip_prefix = "sse2neon-{version}",
url = "https://github.com/DLTcollab/sse2neon/archive/refs/tags/v{version}.tar.gz",
version = "1.5.1",
)
versioned_http_file(
name = "urbit",
sha256 = "a729d8b3c438fef33f5ae8c4da8d84ebdb5af5ad028d41696a92cddc8bf362a8",
url = "https://github.com/urbit/urbit/archive/{version}.tar.gz",
# We can't use a branch name for the `version` because each new commit
# will change the SHA256 hash.
version = "ea8fee3aa0434d4bdf1bf785e5ec346c7ecba7fd",
)
versioned_http_archive(
name = "uv",
build_file = "//bazel/third_party/uv:uv.BUILD",
sha256 = "ccfcdc968c55673c6526d8270a9c8655a806ea92468afcbcabc2b16040f03cb4",
strip_prefix = "libuv-v{version}",
url = "https://dist.libuv.org/dist/v{version}/libuv-v{version}.tar.gz",
version = "1.44.2",
)
versioned_http_archive(
name = "whereami",
build_file = "//bazel/third_party/whereami:whereami.BUILD",
sha256 = "1d8744177f37e8386ec2f6c5992592399040cb93535ed4fd253e1976f889a744",
strip_prefix = "whereami-{version}",
url = "https://github.com/gpakosz/whereami/archive/{version}.tar.gz",
version = "ba364cd54fd431c76c045393b6522b4bff547f50",
)
versioned_http_archive(
name = "zlib",
build_file = "//bazel/third_party/zlib:zlib.BUILD",
sha256 = "b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30",
strip_prefix = "zlib-{version}",
url = "https://www.zlib.net/zlib-{version}.tar.gz",
version = "1.2.13",
)
#
# HEDRON COMPILE COMMANDS SETUP
#
# Hedron's Compile Commands Extractor for Bazel
# https://github.com/hedronvision/bazel-compile-commands-extractor
versioned_http_archive(
name = "hedron_compile_commands",
strip_prefix = "bazel-compile-commands-extractor-{version}",
sha256 = "d7ba7708816132f86f02864b9dba0c5abf249cc0fb035a34c430e4e538c87867",
url = "https://github.com/hedronvision/bazel-compile-commands-extractor/archive/{version}.tar.gz",
version = "d3afb5dfadd4beca48bb027112d029f2d34ff0a0",
)
load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup")
hedron_compile_commands_setup()
#
# DOCKER SETUP
#
# These must be loaded before the Docker rules.
# See https://github.com/bazelbuild/rules_docker/issues/2075#issuecomment-1115954091.
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
go_rules_dependencies()
go_register_toolchains(version = "1.18")
gazelle_dependencies(go_repository_default_config = "//:WORKSPACE.bazel")
load(
"@io_bazel_rules_docker//repositories:repositories.bzl",
_container_repositories = "repositories",
)
load("@io_bazel_rules_docker//repositories:deps.bzl", _container_deps = "deps")
load("@io_bazel_rules_docker//cc:image.bzl", _cc_image_repos = "repositories")
_container_repositories()
_container_deps(
# See https://github.com/bazelbuild/rules_docker/issues/1902.
go_repository_default_config = "@//:WORKSPACE.bazel",
)
_cc_image_repos()
load("@io_bazel_rules_docker//container:container.bzl", "container_pull")
container_pull(
name = "alpine_linux_x86_64",
timeout = 300, # [seconds]
architecture = "amd64",
digest = "sha256:93d5a28ff72d288d69b5997b8ba47396d2cbb62a72b5d87cd3351094b5d578a0",
registry = "docker.io",
repository = "alpine",
)