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