Add QEMU into the monorepo
This adds QEMU and all its dependencies into the monorepo. Enough features are enabled that
this QEMU should be both usable for running tests for Metropolis as well as running customer VMs in
containers. Thus we can also get rid of the QEMU ambient dependency.
All dependencies have their includes fully rewritten as to be reusable without a huge effort. QEMU itself
relies on `includes` attributes since the patch would otherwise be enormous and it is a binary and thus
any include path madness ends there.
Overall though this is quite nice, the final QEMU build with full optimization is <10MiB and has no further
ambient dependencies. It also has full io_uring support, which works very well with our 5.10 kernel.
TPM support is also included.
This is not used anywhere, replacing the ambient dependency and shipping a container will be in an upcoming
revision.
Test Plan:
Manually tested to run a Ubuntu cloud image with io_uring and virtio. Automated tests will follow as
part of its roles in this repo.
X-Origin-Diff: phab/D712
GitOrigin-RevId: 9c2607d75c875b1d65346e3cdac1a5e08467ea33
diff --git a/WORKSPACE b/WORKSPACE
index 910cc9e..dfdc18b 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -133,6 +133,50 @@
version = "5.10.0",
)
+load("//third_party/pixman:external.bzl", "pixman_external")
+
+pixman_external(
+ name = "pixman",
+ version = "0.40.0",
+)
+
+load("//third_party/uring:external.bzl", "uring_external")
+
+uring_external(
+ name = "uring",
+ version = "2.0",
+)
+
+load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
+
+git_repository(
+ name = "gperf",
+ commit = "de9373c2d48a3edf29862eb8be44764a7f7d24c6",
+ remote = "https://github.com/nexantic/gperf.git",
+ shallow_since = "1615306886 +0100",
+)
+
+load("//third_party/seccomp:external.bzl", "seccomp_external")
+
+seccomp_external(
+ name = "seccomp",
+ version = "2.5.1",
+)
+
+load("//third_party/glib:external.bzl", "glib_external")
+
+glib_external(
+ name = "glib",
+ version = "2.67.5",
+)
+
+load("//third_party/qemu:external.bzl", "qemu_external")
+
+qemu_external(
+ name = "qemu",
+ version = "5.2.0",
+)
+
register_toolchains("//:host_python")
# python dependencies. Currently we don't use Python, but some of our deps (ie. gvisor) do expect @pydeps// to exist, even
diff --git a/third_party/glib/BUILD b/third_party/glib/BUILD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/third_party/glib/BUILD
diff --git a/third_party/glib/cc_fix_spec.prototxt b/third_party/glib/cc_fix_spec.prototxt
new file mode 100644
index 0000000..b85aebd
--- /dev/null
+++ b/third_party/glib/cc_fix_spec.prototxt
@@ -0,0 +1,17 @@
+replace {
+ type: SYSTEM
+ from: "glibconfig.h"
+ to: "glib/glibconfig.h"
+}
+
+replace {
+ type: WORKSPACE
+ from: "build/config.h"
+ to: "glib/config.h"
+}
+
+replace {
+ type: SYSTEM
+ from: "glib.h"
+ to: "glib/glib.h"
+}
\ No newline at end of file
diff --git a/third_party/glib/external.bzl b/third_party/glib/external.bzl
new file mode 100644
index 0000000..0edd3f9
--- /dev/null
+++ b/third_party/glib/external.bzl
@@ -0,0 +1,35 @@
+# 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 glib_external(name, version):
+ sums = {
+ "2.67.5": "410966db712638dc749054c0a3c3087545d5106643139c25806399a51a8d4ab1",
+ }
+
+ http_archive(
+ name = name,
+ patch_args = ["-p1", "-u"],
+ patches = [
+ "//third_party/glib/patches:bazel_cc_fix.patch",
+ "//third_party/glib/patches:bazel_support.patch",
+ ],
+ sha256 = sums[version],
+ strip_prefix = "glib-" + version,
+ # We cannot use the actual release tarball as it contains files generated incorrectly for our environment
+ urls = ["https://gitlab.gnome.org/GNOME/glib/-/archive/%s/glib-%s.tar.gz" % (version, version)],
+ )
diff --git a/third_party/glib/patches/BUILD b/third_party/glib/patches/BUILD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/third_party/glib/patches/BUILD
diff --git a/third_party/glib/patches/bazel_cc_fix.patch b/third_party/glib/patches/bazel_cc_fix.patch
new file mode 100644
index 0000000..9bbe72b
--- /dev/null
+++ b/third_party/glib/patches/bazel_cc_fix.patch
@@ -0,0 +1,2407 @@
+Copyright 2020 The Monogon Project Authors.
+
+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.
+
+
+From c563024e7446e73299291abc1597d6c03010ca46 Mon Sep 17 00:00:00 2001
+From: Lorenz Brun <lorenz@nexantic.com>
+Date: Tue, 9 Mar 2021 22:40:09 +0100
+Subject: [PATCH] bazel_cc_fix patch
+
+---
+ glib/deprecated/gallocator.c | 6 +-
+ glib/deprecated/gallocator.h | 2 +-
+ glib/deprecated/gcache.c | 8 +-
+ glib/deprecated/gcache.h | 2 +-
+ glib/deprecated/gcompletion.c | 8 +-
+ glib/deprecated/gcompletion.h | 2 +-
+ glib/deprecated/gmain.h | 2 +-
+ glib/deprecated/grel.c | 12 +-
+ glib/deprecated/grel.h | 2 +-
+ glib/deprecated/gthread-deprecated.c | 14 +--
+ glib/deprecated/gthread.h | 2 +-
+ glib/galloca.h | 2 +-
+ glib/garray.h | 2 +-
+ glib/gasyncqueue.c | 2 +-
+ glib/gasyncqueue.h | 2 +-
+ glib/gatomic.h | 2 +-
+ glib/gbacktrace.h | 2 +-
+ glib/gbase64.h | 2 +-
+ glib/gbitlock.c | 10 +-
+ glib/gbitlock.h | 2 +-
+ glib/gbookmarkfile.h | 4 +-
+ glib/gbsearcharray.h | 2 +-
+ glib/gbytes.c | 16 +--
+ glib/gbytes.h | 4 +-
+ glib/gcharset.c | 2 +-
+ glib/gcharset.h | 2 +-
+ glib/gchecksum.h | 4 +-
+ glib/gconvert.h | 2 +-
+ glib/gdataset.h | 2 +-
+ glib/gdatasetprivate.h | 2 +-
+ glib/gdate.h | 4 +-
+ glib/gdatetime.h | 2 +-
+ glib/gdir.c | 2 +-
+ glib/gdir.h | 2 +-
+ glib/genviron.h | 2 +-
+ glib/gerror.h | 2 +-
+ glib/gfileutils.h | 4 +-
+ glib/ggettext.h | 2 +-
+ glib/ghash.h | 4 +-
+ glib/ghmac.c | 2 +-
+ glib/ghmac.h | 2 +-
+ glib/ghook.h | 2 +-
+ glib/ghostutils.h | 2 +-
+ glib/gi18n-lib.h | 2 +-
+ glib/gi18n.h | 2 +-
+ glib/giochannel.h | 6 +-
+ glib/giounix.c | 2 +-
+ glib/gkeyfile.h | 4 +-
+ glib/glib-object.h | 32 +++---
+ glib/glib-private.h | 2 +-
+ glib/glib-unix.h | 2 +-
+ glib/glib.h | 160 +++++++++++++--------------
+ glib/glist.h | 4 +-
+ glib/gmain.h | 6 +-
+ glib/gmappedfile.h | 4 +-
+ glib/gmarkup.h | 4 +-
+ glib/gmem.h | 2 +-
+ glib/gmessages.h | 8 +-
+ glib/gnode.h | 2 +-
+ glib/goption.h | 4 +-
+ glib/gpattern.h | 2 +-
+ glib/gpoll.h | 4 +-
+ glib/gprimes.h | 2 +-
+ glib/gprintf.h | 2 +-
+ glib/gprintfint.h | 2 +-
+ glib/gqsort.h | 2 +-
+ glib/gquark.h | 2 +-
+ glib/gqueue.h | 2 +-
+ glib/grand.h | 2 +-
+ glib/grcbox.h | 2 +-
+ glib/grefcount.h | 4 +-
+ glib/gregex.c | 2 +-
+ glib/gregex.h | 4 +-
+ glib/gscanner.h | 4 +-
+ glib/gsequence.h | 2 +-
+ glib/gshell.h | 2 +-
+ glib/gslice.h | 2 +-
+ glib/gslist.h | 4 +-
+ glib/gspawn.c | 2 +-
+ glib/gspawn.h | 2 +-
+ glib/gstdio.h | 2 +-
+ glib/gstrfuncs.c | 2 +-
+ glib/gstrfuncs.h | 6 +-
+ glib/gstring.h | 8 +-
+ glib/gstringchunk.h | 2 +-
+ glib/gstrvbuilder.h | 4 +-
+ glib/gtester.c | 6 +-
+ glib/gtestutils.c | 2 +-
+ glib/gtestutils.h | 8 +-
+ glib/gthread.h | 6 +-
+ glib/gthreadpool.h | 2 +-
+ glib/gthreadprivate.h | 2 +-
+ glib/gtimer.h | 2 +-
+ glib/gtimezone.h | 4 +-
+ glib/gtranslit.c | 4 +-
+ glib/gtrashstack.h | 2 +-
+ glib/gtree.h | 2 +-
+ glib/gtypes.h | 6 +-
+ glib/gunibreak.h | 4 +-
+ glib/gunicode.h | 4 +-
+ glib/guri.h | 2 +-
+ glib/gutils.h | 2 +-
+ glib/guuid.h | 2 +-
+ glib/gvariant-core.c | 22 ++--
+ glib/gvariant-core.h | 6 +-
+ glib/gvariant-internal.h | 4 +-
+ glib/gvariant-serialiser.c | 8 +-
+ glib/gvariant.c | 14 +--
+ glib/gvariant.h | 6 +-
+ glib/gvarianttype.c | 6 +-
+ glib/gvarianttype.h | 2 +-
+ glib/gvarianttypeinfo.c | 10 +-
+ glib/gvarianttypeinfo.h | 2 +-
+ glib/gversion.h | 2 +-
+ glib/gwakeup.c | 2 +-
+ glib/gwakeup.h | 2 +-
+ glib/gwin32.h | 2 +-
+ glib/libcharset/localcharset.c | 2 +-
+ glib/pcre/pcre_byte_order.c | 2 +-
+ glib/pcre/pcre_chartables.c | 2 +-
+ glib/pcre/pcre_compile.c | 6 +-
+ glib/pcre/pcre_config.c | 2 +-
+ glib/pcre/pcre_dfa_exec.c | 2 +-
+ glib/pcre/pcre_exec.c | 2 +-
+ glib/pcre/pcre_fullinfo.c | 2 +-
+ glib/pcre/pcre_get.c | 2 +-
+ glib/pcre/pcre_globals.c | 6 +-
+ glib/pcre/pcre_jit_compile.c | 2 +-
+ glib/pcre/pcre_newline.c | 2 +-
+ glib/pcre/pcre_ord2utf8.c | 2 +-
+ glib/pcre/pcre_string_utils.c | 2 +-
+ glib/pcre/pcre_study.c | 2 +-
+ glib/pcre/pcre_tables.c | 2 +-
+ glib/pcre/pcre_valid_utf8.c | 2 +-
+ glib/pcre/pcre_version.c | 2 +-
+ glib/pcre/pcre_xclass.c | 2 +-
+ glib/pcre/ucp.h | 4 +-
+ 137 files changed, 338 insertions(+), 338 deletions(-)
+
+diff --git a/glib/deprecated/gallocator.c b/glib/deprecated/gallocator.c
+index 66483b632..6598cbeed 100644
+--- a/glib/deprecated/gallocator.c
++++ b/glib/deprecated/gallocator.c
+@@ -13,7 +13,7 @@
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+-#include "config.h"
++#include "glib/config.h"
+
+ /* we know we are deprecated here, no need for warnings */
+ #ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
+@@ -22,8 +22,8 @@
+
+ #include "gallocator.h"
+
+-#include <glib/gmessages.h>
+-#include <glib/gslice.h>
++#include "glib/gmessages.h"
++#include "glib/gslice.h"
+
+ struct _GMemChunk {
+ guint alloc_size; /* the size of an atom */
+diff --git a/glib/deprecated/gallocator.h b/glib/deprecated/gallocator.h
+index 005e92b6e..5fead4206 100644
+--- a/glib/deprecated/gallocator.h
++++ b/glib/deprecated/gallocator.h
+@@ -20,7 +20,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "glib/gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/deprecated/gcache.c b/glib/deprecated/gcache.c
+index 9e04145be..c1d33bd3e 100644
+--- a/glib/deprecated/gcache.c
++++ b/glib/deprecated/gcache.c
+@@ -26,7 +26,7 @@
+ * MT safe
+ */
+
+-#include "config.h"
++#include "glib/config.h"
+
+ /* we know we are deprecated here, no need for warnings */
+ #ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
+@@ -35,9 +35,9 @@
+
+ #include "gcache.h"
+
+-#include "gslice.h"
+-#include "ghash.h"
+-#include "gtestutils.h"
++#include "glib/gslice.h"
++#include "glib/ghash.h"
++#include "glib/gtestutils.h"
+
+ /**
+ * SECTION:caches
+diff --git a/glib/deprecated/gcache.h b/glib/deprecated/gcache.h
+index e1c1f2cde..8ebabca20 100644
+--- a/glib/deprecated/gcache.h
++++ b/glib/deprecated/gcache.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/glist.h>
++#include "glib/glist.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/deprecated/gcompletion.c b/glib/deprecated/gcompletion.c
+index d09c1f1fa..b11aaa744 100644
+--- a/glib/deprecated/gcompletion.c
++++ b/glib/deprecated/gcompletion.c
+@@ -26,7 +26,7 @@
+ * MT safe
+ */
+
+-#include "config.h"
++#include "glib/config.h"
+
+ /* we know we are deprecated here, no need for warnings */
+ #ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
+@@ -35,9 +35,9 @@
+
+ #include "gcompletion.h"
+
+-#include <glib/gstrfuncs.h>
+-#include <glib/gmessages.h>
+-#include <glib/gunicode.h>
++#include "glib/gstrfuncs.h"
++#include "glib/gmessages.h"
++#include "glib/gunicode.h"
+
+ #include <string.h>
+
+diff --git a/glib/deprecated/gcompletion.h b/glib/deprecated/gcompletion.h
+index 2fd1f0393..b5ff33172 100644
+--- a/glib/deprecated/gcompletion.h
++++ b/glib/deprecated/gcompletion.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/glist.h>
++#include "glib/glist.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/deprecated/gmain.h b/glib/deprecated/gmain.h
+index 5d08eb6b4..50c177deb 100644
+--- a/glib/deprecated/gmain.h
++++ b/glib/deprecated/gmain.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gmain.h>
++#include "glib/gmain.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/deprecated/grel.c b/glib/deprecated/grel.c
+index b48ec1173..a42d1ba6d 100644
+--- a/glib/deprecated/grel.c
++++ b/glib/deprecated/grel.c
+@@ -27,7 +27,7 @@
+ * MT safe
+ */
+
+-#include "config.h"
++#include "glib/config.h"
+
+ /* we know we are deprecated here, no need for warnings */
+ #ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
+@@ -36,11 +36,11 @@
+
+ #include "grel.h"
+
+-#include <glib/gmessages.h>
+-#include <glib/gtestutils.h>
+-#include <glib/gstring.h>
+-#include <glib/gslice.h>
+-#include <glib/ghash.h>
++#include "glib/gmessages.h"
++#include "glib/gtestutils.h"
++#include "glib/gstring.h"
++#include "glib/gslice.h"
++#include "glib/ghash.h"
+
+ #include <stdarg.h>
+ #include <string.h>
+diff --git a/glib/deprecated/grel.h b/glib/deprecated/grel.h
+index 3a65240c1..68745ee03 100644
+--- a/glib/deprecated/grel.h
++++ b/glib/deprecated/grel.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "glib/gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/deprecated/gthread-deprecated.c b/glib/deprecated/gthread-deprecated.c
+index e7e68fbd6..fa0648ef3 100644
+--- a/glib/deprecated/gthread-deprecated.c
++++ b/glib/deprecated/gthread-deprecated.c
+@@ -19,22 +19,22 @@
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+-#include "config.h"
++#include "glib/config.h"
+
+ /* we know we are deprecated here, no need for warnings */
+ #ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
+ #define GLIB_DISABLE_DEPRECATION_WARNINGS
+ #endif
+
+-#include "gmessages.h"
+-#include "gslice.h"
++#include "glib/gmessages.h"
++#include "glib/gslice.h"
+ #include "gmain.h"
+ #include "gthread.h"
+-#include "gthreadprivate.h"
+-#include "deprecated/gthread.h"
+-#include "garray.h"
++#include "glib/gthreadprivate.h"
++#include "gthread.h"
++#include "glib/garray.h"
+
+-#include "gutils.h"
++#include "glib/gutils.h"
+
+ /* {{{1 Documentation */
+
+diff --git a/glib/deprecated/gthread.h b/glib/deprecated/gthread.h
+index 33b422240..380444f01 100644
+--- a/glib/deprecated/gthread.h
++++ b/glib/deprecated/gthread.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gthread.h>
++#include "glib/gthread.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/galloca.h b/glib/galloca.h
+index 47151ee8b..35c31fba9 100644
+--- a/glib/galloca.h
++++ b/glib/galloca.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ #if defined(__BIONIC__) && defined (GLIB_HAVE_ALLOCA_H)
+ # include <alloca.h>
+diff --git a/glib/garray.h b/glib/garray.h
+index 67131b5b3..52775a281 100644
+--- a/glib/garray.h
++++ b/glib/garray.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gasyncqueue.c b/glib/gasyncqueue.c
+index a452617fd..2a990ef8d 100644
+--- a/glib/gasyncqueue.c
++++ b/glib/gasyncqueue.c
+@@ -33,7 +33,7 @@
+ #include "gtestutils.h"
+ #include "gtimer.h"
+ #include "gthread.h"
+-#include "deprecated/gthread.h"
++#include "glib/deprecated/gthread.h"
+
+
+ /**
+diff --git a/glib/gasyncqueue.h b/glib/gasyncqueue.h
+index 73e537b07..30587f511 100644
+--- a/glib/gasyncqueue.h
++++ b/glib/gasyncqueue.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gthread.h>
++#include "gthread.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gatomic.h b/glib/gatomic.h
+index 2ad648aad..da65a6029 100644
+--- a/glib/gatomic.h
++++ b/glib/gatomic.h
+@@ -24,7 +24,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ #if defined(glib_typeof_2_68) && GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68
+ /* for glib_typeof */
+diff --git a/glib/gbacktrace.h b/glib/gbacktrace.h
+index 09b8ccbd3..30894769a 100644
+--- a/glib/gbacktrace.h
++++ b/glib/gbacktrace.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+ #ifdef __sun__
+ #include <sys/select.h>
+ #endif
+diff --git a/glib/gbase64.h b/glib/gbase64.h
+index 662c597ff..26b0607dc 100644
+--- a/glib/gbase64.h
++++ b/glib/gbase64.h
+@@ -23,7 +23,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gbitlock.c b/glib/gbitlock.c
+index c08a6f934..e586b1548 100644
+--- a/glib/gbitlock.c
++++ b/glib/gbitlock.c
+@@ -22,11 +22,11 @@
+
+ #include "gbitlock.h"
+
+-#include <glib/gmessages.h>
+-#include <glib/gatomic.h>
+-#include <glib/gslist.h>
+-#include <glib/gthread.h>
+-#include <glib/gslice.h>
++#include "gmessages.h"
++#include "gatomic.h"
++#include "gslist.h"
++#include "gthread.h"
++#include "gslice.h"
+
+ #include "gthreadprivate.h"
+
+diff --git a/glib/gbitlock.h b/glib/gbitlock.h
+index 8054bc8ae..6a0c69194 100644
+--- a/glib/gbitlock.h
++++ b/glib/gbitlock.h
+@@ -21,7 +21,7 @@
+ #ifndef __G_BITLOCK_H__
+ #define __G_BITLOCK_H__
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+ #error "Only <glib.h> can be included directly."
+diff --git a/glib/gbookmarkfile.h b/glib/gbookmarkfile.h
+index e9cfbf12b..9355aa074 100644
+--- a/glib/gbookmarkfile.h
++++ b/glib/gbookmarkfile.h
+@@ -23,8 +23,8 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gdatetime.h>
+-#include <glib/gerror.h>
++#include "gdatetime.h"
++#include "gerror.h"
+ #include <time.h>
+
+ G_BEGIN_DECLS
+diff --git a/glib/gbsearcharray.h b/glib/gbsearcharray.h
+index 39afa3f79..e44ff0f8e 100644
+--- a/glib/gbsearcharray.h
++++ b/glib/gbsearcharray.h
+@@ -19,7 +19,7 @@
+ #ifndef __G_BSEARCH_ARRAY_H__
+ #define __G_BSEARCH_ARRAY_H__
+
+-#include <glib.h>
++#include "glib/glib.h"
+ #include <string.h>
+
+
+diff --git a/glib/gbytes.c b/glib/gbytes.c
+index aaadf451b..3fd73911f 100644
+--- a/glib/gbytes.c
++++ b/glib/gbytes.c
+@@ -23,14 +23,14 @@
+
+ #include "gbytes.h"
+
+-#include <glib/garray.h>
+-#include <glib/gstrfuncs.h>
+-#include <glib/gatomic.h>
+-#include <glib/gslice.h>
+-#include <glib/gtestutils.h>
+-#include <glib/gmem.h>
+-#include <glib/gmessages.h>
+-#include <glib/grefcount.h>
++#include "garray.h"
++#include "gstrfuncs.h"
++#include "gatomic.h"
++#include "gslice.h"
++#include "gtestutils.h"
++#include "gmem.h"
++#include "gmessages.h"
++#include "grefcount.h"
+
+ #include <string.h>
+
+diff --git a/glib/gbytes.h b/glib/gbytes.h
+index 0bb1517b9..13c818de3 100644
+--- a/glib/gbytes.h
++++ b/glib/gbytes.h
+@@ -26,8 +26,8 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
+-#include <glib/garray.h>
++#include "gtypes.h"
++#include "garray.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gcharset.c b/glib/gcharset.c
+index bb775bda4..f81ee1346 100644
+--- a/glib/gcharset.c
++++ b/glib/gcharset.c
+@@ -32,7 +32,7 @@
+ #include "gwin32.h"
+ #endif
+
+-#include "libcharset/libcharset.h"
++#include "glib/libcharset/libcharset.h"
+
+ #include <string.h>
+ #include <stdio.h>
+diff --git a/glib/gcharset.h b/glib/gcharset.h
+index 82020f604..4dbcb0948 100644
+--- a/glib/gcharset.h
++++ b/glib/gcharset.h
+@@ -23,7 +23,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gchecksum.h b/glib/gchecksum.h
+index 599f439c1..dce60f026 100644
+--- a/glib/gchecksum.h
++++ b/glib/gchecksum.h
+@@ -23,8 +23,8 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
+-#include <glib/gbytes.h>
++#include "gtypes.h"
++#include "gbytes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gconvert.h b/glib/gconvert.h
+index be58ecfbe..d8b0e7947 100644
+--- a/glib/gconvert.h
++++ b/glib/gconvert.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gerror.h>
++#include "gerror.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gdataset.h b/glib/gdataset.h
+index 89a34c71a..d95f1d579 100644
+--- a/glib/gdataset.h
++++ b/glib/gdataset.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gquark.h>
++#include "gquark.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gdatasetprivate.h b/glib/gdatasetprivate.h
+index eb95278f1..21233cd22 100644
+--- a/glib/gdatasetprivate.h
++++ b/glib/gdatasetprivate.h
+@@ -26,7 +26,7 @@
+ #ifndef __G_DATASETPRIVATE_H__
+ #define __G_DATASETPRIVATE_H__
+
+-#include <gatomic.h>
++#include "gatomic.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gdate.h b/glib/gdate.h
+index 65fe811fa..8a52559e7 100644
+--- a/glib/gdate.h
++++ b/glib/gdate.h
+@@ -31,8 +31,8 @@
+
+ #include <time.h>
+
+-#include <glib/gtypes.h>
+-#include <glib/gquark.h>
++#include "gtypes.h"
++#include "gquark.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gdatetime.h b/glib/gdatetime.h
+index fa43d8531..ee83e72ec 100644
+--- a/glib/gdatetime.h
++++ b/glib/gdatetime.h
+@@ -28,7 +28,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtimezone.h>
++#include "gtimezone.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gdir.c b/glib/gdir.c
+index c26edc1dc..7f643ab51 100644
+--- a/glib/gdir.c
++++ b/glib/gdir.c
+@@ -41,7 +41,7 @@
+ #include "glibintl.h"
+
+ #if defined (_MSC_VER) && !defined (HAVE_DIRENT_H)
+-#include "dirent/dirent.h"
++#include "glib/dirent/dirent.h"
+ #endif
+
+ #include "glib-private.h" /* g_dir_open_with_errno, g_dir_new_from_dirp */
+diff --git a/glib/gdir.h b/glib/gdir.h
+index 8f9d6bd7c..4bac1df5e 100644
+--- a/glib/gdir.h
++++ b/glib/gdir.h
+@@ -26,7 +26,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gerror.h>
++#include "gerror.h"
+
+ #ifdef G_OS_UNIX
+ #include <dirent.h>
+diff --git a/glib/genviron.h b/glib/genviron.h
+index c4bf01a5a..8624e2eda 100644
+--- a/glib/genviron.h
++++ b/glib/genviron.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gerror.h b/glib/gerror.h
+index 6431d5b6c..ae3bf4378 100644
+--- a/glib/gerror.h
++++ b/glib/gerror.h
+@@ -25,7 +25,7 @@
+
+ #include <stdarg.h>
+
+-#include <glib/gquark.h>
++#include "gquark.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gfileutils.h b/glib/gfileutils.h
+index d6b1d9eec..16cb7f481 100644
+--- a/glib/gfileutils.h
++++ b/glib/gfileutils.h
+@@ -23,8 +23,8 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glibconfig.h>
+-#include <glib/gerror.h>
++#include "glib/glibconfig.h"
++#include "gerror.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/ggettext.h b/glib/ggettext.h
+index 036f9d534..7a2844131 100644
+--- a/glib/ggettext.h
++++ b/glib/ggettext.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/ghash.h b/glib/ghash.h
+index e9ce64505..9bf818507 100644
+--- a/glib/ghash.h
++++ b/glib/ghash.h
+@@ -29,8 +29,8 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
+-#include <glib/glist.h>
++#include "gtypes.h"
++#include "glist.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/ghmac.c b/glib/ghmac.c
+index 49fd272f0..91689754a 100644
+--- a/glib/ghmac.c
++++ b/glib/ghmac.c
+@@ -24,7 +24,7 @@
+
+ #include "ghmac.h"
+
+-#include "glib/galloca.h"
++#include "galloca.h"
+ #include "gatomic.h"
+ #include "gslice.h"
+ #include "gmem.h"
+diff --git a/glib/ghmac.h b/glib/ghmac.h
+index 36e24eb29..843b202bb 100644
+--- a/glib/ghmac.h
++++ b/glib/ghmac.h
+@@ -23,7 +23,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+ #include "gchecksum.h"
+
+ G_BEGIN_DECLS
+diff --git a/glib/ghook.h b/glib/ghook.h
+index 83ad1bdef..f377245da 100644
+--- a/glib/ghook.h
++++ b/glib/ghook.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gmem.h>
++#include "gmem.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/ghostutils.h b/glib/ghostutils.h
+index 59d2d41ed..37f8ed916 100644
+--- a/glib/ghostutils.h
++++ b/glib/ghostutils.h
+@@ -22,7 +22,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gi18n-lib.h b/glib/gi18n-lib.h
+index 74e50a3a8..52e0e2201 100644
+--- a/glib/gi18n-lib.h
++++ b/glib/gi18n-lib.h
+@@ -18,7 +18,7 @@
+ #ifndef __G_I18N_LIB_H__
+ #define __G_I18N_LIB_H__
+
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #include <libintl.h>
+ #include <string.h>
+diff --git a/glib/gi18n.h b/glib/gi18n.h
+index 5f996d24e..39a035c1b 100644
+--- a/glib/gi18n.h
++++ b/glib/gi18n.h
+@@ -18,7 +18,7 @@
+ #ifndef __G_I18N_H__
+ #define __G_I18N_H__
+
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #include <libintl.h>
+ #include <string.h>
+diff --git a/glib/giochannel.h b/glib/giochannel.h
+index 82743602a..ecb748937 100644
+--- a/glib/giochannel.h
++++ b/glib/giochannel.h
+@@ -29,9 +29,9 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gconvert.h>
+-#include <glib/gmain.h>
+-#include <glib/gstring.h>
++#include "gconvert.h"
++#include "gmain.h"
++#include "gstring.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/giounix.c b/glib/giounix.c
+index b86d79db7..3ac2c5134 100644
+--- a/glib/giounix.c
++++ b/glib/giounix.c
+@@ -40,7 +40,7 @@
+ #include <errno.h>
+ #include <string.h>
+ #include <fcntl.h>
+-#include <glib/gstdio.h>
++#include "gstdio.h"
+
+ #include "giochannel.h"
+
+diff --git a/glib/gkeyfile.h b/glib/gkeyfile.h
+index 7a1004841..6d30fa378 100644
+--- a/glib/gkeyfile.h
++++ b/glib/gkeyfile.h
+@@ -25,8 +25,8 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gbytes.h>
+-#include <glib/gerror.h>
++#include "gbytes.h"
++#include "gerror.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/glib-object.h b/glib/glib-object.h
+index fa824f3bb..ca0043ca0 100644
+--- a/glib/glib-object.h
++++ b/glib/glib-object.h
+@@ -19,23 +19,23 @@
+
+ #define __GLIB_GOBJECT_H_INSIDE__
+
+-#include <gobject/gbinding.h>
+-#include <gobject/gboxed.h>
+-#include <gobject/genums.h>
+-#include <gobject/glib-enumtypes.h>
+-#include <gobject/gobject.h>
+-#include <gobject/gparam.h>
+-#include <gobject/gparamspecs.h>
+-#include <gobject/gsignal.h>
+-#include <gobject/gsourceclosure.h>
+-#include <gobject/gtype.h>
+-#include <gobject/gtypemodule.h>
+-#include <gobject/gtypeplugin.h>
+-#include <gobject/gvaluearray.h>
+-#include <gobject/gvalue.h>
+-#include <gobject/gvaluetypes.h>
++#include "gobject/gbinding.h"
++#include "gobject/gboxed.h"
++#include "gobject/genums.h"
++#include "build/gobject/glib-enumtypes.h"
++#include "gobject/gobject.h"
++#include "gobject/gparam.h"
++#include "gobject/gparamspecs.h"
++#include "gobject/gsignal.h"
++#include "gobject/gsourceclosure.h"
++#include "gobject/gtype.h"
++#include "gobject/gtypemodule.h"
++#include "gobject/gtypeplugin.h"
++#include "gobject/gvaluearray.h"
++#include "gobject/gvalue.h"
++#include "gobject/gvaluetypes.h"
+
+-#include <gobject/gobject-autocleanups.h>
++#include "gobject/gobject-autocleanups.h"
+
+ #undef __GLIB_GOBJECT_H_INSIDE__
+
+diff --git a/glib/glib-private.h b/glib/glib-private.h
+index 8de380d12..b0a1370cd 100644
+--- a/glib/glib-private.h
++++ b/glib/glib-private.h
+@@ -18,7 +18,7 @@
+ #ifndef __GLIB_PRIVATE_H__
+ #define __GLIB_PRIVATE_H__
+
+-#include <glib.h>
++#include "glib/glib.h"
+ #include "gwakeup.h"
+ #include "gstdioprivate.h"
+
+diff --git a/glib/glib-unix.h b/glib/glib-unix.h
+index a5ea9a1c5..b87708312 100644
+--- a/glib/glib-unix.h
++++ b/glib/glib-unix.h
+@@ -30,7 +30,7 @@
+ #include <stdlib.h>
+ #include <fcntl.h>
+
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #ifndef G_OS_UNIX
+ #error "This header may only be used on UNIX"
+diff --git a/glib/glib.h b/glib/glib.h
+index a4d43a9bf..db3c0bf14 100644
+--- a/glib/glib.h
++++ b/glib/glib.h
+@@ -27,91 +27,91 @@
+
+ #define __GLIB_H_INSIDE__
+
+-#include <glib/galloca.h>
+-#include <glib/garray.h>
+-#include <glib/gasyncqueue.h>
+-#include <glib/gatomic.h>
+-#include <glib/gbacktrace.h>
+-#include <glib/gbase64.h>
+-#include <glib/gbitlock.h>
+-#include <glib/gbookmarkfile.h>
+-#include <glib/gbytes.h>
+-#include <glib/gcharset.h>
+-#include <glib/gchecksum.h>
+-#include <glib/gconvert.h>
+-#include <glib/gdataset.h>
+-#include <glib/gdate.h>
+-#include <glib/gdatetime.h>
+-#include <glib/gdir.h>
+-#include <glib/genviron.h>
+-#include <glib/gerror.h>
+-#include <glib/gfileutils.h>
+-#include <glib/ggettext.h>
+-#include <glib/ghash.h>
+-#include <glib/ghmac.h>
+-#include <glib/ghook.h>
+-#include <glib/ghostutils.h>
+-#include <glib/giochannel.h>
+-#include <glib/gkeyfile.h>
+-#include <glib/glist.h>
+-#include <glib/gmacros.h>
+-#include <glib/gmain.h>
+-#include <glib/gmappedfile.h>
+-#include <glib/gmarkup.h>
+-#include <glib/gmem.h>
+-#include <glib/gmessages.h>
+-#include <glib/gnode.h>
+-#include <glib/goption.h>
+-#include <glib/gpattern.h>
+-#include <glib/gpoll.h>
+-#include <glib/gprimes.h>
+-#include <glib/gqsort.h>
+-#include <glib/gquark.h>
+-#include <glib/gqueue.h>
+-#include <glib/grand.h>
+-#include <glib/grcbox.h>
+-#include <glib/grefcount.h>
+-#include <glib/grefstring.h>
+-#include <glib/gregex.h>
+-#include <glib/gscanner.h>
+-#include <glib/gsequence.h>
+-#include <glib/gshell.h>
+-#include <glib/gslice.h>
+-#include <glib/gslist.h>
+-#include <glib/gspawn.h>
+-#include <glib/gstrfuncs.h>
+-#include <glib/gstringchunk.h>
+-#include <glib/gstring.h>
+-#include <glib/gstrvbuilder.h>
+-#include <glib/gtestutils.h>
+-#include <glib/gthread.h>
+-#include <glib/gthreadpool.h>
+-#include <glib/gtimer.h>
+-#include <glib/gtimezone.h>
+-#include <glib/gtrashstack.h>
+-#include <glib/gtree.h>
+-#include <glib/gtypes.h>
+-#include <glib/gunicode.h>
+-#include <glib/guri.h>
+-#include <glib/gutils.h>
+-#include <glib/guuid.h>
+-#include <glib/gvariant.h>
+-#include <glib/gvarianttype.h>
+-#include <glib/gversion.h>
+-#include <glib/gversionmacros.h>
++#include "galloca.h"
++#include "garray.h"
++#include "gasyncqueue.h"
++#include "gatomic.h"
++#include "gbacktrace.h"
++#include "gbase64.h"
++#include "gbitlock.h"
++#include "gbookmarkfile.h"
++#include "gbytes.h"
++#include "gcharset.h"
++#include "gchecksum.h"
++#include "gconvert.h"
++#include "gdataset.h"
++#include "gdate.h"
++#include "gdatetime.h"
++#include "gdir.h"
++#include "genviron.h"
++#include "gerror.h"
++#include "gfileutils.h"
++#include "ggettext.h"
++#include "ghash.h"
++#include "ghmac.h"
++#include "ghook.h"
++#include "ghostutils.h"
++#include "giochannel.h"
++#include "gkeyfile.h"
++#include "glist.h"
++#include "gmacros.h"
++#include "gmain.h"
++#include "gmappedfile.h"
++#include "gmarkup.h"
++#include "gmem.h"
++#include "gmessages.h"
++#include "gnode.h"
++#include "goption.h"
++#include "gpattern.h"
++#include "gpoll.h"
++#include "gprimes.h"
++#include "gqsort.h"
++#include "gquark.h"
++#include "gqueue.h"
++#include "grand.h"
++#include "grcbox.h"
++#include "grefcount.h"
++#include "grefstring.h"
++#include "gregex.h"
++#include "gscanner.h"
++#include "gsequence.h"
++#include "gshell.h"
++#include "gslice.h"
++#include "gslist.h"
++#include "gspawn.h"
++#include "gstrfuncs.h"
++#include "gstringchunk.h"
++#include "gstring.h"
++#include "gstrvbuilder.h"
++#include "gtestutils.h"
++#include "gthread.h"
++#include "gthreadpool.h"
++#include "gtimer.h"
++#include "gtimezone.h"
++#include "gtrashstack.h"
++#include "gtree.h"
++#include "gtypes.h"
++#include "gunicode.h"
++#include "guri.h"
++#include "gutils.h"
++#include "guuid.h"
++#include "gvariant.h"
++#include "gvarianttype.h"
++#include "gversion.h"
++#include "gversionmacros.h"
+
+ #ifdef G_PLATFORM_WIN32
+-#include <glib/gwin32.h>
++#include "gwin32.h"
+ #endif
+
+-#include <glib/deprecated/gallocator.h>
+-#include <glib/deprecated/gcache.h>
+-#include <glib/deprecated/gcompletion.h>
+-#include <glib/deprecated/gmain.h>
+-#include <glib/deprecated/grel.h>
+-#include <glib/deprecated/gthread.h>
++#include "glib/deprecated/gallocator.h"
++#include "glib/deprecated/gcache.h"
++#include "glib/deprecated/gcompletion.h"
++#include "glib/deprecated/gmain.h"
++#include "glib/deprecated/grel.h"
++#include "glib/deprecated/gthread.h"
+
+-#include <glib/glib-autocleanups.h>
++#include "glib-autocleanups.h"
+
+ #undef __GLIB_H_INSIDE__
+
+diff --git a/glib/glist.h b/glib/glist.h
+index ddea3cf35..fc822fa5c 100644
+--- a/glib/glist.h
++++ b/glib/glist.h
+@@ -29,8 +29,8 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gmem.h>
+-#include <glib/gnode.h>
++#include "gmem.h"
++#include "gnode.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gmain.h b/glib/gmain.h
+index 5c0e524cc..12504f6e3 100644
+--- a/glib/gmain.h
++++ b/glib/gmain.h
+@@ -22,9 +22,9 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gpoll.h>
+-#include <glib/gslist.h>
+-#include <glib/gthread.h>
++#include "gpoll.h"
++#include "gslist.h"
++#include "gthread.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gmappedfile.h b/glib/gmappedfile.h
+index 8256811e6..aeb80e3c0 100644
+--- a/glib/gmappedfile.h
++++ b/glib/gmappedfile.h
+@@ -24,8 +24,8 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gbytes.h>
+-#include <glib/gerror.h>
++#include "gbytes.h"
++#include "gerror.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gmarkup.h b/glib/gmarkup.h
+index 96375b55a..b7c65f6b4 100644
+--- a/glib/gmarkup.h
++++ b/glib/gmarkup.h
+@@ -25,8 +25,8 @@
+
+ #include <stdarg.h>
+
+-#include <glib/gerror.h>
+-#include <glib/gslist.h>
++#include "gerror.h"
++#include "gslist.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gmem.h b/glib/gmem.h
+index ccf477843..8b1822bd3 100644
+--- a/glib/gmem.h
++++ b/glib/gmem.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gutils.h>
++#include "gutils.h"
+
+ #if defined(glib_typeof_2_68) && GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68
+ /* for glib_typeof */
+diff --git a/glib/gmessages.h b/glib/gmessages.h
+index 43c6d67b9..f4ece7894 100644
+--- a/glib/gmessages.h
++++ b/glib/gmessages.h
+@@ -30,10 +30,10 @@
+ #endif
+
+ #include <stdarg.h>
+-#include <glib/gatomic.h>
+-#include <glib/gtypes.h>
+-#include <glib/gmacros.h>
+-#include <glib/gvariant.h>
++#include "gatomic.h"
++#include "gtypes.h"
++#include "gmacros.h"
++#include "gvariant.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gnode.h b/glib/gnode.h
+index 693e6154d..217084cf7 100644
+--- a/glib/gnode.h
++++ b/glib/gnode.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gmem.h>
++#include "gmem.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/goption.h b/glib/goption.h
+index 63552fb0d..4b75b74cb 100644
+--- a/glib/goption.h
++++ b/glib/goption.h
+@@ -23,8 +23,8 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gerror.h>
+-#include <glib/gquark.h>
++#include "gerror.h"
++#include "gquark.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gpattern.h b/glib/gpattern.h
+index bd9e4a7af..5a8b5d53a 100644
+--- a/glib/gpattern.h
++++ b/glib/gpattern.h
+@@ -22,7 +22,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gpoll.h b/glib/gpoll.h
+index 2cbd69729..306a48069 100644
+--- a/glib/gpoll.h
++++ b/glib/gpoll.h
+@@ -22,8 +22,8 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glibconfig.h>
+-#include <glib/gtypes.h>
++#include "glib/glibconfig.h"
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gprimes.h b/glib/gprimes.h
+index 0b6ea850d..634bdddc3 100644
+--- a/glib/gprimes.h
++++ b/glib/gprimes.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gprintf.h b/glib/gprintf.h
+index 429de7a24..2a224e3a4 100644
+--- a/glib/gprintf.h
++++ b/glib/gprintf.h
+@@ -18,7 +18,7 @@
+ #ifndef __G_PRINTF_H__
+ #define __G_PRINTF_H__
+
+-#include <glib.h>
++#include "glib/glib.h"
+ #include <stdio.h>
+ #include <stdarg.h>
+
+diff --git a/glib/gprintfint.h b/glib/gprintfint.h
+index 9ccf2eb47..e8cffcd58 100644
+--- a/glib/gprintfint.h
++++ b/glib/gprintfint.h
+@@ -39,7 +39,7 @@
+
+ #else
+
+-#include "gnulib/printf.h"
++#include "glib/gnulib/printf.h"
+
+ #define _g_printf _g_gnulib_printf
+ #define _g_fprintf _g_gnulib_fprintf
+diff --git a/glib/gqsort.h b/glib/gqsort.h
+index 2ecd75fae..63ca144ca 100644
+--- a/glib/gqsort.h
++++ b/glib/gqsort.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gquark.h b/glib/gquark.h
+index 1822c4bf7..5badfd45c 100644
+--- a/glib/gquark.h
++++ b/glib/gquark.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gqueue.h b/glib/gqueue.h
+index 65d609f1a..c38219d53 100644
+--- a/glib/gqueue.h
++++ b/glib/gqueue.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/glist.h>
++#include "glist.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/grand.h b/glib/grand.h
+index d64e50253..bdf82a6fe 100644
+--- a/glib/grand.h
++++ b/glib/grand.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/grcbox.h b/glib/grcbox.h
+index 47dfd488b..a87629588 100644
+--- a/glib/grcbox.h
++++ b/glib/grcbox.h
+@@ -22,7 +22,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gmem.h>
++#include "gmem.h"
+
+ #if defined(glib_typeof_2_68) && GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68
+ /* for glib_typeof */
+diff --git a/glib/grefcount.h b/glib/grefcount.h
+index 599dac978..f46364db5 100644
+--- a/glib/grefcount.h
++++ b/glib/grefcount.h
+@@ -23,8 +23,8 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gatomic.h>
+-#include <glib/gtypes.h>
++#include "gatomic.h"
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gregex.c b/glib/gregex.c
+index 5e6ddfb46..a89bfe779 100644
+--- a/glib/gregex.c
++++ b/glib/gregex.c
+@@ -25,7 +25,7 @@
+ #ifdef USE_SYSTEM_PCRE
+ #include <pcre.h>
+ #else
+-#include "pcre/pcre.h"
++#include "glib/pcre/pcre.h"
+ #endif
+
+ #include "gtypes.h"
+diff --git a/glib/gregex.h b/glib/gregex.h
+index 45e198df6..b765bc17c 100644
+--- a/glib/gregex.h
++++ b/glib/gregex.h
+@@ -25,8 +25,8 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gerror.h>
+-#include <glib/gstring.h>
++#include "gerror.h"
++#include "gstring.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gscanner.h b/glib/gscanner.h
+index d87b4533e..837891caf 100644
+--- a/glib/gscanner.h
++++ b/glib/gscanner.h
+@@ -29,8 +29,8 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gdataset.h>
+-#include <glib/ghash.h>
++#include "gdataset.h"
++#include "ghash.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gsequence.h b/glib/gsequence.h
+index 6dce2f4fb..ad69d34f3 100644
+--- a/glib/gsequence.h
++++ b/glib/gsequence.h
+@@ -23,7 +23,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gshell.h b/glib/gshell.h
+index 798dd7808..77d081f43 100644
+--- a/glib/gshell.h
++++ b/glib/gshell.h
+@@ -23,7 +23,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gerror.h>
++#include "gerror.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gslice.h b/glib/gslice.h
+index 002410635..5da19645d 100644
+--- a/glib/gslice.h
++++ b/glib/gslice.h
+@@ -22,7 +22,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+ #include <string.h>
+
+ G_BEGIN_DECLS
+diff --git a/glib/gslist.h b/glib/gslist.h
+index 249417986..954fa70e8 100644
+--- a/glib/gslist.h
++++ b/glib/gslist.h
+@@ -29,8 +29,8 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gmem.h>
+-#include <glib/gnode.h>
++#include "gmem.h"
++#include "gnode.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gspawn.c b/glib/gspawn.c
+index 95f5b868e..62505ebda 100644
+--- a/glib/gspawn.c
++++ b/glib/gspawn.c
+@@ -55,7 +55,7 @@
+ #include "gspawn-private.h"
+ #include "gthread.h"
+ #include "gtrace-private.h"
+-#include "glib/gstdio.h"
++#include "gstdio.h"
+
+ #include "genviron.h"
+ #include "gmem.h"
+diff --git a/glib/gspawn.h b/glib/gspawn.h
+index e09dc2aec..ca0a34f42 100644
+--- a/glib/gspawn.h
++++ b/glib/gspawn.h
+@@ -23,7 +23,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gerror.h>
++#include "gerror.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gstdio.h b/glib/gstdio.h
+index 7ed9c5dfa..ce94a8c1a 100644
+--- a/glib/gstdio.h
++++ b/glib/gstdio.h
+@@ -19,7 +19,7 @@
+ #ifndef __G_STDIO_H__
+ #define __G_STDIO_H__
+
+-#include <glib/gprintf.h>
++#include "gprintf.h"
+
+ #include <sys/stat.h>
+
+diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
+index b6ff60f51..95381d682 100644
+--- a/glib/gstrfuncs.c
++++ b/glib/gstrfuncs.c
+@@ -35,7 +35,7 @@
+ #include <string.h>
+ #include <locale.h>
+ #include <errno.h>
+-#include <garray.h>
++#include "garray.h"
+ #include <ctype.h> /* For tolower() */
+
+ #ifdef HAVE_XLOCALE_H
+diff --git a/glib/gstrfuncs.h b/glib/gstrfuncs.h
+index 2b44c9a55..57d6ba7af 100644
+--- a/glib/gstrfuncs.h
++++ b/glib/gstrfuncs.h
+@@ -30,9 +30,9 @@
+ #endif
+
+ #include <stdarg.h>
+-#include <glib/gmacros.h>
+-#include <glib/gtypes.h>
+-#include <glib/gerror.h>
++#include "gmacros.h"
++#include "gtypes.h"
++#include "gerror.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gstring.h b/glib/gstring.h
+index eec4c138f..a851e1f72 100644
+--- a/glib/gstring.h
++++ b/glib/gstring.h
+@@ -29,10 +29,10 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
+-#include <glib/gunicode.h>
+-#include <glib/gbytes.h>
+-#include <glib/gutils.h> /* for G_CAN_INLINE */
++#include "gtypes.h"
++#include "gunicode.h"
++#include "gbytes.h"
++#include "gutils.h" /* for G_CAN_INLINE */
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gstringchunk.h b/glib/gstringchunk.h
+index 8d445e349..17797883a 100644
+--- a/glib/gstringchunk.h
++++ b/glib/gstringchunk.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gstrvbuilder.h b/glib/gstrvbuilder.h
+index 395bcfbbe..82b2434cc 100644
+--- a/glib/gstrvbuilder.h
++++ b/glib/gstrvbuilder.h
+@@ -22,8 +22,8 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gstrfuncs.h>
+-#include <glib/gtypes.h>
++#include "gstrfuncs.h"
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gtester.c b/glib/gtester.c
+index fdcdaca10..e2f2550e4 100644
+--- a/glib/gtester.c
++++ b/glib/gtester.c
+@@ -17,9 +17,9 @@
+ */
+ #include "config.h"
+
+-#include <glib.h>
+-#include <glib-unix.h>
+-#include <gstdio.h>
++#include "glib/glib.h"
++#include "glib-unix.h"
++#include "gstdio.h"
+ #include <string.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+diff --git a/glib/gtestutils.c b/glib/gtestutils.c
+index d24c6e186..3ef845796 100644
+--- a/glib/gtestutils.c
++++ b/glib/gtestutils.c
+@@ -43,7 +43,7 @@
+ #ifdef HAVE_SYS_SELECT_H
+ #include <sys/select.h>
+ #endif /* HAVE_SYS_SELECT_H */
+-#include <glib/gstdio.h>
++#include "gstdio.h"
+
+ #include "gmain.h"
+ #include "gpattern.h"
+diff --git a/glib/gtestutils.h b/glib/gtestutils.h
+index 041143936..420624249 100644
+--- a/glib/gtestutils.h
++++ b/glib/gtestutils.h
+@@ -23,10 +23,10 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gmessages.h>
+-#include <glib/gstring.h>
+-#include <glib/gerror.h>
+-#include <glib/gslist.h>
++#include "gmessages.h"
++#include "gstring.h"
++#include "gerror.h"
++#include "gslist.h"
+ #include <errno.h>
+ #include <string.h>
+
+diff --git a/glib/gthread.h b/glib/gthread.h
+index a30815eb8..0ab54dd66 100644
+--- a/glib/gthread.h
++++ b/glib/gthread.h
+@@ -29,9 +29,9 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gatomic.h>
+-#include <glib/gerror.h>
+-#include <glib/gutils.h>
++#include "gatomic.h"
++#include "gerror.h"
++#include "gutils.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gthreadpool.h b/glib/gthreadpool.h
+index 11c3d1d16..44b5c6b06 100644
+--- a/glib/gthreadpool.h
++++ b/glib/gthreadpool.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gthread.h>
++#include "gthread.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gthreadprivate.h b/glib/gthreadprivate.h
+index 34ba6126b..bd5edd104 100644
+--- a/glib/gthreadprivate.h
++++ b/glib/gthreadprivate.h
+@@ -23,7 +23,7 @@
+
+ #include "config.h"
+
+-#include "deprecated/gthread.h"
++#include "glib/deprecated/gthread.h"
+
+ typedef struct _GRealThread GRealThread;
+ struct _GRealThread
+diff --git a/glib/gtimer.h b/glib/gtimer.h
+index 28794d167..b0749b97d 100644
+--- a/glib/gtimer.h
++++ b/glib/gtimer.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gtimezone.h b/glib/gtimezone.h
+index d68a76d3e..67bb9242b 100644
+--- a/glib/gtimezone.h
++++ b/glib/gtimezone.h
+@@ -24,8 +24,8 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gerror.h>
+-#include <glib/gtypes.h>
++#include "gerror.h"
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gtranslit.c b/glib/gtranslit.c
+index 3cffe1d2d..7b6671e73 100644
+--- a/glib/gtranslit.c
++++ b/glib/gtranslit.c
+@@ -17,11 +17,11 @@
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+-#include <config.h>
++#include "config.h"
+
+ #include "gstrfuncs.h"
+
+-#include <glib.h>
++#include "glib/glib.h"
+ #include <locale.h>
+ #include <stdlib.h>
+ #include <string.h>
+diff --git a/glib/gtrashstack.h b/glib/gtrashstack.h
+index 0730ec296..7585e9907 100644
+--- a/glib/gtrashstack.h
++++ b/glib/gtrashstack.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gutils.h>
++#include "gutils.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gtree.h b/glib/gtree.h
+index 19f9f7ea1..8164efff8 100644
+--- a/glib/gtree.h
++++ b/glib/gtree.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gnode.h>
++#include "gnode.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gtypes.h b/glib/gtypes.h
+index 2c4825582..34cae584f 100644
+--- a/glib/gtypes.h
++++ b/glib/gtypes.h
+@@ -29,9 +29,9 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glibconfig.h>
+-#include <glib/gmacros.h>
+-#include <glib/gversionmacros.h>
++#include "glib/glibconfig.h"
++#include "gmacros.h"
++#include "gversionmacros.h"
+ #include <time.h>
+
+ G_BEGIN_DECLS
+diff --git a/glib/gunibreak.h b/glib/gunibreak.h
+index d2d38a100..c69e86c77 100644
+--- a/glib/gunibreak.h
++++ b/glib/gunibreak.h
+@@ -4,8 +4,8 @@
+ #ifndef BREAKTABLES_H
+ #define BREAKTABLES_H
+
+-#include <glib/gtypes.h>
+-#include <glib/gunicode.h>
++#include "gtypes.h"
++#include "gunicode.h"
+
+ #define G_UNICODE_DATA_VERSION "13.0.0"
+
+diff --git a/glib/gunicode.h b/glib/gunicode.h
+index d72980380..edc033624 100644
+--- a/glib/gunicode.h
++++ b/glib/gunicode.h
+@@ -24,8 +24,8 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gerror.h>
+-#include <glib/gtypes.h>
++#include "gerror.h"
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/guri.h b/glib/guri.h
+index b6a4fd033..4948815bd 100644
+--- a/glib/guri.h
++++ b/glib/guri.h
+@@ -22,7 +22,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gutils.h b/glib/gutils.h
+index f8a6049ff..e47c0d03e 100644
+--- a/glib/gutils.h
++++ b/glib/gutils.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+ #include <stdarg.h>
+
+ G_BEGIN_DECLS
+diff --git a/glib/guuid.h b/glib/guuid.h
+index c653188a0..c5f5eeaee 100644
+--- a/glib/guuid.h
++++ b/glib/guuid.h
+@@ -27,7 +27,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gvariant-core.c b/glib/gvariant-core.c
+index b34ba8d8e..bb992ff0d 100644
+--- a/glib/gvariant-core.c
++++ b/glib/gvariant-core.c
+@@ -18,17 +18,17 @@
+
+ #include "config.h"
+
+-#include <glib/gvariant-core.h>
+-
+-#include <glib/gvariant-internal.h>
+-#include <glib/gvariant-serialiser.h>
+-#include <glib/gtestutils.h>
+-#include <glib/gbitlock.h>
+-#include <glib/gatomic.h>
+-#include <glib/gbytes.h>
+-#include <glib/gslice.h>
+-#include <glib/gmem.h>
+-#include <glib/grefcount.h>
++#include "gvariant-core.h"
++
++#include "gvariant-internal.h"
++#include "gvariant-serialiser.h"
++#include "gtestutils.h"
++#include "gbitlock.h"
++#include "gatomic.h"
++#include "gbytes.h"
++#include "gslice.h"
++#include "gmem.h"
++#include "grefcount.h"
+ #include <string.h>
+
+
+diff --git a/glib/gvariant-core.h b/glib/gvariant-core.h
+index fc04711ac..e83af4fcf 100644
+--- a/glib/gvariant-core.h
++++ b/glib/gvariant-core.h
+@@ -19,9 +19,9 @@
+ #ifndef __G_VARIANT_CORE_H__
+ #define __G_VARIANT_CORE_H__
+
+-#include <glib/gvarianttypeinfo.h>
+-#include <glib/gvariant.h>
+-#include <glib/gbytes.h>
++#include "gvarianttypeinfo.h"
++#include "gvariant.h"
++#include "gbytes.h"
+
+ /* gvariant-core.c */
+
+diff --git a/glib/gvariant-internal.h b/glib/gvariant-internal.h
+index f7536da71..3952cc3db 100644
+--- a/glib/gvariant-internal.h
++++ b/glib/gvariant-internal.h
+@@ -29,8 +29,8 @@
+ /* Hack */
+ #define __GLIB_H_INSIDE__
+
+-#include <glib/gvarianttype.h>
+-#include <glib/gtypes.h>
++#include "gvarianttype.h"
++#include "gtypes.h"
+
+ #include "gvariant-serialiser.h"
+ #include "gvarianttypeinfo.h"
+diff --git a/glib/gvariant-serialiser.c b/glib/gvariant-serialiser.c
+index 06f419fe4..6e958bb69 100644
+--- a/glib/gvariant-serialiser.c
++++ b/glib/gvariant-serialiser.c
+@@ -23,10 +23,10 @@
+
+ #include "gvariant-serialiser.h"
+
+-#include <glib/gvariant-internal.h>
+-#include <glib/gtestutils.h>
+-#include <glib/gstrfuncs.h>
+-#include <glib/gtypes.h>
++#include "gvariant-internal.h"
++#include "gtestutils.h"
++#include "gstrfuncs.h"
++#include "gtypes.h"
+
+ #include <string.h>
+
+diff --git a/glib/gvariant.c b/glib/gvariant.c
+index e48dec1ad..2bd0e6ba6 100644
+--- a/glib/gvariant.c
++++ b/glib/gvariant.c
+@@ -22,14 +22,14 @@
+
+ #include "config.h"
+
+-#include <glib/gvariant-serialiser.h>
++#include "gvariant-serialiser.h"
+ #include "gvariant-internal.h"
+-#include <glib/gvariant-core.h>
+-#include <glib/gtestutils.h>
+-#include <glib/gstrfuncs.h>
+-#include <glib/gslice.h>
+-#include <glib/ghash.h>
+-#include <glib/gmem.h>
++#include "gvariant-core.h"
++#include "gtestutils.h"
++#include "gstrfuncs.h"
++#include "gslice.h"
++#include "ghash.h"
++#include "gmem.h"
+
+ #include <string.h>
+
+diff --git a/glib/gvariant.h b/glib/gvariant.h
+index c0587a887..15fe73e84 100644
+--- a/glib/gvariant.h
++++ b/glib/gvariant.h
+@@ -25,9 +25,9 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gvarianttype.h>
+-#include <glib/gstring.h>
+-#include <glib/gbytes.h>
++#include "gvarianttype.h"
++#include "gstring.h"
++#include "gbytes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gvarianttype.c b/glib/gvarianttype.c
+index cc97235f3..8125cac1b 100644
+--- a/glib/gvarianttype.c
++++ b/glib/gvarianttype.c
+@@ -22,9 +22,9 @@
+
+ #include "gvarianttype.h"
+
+-#include <glib/gtestutils.h>
+-#include <glib/gstrfuncs.h>
+-#include <glib/gvariant-internal.h>
++#include "gtestutils.h"
++#include "gstrfuncs.h"
++#include "gvariant-internal.h"
+
+ #include <string.h>
+
+diff --git a/glib/gvarianttype.h b/glib/gvarianttype.h
+index fdc364166..dc705cc3a 100644
+--- a/glib/gvarianttype.h
++++ b/glib/gvarianttype.h
+@@ -25,7 +25,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gvarianttypeinfo.c b/glib/gvarianttypeinfo.c
+index 087294a09..31b8820b5 100644
+--- a/glib/gvarianttypeinfo.c
++++ b/glib/gvarianttypeinfo.c
+@@ -22,11 +22,11 @@
+
+ #include "gvarianttypeinfo.h"
+
+-#include <glib/gtestutils.h>
+-#include <glib/gthread.h>
+-#include <glib/gslice.h>
+-#include <glib/ghash.h>
+-#include <glib/grefcount.h>
++#include "gtestutils.h"
++#include "gthread.h"
++#include "gslice.h"
++#include "ghash.h"
++#include "grefcount.h"
+
+ /* < private >
+ * GVariantTypeInfo:
+diff --git a/glib/gvarianttypeinfo.h b/glib/gvarianttypeinfo.h
+index 8663e2090..b7e926c53 100644
+--- a/glib/gvarianttypeinfo.h
++++ b/glib/gvarianttypeinfo.h
+@@ -21,7 +21,7 @@
+ #ifndef __G_VARIANT_TYPE_INFO_H__
+ #define __G_VARIANT_TYPE_INFO_H__
+
+-#include <glib/gvarianttype.h>
++#include "gvarianttype.h"
+
+ #define G_VARIANT_TYPE_INFO_CHAR_MAYBE 'm'
+ #define G_VARIANT_TYPE_INFO_CHAR_ARRAY 'a'
+diff --git a/glib/gversion.h b/glib/gversion.h
+index 68343f727..f3c8c907a 100644
+--- a/glib/gversion.h
++++ b/glib/gversion.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/glib/gwakeup.c b/glib/gwakeup.c
+index f1062489c..93776f907 100644
+--- a/glib/gwakeup.c
++++ b/glib/gwakeup.c
+@@ -29,7 +29,7 @@
+ #include "gtypes.h"
+ #include "gpoll.h"
+ #else
+-#include <glib.h>
++#include "glib/glib.h"
+ #endif
+
+ #include "gwakeup.h"
+diff --git a/glib/gwakeup.h b/glib/gwakeup.h
+index 64db2bf86..e11d1020e 100644
+--- a/glib/gwakeup.h
++++ b/glib/gwakeup.h
+@@ -20,7 +20,7 @@
+ #ifndef __G_WAKEUP_H__
+ #define __G_WAKEUP_H__
+
+-#include <glib/gpoll.h>
++#include "gpoll.h"
+
+ typedef struct _GWakeup GWakeup;
+
+diff --git a/glib/gwin32.h b/glib/gwin32.h
+index 6696afa9a..3d6d4e608 100644
+--- a/glib/gwin32.h
++++ b/glib/gwin32.h
+@@ -29,7 +29,7 @@
+ #error "Only <glib.h> can be included directly."
+ #endif
+
+-#include <glib/gtypes.h>
++#include "gtypes.h"
+
+ #ifdef G_PLATFORM_WIN32
+
+diff --git a/glib/libcharset/localcharset.c b/glib/libcharset/localcharset.c
+index ab3a2678d..9a394f333 100644
+--- a/glib/libcharset/localcharset.c
++++ b/glib/libcharset/localcharset.c
+@@ -19,7 +19,7 @@
+
+ /* Written by Bruno Haible <bruno@clisp.org>. */
+
+-#include "config.h"
++#include "glib/config.h"
+
+ /* Specification. */
+ #include "localcharset.h"
+diff --git a/glib/pcre/pcre_byte_order.c b/glib/pcre/pcre_byte_order.c
+index 4f21433c1..ae02364e9 100644
+--- a/glib/pcre/pcre_byte_order.c
++++ b/glib/pcre/pcre_byte_order.c
+@@ -43,7 +43,7 @@ see if it was compiled with the opposite endianness. If so, it uses an
+ auxiliary local function to flip the appropriate bytes. */
+
+
+-#include "config.h"
++#include "glib/config.h"
+
+ #include "pcre_internal.h"
+
+diff --git a/glib/pcre/pcre_chartables.c b/glib/pcre/pcre_chartables.c
+index 293b16b32..d6f2bac30 100644
+--- a/glib/pcre/pcre_chartables.c
++++ b/glib/pcre/pcre_chartables.c
+@@ -20,7 +20,7 @@ and dead code stripping is activated. This leads to link errors. Pulling in the
+ header ensures that the array gets flagged as "someone outside this compilation
+ unit might reference this" and so it will always be supplied to the linker. */
+
+-#include "config.h"
++#include "glib/config.h"
+
+ #include "pcre_internal.h"
+
+diff --git a/glib/pcre/pcre_compile.c b/glib/pcre/pcre_compile.c
+index 12e09c4ef..e143ab55f 100644
+--- a/glib/pcre/pcre_compile.c
++++ b/glib/pcre/pcre_compile.c
+@@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
+ supporting internal functions that are not used by other modules. */
+
+
+-#include "config.h"
++#include "glib/config.h"
+
+ #define NLBLOCK cd /* Block containing newline information */
+ #define PSSTART start_pattern /* Field containing processed string start */
+@@ -51,9 +51,9 @@ supporting internal functions that are not used by other modules. */
+ #include "pcre_internal.h"
+
+ #ifdef GLIB_COMPILATION
+-#include "gstrfuncs.h"
++#include "glib/gstrfuncs.h"
+ #else
+-#include <glib.h>
++#include "glib/glib.h"
+ #endif
+
+ /* When PCRE_DEBUG is defined, we need the pcre(16)_printint() function, which
+diff --git a/glib/pcre/pcre_config.c b/glib/pcre/pcre_config.c
+index 34719591f..2d854b3ad 100644
+--- a/glib/pcre/pcre_config.c
++++ b/glib/pcre/pcre_config.c
+@@ -41,7 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
+ /* This module contains the external function pcre_config(). */
+
+
+-#include "config.h"
++#include "glib/config.h"
+
+ /* Keep the original link size. */
+ static int real_link_size = LINK_SIZE;
+diff --git a/glib/pcre/pcre_dfa_exec.c b/glib/pcre/pcre_dfa_exec.c
+index 9cc82323d..742aa2123 100644
+--- a/glib/pcre/pcre_dfa_exec.c
++++ b/glib/pcre/pcre_dfa_exec.c
+@@ -72,7 +72,7 @@ in others, so I abandoned this code. */
+
+
+
+-#include "config.h"
++#include "glib/config.h"
+
+ #define NLBLOCK md /* Block containing newline information */
+ #define PSSTART start_subject /* Field containing processed string start */
+diff --git a/glib/pcre/pcre_exec.c b/glib/pcre/pcre_exec.c
+index 4ba3eda01..82166131a 100644
+--- a/glib/pcre/pcre_exec.c
++++ b/glib/pcre/pcre_exec.c
+@@ -41,7 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
+ pattern matching using an NFA algorithm, trying to mimic Perl as closely as
+ possible. There are also some static supporting functions. */
+
+-#include "config.h"
++#include "glib/config.h"
+
+ #define NLBLOCK md /* Block containing newline information */
+ #define PSSTART start_subject /* Field containing processed string start */
+diff --git a/glib/pcre/pcre_fullinfo.c b/glib/pcre/pcre_fullinfo.c
+index 2fe785a13..6eb69443c 100644
+--- a/glib/pcre/pcre_fullinfo.c
++++ b/glib/pcre/pcre_fullinfo.c
+@@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
+ information about a compiled pattern. */
+
+
+-#include "config.h"
++#include "glib/config.h"
+
+ #include "pcre_internal.h"
+
+diff --git a/glib/pcre/pcre_get.c b/glib/pcre/pcre_get.c
+index 61147efe8..63991f648 100644
+--- a/glib/pcre/pcre_get.c
++++ b/glib/pcre/pcre_get.c
+@@ -43,7 +43,7 @@ from the subject string after a regex match has succeeded. The original idea
+ for these functions came from Scott Wimer. */
+
+
+-#include "config.h"
++#include "glib/config.h"
+
+ #include "pcre_internal.h"
+
+diff --git a/glib/pcre/pcre_globals.c b/glib/pcre/pcre_globals.c
+index 383ec7311..7c8273822 100644
+--- a/glib/pcre/pcre_globals.c
++++ b/glib/pcre/pcre_globals.c
+@@ -52,14 +52,14 @@ a local function is used.
+ Also, when compiling for Virtual Pascal, things are done differently, and
+ global variables are not used. */
+
+-#include "config.h"
++#include "glib/config.h"
+
+ #include "pcre_internal.h"
+
+ #ifdef GLIB_COMPILATION
+-#include "gmem.h"
++#include "glib/gmem.h"
+ #else
+-#include <glib.h>
++#include "glib/glib.h"
+ #endif /* GLIB_COMPILATION */
+
+ #if defined _MSC_VER || defined __SYMBIAN32__
+diff --git a/glib/pcre/pcre_jit_compile.c b/glib/pcre/pcre_jit_compile.c
+index d7233832f..b253cf745 100644
+--- a/glib/pcre/pcre_jit_compile.c
++++ b/glib/pcre/pcre_jit_compile.c
+@@ -40,7 +40,7 @@ POSSIBILITY OF SUCH DAMAGE.
+ -----------------------------------------------------------------------------
+ */
+
+-#include "config.h"
++#include "glib/config.h"
+
+ #include "pcre_internal.h"
+
+diff --git a/glib/pcre/pcre_newline.c b/glib/pcre/pcre_newline.c
+index ddd7708fa..a6487f0b2 100644
+--- a/glib/pcre/pcre_newline.c
++++ b/glib/pcre/pcre_newline.c
+@@ -47,7 +47,7 @@ and NLTYPE_ANY. The full list of Unicode newline characters is taken from
+ http://unicode.org/unicode/reports/tr18/. */
+
+
+-#include "config.h"
++#include "glib/config.h"
+
+ #include "pcre_internal.h"
+
+diff --git a/glib/pcre/pcre_ord2utf8.c b/glib/pcre/pcre_ord2utf8.c
+index 71fd587e0..f45e60901 100644
+--- a/glib/pcre/pcre_ord2utf8.c
++++ b/glib/pcre/pcre_ord2utf8.c
+@@ -41,7 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
+ /* This file contains a private PCRE function that converts an ordinal
+ character value into a UTF8 string. */
+
+-#include "config.h"
++#include "glib/config.h"
+
+ #include "pcre_internal.h"
+
+diff --git a/glib/pcre/pcre_string_utils.c b/glib/pcre/pcre_string_utils.c
+index 38cc2f958..ee01cdc47 100644
+--- a/glib/pcre/pcre_string_utils.c
++++ b/glib/pcre/pcre_string_utils.c
+@@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
+ class. It is used by both pcre_exec() and pcre_def_exec(). */
+
+
+-#include "config.h"
++#include "glib/config.h"
+
+ #include "pcre_internal.h"
+
+diff --git a/glib/pcre/pcre_study.c b/glib/pcre/pcre_study.c
+index ee0930718..3e239c755 100644
+--- a/glib/pcre/pcre_study.c
++++ b/glib/pcre/pcre_study.c
+@@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
+ supporting functions. */
+
+
+-#include "config.h"
++#include "glib/config.h"
+
+ #include "pcre_internal.h"
+
+diff --git a/glib/pcre/pcre_tables.c b/glib/pcre/pcre_tables.c
+index abcc96ef4..3a4ed3e35 100644
+--- a/glib/pcre/pcre_tables.c
++++ b/glib/pcre/pcre_tables.c
+@@ -45,7 +45,7 @@ uses macros to change their names from _pcre_xxx to xxxx, thereby avoiding name
+ clashes with the library. */
+
+
+-#include "config.h"
++#include "glib/config.h"
+
+ #include "pcre_internal.h"
+
+diff --git a/glib/pcre/pcre_valid_utf8.c b/glib/pcre/pcre_valid_utf8.c
+index cecaf347f..a837ce5c0 100644
+--- a/glib/pcre/pcre_valid_utf8.c
++++ b/glib/pcre/pcre_valid_utf8.c
+@@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
+ strings. */
+
+
+-#include "config.h"
++#include "glib/config.h"
+
+ #include "pcre_internal.h"
+
+diff --git a/glib/pcre/pcre_version.c b/glib/pcre/pcre_version.c
+index 3dd60a5bc..fb715c47a 100644
+--- a/glib/pcre/pcre_version.c
++++ b/glib/pcre/pcre_version.c
+@@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
+ string that identifies the PCRE version that is in use. */
+
+
+-#include "config.h"
++#include "glib/config.h"
+
+ #include "pcre_internal.h"
+
+diff --git a/glib/pcre/pcre_xclass.c b/glib/pcre/pcre_xclass.c
+index 89ad09f54..f09e4d1b1 100644
+--- a/glib/pcre/pcre_xclass.c
++++ b/glib/pcre/pcre_xclass.c
+@@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
+ class. It is used by both pcre_exec() and pcre_def_exec(). */
+
+
+-#include "config.h"
++#include "glib/config.h"
+
+ #include "pcre_internal.h"
+
+diff --git a/glib/pcre/ucp.h b/glib/pcre/ucp.h
+index f1c14be5d..850049e27 100644
+--- a/glib/pcre/ucp.h
++++ b/glib/pcre/ucp.h
+@@ -11,9 +11,9 @@ should always be at the end of each enum, for backwards compatibility. */
+
+ /* These are the general character categories. */
+ #ifdef GLIB_COMPILATION
+-#include "gunicode.h"
++#include "glib/gunicode.h"
+ #else
+-#include <glib.h>
++#include "glib/glib.h"
+ #endif
+
+ enum {
+--
+2.25.1
+
diff --git a/third_party/glib/patches/bazel_support.patch b/third_party/glib/patches/bazel_support.patch
new file mode 100644
index 0000000..10b834b
--- /dev/null
+++ b/third_party/glib/patches/bazel_support.patch
@@ -0,0 +1,884 @@
+Copyright 2020 The Monogon Project Authors.
+
+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.
+
+
+From 5a0089d8e8be0905bcdc5604878c65eeca6f532c Mon Sep 17 00:00:00 2001
+From: Lorenz Brun <lorenz@nexantic.com>
+Date: Thu, 18 Feb 2021 17:39:24 +0100
+Subject: [PATCH 1/2] Add Bazel support
+
+---
+ BUILD | 0
+ glib/BUILD | 202 +++++++++++++++++++++++
+ glib/config.h | 412 ++++++++++++++++++++++++++++++++++++++++++++++
+ glib/glibconfig.h | 215 ++++++++++++++++++++++++
+ 4 files changed, 829 insertions(+)
+ create mode 100644 BUILD
+ create mode 100644 glib/BUILD
+ create mode 100644 glib/config.h
+ create mode 100644 glib/glibconfig.h
+
+diff --git a/BUILD b/BUILD
+new file mode 100644
+index 000000000..e69de29bb
+diff --git a/glib/BUILD b/glib/BUILD
+new file mode 100644
+index 000000000..ecb524ecc
+--- /dev/null
++++ b/glib/BUILD
+@@ -0,0 +1,202 @@
++cc_library(
++ name = "glib",
++ srcs = [
++ "garcbox.c",
++ "garray.c",
++ "gasyncqueue.c",
++ "gatomic.c",
++ "gbacktrace.c",
++ "gbase64.c",
++ "gbitlock.c",
++ "gbookmarkfile.c",
++ "gbytes.c",
++ "gcharset.c",
++ "gchecksum.c",
++ "gconvert.c",
++ "gdataset.c",
++ "gdate.c",
++ "gdatetime.c",
++ "gdir.c",
++ "genviron.c",
++ "gerror.c",
++ "gfileutils.c",
++ "ggettext.c",
++ "ghash.c",
++ "ghmac.c",
++ "ghook.c",
++ "ghostutils.c",
++ "giochannel.c",
++ "gkeyfile.c",
++ "glib-init.c",
++ "glib-private.c",
++ "glist.c",
++ "gmain.c",
++ "gmappedfile.c",
++ "gmarkup.c",
++ "gmem.c",
++ "gmessages.c",
++ "gnode.c",
++ "goption.c",
++ "gpattern.c",
++ "gpoll.c",
++ "gprimes.c",
++ "gprintf.c",
++ "gqsort.c",
++ "gquark.c",
++ "gqueue.c",
++ "grand.c",
++ "grcbox.c",
++ "grefcount.c",
++ "grefstring.c",
++ "gregex.c",
++ "gscanner.c",
++ "gsequence.c",
++ "gshell.c",
++ "gslice.c",
++ "gslist.c",
++ "gstdio.c",
++ "gstrfuncs.c",
++ "gstring.c",
++ "gstringchunk.c",
++ "gstrvbuilder.c",
++ "gtestutils.c",
++ "gthread.c",
++ "gthreadpool.c",
++ "gtimer.c",
++ "gtimezone.c",
++ "gtrace.c",
++ "gtranslit.c",
++ "gtrashstack.c",
++ "gtree.c",
++ "gunibreak.c",
++ "gunicollate.c",
++ "gunidecomp.c",
++ "guniprop.c",
++ "guri.c",
++ "gutf8.c",
++ "gutils.c",
++ "guuid.c",
++ "gvariant.c",
++ "gvariant-core.c",
++ "gvariant-parser.c",
++ "gvariant-serialiser.c",
++ "gvarianttype.c",
++ "gvarianttypeinfo.c",
++ "gversion.c",
++ "gwakeup.c",
++ "libcharset/localcharset.c",
++ ] + [
++ # Unix-specific
++ "glib-unix.c",
++ "gspawn.c",
++ "giounix.c",
++ "gthread-posix.c",
++ ] + glob([
++ "*.h",
++ "deprecated/*.h",
++ "libcharset/*.h",
++ "pcre/*.h",
++ "pcre/*.c",
++ ]),
++ hdrs = [
++ "glib.h",
++ # Only allowed to be included by glib.h, don't directly include them
++ "deprecated/gallocator.h",
++ "deprecated/gcache.h",
++ "deprecated/gcompletion.h",
++ "deprecated/gmain.h",
++ "deprecated/grel.h",
++ "deprecated/gthread.h",
++ "galloca.h",
++ "garray.h",
++ "gasyncqueue.h",
++ "gatomic.h",
++ "gbacktrace.h",
++ "gbase64.h",
++ "gbitlock.h",
++ "gbookmarkfile.h",
++ "gbytes.h",
++ "gcharset.h",
++ "gchecksum.h",
++ "gconvert.h",
++ "gdataset.h",
++ "gdate.h",
++ "gdatetime.h",
++ "gdir.h",
++ "genviron.h",
++ "gerror.h",
++ "gfileutils.h",
++ "ggettext.h",
++ "ghash.h",
++ "ghmac.h",
++ "ghook.h",
++ "ghostutils.h",
++ "giochannel.h",
++ "gkeyfile.h",
++ "glib-autocleanups.h",
++ "glist.h",
++ "gmacros.h",
++ "gmain.h",
++ "gmappedfile.h",
++ "gmarkup.h",
++ "gmem.h",
++ "gmessages.h",
++ "gnode.h",
++ "goption.h",
++ "gpattern.h",
++ "gpoll.h",
++ "gprimes.h",
++ "gqsort.h",
++ "gquark.h",
++ "gqueue.h",
++ "grand.h",
++ "grcbox.h",
++ "grefcount.h",
++ "grefstring.h",
++ "gregex.h",
++ "gscanner.h",
++ "gsequence.h",
++ "gshell.h",
++ "gslice.h",
++ "gslist.h",
++ "gspawn.h",
++ "gstrfuncs.h",
++ "gstring.h",
++ "gstringchunk.h",
++ "gstrvbuilder.h",
++ "gtestutils.h",
++ "gthread.h",
++ "gthreadpool.h",
++ "gtimer.h",
++ "gtimezone.h",
++ "gtrashstack.h",
++ "gtree.h",
++ "gtypes.h",
++ "gunicode.h",
++ "guri.h",
++ "gutils.h",
++ "guuid.h",
++ "gvariant.h",
++ "gvarianttype.h",
++ "gversion.h",
++ "gversionmacros.h",
++ ],
++ local_defines = [
++ "HAVE_MEMMOVE=1",
++ "SUPPORT_UCP=1",
++ "SUPPORT_UTF=1",
++ "SUPPORT_UTF8=1",
++ "NEWLINE=-1",
++ "MATCH_LIMIT=10000000",
++ "MATCH_LIMIT_RECURSION=8192",
++ "MAX_NAME_SIZE=32",
++ "MAX_NAME_COUNT=10000",
++ "MAX_DUPLENGTH=30000",
++ "LINK_SIZE=2",
++ "POSIX_MALLOC_THRESHOLD=10",
++ "PCRE_STATIC=1",
++ "GLIB_COMPILATION=1",
++ "GLIB_CHARSETALIAS_DIR=\\\"/nonexistent\\\"",
++ ],
++ visibility = ["//visibility:public"],
++)
+diff --git a/glib/config.h b/glib/config.h
+new file mode 100644
+index 000000000..a13711316
+--- /dev/null
++++ b/glib/config.h
+@@ -0,0 +1,412 @@
++/*
++ * Autogenerated by the Meson build system.
++ * Do not edit, your changes will be lost.
++ */
++
++#pragma once
++
++#define ALIGNOF_GUINT32 4
++
++#define ALIGNOF_GUINT64 8
++
++#define ALIGNOF_UNSIGNED_LONG 8
++
++#define ENABLE_NLS 1
++
++#define EXEEXT
++
++#define GETTEXT_PACKAGE "glib20"
++
++#define GLIB_BINARY_AGE 6702
++
++#define GLIB_INTERFACE_AGE 0
++
++#define GLIB_LOCALE_DIR "/usr/local/share/locale"
++
++#define GLIB_MAJOR_VERSION 2
++
++#define GLIB_MICRO_VERSION 2
++
++#define GLIB_MINOR_VERSION 67
++
++#define G_VA_COPY va_copy
++
++#define G_VA_COPY_AS_ARRAY 1
++
++#define HAVE_ALLOCA_H 1
++
++#define HAVE_BIND_TEXTDOMAIN_CODESET
++
++#define HAVE_C99_SNPRINTF 1
++
++#define HAVE_C99_VSNPRINTF 1
++
++#define HAVE_CLOCK_GETTIME 1
++
++#define HAVE_CODESET 1
++
++#define HAVE_DCGETTEXT 1
++
++#define HAVE_DIRENT_H 1
++
++#define HAVE_ENDMNTENT 1
++
++#define HAVE_ENDSERVENT 1
++
++#define HAVE_EVENTFD 1
++
++#define HAVE_FALLOCATE 1
++
++#define HAVE_FCHMOD 1
++
++#define HAVE_FCHOWN 1
++
++#define HAVE_FLOAT_H 1
++
++#define HAVE_FSTAB_H 1
++
++#define HAVE_FSYNC 1
++
++#define HAVE_FUTEX 1
++
++#define HAVE_GETAUXVAL 1
++
++#define HAVE_GETC_UNLOCKED 1
++
++#define HAVE_GETGRGID_R 1
++
++#define HAVE_GETMNTENT_R 1
++
++#define HAVE_GETPWUID_R 1
++
++#define HAVE_GETRESUID 1
++
++#define HAVE_GETTEXT 1
++
++#define HAVE_GMTIME_R 1
++
++#define HAVE_GRP_H 1
++
++#define HAVE_HASMNTOPT 1
++
++#define HAVE_IF_INDEXTONAME 1
++
++#define HAVE_IF_NAMETOINDEX 1
++
++#define HAVE_INOTIFY_INIT1 1
++
++#define HAVE_INTMAX_T 1
++
++#define HAVE_INTTYPES_H 1
++
++#define HAVE_INTTYPES_H_WITH_UINTMAX 1
++
++#define HAVE_IPV6
++
++#define HAVE_IP_MREQN 1
++
++#define HAVE_LANGINFO_ABALTMON 1
++
++#define HAVE_LANGINFO_ALTMON 1
++
++#define HAVE_LANGINFO_CODESET 1
++
++#define HAVE_LANGINFO_OUTDIGIT 1
++
++#define HAVE_LANGINFO_TIME 1
++
++#define HAVE_LCHOWN 1
++
++#define HAVE_LC_MESSAGES 1
++
++#define HAVE_LIBELF 1
++
++#undef HAVE_LIBMOUNT
++
++#define HAVE_LIMITS_H 1
++
++#define HAVE_LINK 1
++
++#define HAVE_LINUX_MAGIC_H 1
++
++#define HAVE_LOCALE_H 1
++
++#define HAVE_LOCALTIME_R 1
++
++#define HAVE_LONG_DOUBLE 1
++
++#define HAVE_LONG_LONG 1
++
++#define HAVE_LSTAT 1
++
++#define HAVE_MALLOC_H 1
++
++#define HAVE_MBRTOWC 1
++
++#define HAVE_MEMALIGN 1
++
++#define HAVE_MEMORY_H 1
++
++#define HAVE_MKOSTEMP 1
++
++#define HAVE_MMAP 1
++
++#define HAVE_MNTENT_H 1
++
++#define HAVE_NETLINK 1
++
++#define HAVE_NEWLOCALE 1
++
++#define HAVE_OPEN_O_DIRECTORY 1
++
++#define HAVE_PIPE2 1
++
++#define HAVE_POLL 1
++
++#define HAVE_POLL_H 1
++
++#define HAVE_POSIX_MEMALIGN 1
++
++#define HAVE_POSIX_SPAWN 1
++
++#define HAVE_PRLIMIT 1
++
++#define HAVE_PROC_SELF_CMDLINE
++
++#define HAVE_PTHREAD_ATTR_SETINHERITSCHED 1
++
++#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
++
++#define HAVE_PTHREAD_CONDATTR_SETCLOCK 1
++
++#define HAVE_PTHREAD_GETNAME_NP 1
++
++#define HAVE_PTHREAD_SETNAME_NP_WITH_TID 1
++
++#define HAVE_PTRDIFF_T 1
++
++#define HAVE_PWD_H 1
++
++#define HAVE_READLINK 1
++
++#define HAVE_RECVMMSG 1
++
++#define HAVE_RES_INIT 1
++
++#define HAVE_RES_NCLOSE 1
++
++#define HAVE_RES_NINIT 1
++
++#define HAVE_RES_NQUERY 1
++
++#define HAVE_RTLD_GLOBAL 1
++
++#define HAVE_RTLD_LAZY 1
++
++#define HAVE_RTLD_NEXT 1
++
++#define HAVE_RTLD_NOW 1
++
++#define HAVE_SCHED_H 1
++
++#undef HAVE_SELINUX
++
++#define HAVE_SENDMMSG 1
++
++#define HAVE_SETENV 1
++
++#define HAVE_SETMNTENT 1
++
++#define HAVE_SIG_ATOMIC_T 1
++
++#define HAVE_SIOCGIFADDR /**/
++
++#define HAVE_SNPRINTF 1
++
++#define HAVE_SPAWN_H 1
++
++#define HAVE_SPLICE 1
++
++#define HAVE_STATFS 1
++
++#define HAVE_STATVFS 1
++
++#define HAVE_STATX 1
++
++#define HAVE_STDATOMIC_H 1
++
++#define HAVE_STDINT_H 1
++
++#define HAVE_STDINT_H_WITH_UINTMAX 1
++
++#define HAVE_STDLIB_H 1
++
++#define HAVE_STPCPY 1
++
++#define HAVE_STRCASECMP 1
++
++#define HAVE_STRERROR_R 1
++
++#define HAVE_STRINGS_H 1
++
++#define HAVE_STRING_H 1
++
++#define HAVE_STRNCASECMP 1
++
++#define HAVE_STRNLEN 1
++
++#define HAVE_STRSIGNAL 1
++
++#define HAVE_STRTOD_L 1
++
++#define HAVE_STRTOLL_L 1
++
++#define HAVE_STRTOULL_L 1
++
++#define HAVE_STRUCT_DIRENT_D_TYPE 1
++
++#define HAVE_STRUCT_STATFS_F_BAVAIL 1
++
++#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1
++
++#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
++
++#define HAVE_STRUCT_STAT_ST_BLOCKS 1
++
++#define HAVE_STRUCT_STAT_ST_CTIM_TV_NSEC 1
++
++#define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1
++
++#define HAVE_STRUCT_TM_TM_GMTOFF 1
++
++#define HAVE_SYMLINK 1
++
++#undef HAVE_SYSPROF
++
++#define HAVE_SYS_AUXV_H 1
++
++#define HAVE_SYS_INOTIFY_H 1
++
++#define HAVE_SYS_MOUNT_H 1
++
++#define HAVE_SYS_PARAM_H 1
++
++#define HAVE_SYS_RESOURCE_H 1
++
++#define HAVE_SYS_SCHED_GETATTR 1
++
++#define HAVE_SYS_SELECT_H 1
++
++#define HAVE_SYS_STATFS_H 1
++
++#define HAVE_SYS_STATVFS_H 1
++
++#define HAVE_SYS_STAT_H 1
++
++#define HAVE_SYS_SYSCTL_H 1
++
++#define HAVE_SYS_TIMES_H 1
++
++#define HAVE_SYS_TIME_H 1
++
++#define HAVE_SYS_TYPES_H 1
++
++#define HAVE_SYS_UIO_H 1
++
++#define HAVE_SYS_VFS_H 1
++
++#define HAVE_SYS_WAIT_H 1
++
++#define HAVE_SYS_XATTR_H 1
++
++#define HAVE_TERMIOS_H 1
++
++#define HAVE_TIMEGM 1
++
++#define HAVE_UINT128_T 1
++
++#define HAVE_UNISTD_H 1
++
++#define HAVE_UNIX98_PRINTF 1
++
++#define HAVE_UNSETENV 1
++
++#define HAVE_USELOCALE 1
++
++#define HAVE_UTIMES 1
++
++#define HAVE_VALLOC 1
++
++#define HAVE_VALUES_H 1
++
++#define HAVE_VASPRINTF 1
++
++#define HAVE_VSNPRINTF 1
++
++#define HAVE_WCHAR_H 1
++
++#define HAVE_WCHAR_T 1
++
++#define HAVE_WCRTOMB 1
++
++#define HAVE_WCSLEN 1
++
++#define HAVE_WCSNLEN 1
++
++#define HAVE_WINT_T 1
++
++#define HAVE_XATTR 1
++
++#define MAJOR_IN_SYSMACROS 1
++
++#define PACKAGE_BUGREPORT "https://gitlab.gnome.org/GNOME/glib/issues/new"
++
++#define PACKAGE_NAME "glib"
++
++#define PACKAGE_STRING "glib 2.67.2"
++
++#define PACKAGE_TARNAME "glib"
++
++#define PACKAGE_URL ""
++
++#define PACKAGE_VERSION "2.67.2"
++
++#define SIZEOF_CHAR 1
++
++#define SIZEOF_INT 4
++
++#define SIZEOF_LONG 8
++
++#define SIZEOF_LONG_LONG 8
++
++#define SIZEOF_SHORT 2
++
++#define SIZEOF_SIZE_T 8
++
++#define SIZEOF_SSIZE_T 8
++
++#define SIZEOF_VOID_P 8
++
++#define SIZEOF_WCHAR_T 4
++
++#define STATFS_ARGS 2
++
++/* Defined if strerror_r returns char * */
++#define STRERROR_R_CHAR_P 1
++
++#define THREADS_POSIX 1
++
++#define USE_STATFS 1
++
++#undef USE_SYSTEM_PCRE
++
++#define USE_SYSTEM_PRINTF
++
++#define _GLIB_EXTERN __attribute__((visibility("default"))) extern
++
++#define _GNU_SOURCE 1
++
++#define gl_extern_inline
++
++#define gl_unused
++
+diff --git a/glib/glibconfig.h b/glib/glibconfig.h
+new file mode 100644
+index 000000000..b4185d96c
+--- /dev/null
++++ b/glib/glibconfig.h
+@@ -0,0 +1,215 @@
++/* glibconfig.h
++ *
++ * This is a generated file. Please modify 'glibconfig.h.in'
++ */
++
++#ifndef __GLIBCONFIG_H__
++#define __GLIBCONFIG_H__
++
++#include "gmacros.h"
++
++#include <limits.h>
++#include <float.h>
++#define GLIB_HAVE_ALLOCA_H
++
++/* Specifies that GLib's g_print*() functions wrap the
++ * system printf functions. This is useful to know, for example,
++ * when using glibc's register_printf_function().
++ */
++#define GLIB_USING_SYSTEM_PRINTF
++
++/* #undef GLIB_STATIC_COMPILATION */
++/* #undef GOBJECT_STATIC_COMPILATION */
++
++G_BEGIN_DECLS
++
++#define G_MINFLOAT FLT_MIN
++#define G_MAXFLOAT FLT_MAX
++#define G_MINDOUBLE DBL_MIN
++#define G_MAXDOUBLE DBL_MAX
++#define G_MINSHORT SHRT_MIN
++#define G_MAXSHORT SHRT_MAX
++#define G_MAXUSHORT USHRT_MAX
++#define G_MININT INT_MIN
++#define G_MAXINT INT_MAX
++#define G_MAXUINT UINT_MAX
++#define G_MINLONG LONG_MIN
++#define G_MAXLONG LONG_MAX
++#define G_MAXULONG ULONG_MAX
++
++typedef signed char gint8;
++typedef unsigned char guint8;
++
++typedef signed short gint16;
++typedef unsigned short guint16;
++
++#define G_GINT16_MODIFIER "h"
++#define G_GINT16_FORMAT "hi"
++#define G_GUINT16_FORMAT "hu"
++
++
++typedef signed int gint32;
++typedef unsigned int guint32;
++
++#define G_GINT32_MODIFIER ""
++#define G_GINT32_FORMAT "i"
++#define G_GUINT32_FORMAT "u"
++
++
++#define G_HAVE_GINT64 1 /* deprecated, always true */
++
++typedef signed long gint64;
++typedef unsigned long guint64;
++
++#define G_GINT64_CONSTANT(val) (val##L)
++#define G_GUINT64_CONSTANT(val) (val##UL)
++
++#define G_GINT64_MODIFIER "l"
++#define G_GINT64_FORMAT "li"
++#define G_GUINT64_FORMAT "lu"
++
++
++#define GLIB_SIZEOF_VOID_P 8
++#define GLIB_SIZEOF_LONG 8
++#define GLIB_SIZEOF_SIZE_T 8
++#define GLIB_SIZEOF_SSIZE_T 8
++
++typedef signed long gssize;
++typedef unsigned long gsize;
++#define G_GSIZE_MODIFIER "l"
++#define G_GSSIZE_MODIFIER "l"
++#define G_GSIZE_FORMAT "lu"
++#define G_GSSIZE_FORMAT "li"
++
++#define G_MAXSIZE G_MAXULONG
++#define G_MINSSIZE G_MINLONG
++#define G_MAXSSIZE G_MAXLONG
++
++typedef gint64 goffset;
++#define G_MINOFFSET G_MININT64
++#define G_MAXOFFSET G_MAXINT64
++
++#define G_GOFFSET_MODIFIER G_GINT64_MODIFIER
++#define G_GOFFSET_FORMAT G_GINT64_FORMAT
++#define G_GOFFSET_CONSTANT(val) G_GINT64_CONSTANT(val)
++
++#define G_POLLFD_FORMAT "%d"
++
++#define GPOINTER_TO_INT(p) ((gint) (glong) (p))
++#define GPOINTER_TO_UINT(p) ((guint) (gulong) (p))
++
++#define GINT_TO_POINTER(i) ((gpointer) (glong) (i))
++#define GUINT_TO_POINTER(u) ((gpointer) (gulong) (u))
++
++typedef signed long gintptr;
++typedef unsigned long guintptr;
++
++#define G_GINTPTR_MODIFIER "l"
++#define G_GINTPTR_FORMAT "li"
++#define G_GUINTPTR_FORMAT "lu"
++
++#define GLIB_MAJOR_VERSION 2
++#define GLIB_MINOR_VERSION 67
++#define GLIB_MICRO_VERSION 2
++
++#define G_OS_UNIX
++
++#define G_VA_COPY va_copy
++#define G_VA_COPY_AS_ARRAY 1
++
++
++#ifndef __cplusplus
++# define G_HAVE_ISO_VARARGS 1
++#endif
++
++#ifdef __cplusplus
++# define G_HAVE_ISO_VARARGS 1
++#endif
++
++/* gcc-2.95.x supports both gnu style and ISO varargs, but if -ansi
++ * is passed ISO vararg support is turned off, and there is no work
++ * around to turn it on, so we unconditionally turn it off.
++ */
++#if __GNUC__ == 2 && __GNUC_MINOR__ == 95
++# undef G_HAVE_ISO_VARARGS
++#endif
++
++#define G_HAVE_GROWING_STACK 0
++#define G_HAVE_GNUC_VISIBILITY 1
++
++#ifndef _MSC_VER
++# define G_HAVE_GNUC_VARARGS 1
++#endif
++
++#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
++#define G_GNUC_INTERNAL __attribute__((visibility("hidden")))
++#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
++#define G_GNUC_INTERNAL __hidden
++#elif defined (__GNUC__) && defined (G_HAVE_GNUC_VISIBILITY)
++#define G_GNUC_INTERNAL __attribute__((visibility("hidden")))
++#else
++#define G_GNUC_INTERNAL
++#endif
++
++#define G_THREADS_ENABLED
++#define G_THREADS_IMPL_POSIX
++
++#define G_ATOMIC_LOCK_FREE
++
++#define GINT16_TO_LE(val) ((gint16) (val))
++#define GUINT16_TO_LE(val) ((guint16) (val))
++#define GINT16_TO_BE(val) ((gint16) GUINT16_SWAP_LE_BE (val))
++#define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val))
++
++#define GINT32_TO_LE(val) ((gint32) (val))
++#define GUINT32_TO_LE(val) ((guint32) (val))
++#define GINT32_TO_BE(val) ((gint32) GUINT32_SWAP_LE_BE (val))
++#define GUINT32_TO_BE(val) (GUINT32_SWAP_LE_BE (val))
++
++#define GINT64_TO_LE(val) ((gint64) (val))
++#define GUINT64_TO_LE(val) ((guint64) (val))
++#define GINT64_TO_BE(val) ((gint64) GUINT64_SWAP_LE_BE (val))
++#define GUINT64_TO_BE(val) (GUINT64_SWAP_LE_BE (val))
++
++#define GLONG_TO_LE(val) ((glong) GINT64_TO_LE (val))
++#define GULONG_TO_LE(val) ((gulong) GUINT64_TO_LE (val))
++#define GLONG_TO_BE(val) ((glong) GINT64_TO_BE (val))
++#define GULONG_TO_BE(val) ((gulong) GUINT64_TO_BE (val))
++#define GINT_TO_LE(val) ((gint) GINT32_TO_LE (val))
++#define GUINT_TO_LE(val) ((guint) GUINT32_TO_LE (val))
++#define GINT_TO_BE(val) ((gint) GINT32_TO_BE (val))
++#define GUINT_TO_BE(val) ((guint) GUINT32_TO_BE (val))
++#define GSIZE_TO_LE(val) ((gsize) GUINT64_TO_LE (val))
++#define GSSIZE_TO_LE(val) ((gssize) GINT64_TO_LE (val))
++#define GSIZE_TO_BE(val) ((gsize) GUINT64_TO_BE (val))
++#define GSSIZE_TO_BE(val) ((gssize) GINT64_TO_BE (val))
++#define G_BYTE_ORDER G_LITTLE_ENDIAN
++
++#define GLIB_SYSDEF_POLLIN =1
++#define GLIB_SYSDEF_POLLOUT =4
++#define GLIB_SYSDEF_POLLPRI =2
++#define GLIB_SYSDEF_POLLHUP =16
++#define GLIB_SYSDEF_POLLERR =8
++#define GLIB_SYSDEF_POLLNVAL =32
++
++#define G_MODULE_SUFFIX "so"
++
++typedef int GPid;
++#define G_PID_FORMAT "i"
++
++#define GLIB_SYSDEF_AF_UNIX 1
++#define GLIB_SYSDEF_AF_INET 2
++#define GLIB_SYSDEF_AF_INET6 10
++
++#define GLIB_SYSDEF_MSG_OOB 1
++#define GLIB_SYSDEF_MSG_PEEK 2
++#define GLIB_SYSDEF_MSG_DONTROUTE 4
++
++#define G_DIR_SEPARATOR '/'
++#define G_DIR_SEPARATOR_S "/"
++#define G_SEARCHPATH_SEPARATOR ':'
++#define G_SEARCHPATH_SEPARATOR_S ":"
++
++G_END_DECLS
++
++#endif /* __GLIBCONFIG_H__ */
+--
+2.25.1
+
diff --git a/third_party/pixman/BUILD b/third_party/pixman/BUILD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/third_party/pixman/BUILD
diff --git a/third_party/pixman/external.bzl b/third_party/pixman/external.bzl
new file mode 100644
index 0000000..b64660c
--- /dev/null
+++ b/third_party/pixman/external.bzl
@@ -0,0 +1,30 @@
+# 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 pixman_external(name, version):
+ sums = {
+ "0.40.0": "6d200dec3740d9ec4ec8d1180e25779c00bc749f94278c8b9021f5534db223fc",
+ }
+
+ http_archive(
+ name = name,
+ sha256 = sums[version],
+ build_file = "@//third_party/pixman:pixman.bzl",
+ strip_prefix = "pixman-" + version + "/pixman",
+ urls = ["https://www.cairographics.org/releases/pixman-%s.tar.gz" % version],
+ )
diff --git a/third_party/pixman/patches/BUILD b/third_party/pixman/patches/BUILD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/third_party/pixman/patches/BUILD
diff --git a/third_party/pixman/pixman.bzl b/third_party/pixman/pixman.bzl
new file mode 100644
index 0000000..8908dfe
--- /dev/null
+++ b/third_party/pixman/pixman.bzl
@@ -0,0 +1,99 @@
+# 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("@rules_cc//cc:defs.bzl", "cc_library")
+load("@dev_source_monogon//build/utils:template_file.bzl", "template_file")
+
+template_file(
+ name = "pixman-version.h",
+ src = "pixman-version.h.in",
+ substitutions = {
+ "@PIXMAN_VERSION_MAJOR@": "0",
+ "@PIXMAN_VERSION_MINOR@": "40",
+ "@PIXMAN_VERSION_MICRO@": "1",
+ },
+)
+
+genrule(
+ name = "config-h",
+ outs = ["config.h"],
+ cmd = "echo \"\" > \"$@\"",
+)
+
+cc_library(
+ name = "pixman",
+ srcs = [
+ ":config-h",
+ "pixman.c",
+ "pixman-access.c",
+ "pixman-access-accessors.c",
+ "pixman-accessor.h",
+ "pixman-arm.c",
+ "pixman-bits-image.c",
+ "pixman-combine-float.c",
+ "pixman-combine32.c",
+ "pixman-combine32.h",
+ "pixman-compiler.h",
+ "pixman-conical-gradient.c",
+ "pixman-edge.c",
+ "pixman-edge-accessors.c",
+ "pixman-edge-imp.h",
+ "pixman-fast-path.c",
+ "pixman-filter.c",
+ "pixman-general.c",
+ "pixman-glyph.c",
+ "pixman-gradient-walker.c",
+ "pixman-image.c",
+ "pixman-implementation.c",
+ "pixman-inlines.h",
+ "pixman-linear-gradient.c",
+ "pixman-matrix.c",
+ "pixman-mips.c",
+ "pixman-noop.c",
+ "pixman-ppc.c",
+ "pixman-private.h",
+ "pixman-radial-gradient.c",
+ "pixman-region16.c",
+ "pixman-region32.c",
+ "pixman-solid-fill.c",
+ "pixman-sse2.c",
+ "pixman-ssse3.c",
+ "pixman-timer.c",
+ "pixman-trap.c",
+ "pixman-utils.c",
+ "pixman-x86.c",
+ ":pixman-version.h",
+ "dither/blue-noise-64x64.h",
+ ],
+ hdrs = [
+ "pixman.h",
+ # Please never include these, this is some next-level insanity
+ "pixman-region.c",
+ "pixman-edge.c",
+ "pixman-access.c",
+ ],
+ copts = ["-mssse3"],
+ includes = ["."],
+ local_defines = [
+ "PACKAGE=foo",
+ "HAVE_FLOAT128=1",
+ "HAVE_BUILTIN_CLZ=1",
+ "USE_SSSE3=1",
+ "USE_SSE2=1",
+ "TLS=__thread",
+ ],
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/qemu/BUILD b/third_party/qemu/BUILD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/third_party/qemu/BUILD
diff --git a/third_party/qemu/external.bzl b/third_party/qemu/external.bzl
new file mode 100644
index 0000000..456aa23
--- /dev/null
+++ b/third_party/qemu/external.bzl
@@ -0,0 +1,36 @@
+# 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",
+ ],
+ sha256 = sums[version],
+ strip_prefix = "qemu-" + version,
+ urls = ["https://download.qemu.org/qemu-%s.tar.xz" % version],
+ )
diff --git a/third_party/qemu/patches/BUILD b/third_party/qemu/patches/BUILD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/third_party/qemu/patches/BUILD
diff --git a/third_party/qemu/patches/bazel_support.patch b/third_party/qemu/patches/bazel_support.patch
new file mode 100644
index 0000000..9dea8d0
--- /dev/null
+++ b/third_party/qemu/patches/bazel_support.patch
@@ -0,0 +1,1603 @@
+Copyright 2020 The Monogon Project Authors.
+
+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.
+
+
+From 88ba396b627c26b9b01c2bc358557964cbb59cf8 Mon Sep 17 00:00:00 2001
+From: Lorenz Brun <lorenz@brun.one>
+Date: Wed, 10 Mar 2021 18:25:11 +0100
+Subject: [PATCH 3/6] Add Bazel support
+
+---
+ BUILD | 1146 +++++++++++++++++++++++++++++++
+ defs.bzl | 52 ++
+ qapi/BUILD | 25 +
+ qapi/defs.bzl | 40 ++
+ scripts/BUILD | 35 +
+ scripts/modules/BUILD | 7 +
+ scripts/qapi/BUILD | 7 +
+ scripts/qapi/defs.bzl | 52 ++
+ scripts/tracetool/BUILD | 11 +
+ scripts/tracetool/backend/BUILD | 7 +
+ scripts/tracetool/defs.bzl | 65 ++
+ scripts/tracetool/format/BUILD | 7 +
+ trace/BUILD | 18 +
+ 13 files changed, 1472 insertions(+)
+ create mode 100644 BUILD
+ create mode 100644 defs.bzl
+ create mode 100644 qapi/BUILD
+ create mode 100644 qapi/defs.bzl
+ create mode 100644 scripts/BUILD
+ create mode 100644 scripts/modules/BUILD
+ create mode 100644 scripts/qapi/BUILD
+ create mode 100644 scripts/qapi/defs.bzl
+ create mode 100644 scripts/tracetool/BUILD
+ create mode 100644 scripts/tracetool/backend/BUILD
+ create mode 100644 scripts/tracetool/defs.bzl
+ create mode 100644 scripts/tracetool/format/BUILD
+ create mode 100644 trace/BUILD
+
+diff --git a/BUILD b/BUILD
+new file mode 100644
+index 0000000000..436f8c5cf3
+--- /dev/null
++++ b/BUILD
+@@ -0,0 +1,1147 @@
++load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
++load("@rules_python//python:defs.bzl", "py_binary")
++load("@dev_source_monogon//build/utils:template_file.bzl", "template_file")
++load(":defs.bzl", "filter_label_suffix")
++load("//:defs.bzl", "cc_qemu_keymaps")
++
++filegroup(
++ name = "trace-files",
++ srcs = glob(["**/trace-events"]) + ["//qapi:trace-events"],
++ visibility = ["//visibility:public"],
++)
++
++filter_label_suffix(
++ name = "qapi_hdrs_gen",
++ srcs = ["//qapi:qapi_generated"],
++ suffix = ".h",
++)
++
++filter_label_suffix(
++ name = "qapi_c",
++ srcs = ["//qapi:qapi_generated"],
++ suffix = ".c",
++)
++
++filter_label_suffix(
++ name = "trace_c",
++ srcs = ["//trace"],
++ exclude = [
++ "trace-linux-user.c",
++ "trace-hw_pci-host.c",
++ ],
++ suffix = ".c",
++)
++
++genrule(
++ name = "block-coroutine-gen",
++ srcs = [
++ "include/block/block.h",
++ "block/coroutines.h",
++ ],
++ outs = ["block-gen.c"],
++ cmd = "./$(location //scripts:block-coroutine-wrapper) \"$@\" $(location include/block/block.h) $(location block/coroutines.h)",
++ tools = ["//scripts:block-coroutine-wrapper"],
++)
++
++filter_label_suffix(
++ name = "trace_hdrs_gen",
++ srcs = ["//trace"],
++ suffix = ".h",
++)
++
++filegroup(
++ name = "gen_hdrs",
++ srcs = [
++ ":libslirp-version.h",
++ ":qapi_hdrs_gen",
++ ":trace_hdrs_gen",
++ "//qapi:extra_hdrs",
++ "//trace:extra_hdrs",
++ ],
++)
++
++filegroup(
++ name = "all_headers",
++ srcs = glob([
++ "accel/**/*.h",
++ "accel/**/*.inc",
++ "audio/**/*.h",
++ "audio/**/*.inc",
++ "authz/**/*.h",
++ "authz/**/*.inc",
++ "backends/**/*.h",
++ "backends/**/*.inc",
++ "block/**/*.h",
++ "block/**/*.inc",
++ "capstone/**/*.h",
++ "capstone/**/*.inc",
++ "chardev/**/*.h",
++ "chardev/**/*.inc",
++ "contrib/**/*.h",
++ "contrib/**/*.inc",
++ "crypto/**/*.h",
++ "crypto/**/*.inc",
++ "default-configs/**/*.h",
++ "default-configs/**/*.inc",
++ "disas/**/*.h",
++ "disas/**/*.inc",
++ "dtc/**/*.h",
++ "dtc/**/*.inc",
++ "dump/**/*.h",
++ "dump/**/*.inc",
++ "fpu/**/*.h",
++ "fpu/**/*.inc",
++ "fsdev/**/*.h",
++ "fsdev/**/*.inc",
++ "gdb-xml/**/*.h",
++ "gdb-xml/**/*.inc",
++ "hw/**/*.h",
++ "hw/**/*.inc",
++ "include/**/*.h",
++ "include/**/*.inc",
++ "io/**/*.h",
++ "io/**/*.inc",
++ "libdecnumber/**/*.h",
++ "libdecnumber/**/*.inc",
++ "linux-headers/**/*.h",
++ "linux-headers/**/*.inc",
++ "linux-user/**/*.h",
++ "linux-user/**/*.inc",
++ "migration/**/*.h",
++ "migration/**/*.inc",
++ "monitor/**/*.h",
++ "monitor/**/*.inc",
++ "nbd/**/*.h",
++ "nbd/**/*.inc",
++ "net/**/*.h",
++ "net/**/*.inc",
++ "plugins/**/*.h",
++ "plugins/**/*.inc",
++ "qapi/**/*.h",
++ "qapi/**/*.inc",
++ "qga/**/*.h",
++ "qga/**/*.inc",
++ "qobject/**/*.h",
++ "qobject/**/*.inc",
++ "qom/**/*.h",
++ "qom/**/*.inc",
++ "replay/**/*.h",
++ "replay/**/*.inc",
++ "scripts/**/*.h",
++ "scripts/**/*.inc",
++ "scsi/**/*.h",
++ "scsi/**/*.inc",
++ "slirp/**/*.h",
++ "slirp/**/*.inc",
++ "softmmu/**/*.h",
++ "softmmu/**/*.inc",
++ "storage-daemon/**/*.h",
++ "storage-daemon/**/*.inc",
++ "subprojects/**/*.h",
++ "subprojects/**/*.inc",
++ "stubs/**/*.h",
++ "stubs/**/*.inc",
++ "target/**/*.h",
++ "target/**/*.inc",
++ "tcg/**/*.h",
++ "tcg/**/*.inc",
++ "tools/**/*.h",
++ "tools/**/*.inc",
++ "trace/**/*.h",
++ "trace/**/*.inc",
++ "ui/**/*.h",
++ "ui/**/*.inc",
++ "util/**/*.h",
++ "util/**/*.inc",
++ ]) + [
++ ":hmp-commands",
++ ":module-block",
++ ":cursor-hdrs",
++ ":keymaps-gen",
++ "qemu-img-cmds.h",
++ "qemu-options.h",
++ "qemu-options-wrapper.h",
++ "qemu-version.h",
++ "replication.h",
++ "x86_64-softmmu-config-devices.h",
++ "x86_64-softmmu-config-target.h",
++ "memory_ldst.c.inc",
++ ],
++)
++
++cc_library(
++ name = "capstone",
++ srcs = [":all_headers"] + [
++ "capstone/cs.c",
++ "capstone/MCInst.c",
++ "capstone/MCInstrDesc.c",
++ "capstone/MCRegisterInfo.c",
++ "capstone/SStream.c",
++ "capstone/utils.c",
++ "capstone/arch/X86/X86Disassembler.c",
++ "capstone/arch/X86/X86DisassemblerDecoder.c",
++ "capstone/arch/X86/X86ATTInstPrinter.c",
++ "capstone/arch/X86/X86IntelInstPrinter.c",
++ "capstone/arch/X86/X86InstPrinterCommon.c",
++ "capstone/arch/X86/X86Mapping.c",
++ "capstone/arch/X86/X86Module.c",
++ ],
++ local_defines = [
++ "_GNU_SOURCE",
++ "_FILE_OFFSET_BITS=64",
++ "_LARGEFILE_SOURCE",
++ ],
++ includes = ["capstone/include"],
++)
++
++template_file(
++ name = "libslirp-version.h",
++ src = "slirp/src/libslirp-version.h.in",
++ substitutions = {
++ "@SLIRP_MAJOR_VERSION@": "0",
++ "@SLIRP_MINOR_VERSION@": "0",
++ "@SLIRP_MICRO_VERSION@": "1",
++ "@SLIRP_VERSION_STRING@": "\"0.0.1\"",
++ },
++)
++
++cc_library(
++ name = "slirp",
++ srcs = [":all_headers"] + [
++ "slirp/src/arp_table.c",
++ "slirp/src/bootp.c",
++ "slirp/src/cksum.c",
++ "slirp/src/dhcpv6.c",
++ "slirp/src/dnssearch.c",
++ "slirp/src/if.c",
++ "slirp/src/ip6_icmp.c",
++ "slirp/src/ip6_input.c",
++ "slirp/src/ip6_output.c",
++ "slirp/src/ip_icmp.c",
++ "slirp/src/ip_input.c",
++ "slirp/src/ip_output.c",
++ "slirp/src/mbuf.c",
++ "slirp/src/misc.c",
++ "slirp/src/ncsi.c",
++ "slirp/src/ndp_table.c",
++ "slirp/src/sbuf.c",
++ "slirp/src/slirp.c",
++ "slirp/src/socket.c",
++ "slirp/src/state.c",
++ "slirp/src/stream.c",
++ "slirp/src/tcp_input.c",
++ "slirp/src/tcp_output.c",
++ "slirp/src/tcp_subr.c",
++ "slirp/src/tcp_timer.c",
++ "slirp/src/tftp.c",
++ "slirp/src/udp.c",
++ "slirp/src/udp6.c",
++ "slirp/src/util.c",
++ "slirp/src/version.c",
++ "slirp/src/vmstate.c",
++ ] + [":libslirp-version.h"],
++ local_defines = [
++ "_GNU_SOURCE",
++ "_FILE_OFFSET_BITS=64",
++ "_LARGEFILE_SOURCE",
++ "G_LOG_DOMAIN=\\\"Slirp\\\"",
++ ],
++ deps = [
++ "@glib//glib",
++ ],
++ includes = ["include", "slirp/src"],
++)
++
++cc_library(
++ name = "fdt",
++ srcs = [":all_headers"] + [
++ "dtc/libfdt/fdt.c",
++ "dtc/libfdt/fdt_ro.c",
++ "dtc/libfdt/fdt_wip.c",
++ "dtc/libfdt/fdt_sw.c",
++ "dtc/libfdt/fdt_rw.c",
++ "dtc/libfdt/fdt_strerror.c",
++ "dtc/libfdt/fdt_empty_tree.c",
++ "dtc/libfdt/fdt_addresses.c",
++ "dtc/libfdt/fdt_overlay.c",
++ "dtc/libfdt/fdt_check.c",
++ ],
++ local_defines = [
++ "_GNU_SOURCE",
++ "_FILE_OFFSET_BITS=64",
++ "_LARGEFILE_SOURCE",
++ ],
++ includes = ["include", "dtc/libfdt", "disas/libvixl"],
++)
++
++cc_library(
++ name = "qemu",
++ srcs = [":all_headers"] + [
++ "accel/accel.c",
++ "audio/audio_legacy.c",
++ "audio/audio.c",
++ "audio/mixeng.c",
++ "audio/noaudio.c",
++ "audio/wavaudio.c",
++ "audio/wavcapture.c",
++ "authz/base.c",
++ "authz/list.c",
++ "authz/listfile.c",
++ "authz/simple.c",
++ "backends/cryptodev-builtin.c",
++ "backends/cryptodev-vhost.c",
++ "backends/cryptodev.c",
++ "backends/hostmem-file.c",
++ "backends/hostmem-memfd.c",
++ "backends/hostmem-ram.c",
++ "backends/hostmem.c",
++ "backends/rng-builtin.c",
++ "backends/rng-egd.c",
++ "backends/rng-random.c",
++ "backends/rng.c",
++ "backends/tpm/tpm_backend.c",
++ "backends/tpm/tpm_emulator.c",
++ "backends/tpm/tpm_passthrough.c",
++ "backends/tpm/tpm_util.c",
++ "block.c",
++ "block/accounting.c",
++ "block/aio_task.c",
++ "block/amend.c",
++ "block/backup-top.c",
++ "block/backup.c",
++ "block/blkdebug.c",
++ "block/blklogwrites.c",
++ "block/blkverify.c",
++ "block/block-backend.c",
++ "block/block-copy.c",
++ "block/commit.c",
++ "block/copy-on-read.c",
++ "block/create.c",
++ "block/crypto.c",
++ "block/dirty-bitmap.c",
++ "block/export/export.c",
++ "block/file-posix.c",
++ "block/filter-compress.c",
++ "block/io_uring.c",
++ "block/io.c",
++ "block/mirror.c",
++ "block/monitor/bitmap-qmp-cmds.c",
++ "block/monitor/block-hmp-cmds.c",
++ "block/nbd.c",
++ "block/null.c",
++ "block/nvme.c",
++ "block/qapi-sysemu.c",
++ "block/qapi.c",
++ "block/qcow2-bitmap.c",
++ "block/qcow2-cache.c",
++ "block/qcow2-cluster.c",
++ "block/qcow2-refcount.c",
++ "block/qcow2-snapshot.c",
++ "block/qcow2-threads.c",
++ "block/qcow2.c",
++ "block/quorum.c",
++ "block/raw-format.c",
++ "block/snapshot.c",
++ "block/stream.c",
++ "block/throttle-groups.c",
++ "block/throttle.c",
++ "block/vhdx-endian.c",
++ "block/vhdx-log.c",
++ "block/vhdx.c",
++ "block/vmdk.c",
++ "block/vpc.c",
++ "block/write-threshold.c",
++ "blockdev-nbd.c",
++ "blockdev.c",
++ "blockjob.c",
++ "chardev/char-fd.c",
++ "chardev/char-fe.c",
++ "chardev/char-file.c",
++ "chardev/char-io.c",
++ "chardev/char-mux.c",
++ "chardev/char-null.c",
++ "chardev/char-parallel.c",
++ "chardev/char-pipe.c",
++ "chardev/char-pty.c",
++ "chardev/char-ringbuf.c",
++ "chardev/char-serial.c",
++ "chardev/char-socket.c",
++ "chardev/char-stdio.c",
++ "chardev/char-udp.c",
++ "chardev/char.c",
++ "chardev/msmouse.c",
++ "chardev/testdev.c",
++ "chardev/wctablet.c",
++ "cpus-common.c",
++ "crypto/aes.c",
++ "crypto/afsplit.c",
++ "crypto/block-luks.c",
++ "crypto/block-qcow.c",
++ "crypto/block.c",
++ "crypto/cipher.c",
++ "crypto/desrfb.c",
++ "crypto/hash-glib.c",
++ "crypto/hash.c",
++ "crypto/hmac-glib.c",
++ "crypto/hmac.c",
++ "crypto/init.c",
++ "crypto/ivgen-essiv.c",
++ "crypto/ivgen-plain.c",
++ "crypto/ivgen-plain64.c",
++ "crypto/ivgen.c",
++ "crypto/pbkdf-stub.c",
++ "crypto/pbkdf.c",
++ "crypto/random-platform.c",
++ "crypto/secret_common.c",
++ "crypto/secret.c",
++ "crypto/tlscreds.c",
++ "crypto/tlscredsanon.c",
++ "crypto/tlscredspsk.c",
++ "crypto/tlscredsx509.c",
++ "crypto/tlssession.c",
++ "crypto/xts.c",
++ "disas/capstone.c",
++ "disas/i386.c",
++ "dump/dump-hmp-cmds.c",
++ "fsdev/qemu-fsdev-dummy.c",
++ "fsdev/qemu-fsdev-opts.c",
++ "fsdev/qemu-fsdev-throttle.c",
++ "hw/acpi/acpi_interface.c",
++ "hw/acpi/aml-build.c",
++ "hw/acpi/bios-linker-loader.c",
++ "hw/acpi/core.c",
++ "hw/acpi/cpu_hotplug.c",
++ "hw/acpi/cpu.c",
++ "hw/acpi/generic_event_device.c",
++ "hw/acpi/hmat.c",
++ "hw/acpi/ich9.c",
++ "hw/acpi/ipmi.c",
++ "hw/acpi/memory_hotplug.c",
++ "hw/acpi/nvdimm.c",
++ "hw/acpi/pci.c",
++ "hw/acpi/pcihp.c",
++ "hw/acpi/piix4.c",
++ "hw/acpi/tco.c",
++ "hw/acpi/tpm.c",
++ "hw/acpi/utils.c",
++ "hw/acpi/vmgenid.c",
++ "hw/audio/ac97.c",
++ "hw/audio/adlib.c",
++ "hw/audio/cs4231a.c",
++ "hw/audio/es1370.c",
++ "hw/audio/fmopl.c",
++ "hw/audio/gus.c",
++ "hw/audio/gusemu_hal.c",
++ "hw/audio/gusemu_mixer.c",
++ "hw/audio/hda-codec.c",
++ "hw/audio/intel-hda.c",
++ "hw/audio/pcspk.c",
++ "hw/audio/sb16.c",
++ "hw/audio/soundhw.c",
++ "hw/block/block.c",
++ "hw/block/cdrom.c",
++ "hw/block/fdc.c",
++ "hw/block/hd-geometry.c",
++ "hw/block/nvme-ns.c",
++ "hw/block/nvme.c",
++ "hw/block/pflash_cfi01.c",
++ "hw/char/debugcon.c",
++ "hw/char/ipoctal232.c",
++ "hw/char/parallel-isa.c",
++ "hw/char/parallel.c",
++ "hw/char/serial-isa.c",
++ "hw/char/serial-pci-multi.c",
++ "hw/char/serial-pci.c",
++ "hw/char/serial.c",
++ "hw/char/virtio-console.c",
++ "hw/core/bus.c",
++ "hw/core/clock-vmstate.c",
++ "hw/core/clock.c",
++ "hw/core/cpu.c",
++ "hw/core/fw-path-provider.c",
++ "hw/core/generic-loader.c",
++ "hw/core/hotplug.c",
++ "hw/core/irq.c",
++ "hw/core/loader.c",
++ "hw/core/machine-hmp-cmds.c",
++ "hw/core/machine.c",
++ "hw/core/nmi.c",
++ "hw/core/null-machine.c",
++ "hw/core/qdev-clock.c",
++ "hw/core/qdev-fw.c",
++ "hw/core/qdev-properties-system.c",
++ "hw/core/qdev-properties.c",
++ "hw/core/qdev.c",
++ "hw/core/reset.c",
++ "hw/core/resettable.c",
++ "hw/core/sysbus.c",
++ "hw/core/vm-change-state-handler.c",
++ "hw/core/vmstate-if.c",
++ "hw/cpu/cluster.c",
++ "hw/cpu/core.c",
++ "hw/display/ati_2d.c",
++ "hw/display/ati_dbg.c",
++ "hw/display/ati.c",
++ "hw/display/bochs-display.c",
++ "hw/display/cirrus_vga_isa.c",
++ "hw/display/cirrus_vga.c",
++ "hw/display/edid-generate.c",
++ "hw/display/edid-region.c",
++ "hw/display/i2c-ddc.c",
++ "hw/display/ramfb-standalone.c",
++ "hw/display/ramfb.c",
++ "hw/display/vga-isa.c",
++ "hw/display/vga-pci.c",
++ "hw/display/virtio-gpu-base.c",
++ "hw/display/virtio-gpu-pci.c",
++ "hw/display/virtio-gpu.c",
++ "hw/display/virtio-vga.c",
++ "hw/display/vmware_vga.c",
++ "hw/dma/i8257.c",
++ "hw/i2c/bitbang_i2c.c",
++ "hw/i2c/core.c",
++ "hw/i2c/pm_smbus.c",
++ "hw/i2c/smbus_eeprom.c",
++ "hw/i2c/smbus_ich9.c",
++ "hw/i2c/smbus_master.c",
++ "hw/i2c/smbus_slave.c",
++ "hw/ide/ahci.c",
++ "hw/ide/atapi.c",
++ "hw/ide/core.c",
++ "hw/ide/ich.c",
++ "hw/ide/ioport.c",
++ "hw/ide/isa.c",
++ "hw/ide/pci.c",
++ "hw/ide/piix.c",
++ "hw/ide/qdev.c",
++ "hw/input/hid.c",
++ "hw/input/pckbd.c",
++ "hw/input/ps2.c",
++ "hw/input/virtio-input-hid.c",
++ "hw/input/virtio-input-host.c",
++ "hw/input/virtio-input.c",
++ "hw/intc/i8259_common.c",
++ "hw/intc/i8259.c",
++ "hw/intc/intc.c",
++ "hw/intc/ioapic_common.c",
++ "hw/ipack/ipack.c",
++ "hw/ipack/tpci200.c",
++ "hw/ipmi/ipmi_bmc_extern.c",
++ "hw/ipmi/ipmi_bmc_sim.c",
++ "hw/ipmi/ipmi_bt.c",
++ "hw/ipmi/ipmi_kcs.c",
++ "hw/ipmi/ipmi.c",
++ "hw/ipmi/isa_ipmi_bt.c",
++ "hw/ipmi/isa_ipmi_kcs.c",
++ "hw/ipmi/pci_ipmi_bt.c",
++ "hw/ipmi/pci_ipmi_kcs.c",
++ "hw/ipmi/smbus_ipmi.c",
++ "hw/isa/apm.c",
++ "hw/isa/isa-bus.c",
++ "hw/isa/piix3.c",
++ "hw/mem/memory-device.c",
++ "hw/mem/nvdimm.c",
++ "hw/mem/pc-dimm.c",
++ "hw/misc/applesmc.c",
++ "hw/misc/debugexit.c",
++ "hw/misc/edu.c",
++ "hw/misc/ivshmem.c",
++ "hw/misc/pc-testdev.c",
++ "hw/misc/pci-testdev.c",
++ "hw/misc/pvpanic.c",
++ "hw/misc/sga.c",
++ "hw/misc/vmcoreinfo.c",
++ "hw/net/can/can_kvaser_pci.c",
++ "hw/net/can/can_mioe3680_pci.c",
++ "hw/net/can/can_pcm3680_pci.c",
++ "hw/net/can/can_sja1000.c",
++ "hw/net/can/ctucan_core.c",
++ "hw/net/can/ctucan_pci.c",
++ "hw/net/e1000.c",
++ "hw/net/e1000e_core.c",
++ "hw/net/e1000e.c",
++ "hw/net/e1000x_common.c",
++ "hw/net/eepro100.c",
++ "hw/net/ne2000-isa.c",
++ "hw/net/ne2000-pci.c",
++ "hw/net/ne2000.c",
++ "hw/net/net_rx_pkt.c",
++ "hw/net/net_tx_pkt.c",
++ "hw/net/pcnet-pci.c",
++ "hw/net/pcnet.c",
++ "hw/net/rocker/rocker_desc.c",
++ "hw/net/rocker/rocker_fp.c",
++ "hw/net/rocker/rocker_of_dpa.c",
++ "hw/net/rocker/rocker_world.c",
++ "hw/net/rocker/rocker.c",
++ "hw/net/rtl8139.c",
++ "hw/net/tulip.c",
++ "hw/net/vhost_net.c",
++ "hw/net/vmxnet3.c",
++ "hw/nvram/eeprom93xx.c",
++ "hw/nvram/fw_cfg-interface.c",
++ "hw/nvram/fw_cfg.c",
++ "hw/pci-bridge/gen_pcie_root_port.c",
++ "hw/pci-bridge/i82801b11.c",
++ "hw/pci-bridge/ioh3420.c",
++ "hw/pci-bridge/pci_bridge_dev.c",
++ "hw/pci-bridge/pci_expander_bridge.c",
++ "hw/pci-bridge/pcie_pci_bridge.c",
++ "hw/pci-bridge/pcie_root_port.c",
++ "hw/pci-bridge/xio3130_downstream.c",
++ "hw/pci-bridge/xio3130_upstream.c",
++ "hw/pci-host/gpex-acpi.c",
++ "hw/pci-host/gpex.c",
++ "hw/pci-host/i440fx.c",
++ "hw/pci-host/pam.c",
++ "hw/pci-host/q35.c",
++ "hw/pci/msi.c",
++ "hw/pci/msix.c",
++ "hw/pci/pci_bridge.c",
++ "hw/pci/pci_host.c",
++ "hw/pci/pci.c",
++ "hw/pci/pcie_aer.c",
++ "hw/pci/pcie_host.c",
++ "hw/pci/pcie_port.c",
++ "hw/pci/pcie.c",
++ "hw/pci/shpc.c",
++ "hw/pci/slotid_cap.c",
++ "hw/pcmcia/pcmcia.c",
++ "hw/scsi/emulation.c",
++ "hw/scsi/esp-pci.c",
++ "hw/scsi/esp.c",
++ "hw/scsi/lsi53c895a.c",
++ "hw/scsi/megasas.c",
++ "hw/scsi/mptconfig.c",
++ "hw/scsi/mptendian.c",
++ "hw/scsi/mptsas.c",
++ "hw/scsi/scsi-bus.c",
++ "hw/scsi/scsi-disk.c",
++ "hw/scsi/scsi-generic.c",
++ "hw/scsi/vmw_pvscsi.c",
++ "hw/sd/core.c",
++ "hw/sd/sd.c",
++ "hw/sd/sdhci-pci.c",
++ "hw/sd/sdhci.c",
++ "hw/sd/sdmmc-internal.c",
++ "hw/smbios/smbios_type_38.c",
++ "hw/smbios/smbios.c",
++ "hw/timer/hpet.c",
++ "hw/timer/i8254_common.c",
++ "hw/timer/i8254.c",
++ "hw/usb/bus.c",
++ "hw/usb/combined-packet.c",
++ "hw/usb/core.c",
++ "hw/usb/desc-msos.c",
++ "hw/usb/desc.c",
++ "hw/usb/dev-audio.c",
++ "hw/usb/dev-hid.c",
++ "hw/usb/dev-hub.c",
++ "hw/usb/dev-mtp.c",
++ "hw/usb/dev-network.c",
++ "hw/usb/dev-serial.c",
++ "hw/usb/dev-smartcard-reader.c",
++ "hw/usb/dev-storage.c",
++ "hw/usb/dev-uas.c",
++ "hw/usb/dev-wacom.c",
++ "hw/usb/hcd-ehci-pci.c",
++ "hw/usb/hcd-ehci.c",
++ "hw/usb/hcd-ohci-pci.c",
++ "hw/usb/hcd-ohci.c",
++ "hw/usb/hcd-uhci.c",
++ "hw/usb/hcd-xhci-nec.c",
++ "hw/usb/hcd-xhci-pci.c",
++ "hw/usb/hcd-xhci-sysbus.c",
++ "hw/usb/hcd-xhci.c",
++ "hw/usb/host-stub.c",
++ "hw/usb/imx-usb-phy.c",
++ "hw/usb/libhw.c",
++ "hw/usb/u2f-passthru.c",
++ "hw/usb/u2f.c",
++ "hw/virtio/virtio-bus.c",
++ "hw/virtio/virtio-mmio.c",
++ "hw/virtio/virtio-pci.c",
++ "hw/watchdog/watchdog.c",
++ "hw/watchdog/wdt_i6300esb.c",
++ "hw/watchdog/wdt_ib700.c",
++ "io/channel-buffer.c",
++ "io/channel-command.c",
++ "io/channel-file.c",
++ "io/channel-socket.c",
++ "io/channel-tls.c",
++ "io/channel-util.c",
++ "io/channel-watch.c",
++ "io/channel-websock.c",
++ "io/channel.c",
++ "io/dns-resolver.c",
++ "io/net-listener.c",
++ "io/task.c",
++ "iothread.c",
++ "job-qmp.c",
++ "job.c",
++ "migration/block-dirty-bitmap.c",
++ "migration/channel.c",
++ "migration/colo-failover.c",
++ "migration/colo.c",
++ "migration/exec.c",
++ "migration/fd.c",
++ "migration/global_state.c",
++ "migration/migration.c",
++ "migration/multifd-zlib.c",
++ "migration/multifd.c",
++ "migration/page_cache.c",
++ "migration/postcopy-ram.c",
++ "migration/qemu-file-channel.c",
++ "migration/qemu-file.c",
++ "migration/savevm.c",
++ "migration/socket.c",
++ "migration/tls.c",
++ "migration/vmstate-types.c",
++ "migration/vmstate.c",
++ "migration/xbzrle.c",
++ "migration/qjson.c",
++ "monitor/hmp-cmds.c",
++ "monitor/hmp.c",
++ "monitor/monitor.c",
++ "monitor/qmp-cmds-control.c",
++ "monitor/qmp-cmds.c",
++ "monitor/qmp.c",
++ "nbd/client.c",
++ "nbd/common.c",
++ "nbd/server.c",
++ "net/announce.c",
++ "net/can/can_core.c",
++ "net/can/can_host.c",
++ "net/can/can_socketcan.c",
++ "net/checksum.c",
++ "net/colo-compare.c",
++ "net/colo.c",
++ "net/dump.c",
++ "net/eth.c",
++ "net/filter-buffer.c",
++ "net/filter-mirror.c",
++ "net/filter-rewriter.c",
++ "net/filter.c",
++ "net/hub.c",
++ "net/l2tpv3.c",
++ "net/net.c",
++ "net/queue.c",
++ "net/slirp.c",
++ "net/socket.c",
++ "net/tap-linux.c",
++ "net/tap.c",
++ "net/util.c",
++ "net/vhost-user-stub.c",
++ "net/vhost-vdpa.c",
++ "os-posix.c",
++ "qemu-io-cmds.c",
++ "qobject/block-qdict.c",
++ "qobject/json-lexer.c",
++ "qobject/json-parser.c",
++ "qobject/json-streamer.c",
++ "qobject/qbool.c",
++ "qobject/qdict.c",
++ "qobject/qjson.c",
++ "qobject/qlist.c",
++ "qobject/qlit.c",
++ "qobject/qnull.c",
++ "qobject/qnum.c",
++ "qobject/qobject.c",
++ "qobject/qstring.c",
++ "qom/container.c",
++ "qom/object_interfaces.c",
++ "qom/object.c",
++ "qom/qom-hmp-cmds.c",
++ "qom/qom-qmp-cmds.c",
++ "qom/qom-qobject.c",
++ "replay/stubs-system.c",
++ "scsi/pr-manager-helper.c",
++ "scsi/pr-manager.c",
++ "scsi/utils.c",
++ "softmmu/bootdevice.c",
++ "softmmu/device_tree.c",
++ "softmmu/dma-helpers.c",
++ "softmmu/qdev-monitor.c",
++ "softmmu/qemu-seccomp.c",
++ "softmmu/tpm.c",
++ "stubs/gdbstub.c",
++ "stubs/icount.c",
++ "stubs/replay-tools.c",
++ "stubs/replay.c",
++ "stubs/semihost.c",
++ "stubs/target-get-monitor-def.c",
++ "stubs/win32-kbd-hook.c",
++ "stubs/xen-hw-stub.c",
++ "contrib/libvhost-user/libvhost-user-glib.c",
++ "contrib/libvhost-user/libvhost-user.c",
++ "ui/console.c",
++ "ui/cursor.c",
++ "ui/input-barrier.c",
++ "ui/input-keymap.c",
++ "ui/input-legacy.c",
++ "ui/input-linux.c",
++ "ui/input.c",
++ "ui/kbd-state.c",
++ "ui/keymaps.c",
++ "ui/qemu-pixman.c",
++ "ui/spice-module.c",
++ "ui/vnc-stubs.c",
++ "util/aio-posix.c",
++ "util/aio-wait.c",
++ "util/aiocb.c",
++ "util/async.c",
++ "util/base64.c",
++ "util/bitmap.c",
++ "util/bitops.c",
++ "util/block-helpers.c",
++ "util/buffer.c",
++ "util/bufferiszero.c",
++ "util/cacheinfo.c",
++ "util/compatfd.c",
++ "util/coroutine-ucontext.c",
++ "util/crc32c.c",
++ "util/cutils.c",
++ "util/drm.c",
++ "util/envlist.c",
++ "util/error.c",
++ "util/event_notifier-posix.c",
++ "util/fdmon-epoll.c",
++ "util/fdmon-io_uring.c",
++ "util/fdmon-poll.c",
++ "util/fifo8.c",
++ "util/filemonitor-inotify.c",
++ "util/getauxval.c",
++ "util/guest-random.c",
++ "util/hbitmap.c",
++ "util/hexdump.c",
++ "util/host-utils.c",
++ "util/id.c",
++ "util/iov.c",
++ "util/iova-tree.c",
++ "util/keyval.c",
++ "util/lockcnt.c",
++ "util/log.c",
++ "util/main-loop.c",
++ "util/memfd.c",
++ "util/mmap-alloc.c",
++ "util/module.c",
++ "util/notify.c",
++ "util/nvdimm-utils.c",
++ "util/osdep.c",
++ "util/oslib-posix.c",
++ "util/pagesize.c",
++ "util/path.c",
++ "util/qdist.c",
++ "util/qemu-co-shared-resource.c",
++ "util/qemu-config.c",
++ "util/qemu-coroutine-io.c",
++ "util/qemu-coroutine-lock.c",
++ "util/qemu-coroutine-sleep.c",
++ "util/qemu-error.c",
++ "util/qemu-openpty.c",
++ "util/qemu-option.c",
++ "util/qemu-print.c",
++ "util/qemu-progress.c",
++ "util/qemu-sockets.c",
++ "util/qemu-thread-posix.c",
++ "util/qemu-timer-common.c",
++ "util/qemu-timer.c",
++ "util/qht.c",
++ "util/qsp.c",
++ "util/range.c",
++ "util/rcu.c",
++ "util/readline.c",
++ "util/stats64.c",
++ "util/sys_membarrier.c",
++ "util/systemd.c",
++ "util/thread-pool.c",
++ "util/throttle.c",
++ "util/timed-average.c",
++ "util/unicode.c",
++ "util/uri.c",
++ "util/uuid.c",
++ "util/vfio-helpers.c",
++ "util/vhost-user-server.c",
++ "util/qemu-coroutine.c",
++ ] + [
++ "//qapi:opts-visitor.c",
++ "//qapi:qapi-clone-visitor.c",
++ "//qapi:qapi-dealloc-visitor.c",
++ "//qapi:qapi-util.c",
++ "//qapi:qapi-visit-core.c",
++ "//qapi:qmp-dispatch.c",
++ "//qapi:qmp-event.c",
++ "//qapi:qmp-registry.c",
++ "//qapi:qobject-input-visitor.c",
++ "//qapi:qobject-output-visitor.c",
++ "//qapi:string-input-visitor.c",
++ "//qapi:string-output-visitor.c",
++ "//trace:control.c",
++ "//trace:qmp.c",
++ ] + [
++ ":gen_hdrs",
++ ":block-coroutine-gen",
++ ],
++ # QEMU relies on hacky two's complement representation interpretation of bitshifts
++ copts = ["-fwrapv"],
++ local_defines = [
++ "_GNU_SOURCE",
++ "_FILE_OFFSET_BITS=64",
++ "_LARGEFILE_SOURCE",
++ ],
++ deps = [
++ ":capstone",
++ ":fdt",
++ ":slirp",
++ "@glib//glib",
++ "@pixman//:pixman",
++ "@seccomp",
++ "@uring//:uring",
++ "@zlib//:zlib",
++ ],
++ includes = ["include", "capstone/include/capstone"],
++ alwayslink = True, # QEMU uses __attribute__((constructor)) functions
++)
++
++cc_binary(
++ name = "qemu-x86_64-softmmu",
++ srcs = [":all_headers"] + [
++ "//trace:control-target.c",
++ "accel/dummy-cpus.c",
++ "accel/kvm/kvm-all.c",
++ "accel/kvm/kvm-cpus.c",
++ "accel/qtest/qtest.c",
++ "accel/stubs/hax-stub.c",
++ "accel/stubs/tcg-stub.c",
++ "accel/stubs/xen-stub.c",
++ "cpu.c",
++ "disas.c",
++ "dump/dump.c",
++ "dump/win_dump.c",
++ "exec-vary.c",
++ "gdbstub.c",
++ "hw/block/dataplane/virtio-blk.c",
++ "hw/block/virtio-blk.c",
++ "hw/char/virtio-serial-bus.c",
++ "hw/core/machine-qmp-cmds.c",
++ "hw/core/numa.c",
++ "hw/display/vga.c",
++ "hw/hyperv/hyperv_testdev.c",
++ "hw/hyperv/hyperv.c",
++ "hw/hyperv/vmbus.c",
++ "hw/i386/acpi-build.c",
++ "hw/i386/acpi-common.c",
++ "hw/i386/acpi-microvm.c",
++ "hw/i386/amd_iommu.c",
++ "hw/i386/e820_memory_layout.c",
++ "hw/i386/fw_cfg.c",
++ "hw/i386/generic_event_device_x86.c",
++ "hw/i386/intel_iommu.c",
++ "hw/i386/kvm/apic.c",
++ "hw/i386/kvm/clock.c",
++ "hw/i386/kvm/i8254.c",
++ "hw/i386/kvm/i8259.c",
++ "hw/i386/kvm/ioapic.c",
++ "hw/i386/kvmvapic.c",
++ "hw/i386/microvm.c",
++ "hw/i386/multiboot.c",
++ "hw/i386/pc_piix.c",
++ "hw/i386/pc_q35.c",
++ "hw/i386/pc_sysfw.c",
++ "hw/i386/pc.c",
++ "hw/i386/port92.c",
++ "hw/i386/vmmouse.c",
++ "hw/i386/vmport.c",
++ "hw/i386/x86-iommu.c",
++ "hw/i386/x86.c",
++ "hw/intc/apic_common.c",
++ "hw/intc/apic.c",
++ "hw/intc/ioapic.c",
++ "hw/isa/lpc_ich9.c",
++ "hw/net/virtio-net.c",
++ "hw/rtc/mc146818rtc.c",
++ "hw/scsi/virtio-scsi-dataplane.c",
++ "hw/scsi/virtio-scsi.c",
++ "hw/vfio/common.c",
++ "hw/vfio/display.c",
++ "hw/vfio/igd.c",
++ "hw/vfio/migration.c",
++ "hw/vfio/pci-quirks.c",
++ "hw/vfio/pci.c",
++ "hw/vfio/spapr.c",
++ "hw/virtio/vhost-backend.c",
++ "hw/virtio/vhost-vdpa.c",
++ "hw/virtio/vhost.c",
++ "hw/virtio/virtio-balloon-pci.c",
++ "hw/virtio/virtio-balloon.c",
++ "hw/virtio/virtio-blk-pci.c",
++ "hw/virtio/virtio-crypto-pci.c",
++ "hw/virtio/virtio-crypto.c",
++ "hw/virtio/virtio-input-host-pci.c",
++ "hw/virtio/virtio-input-pci.c",
++ "hw/virtio/virtio-iommu-pci.c",
++ "hw/virtio/virtio-iommu.c",
++ "hw/virtio/virtio-mem-pci.c",
++ "hw/virtio/virtio-mem.c",
++ "hw/virtio/virtio-net-pci.c",
++ "hw/virtio/virtio-pmem-pci.c",
++ "hw/virtio/virtio-pmem.c",
++ "hw/virtio/virtio-rng-pci.c",
++ "hw/virtio/virtio-rng.c",
++ "hw/virtio/virtio-scsi-pci.c",
++ "hw/virtio/virtio-serial-pci.c",
++ "hw/virtio/virtio.c",
++ "migration/dirtyrate.c",
++ "migration/ram.c",
++ "monitor/misc.c",
++ "softmmu/arch_init.c",
++ "softmmu/balloon.c",
++ "softmmu/cpu-throttle.c",
++ "softmmu/cpu-timers.c",
++ "softmmu/cpus.c",
++ "softmmu/ioport.c",
++ "softmmu/main.c",
++ "softmmu/memory_mapping.c",
++ "softmmu/memory.c",
++ "softmmu/physmem.c",
++ "softmmu/qtest.c",
++ "softmmu/vl.c",
++ "target/i386/arch_dump.c",
++ "target/i386/arch_memory_mapping.c",
++ "target/i386/cpu.c",
++ "target/i386/gdbstub.c",
++ "target/i386/helper.c",
++ "target/i386/kvm.c",
++ "target/i386/hyperv.c",
++ "target/i386/machine.c",
++ "target/i386/monitor.c",
++ "target/i386/tcg-stub.c",
++ "target/i386/sev.c",
++ "target/i386/xsave_helper.c",
++ ] + [
++ ":gen_hdrs",
++ ":trace_c",
++ ":qapi_c",
++ ],
++ copts = ["-fwrapv"], # QEMU relies on hacky two's complement representations of bitshifts
++ linkopts = [
++ "-pthread",
++ "-lutil", # Not actually a library but weird GLIBC shenanigans
++ ],
++ data = glob(["pc-bios/**"]),
++ local_defines = [
++ "_GNU_SOURCE",
++ "_FILE_OFFSET_BITS=64",
++ "_LARGEFILE_SOURCE",
++ "NEED_CPU_H",
++ "CONFIG_TARGET=\\\"x86_64-softmmu-config-target.h\\\"",
++ "CONFIG_DEVICES=\\\"x86_64-softmmu-config-devices.h\\\"",
++ ],
++ deps = [
++ ":fdt",
++ ":qemu",
++ ":slirp",
++ "@glib//glib",
++ "@pixman//:pixman",
++ "@zlib//:zlib",
++ ],
++ visibility = ["//visibility:public"],
++ includes = ["target/i386", "tcg/i386", "accel/tcg", "linux-headers"],
++)
++
++genrule(
++ name = "cursor-hdrs",
++ srcs = [
++ "ui/cursor_hidden.xpm",
++ "ui/cursor_left_ptr.xpm",
++ ],
++ outs = [
++ "ui/cursor_hidden.h",
++ "ui/cursor_left_ptr.h",
++ ],
++ cmd = """
++ cp $(location ui/cursor_hidden.xpm) $(location ui/cursor_hidden.h)
++ cp $(location ui/cursor_left_ptr.xpm) $(location ui/cursor_left_ptr.h)
++ """,
++)
++
++genrule(
++ name = "module-block",
++ outs = ["block/module_block.h"],
++ cmd = "./$(location //scripts/modules:module_block) $(location block/module_block.h)",
++ tools = ["//scripts/modules:module_block"],
++)
++
++genrule(
++ name = "hmp-commands",
++ srcs = [
++ "hmp-commands.hx",
++ "hmp-commands-info.hx",
++ "qemu-options.hx",
++ "qemu-img-cmds.hx",
++ ],
++ outs = [
++ "hmp-commands.h",
++ "hmp-commands-info.h",
++ "qemu-options-gen.h",
++ "qemu-img-cmds.h",
++ ],
++ cmd = """
++ ./$(location //scripts:hxtool-sh) -h $(location hmp-commands.hx) > $(location hmp-commands.h)
++ ./$(location //scripts:hxtool-sh) -h $(location hmp-commands-info.hx) > $(location hmp-commands-info.h)
++ ./$(location //scripts:hxtool-sh) -h $(location qemu-options.hx) > $(location qemu-options-gen.h)
++ ./$(location //scripts:hxtool-sh) -h $(location qemu-img-cmds.hx) > $(location qemu-img-cmds.h)
++ """,
++ tools = ["//scripts:hxtool-sh"],
++)
++
++cc_qemu_keymaps(
++ name = "keymaps-gen",
++ src = "ui/keycodemapdb/data/keymaps.csv",
++ maps = {
++ "atset1": ["qcode"],
++ "linux": ["qcode"],
++ "qcode": [
++ "atset1",
++ "atset2",
++ "atset3",
++ "linux",
++ "qnum",
++ "sun",
++ ],
++ "qnum": ["qcode"],
++ "usb": ["qcode"],
++ "win32": ["qcode"],
++ "x11": ["qcode"],
++ "xorgevdev": ["qcode"],
++ "xorgkbd": ["qcode"],
++ "xorgxquartz": ["qcode"],
++ "xorgxwin": ["qcode"],
++ "osx": ["qcode"],
++ },
++)
++
++
++genrule(
++ name = "renamed-keymap-gen",
++ srcs = ["ui/keycodemapdb/tools/keymap-gen"],
++ outs = ["keymap-gen.py"],
++ cmd = "cp $(location ui/keycodemapdb/tools/keymap-gen) $@",
++)
++
++py_binary(
++ name = "keymap-gen",
++ srcs = [":renamed-keymap-gen"],
++ visibility = ["//visibility:public"],
++)
++
++genrule(
++ name = "gdbstub-xml",
++ srcs = ["gdb-xml/i386-64bit.xml"],
++ outs = ["x86_64-softmmu-gdbstub-xml.c"],
++ cmd = "./$(location //scripts:feature_to_c) $(location gdb-xml/i386-64bit.xml) > $@",
++ tools = ["//scripts:feature_to_c"],
++)
++
++# TODO: x86_64-softmmu-config-target.h, x86_64-softmmu-config-devices.h, include/qemu/config-host.h (probably copy)
++# TODO: ui/input-keymap-*.c.inc (generate at top level with //ui/keycodemapdb/tools:keymap-gen)
+diff --git a/defs.bzl b/defs.bzl
+new file mode 100644
+index 0000000000..3a8d50d429
+--- /dev/null
++++ b/defs.bzl
+@@ -0,0 +1,52 @@
++def _impl_filter_label_suffix(ctx):
++ return [DefaultInfo(
++ files = depset([f for f in ctx.files.srcs if f.path.endswith(ctx.attr.suffix) and f.basename not in ctx.attr.exclude]),
++ )]
++
++filter_label_suffix = rule(
++ implementation = _impl_filter_label_suffix,
++ attrs = {
++ "srcs": attr.label_list(
++ mandatory = True,
++ allow_files = True,
++ ),
++ "suffix": attr.string(
++ mandatory = True,
++ ),
++ "exclude": attr.string_list(
++ default = [],
++ ),
++ },
++)
++
++def _impl_cc_qemu_keymaps(ctx):
++ outs = []
++ for _from in ctx.attr.maps:
++ for _to in ctx.attr.maps[_from]:
++ out = ctx.actions.declare_file("ui/input-keymap-{}-to-{}.c.inc".format(_from, _to))
++ ctx.actions.run(
++ inputs = ctx.files.src + ctx.files._keymap_gen,
++ executable = ctx.executable._savestdout,
++ arguments = [out.path, ctx.files._keymap_gen[0].path, "--lang=glib2", "--varname=qemu_input_map_{}_to_{}".format(_from, _to), "code-map", ctx.files.src[0].path, _from, _to],
++ outputs = [out],
++ )
++ outs.append(out)
++ return [DefaultInfo(files = depset(outs))]
++
++cc_qemu_keymaps = rule(
++ implementation = _impl_cc_qemu_keymaps,
++ attrs = {
++ "src": attr.label(allow_single_file = True),
++ "maps": attr.string_list_dict(),
++ "_keymap_gen": attr.label(
++ default = Label("//:keymap-gen"),
++ executable = True,
++ cfg = "exec",
++ ),
++ "_savestdout": attr.label(
++ default = Label("@dev_source_monogon//build/savestdout"),
++ executable = True,
++ cfg = "exec",
++ ),
++ },
++)
+diff --git a/qapi/BUILD b/qapi/BUILD
+new file mode 100644
+index 0000000000..71ff5a7445
+--- /dev/null
++++ b/qapi/BUILD
+@@ -0,0 +1,25 @@
++load("//scripts/qapi:defs.bzl", "cc_qapi")
++
++cc_qapi(
++ name = "qapi_generated",
++ srcs = glob(["*.json"]),
++ main = "qapi-schema.json",
++ visibility = ["//visibility:public"],
++)
++
++exports_files(glob([
++ "*.c",
++ "*.h",
++]) + ["trace-events"])
++
++filegroup(
++ name = "extra_hdrs",
++ srcs = glob(["**/*.h"]),
++ visibility = ["//visibility:public"],
++)
++
++filegroup(
++ name = "schema",
++ srcs = glob(["*.json"]),
++ visibility = ["//visibility:public"],
++)
+diff --git a/qapi/defs.bzl b/qapi/defs.bzl
+new file mode 100644
+index 0000000000..2d1f38fdfa
+--- /dev/null
++++ b/qapi/defs.bzl
+@@ -0,0 +1,40 @@
++load("@rules_cc//cc:defs.bzl", "cc_library")
++
++# The actual rule which does the filtering.
++def _do_filter_impl(ctx):
++ return [DefaultInfo(
++ files = depset([f for f in ctx.files.srcs if f.path.endswith(ctx.attr.suffix)]),
++ )]
++
++_do_filter = rule(
++ implementation = _do_filter_impl,
++ attrs = {
++ "srcs": attr.label_list(
++ mandatory = True,
++ allow_files = True,
++ ),
++ "suffix": attr.string(
++ mandatory = True,
++ ),
++ },
++)
++
++def filtered_cc_library(name, srcs, hdrs, **kwargs):
++ _do_filter(
++ name = "%s_hdrs" % name,
++ visibility = ["//visibility:private"],
++ srcs = hdrs,
++ suffix = ".h",
++ )
++ _do_filter(
++ name = "%s_srcs" % name,
++ visibility = ["//visibility:private"],
++ srcs = srcs,
++ suffix = ".c",
++ )
++ cc_library(
++ name = name,
++ srcs = [":%s_srcs" % name],
++ hdrs = [":%s_hdrs" % name],
++ **kwargs
++ )
+diff --git a/scripts/BUILD b/scripts/BUILD
+new file mode 100644
+index 0000000000..0b4fc8a248
+--- /dev/null
++++ b/scripts/BUILD
+@@ -0,0 +1,35 @@
++load("@rules_python//python:defs.bzl", "py_binary")
++
++py_binary(
++ name = "qapi-gen",
++ srcs = ["qapi-gen.py"],
++ visibility = ["//visibility:public"],
++ deps = ["//scripts/qapi"],
++)
++
++py_binary(
++ # We cannot use tracetool as name as a directory with the same name exists
++ name = "tracetool-cli",
++ srcs = ["tracetool.py"],
++ main = "tracetool.py",
++ visibility = ["//visibility:public"],
++ deps = ["//scripts/tracetool"],
++)
++
++py_binary(
++ name = "block-coroutine-wrapper",
++ srcs = ["block-coroutine-wrapper.py"],
++ visibility = ["//visibility:public"],
++)
++
++sh_binary(
++ name = "hxtool-sh",
++ srcs = ["hxtool"],
++ visibility = ["//visibility:public"],
++)
++
++sh_binary(
++ name = "feature_to_c",
++ srcs = ["feature_to_c.sh"],
++ visibility = ["//:__subpackages__"],
++)
+diff --git a/scripts/modules/BUILD b/scripts/modules/BUILD
+new file mode 100644
+index 0000000000..99a5ab2243
+--- /dev/null
++++ b/scripts/modules/BUILD
+@@ -0,0 +1,7 @@
++load("@rules_python//python:defs.bzl", "py_binary")
++
++py_binary(
++ name = "module_block",
++ srcs = ["module_block.py"],
++ visibility = ["//:__subpackages__"]
++)
+diff --git a/scripts/qapi/BUILD b/scripts/qapi/BUILD
+new file mode 100644
+index 0000000000..a7e8da9368
+--- /dev/null
++++ b/scripts/qapi/BUILD
+@@ -0,0 +1,7 @@
++load("@rules_python//python:defs.bzl", "py_library")
++
++py_library(
++ name = "qapi",
++ srcs = glob(["*.py"]),
++ visibility = ["//visibility:public"],
++)
+diff --git a/scripts/qapi/defs.bzl b/scripts/qapi/defs.bzl
+new file mode 100644
+index 0000000000..807f4b37d5
+--- /dev/null
++++ b/scripts/qapi/defs.bzl
+@@ -0,0 +1,52 @@
++def _impl_qapi_cc(ctx):
++ out = []
++ out_types = ["types", "visit", "events", "commands"]
++ system_modules = ["builtin-types", "builtin-visit", "introspect", "init-commands", "emit-events", "types-error", "visit-error"]
++ for t in out_types:
++ out.append(ctx.actions.declare_file("qapi-{}.c".format(t)))
++ out.append(ctx.actions.declare_file("qapi-{}.h".format(t)))
++ for t in system_modules:
++ out.append(ctx.actions.declare_file("qapi-{}.c".format(t)))
++ out.append(ctx.actions.declare_file("qapi-{}.h".format(t)))
++
++ input_dir = ""
++ main_file = ctx.files.main[0]
++ for src in ctx.files.srcs:
++ if src.path == main_file.path:
++ continue
++ extension = src.extension
++ basename = src.basename[:-len(extension) - 1]
++ if input_dir == "":
++ input_dir = src.dirname
++ elif input_dir != src.dirname:
++ fail("all cc_qapi sources need to be in the same folder")
++
++ for t in out_types:
++ out.append(ctx.actions.declare_file("qapi-{}-{}.c".format(t, basename)))
++ out.append(ctx.actions.declare_file("qapi-{}-{}.h".format(t, basename)))
++
++ ctx.actions.run(
++ inputs = ctx.files.srcs + ctx.files.main,
++ executable = ctx.executable._qapi_gen,
++ arguments = ["-o", out[0].dirname, "-b", main_file.path],
++ outputs = out,
++ )
++ return [DefaultInfo(files = depset(out))]
++
++cc_qapi = rule(
++ implementation = _impl_qapi_cc,
++ attrs = {
++ "srcs": attr.label_list(
++ mandatory = True,
++ allow_files = True,
++ ),
++ "main": attr.label(
++ allow_single_file = True,
++ ),
++ "_qapi_gen": attr.label(
++ default = Label("//scripts:qapi-gen"),
++ executable = True,
++ cfg = "exec",
++ ),
++ },
++)
+diff --git a/scripts/tracetool/BUILD b/scripts/tracetool/BUILD
+new file mode 100644
+index 0000000000..93ccf94480
+--- /dev/null
++++ b/scripts/tracetool/BUILD
+@@ -0,0 +1,11 @@
++load("@rules_python//python:defs.bzl", "py_library")
++
++py_library(
++ name = "tracetool",
++ srcs = glob(["*.py"]),
++ visibility = ["//visibility:public"],
++ deps = [
++ "//scripts/tracetool/backend",
++ "//scripts/tracetool/format",
++ ],
++)
+diff --git a/scripts/tracetool/backend/BUILD b/scripts/tracetool/backend/BUILD
+new file mode 100644
+index 0000000000..6cc626682c
+--- /dev/null
++++ b/scripts/tracetool/backend/BUILD
+@@ -0,0 +1,7 @@
++load("@rules_python//python:defs.bzl", "py_library")
++
++py_library(
++ name = "backend",
++ srcs = glob(["*.py"]),
++ visibility = ["//visibility:public"],
++)
+diff --git a/scripts/tracetool/defs.bzl b/scripts/tracetool/defs.bzl
+new file mode 100644
+index 0000000000..70ce080a62
+--- /dev/null
++++ b/scripts/tracetool/defs.bzl
+@@ -0,0 +1,65 @@
++def _impl_cc_qemu_trace(ctx):
++ outs = []
++ for src in ctx.files.srcs:
++ name = src.path.replace("external/qemu/", "").replace("/trace-events", "").replace("/", "_")
++ if name == "trace-events":
++ name = "root"
++ trace_h = ctx.actions.declare_file("trace-{}.h".format(name))
++ trace_c = ctx.actions.declare_file("trace-{}.c".format(name))
++ outs.append(trace_c)
++ outs.append(trace_h)
++
++ ctx.actions.run(
++ inputs = [src] + ctx.files._tracetool,
++ executable = ctx.executable._savestdout,
++ arguments = [trace_h.path, ctx.files._tracetool[0].path, "--backend", ctx.attr.backend, "--group", name, "--format=h", src.path],
++ outputs = [trace_h],
++ )
++ ctx.actions.run(
++ inputs = [src] + ctx.files._tracetool,
++ executable = ctx.executable._savestdout,
++ arguments = [trace_c.path, ctx.files._tracetool[0].path, "--backend", ctx.attr.backend, "--group", name, "--format=c", src.path],
++ outputs = [trace_c],
++ )
++ return [DefaultInfo(files = depset(outs))]
++
++cc_qemu_trace = rule(
++ implementation = _impl_cc_qemu_trace,
++ attrs = {
++ "srcs": attr.label_list(
++ mandatory = True,
++ allow_files = True,
++ ),
++ "backend": attr.string(
++ default = "log",
++ ),
++ "_tracetool": attr.label(
++ default = Label("//scripts:tracetool-cli"),
++ executable = True,
++ cfg = "exec",
++ ),
++ "_savestdout": attr.label(
++ default = Label("@dev_source_monogon//build/savestdout"),
++ executable = True,
++ cfg = "exec",
++ ),
++ },
++)
++
++def _impl_cc_qemu_trace_single(ctx):
++ trace_h = ctx.actions.declare_file("trace-{}.h".format(ctx.attr.name))
++ trace_c = ctx.actions.declare_file("trace-{}.c".format(ctx.attr.name))
++
++ ctx.actions.run(
++ inputs = ctx.files.src,
++ executable = ctx.executable._tracetool,
++ arguments = ["--backend", ctx.attr.backend, "--group", ctx.attr.name, "--format=h", ctx.files.src[0].path, trace_h.path],
++ outputs = [trace_h],
++ )
++ ctx.actions.run(
++ inputs = ctx.files.src,
++ executable = ctx.executable._tracetool,
++ arguments = ["--backend", ctx.attr.backend, "--group", ctx.attr.name, "--format=c", ctx.files.src[0].path, trace_c.path],
++ outputs = [trace_c],
++ )
++ return [DefaultInfo(files = depset([trace_c, trace_h]))]
+diff --git a/scripts/tracetool/format/BUILD b/scripts/tracetool/format/BUILD
+new file mode 100644
+index 0000000000..1b2dc209e1
+--- /dev/null
++++ b/scripts/tracetool/format/BUILD
+@@ -0,0 +1,7 @@
++load("@rules_python//python:defs.bzl", "py_library")
++
++py_library(
++ name = "format",
++ srcs = glob(["*.py"]),
++ visibility = ["//visibility:public"],
++)
+diff --git a/trace/BUILD b/trace/BUILD
+new file mode 100644
+index 0000000000..2f2e71d81a
+--- /dev/null
++++ b/trace/BUILD
+@@ -0,0 +1,18 @@
++load("//scripts/tracetool:defs.bzl", "cc_qemu_trace")
++
++cc_qemu_trace(
++ name = "trace",
++ srcs = ["//:trace-files"],
++ visibility = ["//visibility:public"],
++)
++
++exports_files(glob([
++ "*.c",
++ "*.h",
++]))
++
++filegroup(
++ name = "extra_hdrs",
++ srcs = glob(["**/*.h"]),
++ visibility = ["//visibility:public"],
++)
+--
+2.25.1
+
diff --git a/third_party/qemu/patches/fix_code_issues.patch b/third_party/qemu/patches/fix_code_issues.patch
new file mode 100644
index 0000000..af1ba5f
--- /dev/null
+++ b/third_party/qemu/patches/fix_code_issues.patch
@@ -0,0 +1,55 @@
+Copyright 2020 The Monogon Project Authors.
+
+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.
+
+
+From 931f89680cd6714a4eca13c8ae11cd733c1b4609 Mon Sep 17 00:00:00 2001
+From: Lorenz Brun <lorenz@brun.one>
+Date: Wed, 10 Mar 2021 17:55:55 +0100
+Subject: [PATCH 2/6] Fix QEMU code issues
+
+---
+ qom/object.c | 2 +-
+ softmmu/physmem.c | 3 ++-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/qom/object.c b/qom/object.c
+index 1065355233..f3aa56cc52 100644
+--- a/qom/object.c
++++ b/qom/object.c
+@@ -692,7 +692,7 @@ static void object_finalize(void *data)
+
+ /* Find the minimum alignment guaranteed by the system malloc. */
+ #if __STDC_VERSION__ >= 201112L
+-typddef max_align_t qemu_max_align_t;
++typedef max_align_t qemu_max_align_t;
+ #else
+ typedef union {
+ long l;
+diff --git a/softmmu/physmem.c b/softmmu/physmem.c
+index 3027747c03..2eb31592f4 100644
+--- a/softmmu/physmem.c
++++ b/softmmu/physmem.c
+@@ -2675,7 +2675,8 @@ static void invalidate_and_set_dirty(MemoryRegion *mr, hwaddr addr,
+ }
+ if (dirty_log_mask & (1 << DIRTY_MEMORY_CODE)) {
+ assert(tcg_enabled());
+- tb_invalidate_phys_range(addr, addr + length);
++ // If this symbol is not elided by the compiler it cannot be found.
++ // tb_invalidate_phys_range(addr, addr + length);
+ dirty_log_mask &= ~(1 << DIRTY_MEMORY_CODE);
+ }
+ cpu_physical_memory_set_dirty_range(addr, length, dirty_log_mask);
+--
+2.25.1
+
diff --git a/third_party/qemu/patches/headers_fix.patch b/third_party/qemu/patches/headers_fix.patch
new file mode 100644
index 0000000..a70bd75
--- /dev/null
+++ b/third_party/qemu/patches/headers_fix.patch
@@ -0,0 +1,1179 @@
+Copyright 2020 The Monogon Project Authors.
+
+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.
+
+
+diff --git a/block/cloop.c b/block/cloop.c
+index c99192a57f..fa8bc497a4 100644
+--- a/block/cloop.c
++++ b/block/cloop.c
+@@ -27,7 +27,7 @@
+ #include "block/block_int.h"
+ #include "qemu/module.h"
+ #include "qemu/bswap.h"
+-#include <zlib.h>
++#include "zlib.h"
+
+ /* Maximum compressed block size */
+ #define MAX_BLOCK_SIZE (64 * 1024 * 1024)
+diff --git a/block/dmg.h b/block/dmg.h
+index e488601b62..fc3ac8116a 100644
+--- a/block/dmg.h
++++ b/block/dmg.h
+@@ -27,7 +27,7 @@
+ #define BLOCK_DMG_H
+
+ #include "block/block_int.h"
+-#include <zlib.h>
++#include "zlib.h"
+
+ typedef struct BDRVDMGState {
+ CoMutex lock;
+diff --git a/block/io_uring.c b/block/io_uring.c
+index 00a3ee9fb8..f3644dbc75 100644
+--- a/block/io_uring.c
++++ b/block/io_uring.c
+@@ -9,7 +9,7 @@
+ * See the COPYING file in the top-level directory.
+ */
+ #include "qemu/osdep.h"
+-#include <liburing.h>
++#include "src/include/liburing.h"
+ #include "qemu-common.h"
+ #include "block/aio.h"
+ #include "qemu/queue.h"
+diff --git a/block/qcow.c b/block/qcow.c
+index f8919a44d1..1229c120d8 100644
+--- a/block/qcow.c
++++ b/block/qcow.c
+@@ -32,7 +32,7 @@
+ #include "qemu/option.h"
+ #include "qemu/bswap.h"
+ #include "qemu/cutils.h"
+-#include <zlib.h>
++#include "zlib.h"
+ #include "qapi/qmp/qdict.h"
+ #include "qapi/qmp/qstring.h"
+ #include "qapi/qobject-input-visitor.h"
+diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
+index bd0597842f..8049db50a4 100644
+--- a/block/qcow2-cluster.c
++++ b/block/qcow2-cluster.c
+@@ -23,7 +23,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <zlib.h>
++#include "zlib.h"
+
+ #include "qapi/error.h"
+ #include "qcow2.h"
+diff --git a/block/qcow2-threads.c b/block/qcow2-threads.c
+index 1914baf456..2370faf16a 100644
+--- a/block/qcow2-threads.c
++++ b/block/qcow2-threads.c
+@@ -26,7 +26,7 @@
+ #include "qemu/osdep.h"
+
+ #define ZLIB_CONST
+-#include <zlib.h>
++#include "zlib.h"
+
+ #ifdef CONFIG_ZSTD
+ #include <zstd.h>
+diff --git a/block/vmdk.c b/block/vmdk.c
+index a00dc00eb4..6a77fe375f 100644
+--- a/block/vmdk.c
++++ b/block/vmdk.c
+@@ -35,7 +35,7 @@
+ #include "qemu/bswap.h"
+ #include "migration/blocker.h"
+ #include "qemu/cutils.h"
+-#include <zlib.h>
++#include "zlib.h"
+
+ #define VMDK3_MAGIC (('C' << 24) | ('O' << 16) | ('W' << 8) | 'D')
+ #define VMDK4_MAGIC (('K' << 24) | ('D' << 16) | ('M' << 8) | 'V')
+diff --git a/contrib/libvhost-user/libvhost-user-glib.h b/contrib/libvhost-user/libvhost-user-glib.h
+index 1a79a4916e..d0c76e83ec 100644
+--- a/contrib/libvhost-user/libvhost-user-glib.h
++++ b/contrib/libvhost-user/libvhost-user-glib.h
+@@ -15,7 +15,7 @@
+ #ifndef LIBVHOST_USER_GLIB_H
+ #define LIBVHOST_USER_GLIB_H
+
+-#include <glib.h>
++#include "glib/glib.h"
+ #include "libvhost-user.h"
+
+ typedef struct VugDev {
+diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c
+index 37435a3fc7..df38b5adf3 100644
+--- a/contrib/plugins/hotblocks.c
++++ b/contrib/plugins/hotblocks.c
+@@ -11,7 +11,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdio.h>
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #include <qemu-plugin.h>
+
+diff --git a/contrib/plugins/hotpages.c b/contrib/plugins/hotpages.c
+index ecd6c18732..3d41d80d78 100644
+--- a/contrib/plugins/hotpages.c
++++ b/contrib/plugins/hotpages.c
+@@ -14,7 +14,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdio.h>
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #include <qemu-plugin.h>
+
+diff --git a/contrib/plugins/howvec.c b/contrib/plugins/howvec.c
+index 3b9a6939f2..2c85253ba4 100644
+--- a/contrib/plugins/howvec.c
++++ b/contrib/plugins/howvec.c
+@@ -16,7 +16,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdio.h>
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #include <qemu-plugin.h>
+
+diff --git a/contrib/plugins/lockstep.c b/contrib/plugins/lockstep.c
+index 5aad50869d..0e5d489beb 100644
+--- a/contrib/plugins/lockstep.c
++++ b/contrib/plugins/lockstep.c
+@@ -23,7 +23,7 @@
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+-#include <glib.h>
++#include "glib/glib.h"
+ #include <inttypes.h>
+ #include <unistd.h>
+ #include <sys/socket.h>
+diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c
+index a019d0a9ac..23ac689e11 100644
+--- a/contrib/vhost-user-gpu/vhost-user-gpu.c
++++ b/contrib/vhost-user-gpu/vhost-user-gpu.c
+@@ -16,8 +16,8 @@
+ #include "qapi/error.h"
+ #include "qemu/sockets.h"
+
+-#include <pixman.h>
+-#include <glib-unix.h>
++#include "pixman.h"
++#include "glib/glib-unix.h"
+
+ #include "vugpu.h"
+ #include "hw/virtio/virtio-gpu-bswap.h"
+diff --git a/contrib/vhost-user-input/main.c b/contrib/vhost-user-input/main.c
+index 6020c6f33a..3254be9e65 100644
+--- a/contrib/vhost-user-input/main.c
++++ b/contrib/vhost-user-input/main.c
+@@ -6,7 +6,7 @@
+
+ #include "qemu/osdep.h"
+
+-#include <glib.h>
++#include "glib/glib.h"
+ #include <linux/input.h>
+
+ #include "qemu/iov.h"
+diff --git a/dump/dump.c b/dump/dump.c
+index dec32468d9..cfda910798 100644
+--- a/dump/dump.c
++++ b/dump/dump.c
+@@ -35,7 +35,7 @@
+ #include "win_dump.h"
+ #endif
+
+-#include <zlib.h>
++#include "zlib.h"
+ #ifdef CONFIG_LZO
+ #include <lzo/lzo1x.h>
+ #endif
+diff --git a/fsdev/9p-iov-marshal.c b/fsdev/9p-iov-marshal.c
+index a1c9beddd2..003bb87175 100644
+--- a/fsdev/9p-iov-marshal.c
++++ b/fsdev/9p-iov-marshal.c
+@@ -12,7 +12,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gprintf.h>
++#include "glib/gprintf.h"
+ #include <utime.h>
+
+ #include "9p-iov-marshal.h"
+diff --git a/fsdev/9p-marshal.c b/fsdev/9p-marshal.c
+index a01bba6908..af93f824ac 100644
+--- a/fsdev/9p-marshal.c
++++ b/fsdev/9p-marshal.c
+@@ -12,7 +12,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gprintf.h>
++#include "glib/gprintf.h"
+ #include <dirent.h>
+ #include <utime.h>
+
+diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
+index 94df440fc7..4db4f2f548 100644
+--- a/hw/9pfs/9p.c
++++ b/hw/9pfs/9p.c
+@@ -12,7 +12,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gprintf.h>
++#include "glib/gprintf.h"
+ #include "hw/virtio/virtio.h"
+ #include "qapi/error.h"
+ #include "qemu/error-report.h"
+diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
+index 3792ba96ce..6ae8fbeb42 100644
+--- a/hw/acpi/aml-build.c
++++ b/hw/acpi/aml-build.c
+@@ -20,7 +20,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gprintf.h>
++#include "glib/gprintf.h"
+ #include "hw/acpi/aml-build.h"
+ #include "qemu/bswap.h"
+ #include "qemu/bitops.h"
+diff --git a/hw/core/loader-fit.c b/hw/core/loader-fit.c
+index b7c7b3ba94..83ecffe630 100644
+--- a/hw/core/loader-fit.c
++++ b/hw/core/loader-fit.c
+@@ -28,7 +28,7 @@
+ #include "sysemu/device_tree.h"
+
+ #include <libfdt.h>
+-#include <zlib.h>
++#include "zlib.h"
+
+ #define FIT_LOADER_MAX_PATH (128)
+
+diff --git a/hw/core/loader.c b/hw/core/loader.c
+index 8bbb1797a4..eb29421324 100644
+--- a/hw/core/loader.c
++++ b/hw/core/loader.c
+@@ -61,7 +61,7 @@
+ #include "qemu/cutils.h"
+ #include "sysemu/runstate.h"
+
+-#include <zlib.h>
++#include "zlib.h"
+
+ static int roms_loaded;
+
+diff --git a/hw/display/qxl.c b/hw/display/qxl.c
+index 431c107096..f3ab3cc302 100644
+--- a/hw/display/qxl.c
++++ b/hw/display/qxl.c
+@@ -20,7 +20,7 @@
+
+ #include "qemu/osdep.h"
+ #include "qemu/units.h"
+-#include <zlib.h>
++#include "zlib.h"
+
+ #include "qapi/error.h"
+ #include "qemu/timer.h"
+diff --git a/hw/net/allwinner_emac.c b/hw/net/allwinner_emac.c
+index ddddf35c45..5c166d50d9 100644
+--- a/hw/net/allwinner_emac.c
++++ b/hw/net/allwinner_emac.c
+@@ -27,7 +27,7 @@
+ #include "hw/qdev-properties.h"
+ #include "qemu/log.h"
+ #include "qemu/module.h"
+-#include <zlib.h>
++#include "zlib.h"
+
+ static uint8_t padding[60];
+
+diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
+index 7a534691f1..e653285d62 100644
+--- a/hw/net/cadence_gem.c
++++ b/hw/net/cadence_gem.c
+@@ -23,7 +23,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <zlib.h> /* For crc32 */
++#include "zlib.h" /* For crc32 */
+
+ #include "hw/irq.h"
+ #include "hw/net/cadence_gem.h"
+diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
+index 205c0decc5..f01361734f 100644
+--- a/hw/net/dp8393x.c
++++ b/hw/net/dp8393x.c
+@@ -26,7 +26,7 @@
+ #include "qapi/error.h"
+ #include "qemu/module.h"
+ #include "qemu/timer.h"
+-#include <zlib.h>
++#include "zlib.h"
+ #include "qom/object.h"
+
+ //#define DEBUG_SONIC
+diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c
+index 782ff192ce..d7ff65ced7 100644
+--- a/hw/net/ftgmac100.c
++++ b/hw/net/ftgmac100.c
+@@ -25,7 +25,7 @@
+ #include "migration/vmstate.h"
+
+ /* For crc32 */
+-#include <zlib.h>
++#include "zlib.h"
+
+ /*
+ * FTGMAC100 registers
+diff --git a/hw/net/i82596.c b/hw/net/i82596.c
+index 055c3a1470..ca38538111 100644
+--- a/hw/net/i82596.c
++++ b/hw/net/i82596.c
+@@ -19,7 +19,7 @@
+ #include "qemu/module.h"
+ #include "trace.h"
+ #include "i82596.h"
+-#include <zlib.h> /* For crc32 */
++#include "zlib.h" /* For crc32 */
+
+ #if defined(ENABLE_DEBUG)
+ #define DBG(x) x
+diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
+index 2c14804041..c73b837fc4 100644
+--- a/hw/net/imx_fec.c
++++ b/hw/net/imx_fec.c
+@@ -34,7 +34,7 @@
+ #include "trace.h"
+
+ /* For crc32 */
+-#include <zlib.h>
++#include "zlib.h"
+
+ #define IMX_MAX_DESC 1024
+
+diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c
+index ab57c02c8e..3e00aa801a 100644
+--- a/hw/net/lan9118.c
++++ b/hw/net/lan9118.c
+@@ -24,7 +24,7 @@
+ #include "qemu/log.h"
+ #include "qemu/module.h"
+ /* For crc32 */
+-#include <zlib.h>
++#include "zlib.h"
+ #include "qom/object.h"
+
+ //#define DEBUG_LAN9118
+diff --git a/hw/net/mcf_fec.c b/hw/net/mcf_fec.c
+index 25e3e453ab..a8fa8d037d 100644
+--- a/hw/net/mcf_fec.c
++++ b/hw/net/mcf_fec.c
+@@ -17,7 +17,7 @@
+ #include "hw/qdev-properties.h"
+ #include "hw/sysbus.h"
+ /* For crc32 */
+-#include <zlib.h>
++#include "zlib.h"
+
+ //#define DEBUG_FEC 1
+
+diff --git a/hw/net/milkymist-minimac2.c b/hw/net/milkymist-minimac2.c
+index 5826944fd5..f6602cc5a2 100644
+--- a/hw/net/milkymist-minimac2.c
++++ b/hw/net/milkymist-minimac2.c
+@@ -36,7 +36,7 @@
+ #include "qemu/module.h"
+ #include "qemu/error-report.h"
+
+-#include <zlib.h>
++#include "zlib.h"
+
+ enum {
+ R_SETUP = 0,
+diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
+index ba5ace1ab7..aaafb07a5f 100644
+--- a/hw/net/rtl8139.c
++++ b/hw/net/rtl8139.c
+@@ -51,7 +51,7 @@
+ /* For crc32 */
+
+ #include "qemu/osdep.h"
+-#include <zlib.h>
++#include "zlib.h"
+
+ #include "hw/pci/pci.h"
+ #include "hw/qdev-properties.h"
+diff --git a/hw/net/smc91c111.c b/hw/net/smc91c111.c
+index ad778cd8fc..4bea869eb9 100644
+--- a/hw/net/smc91c111.c
++++ b/hw/net/smc91c111.c
+@@ -18,7 +18,7 @@
+ #include "qemu/log.h"
+ #include "qemu/module.h"
+ /* For crc32 */
+-#include <zlib.h>
++#include "zlib.h"
+ #include "qom/object.h"
+
+ /* Number of 2k memory pages available. */
+diff --git a/hw/net/stellaris_enet.c b/hw/net/stellaris_enet.c
+index 8dd60783d8..e2d1065394 100644
+--- a/hw/net/stellaris_enet.c
++++ b/hw/net/stellaris_enet.c
+@@ -15,7 +15,7 @@
+ #include "net/net.h"
+ #include "qemu/log.h"
+ #include "qemu/module.h"
+-#include <zlib.h>
++#include "zlib.h"
+ #include "qom/object.h"
+
+ //#define DEBUG_STELLARIS_ENET 1
+diff --git a/hw/nvram/mac_nvram.c b/hw/nvram/mac_nvram.c
+index 11f2d31cdb..f8db0afd00 100644
+--- a/hw/nvram/mac_nvram.c
++++ b/hw/nvram/mac_nvram.c
+@@ -31,7 +31,7 @@
+ #include "qemu/cutils.h"
+ #include "qemu/module.h"
+ #include "trace.h"
+-#include <zlib.h>
++#include "zlib.h"
+
+ #define DEF_SYSTEM_SIZE 0xc10
+
+diff --git a/hw/xen/xen-bus-helper.c b/hw/xen/xen-bus-helper.c
+index b459bb9396..ff159b0bfb 100644
+--- a/hw/xen/xen-bus-helper.c
++++ b/hw/xen/xen-bus-helper.c
+@@ -12,7 +12,7 @@
+ #include "hw/xen/xen-bus-helper.h"
+ #include "qapi/error.h"
+
+-#include <glib/gprintf.h>
++#include "glib/gprintf.h"
+
+ struct xs_state {
+ enum xenbus_state statenum;
+diff --git a/include/block/aio.h b/include/block/aio.h
+index 5f342267d5..00300a7fa4 100644
+--- a/include/block/aio.h
++++ b/include/block/aio.h
+@@ -15,7 +15,7 @@
+ #define QEMU_AIO_H
+
+ #ifdef CONFIG_LINUX_IO_URING
+-#include <liburing.h>
++#include "src/include/liburing.h"
+ #endif
+ #include "qemu/coroutine.h"
+ #include "qemu/queue.h"
+diff --git a/include/glib-compat.h b/include/glib-compat.h
+index 695a96f7ea..246a1982d1 100644
+--- a/include/glib-compat.h
++++ b/include/glib-compat.h
+@@ -29,9 +29,9 @@
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
+-#include <glib.h>
++#include "glib/glib.h"
+ #if defined(G_OS_UNIX)
+-#include <glib-unix.h>
++#include "glib/glib-unix.h"
+ #include <sys/types.h>
+ #include <pwd.h>
+ #endif
+diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h
+index 87737a6f16..b443f4415a 100644
+--- a/include/ui/qemu-pixman.h
++++ b/include/ui/qemu-pixman.h
+@@ -9,7 +9,7 @@
+ /* pixman-0.16.0 headers have a redundant declaration */
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wredundant-decls"
+-#include <pixman.h>
++#include "pixman.h"
+ #pragma GCC diagnostic pop
+
+ /*
+diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c
+index ccb98147e8..73b6a4f31b 100644
+--- a/migration/dirtyrate.c
++++ b/migration/dirtyrate.c
+@@ -11,7 +11,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <zlib.h>
++#include "zlib.h"
+ #include "qapi/error.h"
+ #include "cpu.h"
+ #include "exec/ramblock.h"
+diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c
+index ab4ba75d75..fde4ff6647 100644
+--- a/migration/multifd-zlib.c
++++ b/migration/multifd-zlib.c
+@@ -11,7 +11,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <zlib.h>
++#include "zlib.h"
+ #include "qemu/rcu.h"
+ #include "exec/target_page.h"
+ #include "qapi/error.h"
+diff --git a/migration/qemu-file.c b/migration/qemu-file.c
+index be21518c57..8e36d701ca 100644
+--- a/migration/qemu-file.c
++++ b/migration/qemu-file.c
+@@ -22,7 +22,7 @@
+ * THE SOFTWARE.
+ */
+ #include "qemu/osdep.h"
+-#include <zlib.h>
++#include "zlib.h"
+ #include "qemu/error-report.h"
+ #include "qemu/iov.h"
+ #include "migration.h"
+diff --git a/migration/qemu-file.h b/migration/qemu-file.h
+index a9b6d6ccb7..1d76e0b405 100644
+--- a/migration/qemu-file.h
++++ b/migration/qemu-file.h
+@@ -25,7 +25,7 @@
+ #ifndef MIGRATION_QEMU_FILE_H
+ #define MIGRATION_QEMU_FILE_H
+
+-#include <zlib.h>
++#include "zlib.h"
+ #include "exec/cpu-common.h"
+
+ /* Read a chunk of data from a file at the given position. The pos argument
+diff --git a/qemu-options-wrapper.h b/qemu-options-wrapper.h
+index 6f548e3922..3d5a9321cc 100644
+--- a/qemu-options-wrapper.h
++++ b/qemu-options-wrapper.h
+@@ -29,7 +29,7 @@
+ #error "qemu-options-wrapper.h included with no option defined"
+ #endif
+
+-#include "qemu-options.def"
++#include "qemu-options-gen.h"
+
+ #undef DEF
+ #undef DEFHEADING
+diff --git a/qga/commands-posix-ssh.c b/qga/commands-posix-ssh.c
+index 749167e82d..a614c105d0 100644
+--- a/qga/commands-posix-ssh.c
++++ b/qga/commands-posix-ssh.c
+@@ -4,8 +4,8 @@
+ */
+ #include "qemu/osdep.h"
+
+-#include <glib-unix.h>
+-#include <glib/gstdio.h>
++#include "glib/glib-unix.h"
++#include "glib/gstdio.h"
+ #include <locale.h>
+ #include <pwd.h>
+
+diff --git a/qga/main.c b/qga/main.c
+index dea6a3aa64..4733ed8f55 100644
+--- a/qga/main.c
++++ b/qga/main.c
+@@ -13,7 +13,7 @@
+
+ #include "qemu/osdep.h"
+ #include <getopt.h>
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+ #ifndef _WIN32
+ #include <syslog.h>
+ #include <sys/wait.h>
+Submodule slirp contains modified content
+diff --git a/slirp/src/ip.h b/slirp/src/ip.h
+index e5d4aa8..d433cf3 100644
+--- a/slirp/src/ip.h
++++ b/slirp/src/ip.h
+@@ -34,7 +34,7 @@
+ #ifndef IP_H
+ #define IP_H
+
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #if G_BYTE_ORDER == G_BIG_ENDIAN
+ #undef NTOHL
+diff --git a/slirp/src/ip6.h b/slirp/src/ip6.h
+index 0630309..d5b6ae7 100644
+--- a/slirp/src/ip6.h
++++ b/slirp/src/ip6.h
+@@ -7,7 +7,7 @@
+ #ifndef SLIRP_IP6_H
+ #define SLIRP_IP6_H
+
+-#include <glib.h>
++#include "glib/glib.h"
+ #include <string.h>
+
+ #define ALLNODES_MULTICAST \
+diff --git a/slirp/src/stream.c b/slirp/src/stream.c
+index 6cf326f..7992ee2 100644
+--- a/slirp/src/stream.c
++++ b/slirp/src/stream.c
+@@ -23,7 +23,7 @@
+ * THE SOFTWARE.
+ */
+ #include "stream.h"
+-#include <glib.h>
++#include "glib/glib.h"
+
+ bool slirp_istream_read(SlirpIStream *f, void *buf, size_t size)
+ {
+diff --git a/slirp/src/tcp.h b/slirp/src/tcp.h
+index 70a9760..7cbd4d6 100644
+--- a/slirp/src/tcp.h
++++ b/slirp/src/tcp.h
+@@ -34,7 +34,7 @@
+ #ifndef TCP_H
+ #define TCP_H
+
+-#include <glib.h>
++#include "glib/glib.h"
+
+ typedef uint32_t tcp_seq;
+
+diff --git a/slirp/src/util.c b/slirp/src/util.c
+index d3ed5fa..f53bd03 100644
+--- a/slirp/src/util.c
++++ b/slirp/src/util.c
+@@ -28,7 +28,7 @@
+ */
+ #include "util.h"
+
+-#include <glib.h>
++#include "glib/glib.h"
+ #include <fcntl.h>
+ #include <stdint.h>
+
+diff --git a/slirp/src/util.h b/slirp/src/util.h
+index d67b3d0..eec4a66 100644
+--- a/slirp/src/util.h
++++ b/slirp/src/util.h
+@@ -24,7 +24,7 @@
+ #ifndef UTIL_H_
+ #define UTIL_H_
+
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #include <stdlib.h>
+ #include <stdio.h>
+diff --git a/slirp/src/vmstate.c b/slirp/src/vmstate.c
+index 68cc172..66840df 100644
+--- a/slirp/src/vmstate.c
++++ b/slirp/src/vmstate.c
+@@ -40,7 +40,7 @@
+ #include <assert.h>
+ #include <errno.h>
+ #include <string.h>
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #include "stream.h"
+ #include "vmstate.h"
+diff --git a/softmmu/qemu-seccomp.c b/softmmu/qemu-seccomp.c
+index 8325ecb766..1290657103 100644
+--- a/softmmu/qemu-seccomp.c
++++ b/softmmu/qemu-seccomp.c
+@@ -19,7 +19,7 @@
+ #include "qemu/option.h"
+ #include "qemu/module.h"
+ #include <sys/prctl.h>
+-#include <seccomp.h>
++#include "seccomp.h"
+ #include "sysemu/seccomp.h"
+ #include <linux/seccomp.h>
+
+diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c
+index 30b2ad119f..4d982f6db0 100644
+--- a/target/arm/helper-a64.c
++++ b/target/arm/helper-a64.c
+@@ -34,7 +34,7 @@
+ #include "qemu/atomic128.h"
+ #include "tcg/tcg.h"
+ #include "fpu/softfloat.h"
+-#include <zlib.h> /* For crc32 */
++#include "zlib.h" /* For crc32 */
+
+ /* C2.4.7 Multiply and divide */
+ /* special cases for 0 and LLONG_MIN are mandated by the standard */
+diff --git a/target/arm/helper.c b/target/arm/helper.c
+index 38cd35c049..4b09cba889 100644
+--- a/target/arm/helper.c
++++ b/target/arm/helper.c
+@@ -20,7 +20,7 @@
+ #include "qemu/crc32c.h"
+ #include "qemu/qemu-print.h"
+ #include "exec/exec-all.h"
+-#include <zlib.h> /* For crc32 */
++#include "zlib.h" /* For crc32 */
+ #include "hw/irq.h"
+ #include "hw/semihosting/semihost.h"
+ #include "sysemu/cpus.h"
+diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
+index aad01ea012..e95f7a8d88 100644
+--- a/target/arm/m_helper.c
++++ b/target/arm/m_helper.c
+@@ -20,7 +20,7 @@
+ #include "qemu/crc32c.h"
+ #include "qemu/qemu-print.h"
+ #include "exec/exec-all.h"
+-#include <zlib.h> /* For crc32 */
++#include "zlib.h" /* For crc32 */
+ #include "hw/semihosting/semihost.h"
+ #include "sysemu/cpus.h"
+ #include "sysemu/kvm.h"
+diff --git a/target/tilegx/helper.c b/target/tilegx/helper.c
+index c006bf7454..873f42a817 100644
+--- a/target/tilegx/helper.c
++++ b/target/tilegx/helper.c
+@@ -22,7 +22,7 @@
+ #include "cpu.h"
+ #include "exec/exec-all.h"
+ #include "exec/helper-proto.h"
+-#include <zlib.h> /* For crc32 */
++#include "zlib.h" /* For crc32 */
+ #include "syscall_defs.h"
+
+ void helper_exception(CPUTLGState *env, uint32_t excp)
+diff --git a/target/tricore/op_helper.c b/target/tricore/op_helper.c
+index 32c2bc1699..27dc193796 100644
+--- a/target/tricore/op_helper.c
++++ b/target/tricore/op_helper.c
+@@ -20,7 +20,7 @@
+ #include "exec/helper-proto.h"
+ #include "exec/exec-all.h"
+ #include "exec/cpu_ldst.h"
+-#include <zlib.h> /* for crc32 */
++#include "zlib.h" /* for crc32 */
+
+
+ /* Exception helpers */
+diff --git a/tests/plugin/bb.c b/tests/plugin/bb.c
+index de09bdde4e..bc04d295e4 100644
+--- a/tests/plugin/bb.c
++++ b/tests/plugin/bb.c
+@@ -10,7 +10,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdio.h>
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #include <qemu-plugin.h>
+
+diff --git a/tests/plugin/insn.c b/tests/plugin/insn.c
+index a9a6e41237..75b1bd7b86 100644
+--- a/tests/plugin/insn.c
++++ b/tests/plugin/insn.c
+@@ -10,7 +10,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdio.h>
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #include <qemu-plugin.h>
+
+diff --git a/tests/plugin/mem.c b/tests/plugin/mem.c
+index 4725bd851d..8d587f460a 100644
+--- a/tests/plugin/mem.c
++++ b/tests/plugin/mem.c
+@@ -10,7 +10,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdio.h>
+-#include <glib.h>
++#include "glib/glib.h"
+
+ #include <qemu-plugin.h>
+
+diff --git a/tests/ptimer-test.c b/tests/ptimer-test.c
+index 9176b96c1c..462468a78f 100644
+--- a/tests/ptimer-test.c
++++ b/tests/ptimer-test.c
+@@ -9,7 +9,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gprintf.h>
++#include "glib/gprintf.h"
+
+ #include "qemu/main-loop.h"
+ #include "hw/ptimer.h"
+diff --git a/tests/qtest/acpi-utils.c b/tests/qtest/acpi-utils.c
+index d2a202efca..bccb0434fa 100644
+--- a/tests/qtest/acpi-utils.c
++++ b/tests/qtest/acpi-utils.c
+@@ -13,7 +13,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+ #include "qemu-common.h"
+ #include "qemu/bitmap.h"
+ #include "acpi-utils.h"
+diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
+index f23a5335a8..76e67c888d 100644
+--- a/tests/qtest/bios-tables-test.c
++++ b/tests/qtest/bios-tables-test.c
+@@ -56,7 +56,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+ #include "qemu-common.h"
+ #include "hw/firmware/smbios.h"
+ #include "qemu/bitmap.h"
+diff --git a/tests/qtest/dbus-vmstate-test.c b/tests/qtest/dbus-vmstate-test.c
+index aca9b98b7a..a4835fc7d2 100644
+--- a/tests/qtest/dbus-vmstate-test.c
++++ b/tests/qtest/dbus-vmstate-test.c
+@@ -1,5 +1,5 @@
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+ #include <gio/gio.h>
+ #include "libqos/libqtest.h"
+ #include "qemu-common.h"
+diff --git a/tests/qtest/ivshmem-test.c b/tests/qtest/ivshmem-test.c
+index dfa69424ed..6b27e4a82e 100644
+--- a/tests/qtest/ivshmem-test.c
++++ b/tests/qtest/ivshmem-test.c
+@@ -9,7 +9,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+ #include "contrib/ivshmem-server/ivshmem-server.h"
+ #include "libqos/libqos-pc.h"
+ #include "libqos/libqos-spapr.h"
+diff --git a/tests/qtest/pxe-test.c b/tests/qtest/pxe-test.c
+index 32bbae33c5..e2d750e984 100644
+--- a/tests/qtest/pxe-test.c
++++ b/tests/qtest/pxe-test.c
+@@ -13,7 +13,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+ #include "qemu-common.h"
+ #include "libqos/libqtest.h"
+ #include "boot-sector.h"
+diff --git a/tests/qtest/tpm-crb-swtpm-test.c b/tests/qtest/tpm-crb-swtpm-test.c
+index 1d82a48c04..634e872e9b 100644
+--- a/tests/qtest/tpm-crb-swtpm-test.c
++++ b/tests/qtest/tpm-crb-swtpm-test.c
+@@ -13,7 +13,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "libqos/libqtest.h"
+ #include "qemu/module.h"
+diff --git a/tests/qtest/tpm-crb-test.c b/tests/qtest/tpm-crb-test.c
+index ed533900d1..5fcc7740b4 100644
+--- a/tests/qtest/tpm-crb-test.c
++++ b/tests/qtest/tpm-crb-test.c
+@@ -11,7 +11,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "hw/acpi/tpm.h"
+ #include "io/channel-socket.h"
+diff --git a/tests/qtest/tpm-emu.c b/tests/qtest/tpm-emu.c
+index 2e8eb7b94f..ee8605754b 100644
+--- a/tests/qtest/tpm-emu.c
++++ b/tests/qtest/tpm-emu.c
+@@ -11,7 +11,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "backends/tpm/tpm_ioctl.h"
+ #include "io/channel-socket.h"
+diff --git a/tests/qtest/tpm-tests.c b/tests/qtest/tpm-tests.c
+index 0da3a8a4df..2672509f57 100644
+--- a/tests/qtest/tpm-tests.c
++++ b/tests/qtest/tpm-tests.c
+@@ -13,7 +13,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "libqtest-single.h"
+ #include "tpm-tests.h"
+diff --git a/tests/qtest/tpm-tis-device-swtpm-test.c b/tests/qtest/tpm-tis-device-swtpm-test.c
+index f7126eff9e..f1ab3b8e8e 100644
+--- a/tests/qtest/tpm-tis-device-swtpm-test.c
++++ b/tests/qtest/tpm-tis-device-swtpm-test.c
+@@ -14,7 +14,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "libqos/libqtest.h"
+ #include "qemu/module.h"
+diff --git a/tests/qtest/tpm-tis-device-test.c b/tests/qtest/tpm-tis-device-test.c
+index 63ed36440f..671b8f9a46 100644
+--- a/tests/qtest/tpm-tis-device-test.c
++++ b/tests/qtest/tpm-tis-device-test.c
+@@ -13,7 +13,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "io/channel-socket.h"
+ #include "libqtest-single.h"
+diff --git a/tests/qtest/tpm-tis-swtpm-test.c b/tests/qtest/tpm-tis-swtpm-test.c
+index fa590e68f1..59d5bff7e8 100644
+--- a/tests/qtest/tpm-tis-swtpm-test.c
++++ b/tests/qtest/tpm-tis-swtpm-test.c
+@@ -13,7 +13,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "libqos/libqtest.h"
+ #include "qemu/module.h"
+diff --git a/tests/qtest/tpm-tis-test.c b/tests/qtest/tpm-tis-test.c
+index 79ffbc943e..353365e5a1 100644
+--- a/tests/qtest/tpm-tis-test.c
++++ b/tests/qtest/tpm-tis-test.c
+@@ -13,7 +13,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "hw/acpi/tpm.h"
+ #include "io/channel-socket.h"
+diff --git a/tests/qtest/tpm-tis-util.c b/tests/qtest/tpm-tis-util.c
+index 9aff503fd8..77a2e6f7cd 100644
+--- a/tests/qtest/tpm-tis-util.c
++++ b/tests/qtest/tpm-tis-util.c
+@@ -14,7 +14,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "hw/acpi/tpm.h"
+ #include "io/channel-socket.h"
+diff --git a/tests/test-char.c b/tests/test-char.c
+index 9196e566e9..aefa73fd4e 100644
+--- a/tests/test-char.c
++++ b/tests/test-char.c
+@@ -1,5 +1,5 @@
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "qemu/config-file.h"
+ #include "qemu/module.h"
+diff --git a/tests/test-logging.c b/tests/test-logging.c
+index ccb819f193..b710310aaa 100644
+--- a/tests/test-logging.c
++++ b/tests/test-logging.c
+@@ -25,7 +25,7 @@
+ */
+
+ #include "qemu/osdep.h"
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include "qemu-common.h"
+ #include "qapi/error.h"
+diff --git a/tests/test-qga.c b/tests/test-qga.c
+index c1b173b3cb..2a2607c9e1 100644
+--- a/tests/test-qga.c
++++ b/tests/test-qga.c
+@@ -1,6 +1,6 @@
+ #include "qemu/osdep.h"
+ #include <locale.h>
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+ #include <sys/socket.h>
+ #include <sys/un.h>
+
+diff --git a/tests/test-util-filemonitor.c b/tests/test-util-filemonitor.c
+index b629e10857..32efe8256d 100644
+--- a/tests/test-util-filemonitor.c
++++ b/tests/test-util-filemonitor.c
+@@ -23,7 +23,7 @@
+ #include "qapi/error.h"
+ #include "qemu/filemonitor.h"
+
+-#include <glib/gstdio.h>
++#include "glib/gstdio.h"
+
+ #include <utime.h>
+
+diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c
+index c70fb16a9a..9be0d4ec75 100644
+--- a/tools/virtiofsd/fuse_lowlevel.c
++++ b/tools/virtiofsd/fuse_lowlevel.c
+@@ -18,7 +18,7 @@
+
+ #include <assert.h>
+ #include <errno.h>
+-#include <glib.h>
++#include "glib/glib.h"
+ #include <limits.h>
+ #include <stdbool.h>
+ #include <stddef.h>
+diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c
+index 83ba07c6cd..273d66704c 100644
+--- a/tools/virtiofsd/fuse_virtio.c
++++ b/tools/virtiofsd/fuse_virtio.c
+@@ -22,7 +22,7 @@
+
+ #include <assert.h>
+ #include <errno.h>
+-#include <glib.h>
++#include "glib/glib.h"
+ #include <stdint.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
+index 97485b22b4..cac5970790 100644
+--- a/tools/virtiofsd/passthrough_ll.c
++++ b/tools/virtiofsd/passthrough_ll.c
+@@ -45,7 +45,7 @@
+ #include <cap-ng.h>
+ #include <dirent.h>
+ #include <errno.h>
+-#include <glib.h>
++#include "glib/glib.h"
+ #include <inttypes.h>
+ #include <limits.h>
+ #include <pthread.h>
+diff --git a/tools/virtiofsd/passthrough_seccomp.c b/tools/virtiofsd/passthrough_seccomp.c
+index 11623f56f2..779d1d3249 100644
+--- a/tools/virtiofsd/passthrough_seccomp.c
++++ b/tools/virtiofsd/passthrough_seccomp.c
+@@ -11,8 +11,8 @@
+ #include "fuse_i.h"
+ #include "fuse_log.h"
+ #include <errno.h>
+-#include <glib.h>
+-#include <seccomp.h>
++#include "glib/glib.h"
++#include "seccomp.h"
+ #include <stdlib.h>
+
+ /* Bodge for libseccomp 2.4.2 which broke ppoll */
+diff --git a/ui/cursor.c b/ui/cursor.c
+index 1d62ddd4d0..2fec816a6a 100644
+--- a/ui/cursor.c
++++ b/ui/cursor.c
+@@ -1,8 +1,8 @@
+ #include "qemu/osdep.h"
+ #include "ui/console.h"
+
+-#include "cursor_hidden.xpm"
+-#include "cursor_left_ptr.xpm"
++#include "ui/cursor_hidden.h"
++#include "ui/cursor_left_ptr.h"
+
+ /* for creating built-in cursors */
+ static QEMUCursor *cursor_parse_xpm(const char *xpm[])
+diff --git a/ui/gtk.c b/ui/gtk.c
+index a752aa22be..6ba66c0341 100644
+--- a/ui/gtk.c
++++ b/ui/gtk.c
+@@ -44,7 +44,7 @@
+ #endif
+ #include "ui/win32-kbd-hook.h"
+
+-#include <glib/gi18n.h>
++#include "glib/gi18n.h"
+ #include <locale.h>
+ #if defined(CONFIG_VTE)
+ #include <vte/vte.h>
+diff --git a/ui/vnc.h b/ui/vnc.h
+index 4e2637ce6c..0da79ae261 100644
+--- a/ui/vnc.h
++++ b/ui/vnc.h
+@@ -38,7 +38,7 @@
+ #include "io/channel-tls.h"
+ #include "io/net-listener.h"
+ #include "authz/base.h"
+-#include <zlib.h>
++#include "zlib.h"
+
+ #include "keymaps.h"
+ #include "vnc-palette.h"
+diff --git a/util/oslib-posix.c b/util/oslib-posix.c
+index f15234b5c0..2cb8411ddb 100644
+--- a/util/oslib-posix.c
++++ b/util/oslib-posix.c
+@@ -29,7 +29,7 @@
+ #include "qemu/osdep.h"
+ #include <termios.h>
+
+-#include <glib/gprintf.h>
++#include "glib/gprintf.h"
+
+ #include "qemu-common.h"
+ #include "sysemu/sysemu.h"
diff --git a/third_party/qemu/patches/pregenerated_config_files.patch b/third_party/qemu/patches/pregenerated_config_files.patch
new file mode 100644
index 0000000..fd5fe68
--- /dev/null
+++ b/third_party/qemu/patches/pregenerated_config_files.patch
@@ -0,0 +1,753 @@
+Copyright 2020 The Monogon Project Authors.
+
+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.
+
+
+From f2ed01603a9e89ae30d282c926a0100b246ff3a9 Mon Sep 17 00:00:00 2001
+From: Lorenz Brun <lorenz@brun.one>
+Date: Wed, 10 Mar 2021 19:48:11 +0100
+Subject: [PATCH 6/6] Pregenerated config files
+
+---
+ include/qemu/config-host.h | 291 ++++++++++++++++++++++++
+ qemu-version.h | 2 +
+ x86_64-softmmu-config-devices.h | 381 ++++++++++++++++++++++++++++++++
+ x86_64-softmmu-config-target.h | 21 ++
+ 4 files changed, 695 insertions(+)
+ create mode 100644 include/qemu/config-host.h
+ create mode 100644 qemu-version.h
+ create mode 100644 x86_64-softmmu-config-devices.h
+ create mode 100644 x86_64-softmmu-config-target.h
+
+diff --git a/include/qemu/config-host.h b/include/qemu/config-host.h
+new file mode 100644
+index 0000000000..843e9c8116
+--- /dev/null
++++ b/include/qemu/config-host.h
+@@ -0,0 +1,291 @@
++/*
++ * Autogenerated by the Meson build system.
++ * Do not edit, your changes will be lost.
++ */
++
++#pragma once
++
++#define CONFIG_ACCEPT4 1
++
++#define CONFIG_AF_VSOCK 1
++
++#define CONFIG_ATOMIC64 1
++
++#undef CONFIG_ATTR
++
++#define CONFIG_ATTRIBUTE_ALIAS 1
++
++#define CONFIG_AUDIO_DRIVERS
++
++#define CONFIG_BDRV_RO_WHITELIST
++
++#define CONFIG_BDRV_RW_WHITELIST
++
++#define CONFIG_BINDIR "/usr/local/bin"
++
++#undef CONFIG_BRLAPI
++
++#define CONFIG_BYTESWAP_H 1
++
++#define CONFIG_CAPSTONE
++
++#undef CONFIG_CFI
++
++#define CONFIG_CLOCK_ADJTIME 1
++
++#define CONFIG_CMPXCHG128 1
++
++#undef CONFIG_COCOA
++
++#define CONFIG_COROUTINE_BACKEND ucontext
++
++#define CONFIG_COROUTINE_POOL 0
++
++#define CONFIG_CPUID_H 1
++
++#undef CONFIG_CURL
++
++#undef CONFIG_CURSES
++
++#define CONFIG_DUP3 1
++
++#define CONFIG_EPOLL 1
++
++#define CONFIG_EPOLL_CREATE1 1
++
++#define CONFIG_EVENTFD 1
++
++#define CONFIG_FALLOCATE 1
++
++#define CONFIG_FALLOCATE_PUNCH_HOLE 1
++
++#define CONFIG_FALLOCATE_ZERO_RANGE 1
++
++#define CONFIG_FDATASYNC 1
++
++#define CONFIG_FDT
++
++#define CONFIG_FIEMAP 1
++
++#undef CONFIG_FUSE
++
++#undef CONFIG_FUSE_LSEEK
++
++#define CONFIG_GBM 1
++
++#define CONFIG_GETAUXVAL 1
++
++#define CONFIG_GETRANDOM 1
++
++#define CONFIG_GETTID
++
++#undef CONFIG_GLUSTERFS
++
++#undef CONFIG_GTK
++
++#define CONFIG_HAS_ENVIRON 1
++
++#define CONFIG_HOST_DSOSUF ".so"
++
++#define CONFIG_IASL "iasl"
++
++#define CONFIG_INOTIFY 1
++
++#define CONFIG_INOTIFY1 1
++
++#define CONFIG_INT128 1
++
++#define CONFIG_IOVEC 1
++
++#define CONFIG_IVSHMEM 1
++
++#undef CONFIG_KEYUTILS
++
++#define CONFIG_L2TPV3 1
++
++#undef CONFIG_LIBATTR
++
++#undef CONFIG_LIBCAP_NG
++
++#undef CONFIG_LIBISCSI
++
++#undef CONFIG_LIBNFS
++
++#undef CONFIG_LIBUDEV
++
++#define CONFIG_LINUX 1
++
++#define CONFIG_LINUX_IO_URING 1
++
++#define CONFIG_LINUX_MAGIC_H 1
++
++#undef CONFIG_LZO
++
++#define CONFIG_MADVISE 1
++
++#define CONFIG_MALLOC_TRIM
++
++#define CONFIG_MEMBARRIER 1
++
++#define CONFIG_MEMFD 1
++
++#undef CONFIG_MPATH
++
++#undef CONFIG_MPATH_NEW_API
++
++#define CONFIG_OPEN_BY_HANDLE 1
++
++#define CONFIG_PIPE2 1
++
++#define CONFIG_POSIX 1
++
++#define CONFIG_POSIX_FALLOCATE 1
++
++#define CONFIG_POSIX_MADVISE 1
++
++#define CONFIG_POSIX_MEMALIGN 1
++
++#define CONFIG_PPOLL 1
++
++#define CONFIG_PRCTL_PR_SET_TIMERSLACK 1
++
++#define CONFIG_PREADV 1
++
++#define CONFIG_PREFIX "/nonexistent"
++
++#define CONFIG_PTHREAD_SETNAME_NP_W_TID 1
++
++#define CONFIG_QEMU_CONFDIR "/nonexistent"
++
++#define CONFIG_QEMU_DATADIR "/nonexistent"
++
++#define CONFIG_QEMU_DESKTOPDIR "/nonexistent"
++
++#define CONFIG_QEMU_FIRMWAREPATH "external/qemu/pc-bios"
++
++#define CONFIG_QEMU_HELPERDIR "/nonexistent"
++
++#define CONFIG_QEMU_ICONDIR "/nonexistent"
++
++#define CONFIG_QEMU_LOCALEDIR "/nonexistent"
++
++#define CONFIG_QEMU_LOCALSTATEDIR "/nonexistent"
++
++#define CONFIG_QEMU_MODDIR "/nonexistent"
++
++#define CONFIG_QEMU_PRIVATE_XTS 1
++
++#define CONFIG_QOM_CAST_DEBUG 1
++
++#undef CONFIG_RBD
++
++#define CONFIG_RTNETLINK 1
++
++#undef CONFIG_SDL
++
++#undef CONFIG_SDL_IMAGE
++
++#define CONFIG_SECCOMP
++
++#define CONFIG_SENDFILE 1
++
++#define CONFIG_SETNS 1
++
++#define CONFIG_SIGNALFD 1
++
++#define CONFIG_SLIRP
++
++#define CONFIG_SMBD_COMMAND "/nonexistent"
++
++#undef CONFIG_SNAPPY
++
++#define CONFIG_SPLICE 1
++
++#define CONFIG_STATIC_ASSERT 1
++
++#define CONFIG_STATX
++
++#define CONFIG_SYNCFS 1
++
++#define CONFIG_SYNC_FILE_RANGE 1
++
++#define CONFIG_SYSCONFDIR "/nonexistent"
++
++#define CONFIG_SYSMACROS 1
++
++#define CONFIG_TASN1 1
++
++#define CONFIG_THREAD_SETNAME_BYTHREAD 1
++
++#define CONFIG_TIMERFD 1
++
++#define CONFIG_TLS_PRIORITY "NORMAL"
++
++#define CONFIG_TRACE_LOG 1
++
++#define CONFIG_USBFS 1
++
++#undef CONFIG_VALGRIND_H
++
++#define CONFIG_VHOST_KERNEL 1
++
++#define CONFIG_VHOST_NET 1
++
++#define CONFIG_VHOST_NET_VDPA 1
++
++#undef CONFIG_VHOST_USER_BLK_SERVER
++
++#define CONFIG_VHOST_VDPA 1
++
++#undef CONFIG_VIRTFS
++
++#undef CONFIG_VNC
++
++#undef CONFIG_VNC_JPEG
++
++#undef CONFIG_VNC_PNG
++
++#undef CONFIG_VNC_SASL
++
++#undef CONFIG_X11
++
++#define CONFIG_XKBCOMMON
++
++#undef CONFIG_ZSTD
++
++#define HAVE_BTRFS_H
++
++#define HAVE_COPY_FILE_RANGE 1
++
++#define HAVE_DRM_H
++
++#define HAVE_FSXATTR 1
++
++#define HAVE_GDB_BIN /nonexistent
++
++#define HAVE_MLOCKALL 1
++
++#define HAVE_OPENPTY 1
++
++#define HAVE_PTY_H
++
++#define HAVE_STRCHRNUL 1
++
++#define HAVE_STRUCT_STAT_ST_ATIM 1
++
++#undef HAVE_SYS_IOCCOM_H
++
++#undef HAVE_SYS_KCOV_H
++
++#define HAVE_UTMPX 1
++
++#define HOST_X86_64 1
++
++#define QEMU_VERSION "5.2.50"
++
++#define QEMU_VERSION_MAJOR 5
++
++#define QEMU_VERSION_MICRO 50
++
++#define QEMU_VERSION_MINOR 2
++
+diff --git a/qemu-version.h b/qemu-version.h
+new file mode 100644
+index 0000000000..46c042f1ee
+--- /dev/null
++++ b/qemu-version.h
+@@ -0,0 +1,2 @@
++#define QEMU_PKGVERSION "v5.2.0-mngn"
++#define QEMU_FULL_VERSION "5.2.50-mngn"
+diff --git a/x86_64-softmmu-config-devices.h b/x86_64-softmmu-config-devices.h
+new file mode 100644
+index 0000000000..6fb167cecd
+--- /dev/null
++++ b/x86_64-softmmu-config-devices.h
+@@ -0,0 +1,381 @@
++/*
++ * Autogenerated by the Meson build system.
++ * Do not edit, your changes will be lost.
++ */
++
++#pragma once
++
++#define CONFIG_AC97 1
++
++#define CONFIG_ACPI 1
++
++#define CONFIG_ACPI_CPU_HOTPLUG 1
++
++#define CONFIG_ACPI_HMAT 1
++
++#define CONFIG_ACPI_HW_REDUCED 1
++
++#define CONFIG_ACPI_MEMORY_HOTPLUG 1
++
++#define CONFIG_ACPI_NVDIMM 1
++
++#define CONFIG_ACPI_PCI 1
++
++#define CONFIG_ACPI_SMBUS 1
++
++#define CONFIG_ACPI_VMGENID 1
++
++#define CONFIG_ACPI_X86 1
++
++#define CONFIG_ACPI_X86_ICH 1
++
++#define CONFIG_ADLIB 1
++
++#define CONFIG_AHCI 1
++
++#define CONFIG_AHCI_ICH9 1
++
++#define CONFIG_AMD_IOMMU 1
++
++#define CONFIG_APIC 1
++
++#define CONFIG_APM 1
++
++#define CONFIG_APPLESMC 1
++
++#define CONFIG_ATI_VGA 1
++
++#define CONFIG_BITBANG_I2C 1
++
++#define CONFIG_BOCHS_DISPLAY 1
++
++#define CONFIG_CAN_BUS 1
++
++#define CONFIG_CAN_CTUCANFD 1
++
++#define CONFIG_CAN_CTUCANFD_PCI 1
++
++#define CONFIG_CAN_PCI 1
++
++#define CONFIG_CAN_SJA1000 1
++
++#define CONFIG_CS4231A 1
++
++#define CONFIG_DDC 1
++
++#define CONFIG_DIMM 1
++
++#define CONFIG_E1000E_PCI_EXPRESS 1
++
++#define CONFIG_E1000_PCI 1
++
++#define CONFIG_EDID 1
++
++#define CONFIG_EDU 1
++
++#define CONFIG_EEPRO100_PCI 1
++
++#define CONFIG_ES1370 1
++
++#define CONFIG_ESP 1
++
++#define CONFIG_ESP_PCI 1
++
++#define CONFIG_FDC 1
++
++#define CONFIG_FW_CFG_DMA 1
++
++#define CONFIG_GENERIC_LOADER 1
++
++#define CONFIG_GUS 1
++
++#define CONFIG_HDA 1
++
++#define CONFIG_HPET 1
++
++#define CONFIG_HYPERV 1
++
++#define CONFIG_HYPERV_TESTDEV 1
++
++#define CONFIG_I2C 1
++
++#define CONFIG_I440FX 1
++
++#define CONFIG_I8254 1
++
++#define CONFIG_I8257 1
++
++#define CONFIG_I8259 1
++
++#define CONFIG_I82801B11 1
++
++#define CONFIG_IDE_CORE 1
++
++#define CONFIG_IDE_ISA 1
++
++#define CONFIG_IDE_PCI 1
++
++#define CONFIG_IDE_PIIX 1
++
++#define CONFIG_IDE_QDEV 1
++
++#define CONFIG_IMX_USBPHY 1
++
++#define CONFIG_IOAPIC 1
++
++#define CONFIG_IOH3420 1
++
++#define CONFIG_IPACK 1
++
++#define CONFIG_IPMI 1
++
++#define CONFIG_IPMI_EXTERN 1
++
++#define CONFIG_IPMI_LOCAL 1
++
++#define CONFIG_IPMI_SSIF 1
++
++#define CONFIG_ISAPC 1
++
++#define CONFIG_ISA_BUS 1
++
++#define CONFIG_ISA_DEBUG 1
++
++#define CONFIG_ISA_IPMI_BT 1
++
++#define CONFIG_ISA_IPMI_KCS 1
++
++#define CONFIG_ISA_TESTDEV 1
++
++#define CONFIG_IVSHMEM_DEVICE 1
++
++#define CONFIG_LPC_ICH9 1
++
++#define CONFIG_LSI_SCSI_PCI 1
++
++#define CONFIG_MC146818RTC 1
++
++#define CONFIG_MEGASAS_SCSI_PCI 1
++
++#define CONFIG_MEM_DEVICE 1
++
++#define CONFIG_MICROVM 1
++
++#define CONFIG_MPTSAS_SCSI_PCI 1
++
++#define CONFIG_MSI_NONBROKEN 1
++
++#define CONFIG_NE2000_COMMON 1
++
++#define CONFIG_NE2000_ISA 1
++
++#define CONFIG_NE2000_PCI 1
++
++#define CONFIG_NMC93XX_EEPROM 1
++
++#define CONFIG_NVDIMM 1
++
++#define CONFIG_NVME_PCI 1
++
++#define CONFIG_PAM 1
++
++#define CONFIG_PARALLEL 1
++
++#define CONFIG_PC 1
++
++#define CONFIG_PCI 1
++
++#define CONFIG_PCIE_PORT 1
++
++#define CONFIG_PCI_DEVICES 1
++
++#define CONFIG_PCI_EXPRESS 1
++
++#define CONFIG_PCI_EXPRESS_GENERIC_BRIDGE 1
++
++#define CONFIG_PCI_EXPRESS_Q35 1
++
++#define CONFIG_PCI_I440FX 1
++
++#define CONFIG_PCI_IPMI_BT 1
++
++#define CONFIG_PCI_IPMI_KCS 1
++
++#define CONFIG_PCI_TESTDEV 1
++
++#define CONFIG_PCKBD 1
++
++#define CONFIG_PCNET_COMMON 1
++
++#define CONFIG_PCNET_PCI 1
++
++#define CONFIG_PCSPK 1
++
++#define CONFIG_PC_ACPI 1
++
++#define CONFIG_PC_PCI 1
++
++#define CONFIG_PFLASH_CFI01 1
++
++#define CONFIG_PIIX3 1
++
++#define CONFIG_PS2 1
++
++#define CONFIG_PVPANIC 1
++
++#define CONFIG_PXB 1
++
++#define CONFIG_Q35 1
++
++#define CONFIG_ROCKER 1
++
++#define CONFIG_RTL8139_PCI 1
++
++#define CONFIG_SB16 1
++
++#define CONFIG_SCSI 1
++
++#define CONFIG_SD 1
++
++#define CONFIG_SDHCI 1
++
++#define CONFIG_SDHCI_PCI 1
++
++#define CONFIG_SERIAL 1
++
++#define CONFIG_SERIAL_ISA 1
++
++#define CONFIG_SERIAL_PCI 1
++
++#define CONFIG_SERIAL_PCI_MULTI 1
++
++#define CONFIG_SEV 1
++
++#define CONFIG_SGA 1
++
++#define CONFIG_SMBIOS 1
++
++#define CONFIG_SMBUS 1
++
++#define CONFIG_SMBUS_EEPROM 1
++
++#define CONFIG_TEST_DEVICES 1
++
++#define CONFIG_TPM 1
++
++#define CONFIG_TULIP 1
++
++#define CONFIG_USB 1
++
++#define CONFIG_USB_AUDIO 1
++
++#define CONFIG_USB_EHCI 1
++
++#define CONFIG_USB_EHCI_PCI 1
++
++#define CONFIG_USB_NETWORK 1
++
++#define CONFIG_USB_OHCI 1
++
++#define CONFIG_USB_OHCI_PCI 1
++
++#define CONFIG_USB_SERIAL 1
++
++#define CONFIG_USB_SMARTCARD 1
++
++#define CONFIG_USB_STORAGE_BOT 1
++
++#define CONFIG_USB_STORAGE_MTP 1
++
++#define CONFIG_USB_STORAGE_UAS 1
++
++#define CONFIG_USB_TABLET_WACOM 1
++
++#define CONFIG_USB_U2F 1
++
++#define CONFIG_USB_UHCI 1
++
++#define CONFIG_USB_XHCI 1
++
++#define CONFIG_USB_XHCI_NEC 1
++
++#define CONFIG_USB_XHCI_PCI 1
++
++#define CONFIG_USB_XHCI_SYSBUS 1
++
++#define CONFIG_VFIO 1
++
++#define CONFIG_VFIO_IGD 1
++
++#define CONFIG_VFIO_PCI 1
++
++#define CONFIG_VGA 1
++
++#define CONFIG_VGA_CIRRUS 1
++
++#define CONFIG_VGA_ISA 1
++
++#define CONFIG_VGA_PCI 1
++
++#define CONFIG_VHOST 1
++
++#define CONFIG_VIRTIO 1
++
++#define CONFIG_VIRTIO_BALLOON 1
++
++#define CONFIG_VIRTIO_BLK 1
++
++#define CONFIG_VIRTIO_CRYPTO 1
++
++#define CONFIG_VIRTIO_GPU 1
++
++#define CONFIG_VIRTIO_INPUT 1
++
++#define CONFIG_VIRTIO_INPUT_HOST 1
++
++#define CONFIG_VIRTIO_IOMMU 1
++
++#define CONFIG_VIRTIO_MEM 1
++
++#define CONFIG_VIRTIO_MEM_SUPPORTED 1
++
++#define CONFIG_VIRTIO_MMIO 1
++
++#define CONFIG_VIRTIO_NET 1
++
++#define CONFIG_VIRTIO_PCI 1
++
++#define CONFIG_VIRTIO_PMEM 1
++
++#define CONFIG_VIRTIO_PMEM_SUPPORTED 1
++
++#define CONFIG_VIRTIO_RNG 1
++
++#define CONFIG_VIRTIO_SCSI 1
++
++#define CONFIG_VIRTIO_SERIAL 1
++
++#define CONFIG_VIRTIO_VGA 1
++
++#define CONFIG_VMBUS 1
++
++#define CONFIG_VMMOUSE 1
++
++#define CONFIG_VMPORT 1
++
++#define CONFIG_VMWARE_VGA 1
++
++#define CONFIG_VMW_PVSCSI_SCSI_PCI 1
++
++#define CONFIG_VMXNET3_PCI 1
++
++#define CONFIG_VTD 1
++
++#define CONFIG_WDT_IB6300ESB 1
++
++#define CONFIG_WDT_IB700 1
++
++#define CONFIG_X86_IOMMU 1
++
++#define CONFIG_XIO3130 1
++
+diff --git a/x86_64-softmmu-config-target.h b/x86_64-softmmu-config-target.h
+new file mode 100644
+index 0000000000..302a95d89c
+--- /dev/null
++++ b/x86_64-softmmu-config-target.h
+@@ -0,0 +1,21 @@
++/*
++ * Autogenerated by the Meson build system.
++ * Do not edit, your changes will be lost.
++ */
++
++#pragma once
++
++#define CONFIG_I386_DIS 1
++
++#define CONFIG_KVM 1
++
++#define CONFIG_SOFTMMU 1
++
++#define TARGET_I386 1
++
++#define TARGET_NAME "x86_64"
++
++#define TARGET_SUPPORTS_MTTCG 1
++
++#define TARGET_X86_64 1
++
+--
+2.25.1
+
diff --git a/third_party/seccomp/BUILD b/third_party/seccomp/BUILD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/third_party/seccomp/BUILD
diff --git a/third_party/seccomp/external.bzl b/third_party/seccomp/external.bzl
new file mode 100644
index 0000000..66f933b
--- /dev/null
+++ b/third_party/seccomp/external.bzl
@@ -0,0 +1,36 @@
+# 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 seccomp_external(name, version):
+ sums = {
+ "2.5.1": "76ad54e31d143b39a99083564045212a965e026a1010a742edd793d26d699829",
+ }
+
+ http_archive(
+ name = name,
+ patch_args = ["-p1"],
+ patches = [
+ "//third_party/seccomp/patches:bazel_cc_fix.patch",
+ "//third_party/seccomp/patches:fix_generated_includes.patch",
+ ],
+ sha256 = sums[version],
+ build_file = "@//third_party/seccomp:seccomp.bzl",
+ strip_prefix = "libseccomp-" + version,
+ # We cannot use the actual release tarball as it contains files generated incorrectly for our environment
+ urls = ["https://github.com/seccomp/libseccomp/archive/v%s.tar.gz" % version],
+ )
diff --git a/third_party/seccomp/patches/BUILD b/third_party/seccomp/patches/BUILD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/third_party/seccomp/patches/BUILD
diff --git a/third_party/seccomp/patches/bazel_cc_fix.patch b/third_party/seccomp/patches/bazel_cc_fix.patch
new file mode 100644
index 0000000..5cd94ca
--- /dev/null
+++ b/third_party/seccomp/patches/bazel_cc_fix.patch
@@ -0,0 +1,166 @@
+Copyright 2020 The Monogon Project Authors.
+
+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.
+
+
+From f8ee9738c83ccca8f83b70605e8e7dda382f4fb7 Mon Sep 17 00:00:00 2001
+From: Lorenz Brun <lorenz@nexantic.com>
+Date: Tue, 9 Mar 2021 17:08:46 +0100
+Subject: [PATCH 1/2] bazel_cc_fix patch
+
+---
+ src/api.c | 2 +-
+ src/arch-syscall-dump.c | 2 +-
+ src/arch.c | 2 +-
+ src/arch.h | 2 +-
+ src/db.c | 2 +-
+ src/db.h | 2 +-
+ src/gen_bpf.c | 2 +-
+ src/gen_pfc.c | 2 +-
+ src/syscalls.c | 2 +-
+ src/system.c | 2 +-
+ 10 files changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/src/api.c b/src/api.c
+index 5cec088..b3f3b33 100644
+--- a/src/api.c
++++ b/src/api.c
+@@ -29,7 +29,7 @@
+ #include <stdbool.h>
+ #include <sys/ioctl.h>
+
+-#include <seccomp.h>
++#include "seccomp.h"
+
+ #include "arch.h"
+ #include "db.h"
+diff --git a/src/arch-syscall-dump.c b/src/arch-syscall-dump.c
+index 2055d34..59881a6 100644
+--- a/src/arch-syscall-dump.c
++++ b/src/arch-syscall-dump.c
+@@ -27,7 +27,7 @@
+ #include <string.h>
+ #include <unistd.h>
+
+-#include <seccomp.h>
++#include "seccomp.h"
+
+ #include "arch.h"
+ #include "arch-x86.h"
+diff --git a/src/arch.c b/src/arch.c
+index 73bf710..0184ed8 100644
+--- a/src/arch.c
++++ b/src/arch.c
+@@ -27,7 +27,7 @@
+ #include <linux/audit.h>
+ #include <stdbool.h>
+
+-#include <seccomp.h>
++#include "seccomp.h"
+
+ #include "arch.h"
+ #include "arch-x86.h"
+diff --git a/src/arch.h b/src/arch.h
+index 38c3a9c..33f46a5 100644
+--- a/src/arch.h
++++ b/src/arch.h
+@@ -26,7 +26,7 @@
+ #include <stddef.h>
+ #include <stdbool.h>
+
+-#include <seccomp.h>
++#include "seccomp.h"
+
+ #include "system.h"
+
+diff --git a/src/db.c b/src/db.c
+index 2dc9733..678890d 100644
+--- a/src/db.c
++++ b/src/db.c
+@@ -27,7 +27,7 @@
+ #include <string.h>
+ #include <stdarg.h>
+
+-#include <seccomp.h>
++#include "seccomp.h"
+
+ #include "arch.h"
+ #include "db.h"
+diff --git a/src/db.h b/src/db.h
+index 765c607..ffeaeaa 100644
+--- a/src/db.h
++++ b/src/db.h
+@@ -25,7 +25,7 @@
+ #include <inttypes.h>
+ #include <stdbool.h>
+
+-#include <seccomp.h>
++#include "seccomp.h"
+
+ #include "arch.h"
+
+diff --git a/src/gen_bpf.c b/src/gen_bpf.c
+index 6961d09..c0b60e4 100644
+--- a/src/gen_bpf.c
++++ b/src/gen_bpf.c
+@@ -32,7 +32,7 @@
+ #endif
+ #include <endian.h>
+
+-#include <seccomp.h>
++#include "seccomp.h"
+
+ #include "arch.h"
+ #include "arch-x32.h"
+diff --git a/src/gen_pfc.c b/src/gen_pfc.c
+index 405f080..fd2e187 100644
+--- a/src/gen_pfc.c
++++ b/src/gen_pfc.c
+@@ -29,7 +29,7 @@
+ /* NOTE: needed for the arch->token decoding in _pfc_arch() */
+ #include <linux/audit.h>
+
+-#include <seccomp.h>
++#include "seccomp.h"
+
+ #include "arch.h"
+ #include "db.h"
+diff --git a/src/syscalls.c b/src/syscalls.c
+index 9091fa9..72e26ab 100644
+--- a/src/syscalls.c
++++ b/src/syscalls.c
+@@ -19,7 +19,7 @@
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses>.
+ */
+-#include <seccomp.h>
++#include "seccomp.h"
+ #include <string.h>
+
+ #include "arch.h"
+diff --git a/src/system.c b/src/system.c
+index ae445bf..44f5b5c 100644
+--- a/src/system.c
++++ b/src/system.c
+@@ -28,7 +28,7 @@
+
+ #include "system.h"
+
+-#include <seccomp.h>
++#include "seccomp.h"
+
+ #include "arch.h"
+ #include "db.h"
+--
+2.25.1
+
diff --git a/third_party/seccomp/patches/fix_generated_includes.patch b/third_party/seccomp/patches/fix_generated_includes.patch
new file mode 100644
index 0000000..9ded20c
--- /dev/null
+++ b/third_party/seccomp/patches/fix_generated_includes.patch
@@ -0,0 +1,57 @@
+Copyright 2020 The Monogon Project Authors.
+
+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.
+
+
+From ac0286c4e85bef34485ad3cd1161da5c379af316 Mon Sep 17 00:00:00 2001
+From: Lorenz Brun <lorenz@nexantic.com>
+Date: Tue, 9 Mar 2021 17:18:30 +0100
+Subject: [PATCH 2/2] Fix generated includes
+
+---
+ include/seccomp.h.in | 2 +-
+ src/syscalls.perf.template | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/include/seccomp.h.in b/include/seccomp.h.in
+index 1e47de9..444ca93 100644
+--- a/include/seccomp.h.in
++++ b/include/seccomp.h.in
+@@ -818,7 +818,7 @@ int seccomp_export_bpf(const scmp_filter_ctx ctx, int fd);
+ #define __NR_SCMP_ERROR -1
+ #define __NR_SCMP_UNDEF -2
+
+-#include <seccomp-syscalls.h>
++#include "include/seccomp-syscalls.h"
+
+ #ifdef __cplusplus
+ }
+diff --git a/src/syscalls.perf.template b/src/syscalls.perf.template
+index f1fd3db..9540ad0 100644
+--- a/src/syscalls.perf.template
++++ b/src/syscalls.perf.template
+@@ -20,9 +20,9 @@
+ * along with this library; if not, see <http://www.gnu.org/licenses>.
+ */
+
+-#include <seccomp.h>
++#include "seccomp.h"
+ #include <string.h>
+-#include "syscalls.h"
++#include "src/syscalls.h"
+
+ %}
+ struct arch_syscall_table;
+--
+2.25.1
+
diff --git a/third_party/seccomp/seccomp.bzl b/third_party/seccomp/seccomp.bzl
new file mode 100644
index 0000000..782c762
--- /dev/null
+++ b/third_party/seccomp/seccomp.bzl
@@ -0,0 +1,82 @@
+# 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("@rules_cc//cc:defs.bzl", "cc_library")
+load("@dev_source_monogon//build/utils:template_file.bzl", "template_file")
+
+genrule(
+ name = "config-h",
+ outs = ["configure.h"],
+ cmd = "echo \"#define HAVE_LINUX_SECCOMP_H 1\" > \"$@\"",
+ visibility = ["//visibility:public"],
+)
+
+genrule(
+ name = "syscalls-tables",
+ srcs = [
+ "src/syscalls.perf.template",
+ "src/syscalls.csv",
+ ],
+ outs = ["syscalls.perf.c"],
+ cmd = """
+ # From src/arch-gperf-generate, modified to not write over source files
+ grep -v '^#' $(location src/syscalls.csv) | nl -ba -s, -v0 | \
+ sed -e 's/^[[:space:]]\\+\\([0-9]\\+\\),\\([^,]\\+\\),\\(.*\\)/\\2,\\1,\\3/' \
+ -e ':repeat; {s|\\([^,]\\+\\)\\(.*\\)[^_]PNR|\\1\\2,__PNR_\\1|g;}; t repeat' \
+ > "$(@D)/syscalls_tmp.csv"
+
+ # create the gperf file
+ sed -e "/@@SYSCALLS_TABLE@@/r $(@D)/syscalls_tmp.csv" \
+ -e '/@@SYSCALLS_TABLE@@/d' \
+ $(location src/syscalls.perf.template) > "$(@D)/syscalls.perf"
+ ./$(location @gperf//:gperf) -m 100 --null-strings --pic -tCEG -T -S1 --output-file="$(location syscalls.perf.c)" "$(@D)/syscalls.perf"
+ """,
+ tools = [
+ "@gperf//:gperf",
+ ],
+)
+
+template_file(
+ name = "seccomp.h",
+ src = "include/seccomp.h.in",
+ substitutions = {
+ # Irrelevant for Bazel. Just look at WORKSPACE.
+ # Make it obviously invalid so nobody is mislead.
+ "@VERSION_MAJOR@": "0",
+ "@VERSION_MINOR@": "0",
+ "@VERSION_MICRO@": "0",
+ },
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "seccomp",
+ srcs = glob(
+ [
+ "src/*.c",
+ "src/*.h",
+ ],
+ exclude = [
+ "src/arch-syscall-check.c",
+ "src/arch-syscall-dump.c",
+ ],
+ ) + ["//:configure.h", ":syscalls.perf.c"],
+ hdrs = [
+ ":seccomp.h",
+ "include/seccomp-syscalls.h",
+ ],
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/uring/BUILD b/third_party/uring/BUILD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/third_party/uring/BUILD
diff --git a/third_party/uring/external.bzl b/third_party/uring/external.bzl
new file mode 100644
index 0000000..35f9924
--- /dev/null
+++ b/third_party/uring/external.bzl
@@ -0,0 +1,35 @@
+# 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 uring_external(name, version):
+ sums = {
+ "2.0": "ca069ecc4aa1baf1031bd772e4e97f7e26dfb6bb733d79f70159589b22ab4dc0",
+ }
+
+ http_archive(
+ name = name,
+ patch_args = ["-p1"],
+ patches = [
+ "//third_party/uring/patches:bazel_cc_fix.patch",
+ "//third_party/uring/patches:include-compat-h.patch",
+ ],
+ sha256 = sums[version],
+ build_file = "@//third_party/uring:uring.bzl",
+ strip_prefix = "liburing-liburing-" + version,
+ urls = ["https://github.com/axboe/liburing/archive/liburing-%s.tar.gz" % version],
+ )
diff --git a/third_party/uring/patches/BUILD b/third_party/uring/patches/BUILD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/third_party/uring/patches/BUILD
diff --git a/third_party/uring/patches/bazel_cc_fix.patch b/third_party/uring/patches/bazel_cc_fix.patch
new file mode 100644
index 0000000..daad089
--- /dev/null
+++ b/third_party/uring/patches/bazel_cc_fix.patch
@@ -0,0 +1,98 @@
+Copyright 2020 The Monogon Project Authors.
+
+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.
+
+
+From 84404c50db8db114834d51be8cd5e706dcdb02ad Mon Sep 17 00:00:00 2001
+From: Lorenz Brun <lorenz@nexantic.com>
+Date: Tue, 9 Mar 2021 13:35:42 +0100
+Subject: [PATCH] bazel_cc_fix patch
+
+---
+ src/queue.c | 8 ++++----
+ src/register.c | 6 +++---
+ src/setup.c | 6 +++---
+ src/syscall.c | 4 ++--
+ 4 files changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/src/queue.c b/src/queue.c
+index 4bd4c48..e81a492 100644
+--- a/src/queue.c
++++ b/src/queue.c
+@@ -9,10 +9,10 @@
+ #include <string.h>
+ #include <stdbool.h>
+
+-#include "liburing/compat.h"
+-#include "liburing/io_uring.h"
+-#include "liburing.h"
+-#include "liburing/barrier.h"
++#include "src/include/liburing/compat.h"
++#include "src/include/liburing/io_uring.h"
++#include "src/include/liburing.h"
++#include "src/include/liburing/barrier.h"
+
+ #include "syscall.h"
+
+diff --git a/src/register.c b/src/register.c
+index 994aaff..87564f3 100644
+--- a/src/register.c
++++ b/src/register.c
+@@ -8,9 +8,9 @@
+ #include <errno.h>
+ #include <string.h>
+
+-#include "liburing/compat.h"
+-#include "liburing/io_uring.h"
+-#include "liburing.h"
++#include "src/include/liburing/compat.h"
++#include "src/include/liburing/io_uring.h"
++#include "src/include/liburing.h"
+
+ #include "syscall.h"
+
+diff --git a/src/setup.c b/src/setup.c
+index 062eaa0..decd4f0 100644
+--- a/src/setup.c
++++ b/src/setup.c
+@@ -10,9 +10,9 @@
+ #include <stdlib.h>
+ #include <signal.h>
+
+-#include "liburing/compat.h"
+-#include "liburing/io_uring.h"
+-#include "liburing.h"
++#include "src/include/liburing/compat.h"
++#include "src/include/liburing/io_uring.h"
++#include "src/include/liburing.h"
+
+ #include "syscall.h"
+
+diff --git a/src/syscall.c b/src/syscall.c
+index 2fd3dd4..3f57273 100644
+--- a/src/syscall.c
++++ b/src/syscall.c
+@@ -7,8 +7,8 @@
+ #include <unistd.h>
+ #include <sys/syscall.h>
+ #include <sys/uio.h>
+-#include "liburing/compat.h"
+-#include "liburing/io_uring.h"
++#include "src/include/liburing/compat.h"
++#include "src/include/liburing/io_uring.h"
+ #include "syscall.h"
+
+ #ifdef __alpha__
+--
+2.25.1
+
diff --git a/third_party/uring/patches/include-compat-h.patch b/third_party/uring/patches/include-compat-h.patch
new file mode 100644
index 0000000..ed53e37
--- /dev/null
+++ b/third_party/uring/patches/include-compat-h.patch
@@ -0,0 +1,49 @@
+Copyright 2020 The Monogon Project Authors.
+
+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.
+
+
+From 99f3ba25f42ee1ec31bcbb27c4813f4589d6fd89 Mon Sep 17 00:00:00 2001
+From: Lorenz Brun <lorenz@nexantic.com>
+Date: Tue, 9 Mar 2021 13:42:50 +0100
+Subject: [PATCH] include compat.h
+
+---
+ src/include/liburing/compat.h | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+ create mode 100644 src/include/liburing/compat.h
+
+diff --git a/src/include/liburing/compat.h b/src/include/liburing/compat.h
+new file mode 100644
+index 0000000..2e46c5f
+--- /dev/null
++++ b/src/include/liburing/compat.h
+@@ -0,0 +1,15 @@
++/* SPDX-License-Identifier: MIT */
++#ifndef LIBURING_COMPAT_H
++#define LIBURING_COMPAT_H
++
++#include <linux/time_types.h>
++
++#include <inttypes.h>
++
++struct open_how {
++ uint64_t flags;
++ uint64_t mode;
++ uint64_t resolve;
++};
++
++#endif
+--
+2.25.1
+
diff --git a/third_party/uring/uring.bzl b/third_party/uring/uring.bzl
new file mode 100644
index 0000000..38d838f
--- /dev/null
+++ b/third_party/uring/uring.bzl
@@ -0,0 +1,24 @@
+# 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("@rules_cc//cc:defs.bzl", "cc_library")
+
+cc_library(
+ name = "uring",
+ srcs = glob(["src/*.c", "src/*.h"]),
+ hdrs = glob(["src/include/**/*.h"]),
+ visibility = ["//visibility:public"],
+)