• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2019 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15"""Loads dependencies needed to compile Sandboxed API for 3rd-party consumers."""
16
17load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
18load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
19load("//sandboxed_api/bazel:llvm_config.bzl", "llvm_configure")
20load("//sandboxed_api/bazel:repositories.bzl", "autotools_repository")
21
22def sapi_non_module_deps():
23    """Loads non-modularized dependencies."""
24
25    # libcap
26    http_archive(
27        name = "org_kernel_libcap",
28        build_file = "@com_google_sandboxed_api//sandboxed_api:bazel/external/libcap.BUILD",
29        sha256 = "260b549c154b07c3cdc16b9ccc93c04633c39f4fb6a4a3b8d1fa5b8a9c3f5fe8",  # 2019-04-16
30        strip_prefix = "libcap-2.27",
31        urls = ["https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.27.tar.gz"],
32    )
33
34    # libffi
35    autotools_repository(
36        name = "org_sourceware_libffi",
37        build_file = "@com_google_sandboxed_api//sandboxed_api:bazel/external/libffi.BUILD",
38        sha256 = "653ffdfc67fbb865f39c7e5df2a071c0beb17206ebfb0a9ecb18a18f63f6b263",  # 2019-11-02
39        strip_prefix = "libffi-3.3-rc2",
40        urls = ["https://github.com/libffi/libffi/releases/download/v3.3-rc2/libffi-3.3-rc2.tar.gz"],
41    )
42
43    # libunwind
44    autotools_repository(
45        name = "org_gnu_libunwind",
46        build_file = "@com_google_sandboxed_api//sandboxed_api:bazel/external/libunwind.BUILD",
47        configure_args = [
48            "--disable-documentation",
49            "--disable-minidebuginfo",
50            "--disable-shared",
51            "--enable-ptrace",
52        ],
53        sha256 = "4a6aec666991fb45d0889c44aede8ad6eb108071c3554fcdff671f9c94794976",  # 2021-12-01
54        strip_prefix = "libunwind-1.6.2",
55        urls = ["https://github.com/libunwind/libunwind/releases/download/v1.6.2/libunwind-1.6.2.tar.gz"],
56    )
57
58    # LLVM/libclang
59    maybe(
60        llvm_configure,
61        name = "llvm-project",
62        commit = "2c494f094123562275ae688bd9e946ae2a0b4f8b",  # 2022-03-31
63        sha256 = "59b9431ae22f0ea5f2ce880925c0242b32a9e4f1ae8147deb2bb0fc19b53fa0d",
64        system_libraries = True,  # Prefer system libraries
65    )
66
67def sapi_deps():
68    """Loads common dependencies needed to compile Sandboxed API."""
69
70    # Bazel rules_python
71    maybe(
72        http_archive,
73        name = "rules_python",
74        sha256 = "c6fb25d0ba0246f6d5bd820dd0b2e66b339ccc510242fd4956b9a639b548d113",  # 2024-10-27
75        strip_prefix = "rules_python-0.37.2",
76        urls = ["https://github.com/bazelbuild/rules_python/releases/download/0.37.2/rules_python-0.37.2.tar.gz"],
77    )
78
79    # Bazel Skylib
80    maybe(
81        http_archive,
82        name = "bazel_skylib",
83        sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f",  # 2024-06-03
84        urls = [
85            "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz",
86            "https://github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz",
87        ],
88    )
89
90    # Abseil
91    maybe(
92        http_archive,
93        name = "com_google_absl",
94        sha256 = "571549a0fa17ebf46f517541bb8d66fe369493963d463409fe61f2b8a44eb2dc",  # 2024-04-05
95        strip_prefix = "abseil-cpp-fa588813c4b2d931737bbe7c4b4f7fa6ed7509db",
96        urls = ["https://github.com/abseil/abseil-cpp/archive/fa588813c4b2d931737bbe7c4b4f7fa6ed7509db.zip"],
97    )
98    maybe(
99        http_archive,
100        name = "com_google_absl_py",
101        sha256 = "8a3d0830e4eb4f66c4fa907c06edf6ce1c719ced811a12e26d9d3162f8471758",  # 2024-01-16
102        strip_prefix = "abseil-py-2.1.0",
103        urls = ["https://github.com/abseil/abseil-py/archive/refs/tags/v2.1.0.tar.gz"],
104    )
105
106    # Abseil-py dependency for Python 2/3 compatiblity
107    maybe(
108        http_archive,
109        name = "six_archive",
110        build_file = "@com_google_sandboxed_api//sandboxed_api:bazel/external/six.BUILD",
111        sha256 = "30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259",  # 2020-05-21
112        strip_prefix = "six-1.15.0",
113        urls = ["https://pypi.python.org/packages/source/s/six/six-1.15.0.tar.gz"],
114    )
115
116    # Protobuf
117    maybe(
118        http_archive,
119        name = "com_google_protobuf",
120        sha256 = "b2340aa47faf7ef10a0328190319d3f3bee1b24f426d4ce8f4253b6f27ce16db",  # 2024-09-18
121        strip_prefix = "protobuf-28.2",
122        urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v28.2/protobuf-28.2.tar.gz"],
123    )
124
125    # GoogleTest/GoogleMock
126    maybe(
127        http_archive,
128        name = "com_google_googletest",
129        sha256 = "a217118c2c36a3632b594af7ff98111a65bb2b980b726a7fa62305e02a998440",  # 2023-06-06
130        strip_prefix = "googletest-334704df263b480a3e9e7441ed3292a5e30a37ec",
131        urls = ["https://github.com/google/googletest/archive/334704df263b480a3e9e7441ed3292a5e30a37ec.zip"],
132    )
133
134    # Google Benchmark
135    maybe(
136        http_archive,
137        name = "com_google_benchmark",
138        sha256 = "342705876335bf894147e052d0dac141fe15962034b41bef5aa59c4b279ca89c",  # 2023-05-30
139        strip_prefix = "benchmark-604f6fd3f4b34a84ec4eb4db81d842fa4db829cd",
140        urls = ["https://github.com/google/benchmark/archive/604f6fd3f4b34a84ec4eb4db81d842fa4db829cd.zip"],
141    )
142
143    sapi_non_module_deps()
144