mirror of
https://github.com/urbit/vere.git
synced 2024-09-11 03:45:31 +03:00
Same as https://github.com/urbit/urbit/pull/3261 but for vere. From what I can tell this NAT-PMP stuff is fairly well supported by routers, works on my machine at least.
431 lines
17 KiB
Plaintext
431 lines
17 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 = "avahi",
|
|
build_file = "//bazel/third_party/avahi:avahi.BUILD",
|
|
sha256 = "060309d7a333d38d951bc27598c677af1796934dbd98e1024e7ad8de798fedda",
|
|
strip_prefix = "avahi-{version}",
|
|
url = "https://github.com/lathiat/avahi/releases/download/v{version}/avahi-{version}.tar.gz",
|
|
version = "0.8",
|
|
)
|
|
|
|
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 = "dbus",
|
|
build_file = "//bazel/third_party/dbus:dbus.BUILD",
|
|
sha256 = "a6bd5bac5cf19f0c3c594bdae2565a095696980a683a0ef37cb6212e093bde35",
|
|
strip_prefix = "dbus-{version}",
|
|
url = "https://src.fedoraproject.org/repo/pkgs/dbus/dbus-{version}.tar.xz/sha512/f3dfc73da28cbe20449d15bbe4166c3574f0e551dfd15fca7cce2b8c71e778360ed2dd391ee5c414a7a47ff4b958727b26ef4cabfee70564f8d0a34bf5ad2386/dbus-1.14.8.tar.xz",
|
|
version = "1.14.8",
|
|
)
|
|
|
|
versioned_http_archive(
|
|
name = "expat",
|
|
build_file = "//bazel/third_party/expat:expat.BUILD",
|
|
strip_prefix = "expat-{version}",
|
|
sha256 = "ef2420f0232c087801abf705e89ae65f6257df6b7931d37846a193ef2e8cdcbe",
|
|
# TODO: fix the R_2_5_0 nonsense
|
|
url = "https://github.com/libexpat/libexpat/releases/download/R_2_5_0/expat-{version}.tar.xz",
|
|
version = "2.5.0",
|
|
)
|
|
|
|
versioned_http_archive(
|
|
name = "gmp",
|
|
build_file = "//bazel/third_party/gmp:gmp.BUILD",
|
|
sha256 = "fb776e19e0267053c3d6ffef0dcc001fb441da0e2b5224cfd9656aa2f1b8614d",
|
|
strip_prefix = "GMP-{version}",
|
|
url = "https://github.com/alisw/GMP/archive/refs/tags/v{version}.tar.gz",
|
|
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 = "d6ab6b57e48c09523e93050f13698f708428cfd5e619252e369d377af6597707",
|
|
url = "https://github.com/bazelbuild/rules_go/releases/download/v{version}/rules_go-v{version}.zip",
|
|
version = "0.43.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_archive(
|
|
name = "natpmp",
|
|
build_file = "//bazel/third_party/natpmp:natpmp.BUILD",
|
|
sha256 = "0684ed2c8406437e7519a1bd20ea83780db871b3a3a5d752311ba3e889dbfc70",
|
|
strip_prefix = "libnatpmp-{version}",
|
|
url = "http://miniupnp.free.fr/files/libnatpmp-{version}.tar.gz",
|
|
version = "20230423",
|
|
)
|
|
|
|
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 = "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 = "cf3098950cb4d853ad95c0841f1f9c6d3dc102dccfcacd521d93925208b76ac8",
|
|
strip_prefix = "openssl-{version}",
|
|
url = "https://www.openssl.org/source/openssl-{version}.tar.gz",
|
|
version = "1.1.1w",
|
|
)
|
|
|
|
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 = "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 = "urcrypt",
|
|
build_file = "//bazel/third_party/urcrypt:urcrypt.BUILD",
|
|
sha256 = "d27ec04d3854da7c479dd815af92ffef986616bc7ff400022e2dfb7971853d86",
|
|
strip_prefix = "urcrypt-{version}",
|
|
url = "https://github.com/urbit/urcrypt/archive/{version}.tar.gz",
|
|
version = "9ae5d604528bc54ae48430f55ebbb17b1ad7956c",
|
|
)
|
|
|
|
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 = "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23",
|
|
strip_prefix = "zlib-{version}",
|
|
url = "https://www.zlib.net/zlib-{version}.tar.gz",
|
|
version = "1.3.1",
|
|
)
|
|
|
|
#
|
|
# 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",
|
|
)
|