treewide: migrate more to bzlmod
This does migrate nearly everything to bzlmod and away from the "old"
WORKSPACE system. We do have to use some workarounds and there is no
good way to get the path to a repository. This definitively requires
some more love in future CLs but this should cover the basics. See
monogon-dev/monogon#343 for more information.
Change-Id: I0e188d8708b66fcdbdf0adc9143c93160e3395ae
Reviewed-on: https://review.monogon.dev/c/monogon/+/3357
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
Reviewed-by: Leopold Schabel <leo@monogon.tech>
Tested-by: Jenkins CI
diff --git a/third_party/swtpm/external.bzl b/third_party/swtpm/external.bzl
deleted file mode 100644
index 903bb33..0000000
--- a/third_party/swtpm/external.bzl
+++ /dev/null
@@ -1,21 +0,0 @@
-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
-
-def swtpm_external(name, version):
- sums = {
- # master at 2024/06/04
- "0c9a6c4a12a63b86ab472e69e95bd75853d4fa96": "169ddb139597fa808e112d452457445c79ed521bb34f999066d20de9214056ce",
- }
-
- http_archive(
- name = name,
- patch_args = ["-p1"],
- patches = [
- "//third_party/swtpm/patches:0001-bazel-compat-glib.h-glib-glib.h.patch",
- "//third_party/swtpm/patches:0002-swtpm_localca-replace-gmp-mpz-dependency-with-boring.patch",
- "//third_party/swtpm/patches:0003-swtpm_setup-replace-dep-on-JSON-GLib-with-sheredom-j.patch",
- "//third_party/swtpm/patches:0004-bazel-support-implement.patch",
- ],
- sha256 = sums[version],
- strip_prefix = "swtpm-" + version,
- urls = ["https://github.com/stefanberger/swtpm/archive/%s.tar.gz" % version],
- )
diff --git a/third_party/swtpm/patches/0004-bazel-support-implement.patch b/third_party/swtpm/patches/0004-bazel-support-implement.patch
index 15245c6..ce69992 100644
--- a/third_party/swtpm/patches/0004-bazel-support-implement.patch
+++ b/third_party/swtpm/patches/0004-bazel-support-implement.patch
@@ -47,8 +47,8 @@
+cc_binary(
+ name = "swtpm",
+ deps = [
-+ "@libtpms//:libtpms_tpm2",
-+ "@glib//glib",
++ "@@//third_party/libtpms:libtpms_tpm2",
++ "@@//third_party/glib",
+ ],
+ srcs = glob([
+ "src/swtpm/*.h",
@@ -64,9 +64,9 @@
+ "src/utils/swtpm_utils.c",
+ ]),
+ copts = [
-+ "-Iexternal/swtpm/include",
-+ "-Iexternal/swtpm/include/swtpm",
-+ "-Iexternal/swtpm/src/utils",
++ "-Iexternal/_main~_repo_rules~swtpm/include",
++ "-Iexternal/_main~_repo_rules~swtpm/include/swtpm",
++ "-Iexternal/_main~_repo_rules~swtpm/src/utils",
+ ],
+ visibility = [
+ "//visibility:public",
@@ -76,8 +76,8 @@
+cc_binary(
+ name = "swtpm_localca",
+ deps = [
-+ "@libtpms//:libtpms_tpm2",
-+ "@glib//glib",
++ "@@//third_party/libtpms:libtpms_tpm2",
++ "@@//third_party/glib",
+ ],
+ srcs = glob([
+ "src/swtpm_localca/*.h",
@@ -88,9 +88,9 @@
+ "src/utils/*.c",
+ ], []),
+ copts = [
-+ "-Iexternal/swtpm/include",
-+ "-Iexternal/swtpm/include/swtpm",
-+ "-Iexternal/swtpm/src/utils",
++ "-Iexternal/_main~_repo_rules~swtpm/include",
++ "-Iexternal/_main~_repo_rules~swtpm/include/swtpm",
++ "-Iexternal/_main~_repo_rules~swtpm/src/utils",
+ ],
+ visibility = [
+ "//visibility:public",
@@ -100,8 +100,8 @@
+cc_binary(
+ name = "swtpm_setup",
+ deps = [
-+ "@libtpms//:libtpms_tpm2",
-+ "@glib//glib",
++ "@@//third_party/libtpms:libtpms_tpm2",
++ "@@//third_party/glib",
+ ],
+ srcs = glob([
+ "src/swtpm_setup/*.h",
@@ -112,9 +112,9 @@
+ "src/utils/*.c",
+ ], []),
+ copts = [
-+ "-Iexternal/swtpm/include",
-+ "-Iexternal/swtpm/include/swtpm",
-+ "-Iexternal/swtpm/src/utils",
++ "-Iexternal/_main~_repo_rules~swtpm/include",
++ "-Iexternal/_main~_repo_rules~swtpm/include/swtpm",
++ "-Iexternal/_main~_repo_rules~swtpm/src/utils",
+ ],
+ visibility = [
+ "//visibility:public",
@@ -132,7 +132,7 @@
+ "include/*.h",
+ ], []),
+ copts = [
-+ "-Iexternal/swtpm/include",
++ "-Iexternal/_main~_repo_rules~swtpm/include",
+ ],
+ visibility = [
+ "//visibility:public",