xref: /aosp_15_r20/external/bazelbuild-rules_rust/examples/sys/sys_deps.bzl (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1"""Dependencies for the `@rules_rust_examples//sys` package"""
2
3load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
5load("//sys/basic/3rdparty/crates:defs.bzl", basic_crate_repositories = "crate_repositories")
6load("//sys/complex/3rdparty/crates:defs.bzl", complex_crate_repositories = "crate_repositories")
7load("//third_party/openssl:openssl_repositories.bzl", "openssl_repositories")
8
9def sys_deps():
10    """This macro loads dependencies for the `sys` crate examples
11
12    Commonly `*-sys` crates are built on top of some existing library and
13    will have a number of dependencies. The examples here use
14    [crate_universe](https://bazelbuild.github.io/rules_rust/crate_universe.html)
15    to gather these dependencies and make them avaialble in the workspace.
16    """
17
18    # Required by `//sys/complex`
19    openssl_repositories()
20
21    basic_crate_repositories()
22    complex_crate_repositories()
23
24    maybe(
25        http_archive,
26        name = "zlib",
27        build_file = Label("//sys/complex/3rdparty:BUILD.zlib.bazel"),
28        sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
29        strip_prefix = "zlib-1.2.11",
30        urls = [
31            "https://zlib.net/zlib-1.2.11.tar.gz",
32            "https://storage.googleapis.com/mirror.tensorflow.org/zlib.net/zlib-1.2.11.tar.gz",
33        ],
34    )
35
36    maybe(
37        http_archive,
38        name = "libgit2",
39        build_file = Label("//sys/complex/3rdparty:BUILD.libgit2.bazel"),
40        sha256 = "d25866a4ee275a64f65be2d9a663680a5cf1ed87b7ee4c534997562c828e500d",
41        # The version here should match the version used with the Rust crate `libgit2-sys`
42        # https://github.com/rust-lang/git2-rs/tree/libgit2-sys-0.15.2+1.6.4/libgit2-sys
43        strip_prefix = "libgit2-1.6.4",
44        urls = ["https://github.com/libgit2/libgit2/archive/refs/tags/v1.6.4.tar.gz"],
45    )
46