blob: e6c434554d46445825c63bdddd488d09d8af1ea6 [file] [log] [blame]
Serge Bazanski31370b02021-01-07 16:31:14 +01001workspace(name = "dev_source_monogon")
Leopold Schabel5c80aca2019-10-22 15:48:58 +02002
Lorenz Brunc88c82d2020-05-08 14:35:04 +02003load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
Leopold Schabel5c80aca2019-10-22 15:48:58 +02004load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
5
Leopold Schabel5c80aca2019-10-22 15:48:58 +02006# Assert minimum Bazel version
7
8load("@bazel_skylib//lib:versions.bzl", "versions")
9
Tim Windelschmidt961a7cc2024-01-13 21:00:02 +010010versions.check(minimum_bazel_version = "7.0.0")
Lorenz Brun5acd3802023-08-29 23:15:06 +020011
Leopoldbc93c2b2023-01-14 13:12:23 +010012# Register our custom CC toolchains. Order matters - more specific toolchains must be registered first.
13# (host_cc_toolchain won't care about //build/platforms/linkmode, but musl_host_toolchain won't
14# match anything unless its linkmode is set).
15register_toolchains("//build/toolchain/musl-host-gcc:musl_host_toolchain")
Tim Windelschmidtf83f5032023-07-04 14:59:14 +020016
Leopoldbc93c2b2023-01-14 13:12:23 +010017register_toolchains("//build/toolchain/llvm-efi:efi_k8_toolchain")
Tim Windelschmidtf83f5032023-07-04 14:59:14 +020018
Leopoldbc93c2b2023-01-14 13:12:23 +010019register_toolchains("//build/toolchain:host_cc_toolchain")
Leopold Schabel5c80aca2019-10-22 15:48:58 +020020
21# Go and Gazelle
Leopold Schabel5c80aca2019-10-22 15:48:58 +020022http_archive(
23 name = "io_bazel_rules_go",
Lorenz Brunadb98f92022-07-04 14:09:41 +000024 patch_args = ["-p1"],
25 patches = [
Lorenz Brun073a1c52022-08-02 11:36:36 +000026 "//third_party/go/patches:rules_go_absolute_embedsrc.patch",
Lorenz Brunadb98f92022-07-04 14:09:41 +000027 ],
Tim Windelschmidt961a7cc2024-01-13 21:00:02 +010028 sha256 = "de7974538c31f76658e0d333086c69efdf6679dbc6a466ac29e65434bf47076d",
Leopold Schabel5c80aca2019-10-22 15:48:58 +020029 urls = [
Tim Windelschmidt961a7cc2024-01-13 21:00:02 +010030 "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.45.0/rules_go-v0.45.0.zip",
31 "https://github.com/bazelbuild/rules_go/releases/download/v0.45.0/rules_go-v0.45.0.zip",
Leopold Schabel5c80aca2019-10-22 15:48:58 +020032 ],
33)
34
35http_archive(
36 name = "bazel_gazelle",
Tim Windelschmidt961a7cc2024-01-13 21:00:02 +010037 integrity = "sha256-MpOL2hbmcABjA1R5Bj2dJMYO2o15/Uc5Vj9Q0zHLMgk=",
Lorenz Brun2073ce32021-02-03 18:52:59 +010038 patch_args = ["-p1"],
Lorenz Brunefb028f2020-07-28 17:04:49 +020039 patches = [
40 "//third_party/gazelle:add-prepatching.patch",
41 ],
Leopold Schabel5c80aca2019-10-22 15:48:58 +020042 urls = [
Tim Windelschmidt961a7cc2024-01-13 21:00:02 +010043 "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.35.0/bazel-gazelle-v0.35.0.tar.gz",
44 "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.35.0/bazel-gazelle-v0.35.0.tar.gz",
Leopold Schabel5c80aca2019-10-22 15:48:58 +020045 ],
46)
47
48load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
Lorenz Brund13c1c62022-03-30 19:58:58 +020049load("//third_party/go:repositories.bzl", "go_repositories")
50
51# gazelle:repository_macro third_party/go/repositories.bzl%go_repositories
Tim Windelschmidtf83f5032023-07-04 14:59:14 +020052# gazelle:repository go_repository name=dev_source_monogon importpath=source.monogon.dev
Lorenz Brund13c1c62022-03-30 19:58:58 +020053go_repositories()
54
Leopold Schabel5c80aca2019-10-22 15:48:58 +020055go_rules_dependencies()
56
Leopold Schabel60a85b62019-11-17 19:12:41 +010057go_register_toolchains(
Lorenz Brun4ae4b7a2023-12-21 15:50:46 +010058 go_version = "1.21.5",
Serge Bazanski0ef96292021-05-21 15:41:32 +020059 nogo = "@dev_source_monogon//build/analysis:nogo",
Leopold Schabel60a85b62019-11-17 19:12:41 +010060)
Leopold Schabel5c80aca2019-10-22 15:48:58 +020061
Lorenz Brunc2e3b1b2021-11-11 11:06:41 +010062load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
63
64# Load Gazelle-generated local dependencies
65gazelle_dependencies()
66
Leopold Schabel5c80aca2019-10-22 15:48:58 +020067# Protobuf
68
69http_archive(
Leopoldbc93c2b2023-01-14 13:12:23 +010070 name = "rules_proto",
71 sha256 = "dc3fb206a2cb3441b485eb1e423165b231235a1ea9b031b4433cf7bc1fa460dd",
72 strip_prefix = "rules_proto-5.3.0-21.7",
73 urls = [
74 "https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz",
75 ],
Leopold Schabel5c80aca2019-10-22 15:48:58 +020076)
77
Leopoldbc93c2b2023-01-14 13:12:23 +010078load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
Leopold Schabel5c80aca2019-10-22 15:48:58 +020079
Leopoldbc93c2b2023-01-14 13:12:23 +010080rules_proto_dependencies()
Tim Windelschmidtf83f5032023-07-04 14:59:14 +020081
Leopoldbc93c2b2023-01-14 13:12:23 +010082rules_proto_toolchains()
Leopold Schabel5c80aca2019-10-22 15:48:58 +020083
Lorenz Brun65702192023-08-31 16:27:38 +020084# GRPC
85http_archive(
86 name = "com_github_grpc_grpc",
Tim Windelschmidt961a7cc2024-01-13 21:00:02 +010087 integrity = "sha256-Q3BouLd307M52pTTSY8dwgZCrJv6dttDq91SIYaxVCs=",
Lorenz Brun65702192023-08-31 16:27:38 +020088 patch_args = ["-p1"],
89 patches = ["//third_party/go/patches:grpc_extra_deps.patch"],
Tim Windelschmidt961a7cc2024-01-13 21:00:02 +010090 strip_prefix = "grpc-1.60.0",
Lorenz Brun65702192023-08-31 16:27:38 +020091 urls = [
Tim Windelschmidt961a7cc2024-01-13 21:00:02 +010092 "https://github.com/grpc/grpc/archive/v1.60.0.tar.gz",
Lorenz Brun65702192023-08-31 16:27:38 +020093 ],
94)
95
96load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
97
98grpc_deps()
99
100load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
101
102grpc_extra_deps()
103
Serge Bazanskicbf1fa92021-07-02 17:28:50 +0200104# Rust rules
105http_archive(
106 name = "rules_rust",
Tim Windelschmidt223609c2024-01-12 22:59:20 +0100107 integrity = "sha256-ZQGWDD5NoySV0eEAfe0HaaU0yxlcMN6jaqVPnYo/A2E=",
Lorenz Brunf551a762023-08-29 23:21:25 +0200108 patch_args = ["-p1"],
109 patches = [
110 "//third_party:rust-uefi-platform.patch",
Lorenz Brund141d182023-10-02 15:07:01 +0200111 "//third_party:rust-prost-nostd.patch",
Serge Bazanski4f00f902023-12-19 13:54:04 +0100112 "//third_party:rust-reproducibility.patch",
Lorenz Brunf551a762023-08-29 23:21:25 +0200113 ],
Tim Windelschmidt223609c2024-01-12 22:59:20 +0100114 urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.38.0/rules_rust-v0.38.0.tar.gz"],
Serge Bazanskicbf1fa92021-07-02 17:28:50 +0200115)
116
Lorenz Brund141d182023-10-02 15:07:01 +0200117load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")
Leopold2aa8b182023-01-14 23:31:43 +0100118
Lorenz Brunf551a762023-08-29 23:21:25 +0200119rules_rust_dependencies()
120
Lorenz Brund141d182023-10-02 15:07:01 +0200121rust_register_toolchains(
Lorenz Brunf551a762023-08-29 23:21:25 +0200122 edition = "2021",
Lorenz Brunf551a762023-08-29 23:21:25 +0200123 extra_target_triples = [
Tim Windelschmidt223609c2024-01-12 22:59:20 +0100124 "x86_64-unknown-uefi",
125 ],
126 versions = ["1.71.0"],
127)
128
129load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
130
131crate_universe_dependencies()
132
133load("@rules_rust//crate_universe:defs.bzl", "crates_repository")
134
135crates_repository(
136 name = "crate_index",
137 cargo_lockfile = "//third_party/rust:Cargo.lock",
138 generate_binaries = True,
139 lockfile = "//third_party/rust:Cargo.Bazel.lock",
140 manifests = ["//third_party/rust:Cargo.toml"],
141)
142
143load("@crate_index//:defs.bzl", "crate_repositories")
144
145crate_repositories()
146
147crates_repository(
148 name = "crate_index_efi",
149 cargo_lockfile = "//third_party/rust_efi:Cargo.lock",
150 generate_binaries = True,
151 lockfile = "//third_party/rust_efi:Cargo.Bazel.lock",
152 manifests = ["//third_party/rust_efi:Cargo.toml"],
153 supported_platform_triples = [
Lorenz Brunf551a762023-08-29 23:21:25 +0200154 "x86_64-unknown-linux-gnu",
155 "x86_64-unknown-uefi",
156 ],
Lorenz Brunf551a762023-08-29 23:21:25 +0200157)
Leopold2aa8b182023-01-14 23:31:43 +0100158
Tim Windelschmidt223609c2024-01-12 22:59:20 +0100159load("@crate_index_efi//:defs.bzl", crate_efi_repositories = "crate_repositories")
Leopold2aa8b182023-01-14 23:31:43 +0100160
Tim Windelschmidt223609c2024-01-12 22:59:20 +0100161crate_efi_repositories()
Lorenz Brund141d182023-10-02 15:07:01 +0200162
163load("@rules_rust//proto/prost:repositories.bzl", "rust_prost_dependencies")
164
165rust_prost_dependencies()
166
167load("@rules_rust//proto/prost:transitive_repositories.bzl", "rust_prost_transitive_repositories")
168
169rust_prost_transitive_repositories()
170
171register_toolchains("//build/rust:prost_efi_toolchain")
172
Serge Bazanski2fb13a82020-02-11 12:41:37 +0100173# third_party external repositories
174load("//third_party/linux:external.bzl", "linux_external")
Lorenz Brun7b5d9942020-03-19 16:14:02 +0100175
176linux_external(
177 name = "linux",
Lorenz Brun38b959f2024-02-08 17:53:45 +0100178 version = "6.6.13",
Lorenz Brun7b5d9942020-03-19 16:14:02 +0100179)
Leopold Schabel5c80aca2019-10-22 15:48:58 +0200180
Lorenz Brun17c4c8b2022-02-01 12:59:47 +0100181load("//third_party/linux-firmware:external.bzl", "linux_firmware_external")
182
183linux_firmware_external(
184 name = "linux-firmware",
Lorenz Brun60efa442023-12-21 15:52:53 +0100185 version = "20231211",
Lorenz Brun17c4c8b2022-02-01 12:59:47 +0100186)
187
Lorenz Brun80deba52022-02-24 17:07:13 +0100188load("//third_party/intel_ucode:external.bzl", "intel_ucode_external")
189
190intel_ucode_external(
191 name = "intel_ucode",
Lorenz Brun087152b2023-12-21 16:04:24 +0100192 version = "20231114",
Lorenz Brun80deba52022-02-24 17:07:13 +0100193)
194
Serge Bazanski2fb13a82020-02-11 12:41:37 +0100195load("//third_party/edk2:external.bzl", "edk2_external")
Lorenz Brun7b5d9942020-03-19 16:14:02 +0100196
197edk2_external(name = "edk2")
Leopold Schabel5c80aca2019-10-22 15:48:58 +0200198
Serge Bazanski2fb13a82020-02-11 12:41:37 +0100199load("//third_party/musl:external.bzl", "musl_external")
Lorenz Brun7b5d9942020-03-19 16:14:02 +0100200
201musl_external(
202 name = "musl",
203 version = "1.1.24",
204)
Leopold Schabel5c80aca2019-10-22 15:48:58 +0200205
Serge Bazanski2fb13a82020-02-11 12:41:37 +0100206load("//third_party/util-linux:external.bzl", "util_linux_external")
Lorenz Brun7b5d9942020-03-19 16:14:02 +0100207
208util_linux_external(
209 name = "util_linux",
Lorenz Brunddd6caf2021-03-04 17:16:04 +0100210 version = "2.36.2",
Lorenz Brun7b5d9942020-03-19 16:14:02 +0100211)
Leopold Schabel5c80aca2019-10-22 15:48:58 +0200212
Serge Bazanski2fb13a82020-02-11 12:41:37 +0100213load("//third_party/xfsprogs:external.bzl", "xfsprogs_external")
Lorenz Brun7b5d9942020-03-19 16:14:02 +0100214
215xfsprogs_external(
216 name = "xfsprogs",
Lorenz Brunddd6caf2021-03-04 17:16:04 +0100217 version = "5.10.0",
Lorenz Brun7b5d9942020-03-19 16:14:02 +0100218)
Lorenz Brun6c39ea12019-11-04 11:39:42 +0100219
Lorenz Brun0de18932021-03-11 00:36:48 +0100220load("//third_party/pixman:external.bzl", "pixman_external")
221
222pixman_external(
223 name = "pixman",
224 version = "0.40.0",
225)
226
227load("//third_party/uring:external.bzl", "uring_external")
228
229uring_external(
230 name = "uring",
231 version = "2.0",
232)
233
234load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
235
236git_repository(
237 name = "gperf",
238 commit = "de9373c2d48a3edf29862eb8be44764a7f7d24c6",
Leopold Schabel57a9d3e2021-04-01 17:31:48 +0200239 remote = "https://github.com/monogon-dev/gperf.git",
Lorenz Brun0de18932021-03-11 00:36:48 +0100240 shallow_since = "1615306886 +0100",
241)
242
243load("//third_party/seccomp:external.bzl", "seccomp_external")
244
245seccomp_external(
246 name = "seccomp",
247 version = "2.5.1",
248)
249
250load("//third_party/glib:external.bzl", "glib_external")
251
252glib_external(
253 name = "glib",
254 version = "2.67.5",
255)
256
257load("//third_party/qemu:external.bzl", "qemu_external")
258
259qemu_external(
260 name = "qemu",
261 version = "5.2.0",
262)
263
Serge Bazanski8ff4b7c2021-08-17 19:21:18 +0200264load("//third_party/chrony:external.bzl", "chrony_external")
265
266chrony_external(
267 name = "chrony",
268)
269
Lorenz Brun40025ff2021-08-31 13:06:02 +0200270load("//third_party/cap:external.bzl", "cap_external")
271
272cap_external(
273 name = "cap",
274 version = "1.2.55",
275)
276
Lorenz Brun296bde22021-09-28 15:04:40 +0200277load("//third_party/gnuefi:external.bzl", "gnuefi_external")
278
279gnuefi_external(
280 name = "gnuefi",
281 version = "3.0.14",
282)
283
Lorenz Brun5d40c672021-09-28 15:06:37 +0200284load("//third_party/efistub:external.bzl", "efistub_external")
285
286efistub_external(
287 name = "efistub",
288 # Developed in the systemd monorepo, pinned to master as there have been a bunch of critical fixes for the
289 # EFI stub since 249.
290 version = "3542da2442d8b29661b47c42ad7e5fa9bc8562ec",
291)
292
Serge Bazanski46e72ab2022-09-05 15:13:22 +0200293load("//third_party/libpg_query:external.bzl", "libpg_query_external")
Tim Windelschmidtf83f5032023-07-04 14:59:14 +0200294
Serge Bazanski46e72ab2022-09-05 15:13:22 +0200295libpg_query_external(
296 name = "libpg_query",
Tim Windelschmidt3fdaeac2023-11-13 23:33:07 +0100297 version = "15-4.2.3",
Serge Bazanski46e72ab2022-09-05 15:13:22 +0200298)
299
Serge Bazanskibb7db922020-04-30 12:43:10 +0200300register_toolchains("//:host_python")
Lorenz Brun7b5d9942020-03-19 16:14:02 +0100301
Tim Windelschmidt0974b222024-01-16 14:04:15 +0100302http_archive(
303 name = "aspect_bazel_lib",
304 sha256 = "bda4a69fa50411b5feef473b423719d88992514d259dadba7d8218a1d02c7883",
305 strip_prefix = "bazel-lib-2.3.0",
306 url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.3.0/bazel-lib-v2.3.0.tar.gz",
307)
308
309load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "aspect_bazel_lib_register_toolchains")
310
311# Required bazel-lib dependencies
312
313aspect_bazel_lib_dependencies()
314
315# Register bazel-lib toolchains
316
317aspect_bazel_lib_register_toolchains()
Serge Bazanskibb7db922020-04-30 12:43:10 +0200318
Lorenz Brunc88c82d2020-05-08 14:35:04 +0200319# Derived from Mozilla NSS, currently needed for containerd to be able to pull images
320http_file(
321 name = "cacerts",
Lorenz Brun7da4d3c2023-03-27 17:38:47 +0200322 sha256 = "fb1ecd641d0a02c01bc9036d513cb658bbda62a75e246bedbc01764560a639f0",
323 urls = ["https://curl.se/ca/cacert-2023-01-10.pem"],
Lorenz Brunc88c82d2020-05-08 14:35:04 +0200324)
Serge Bazanski140bddc2020-06-05 21:01:19 +0200325
326# lz4, the library and the tool.
327http_archive(
328 name = "com_github_lz4_lz4",
329 patch_args = ["-p1"],
330 patches = ["//third_party/lz4:build.patch"],
331 sha256 = "658ba6191fa44c92280d4aa2c271b0f4fbc0e34d249578dd05e50e76d0e5efcc",
332 strip_prefix = "lz4-1.9.2",
333 urls = ["https://github.com/lz4/lz4/archive/v1.9.2.tar.gz"],
334)
Lorenz Brun2e30e882020-06-24 15:17:29 +0200335
Lorenz Brunddd6caf2021-03-04 17:16:04 +0100336# ini.h, a tiny ini parser library
337http_archive(
338 name = "inih",
339 build_file = "@//third_party/inih:inih.bzl",
340 sha256 = "01b0366fdfdf6363efc070c2f856f1afa33e7a6546548bada5456ad94a516241",
341 strip_prefix = "inih-r53",
342 urls = ["https://github.com/benhoyt/inih/archive/r53.tar.gz"],
343)
344
Lorenz Brun2e30e882020-06-24 15:17:29 +0200345# qboot bootloader for MicroVMs
346http_archive(
347 name = "com_github_bonzini_qboot",
348 build_file = "//third_party/qboot:qboot.bzl",
349 sha256 = "a643b2486fbee57b969659d408984094ca9afa1a048317dd3f5d3022e47213e8",
350 strip_prefix = "qboot-a5300c4949b8d4de2d34bedfaed66793f48ec948",
351 urls = ["https://github.com/bonzini/qboot/archive/a5300c4949b8d4de2d34bedfaed66793f48ec948.tar.gz"],
352)
Serge Bazanski9e861a82020-09-16 13:46:41 +0200353
Lorenz Brun073a1c52022-08-02 11:36:36 +0000354load("//third_party/dosfstools:external.bzl", "dosfstools_external")
355
356dosfstools_external(
357 name = "com_github_dosfstools_dosfstools",
358 version = "c888797b1d84ffbb949f147e3116e8bfb2e145a7",
359)
360
Serge Bazanski662b5b32020-12-21 13:49:00 +0100361# Load musl toolchain Metropolis sysroot tarball into external repository.
Serge Bazanski9e861a82020-09-16 13:46:41 +0200362load("//build/toolchain/musl-host-gcc:sysroot.bzl", "musl_sysroot_repositories")
Lorenz Brun2073ce32021-02-03 18:52:59 +0100363
Serge Bazanski9e861a82020-09-16 13:46:41 +0200364musl_sysroot_repositories()
Serge Bazanski1e9d7d82022-09-15 18:45:44 +0200365
366# CockroachDB binary used for tests.
367#
368# WARNING: Not distributed under an OSI certified license. Must only be used in
369# tests, not be redistributed!
370http_archive(
371 name = "cockroach",
Serge Bazanski1e9d7d82022-09-15 18:45:44 +0200372 build_file_content = """
373exports_files([
374 "cockroach"
375])
376""",
Tim Windelschmidtf83f5032023-07-04 14:59:14 +0200377 sha256 = "0821cff5770400fb94c8b6c2ab338d96f4114fbf2b3206bc8a6dcf62f9c0f4ea",
378 strip_prefix = "cockroach-v22.1.6.linux-amd64",
379 urls = [
380 # TODO: select() to pick other host architectures.
381 "https://binaries.cockroachdb.com/cockroach-v22.1.6.linux-amd64.tgz",
382 ],
Serge Bazanski1e9d7d82022-09-15 18:45:44 +0200383)
Leopoldbe326c22023-01-04 20:42:59 +0100384
385# bazeldnf is used to generate our sandbox root.
Tim Windelschmidta5588e12023-09-20 19:43:15 +0200386load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
387
Leopoldbe326c22023-01-04 20:42:59 +0100388http_archive(
389 name = "bazeldnf",
Tim Windelschmidt37dbb942023-11-13 16:06:18 +0100390 sha256 = "cd75fbbad6f191c26b036132d57ca731cce067e9330306a8a2beb3e51af991a8",
Leopoldbe326c22023-01-04 20:42:59 +0100391 urls = [
Tim Windelschmidt37dbb942023-11-13 16:06:18 +0100392 "https://github.com/rmohr/bazeldnf/releases/download/v0.5.8/bazeldnf-v0.5.8.tar.gz",
Leopoldbe326c22023-01-04 20:42:59 +0100393 ],
394)
395
Tim Windelschmidta5588e12023-09-20 19:43:15 +0200396load("@bazeldnf//:deps.bzl", "bazeldnf_dependencies")
Leopoldbe326c22023-01-04 20:42:59 +0100397
398bazeldnf_dependencies()
Leopold7fbf1042023-01-06 19:57:37 +0100399
400load("//third_party/sandboxroot:repositories.bzl", "sandbox_dependencies")
401
402sandbox_dependencies()
Lorenz Brun2d284b52023-03-08 17:05:12 +0100403
404# Used by tests in cloud/takeover
405http_file(
406 name = "debian_11_cloudimage",
407 sha256 = "14caeec68ba3129a115a9b57396d08dc0973cc9f569ce049232d7d15d768ad41",
408 urls = [
409 "https://cloud.debian.org/images/cloud/bullseye/20230124-1270/debian-11-genericcloud-amd64-20230124-1270.qcow2",
410 ],
Serge Bazanski213d90c2023-04-19 17:42:06 +0200411)