treewide: add aliases for third_party dependencies

With bzlmod it is currently not possible to access other third_party libraries. By adding an alias inside the root module we can work around this with a fairly moderate hack. We do have a folder and BUILD file for every dependency anyway, so this isn't that bad.

Change-Id: I472194f590fd4c4aa8ba304af70dd8b92ecc5c1e
Reviewed-on: https://review.monogon.dev/c/monogon/+/3231
Tested-by: Jenkins CI
Reviewed-by: Leopold Schabel <leo@monogon.tech>
diff --git a/third_party/BUILD.bazel b/third_party/BUILD.bazel
index 7d507bc..7df30fe 100644
--- a/third_party/BUILD.bazel
+++ b/third_party/BUILD.bazel
@@ -18,3 +18,10 @@
     },
     visibility = ["//visibility:public"],
 )
+
+# TODO: Workaround for https://github.com/bazelbuild/bazel/issues/19301
+alias(
+    name = "zlib",
+    actual = "@zlib",
+    visibility = ["//visibility:public"],
+)
diff --git a/third_party/glib/BUILD.bazel b/third_party/glib/BUILD.bazel
index e69de29..6ad9477 100644
--- a/third_party/glib/BUILD.bazel
+++ b/third_party/glib/BUILD.bazel
@@ -0,0 +1,6 @@
+# TODO: Workaround for https://github.com/bazelbuild/bazel/issues/19301
+alias(
+    name = "glib",
+    actual = "@glib//glib",
+    visibility = ["//visibility:public"],
+)
diff --git a/third_party/go/patches/libseccomp.patch b/third_party/go/patches/libseccomp.patch
index 27de7d5..6779c5d 100644
--- a/third_party/go/patches/libseccomp.patch
+++ b/third_party/go/patches/libseccomp.patch
@@ -5,7 +5,7 @@
          "seccomp_internal.go",
      ],
 +    cdeps = [
-+        "@seccomp",
++        "@@//third_party/seccomp",
 +    ],
      cgo = True,
      importpath = "github.com/seccomp/libseccomp-golang",
diff --git a/third_party/go/patches/pganalyze-add-cdeps.patch b/third_party/go/patches/pganalyze-add-cdeps.patch
index 6af9192..a73adff 100644
--- a/third_party/go/patches/pganalyze-add-cdeps.patch
+++ b/third_party/go/patches/pganalyze-add-cdeps.patch
@@ -5,7 +5,7 @@
      ],
      cgo = True,
 +    cdeps = [
-+        "@libpg_query//:libpg_query",
++        "@@//third_party/libpg_query",
 +    ],
      clinkopts = [""],
      copts = ["-Iparser/include -g -fstack-protector -std=gnu99 -Wno-deprecated-non-prototype -Wno-unknown-warning-option"],
diff --git a/third_party/go/patches/runc-add-cdeps.patch b/third_party/go/patches/runc-add-cdeps.patch
index fd15c15..e980f59 100644
--- a/third_party/go/patches/runc-add-cdeps.patch
+++ b/third_party/go/patches/runc-add-cdeps.patch
@@ -4,7 +4,7 @@
          "enosys_unsupported.go",
      ],
      cgo = True,
-+    cdeps = ["@seccomp"],
++    cdeps = ["@@//third_party/seccomp"],
      importpath = "github.com/opencontainers/runc/libcontainer/seccomp/patchbpf",
      visibility = ["//visibility:public"],
      deps = select({
diff --git a/third_party/libpg_query/BUILD.bazel b/third_party/libpg_query/BUILD.bazel
index e69de29..4e4c14e 100644
--- a/third_party/libpg_query/BUILD.bazel
+++ b/third_party/libpg_query/BUILD.bazel
@@ -0,0 +1,6 @@
+# TODO: Workaround for https://github.com/bazelbuild/bazel/issues/19301
+alias(
+    name = "libpg_query",
+    actual = "@libpg_query//:libpg_query",
+    visibility = ["//visibility:public"],
+)
diff --git a/third_party/libpg_query/external/BUILD.repo b/third_party/libpg_query/external/BUILD.repo
index ad732b4..b362e34 100644
--- a/third_party/libpg_query/external/BUILD.repo
+++ b/third_party/libpg_query/external/BUILD.repo
@@ -58,6 +58,6 @@
         "-Iexternal/libpg_query/vendor/xxhash",
     ],
     visibility = [
-        "@com_github_pganalyze_pg_query_go_v4//:__subpackages__",
+        "@//third_party/libpg_query:__pkg__",
     ],
 )
diff --git a/third_party/pixman/BUILD.bazel b/third_party/pixman/BUILD.bazel
index e69de29..52a2b0b 100644
--- a/third_party/pixman/BUILD.bazel
+++ b/third_party/pixman/BUILD.bazel
@@ -0,0 +1,6 @@
+# TODO: Workaround for https://github.com/bazelbuild/bazel/issues/19301
+alias(
+    name = "pixman",
+    actual = "@pixman",
+    visibility = ["//visibility:public"],
+)
diff --git a/third_party/qemu/patches/bazel_support.patch b/third_party/qemu/patches/bazel_support.patch
index 4770db8..00c1ff2 100644
--- a/third_party/qemu/patches/bazel_support.patch
+++ b/third_party/qemu/patches/bazel_support.patch
@@ -268,7 +268,7 @@
 +        "G_LOG_DOMAIN=\\\"Slirp\\\"",
 +    ],
 +    deps = [
-+        "@glib//glib",
++        "@@//third_party/glib",
 +    ],
 +    includes = ["include", "slirp/src"],
 +)
@@ -914,11 +914,11 @@
 +        ":capstone",
 +        ":fdt",
 +        ":slirp",
-+        "@glib//glib",
-+        "@pixman//:pixman",
-+        "@seccomp",
-+        "@uring//:uring",
-+        "@zlib//:zlib",
++        "@@//third_party/glib",
++        "@@//third_party/pixman",
++        "@@//third_party/seccomp",
++        "@@//third_party/uring",
++        "@@//third_party:zlib",
 +    ],
 +    includes = ["include", "capstone/include/capstone"],
 +    alwayslink = True,  # QEMU uses __attribute__((constructor)) functions
@@ -1109,9 +1109,9 @@
 +        "_LARGEFILE_SOURCE",
 +    ],
 +    deps = [
-+        "@glib//glib",
-+        "@uring//:uring",
-+        "@zlib//:zlib",
++        "@@//third_party/glib",
++        "@@//third_party/uring",
++        "@@//third_party:zlib",
 +    ],
 +    visibility = ["//visibility:public"],
 +    includes = ["include"],
@@ -1255,9 +1255,9 @@
 +        ":fdt",
 +        ":qemu",
 +        ":slirp",
-+        "@glib//glib",
-+        "@pixman//:pixman",
-+        "@zlib//:zlib",
++        "@@//third_party/glib",
++        "@@//third_party/pixman",
++        "@@//third_party:zlib",
 +    ],
 +    visibility = ["//visibility:public"],
 +    includes = ["target/i386", "tcg/i386", "accel/tcg"],
diff --git a/third_party/seccomp/BUILD.bazel b/third_party/seccomp/BUILD.bazel
index e69de29..1f619ad 100644
--- a/third_party/seccomp/BUILD.bazel
+++ b/third_party/seccomp/BUILD.bazel
@@ -0,0 +1,6 @@
+# TODO: Workaround for https://github.com/bazelbuild/bazel/issues/19301
+alias(
+    name = "seccomp",
+    actual = "@seccomp",
+    visibility = ["//visibility:public"],
+)
diff --git a/third_party/uring/BUILD.bazel b/third_party/uring/BUILD.bazel
index e69de29..612af9d 100644
--- a/third_party/uring/BUILD.bazel
+++ b/third_party/uring/BUILD.bazel
@@ -0,0 +1,6 @@
+# TODO: Workaround for https://github.com/bazelbuild/bazel/issues/19301
+alias(
+    name = "uring",
+    actual = "@uring",
+    visibility = ["//visibility:public"],
+)