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/libtpms/BUILD.bazel b/third_party/libtpms/BUILD.bazel
index e69de29..6bbc4eb 100644
--- a/third_party/libtpms/BUILD.bazel
+++ b/third_party/libtpms/BUILD.bazel
@@ -0,0 +1,6 @@
+# TODO: Workaround for https://github.com/bazelbuild/bazel/issues/19301
+alias(
+ name = "libtpms_tpm2",
+ actual = "@libtpms//:libtpms_tpm2",
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/libtpms/external.bzl b/third_party/libtpms/external.bzl
deleted file mode 100644
index d6052b4..0000000
--- a/third_party/libtpms/external.bzl
+++ /dev/null
@@ -1,23 +0,0 @@
-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
-
-def libtpms_external(name, version):
- sums = {
- # master at 2024/01/09 (0.10.0 prerelease).
- "93a827aeccd3ab2178281571b1545dcfffa2991b": "e509e0ba109f77da517b5e58a9f093beb040525e6be51de06d1153c8278c70d1",
- }
-
- http_archive(
- name = name,
- patch_args = ["-p1"],
- patches = [
- "//third_party/libtpms/patches:0001-boringssl-compat-new-SHA-types.patch",
- "//third_party/libtpms/patches:0002-boringssl-compat-removed-const_DES_cblock.patch",
- "//third_party/libtpms/patches:0003-boringssl-compat-removed-EC_POINTs_mul.patch",
- "//third_party/libtpms/patches:0004-boringssl-compat-removed-camellia-support.patch",
- "//third_party/libtpms/patches:0005-boringssl-compat-remove-constant-time-flags-UNSAFE.patch",
- "//third_party/libtpms/patches:0006-bazel-support-implement.patch",
- ],
- sha256 = sums[version],
- strip_prefix = "libtpms-" + version,
- urls = ["https://github.com/stefanberger/libtpms/archive/%s.tar.gz" % version],
- )
diff --git a/third_party/libtpms/patches/0006-bazel-support-implement.patch b/third_party/libtpms/patches/0006-bazel-support-implement.patch
index 8152a55..ed540b1 100644
--- a/third_party/libtpms/patches/0006-bazel-support-implement.patch
+++ b/third_party/libtpms/patches/0006-bazel-support-implement.patch
@@ -26,11 +26,11 @@
+ "include",
+ ],
+ copts = [
-+ "-Iexternal/libtpms/include/libtpms",
-+ "-Iexternal/libtpms/src",
-+ "-Iexternal/libtpms/src/tpm2",
-+ "-Iexternal/libtpms/src/tpm2/crypto",
-+ "-Iexternal/libtpms/src/tpm2/crypto/openssl",
++ "-Iexternal/_main~_repo_rules~libtpms/include/libtpms",
++ "-Iexternal/_main~_repo_rules~libtpms/src",
++ "-Iexternal/_main~_repo_rules~libtpms/src/tpm2",
++ "-Iexternal/_main~_repo_rules~libtpms/src/tpm2/crypto",
++ "-Iexternal/_main~_repo_rules~libtpms/src/tpm2/crypto/openssl",
+ ],
+ defines = [
+ "TPM_LIBTPMS_CALLBACKS",