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/qemu/external.bzl b/third_party/qemu/external.bzl
deleted file mode 100644
index cae80da..0000000
--- a/third_party/qemu/external.bzl
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 2020 The Monogon Project Authors.
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
-
-def qemu_external(name, version):
- sums = {
- "5.2.0": "cb18d889b628fbe637672b0326789d9b0e3b8027e0445b936537c78549df17bc",
- }
-
- http_archive(
- name = name,
- patch_args = ["-p1"],
- patches = [
- "//third_party/qemu/patches:fix_code_issues.patch",
- "//third_party/qemu/patches:bazel_support.patch",
- "//third_party/qemu/patches:pregenerated_config_files.patch",
- "//third_party/qemu/patches:headers_fix.patch",
- "//third_party/qemu/patches:linux-headers-update.patch",
- "//third_party/qemu/patches:standard-headers-removal.patch",
- ],
- sha256 = sums[version],
- strip_prefix = "qemu-" + version,
- urls = ["https://download.qemu.org/qemu-%s.tar.xz" % version],
- )
diff --git a/third_party/qemu/patches/bazel_support.patch b/third_party/qemu/patches/bazel_support.patch
index 00c1ff2..2b2c66a 100644
--- a/third_party/qemu/patches/bazel_support.patch
+++ b/third_party/qemu/patches/bazel_support.patch
@@ -1684,7 +1684,7 @@
+def _impl_cc_qemu_trace(ctx):
+ outs = []
+ for src in ctx.files.srcs:
-+ name = src.path.replace("external/qemu/", "").replace("/trace-events", "").replace("/", "_")
++ name = src.path.replace("external/_main~_repo_rules~qemu/", "").replace("/trace-events", "").replace("/", "_")
+ if name == "trace-events":
+ name = "root"
+ trace_h = ctx.actions.declare_file("trace-{}.h".format(name))
diff --git a/third_party/qemu/patches/pregenerated_config_files.patch b/third_party/qemu/patches/pregenerated_config_files.patch
index ced72f5..8facc61 100644
--- a/third_party/qemu/patches/pregenerated_config_files.patch
+++ b/third_party/qemu/patches/pregenerated_config_files.patch
@@ -198,7 +198,7 @@
+
+#define CONFIG_QEMU_DESKTOPDIR "/nonexistent"
+
-+#define CONFIG_QEMU_FIRMWAREPATH "external/qemu/pc-bios"
++#define CONFIG_QEMU_FIRMWAREPATH "external/_main~_repo_rules~qemu/pc-bios"
+
+#define CONFIG_QEMU_HELPERDIR "/nonexistent"
+