aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Jansen <jansene@google.com>2024-04-18 15:54:14 -0700
committerErwin Jansen <jansene@google.com>2024-04-24 15:24:05 -0700
commitbb56718927d163c68965a64e2ba4c24074887abe (patch)
tree12aa1fa60577de64d20241786d3de24a74869487
parent2ef05710519aa00f9992b1b06c5df1faa8a1921a (diff)
downloadqemu-bb56718927d163c68965a64e2ba4c24074887abe.tar.gz
Bazel build file for libvhost project
This allows you to compile libvhost using bazel. Change-Id: I4831b7c7cf63b882edad0eadd3a900952e8cb39e
-rw-r--r--subprojects/libvhost-user/BUILD.bazel70
-rw-r--r--subprojects/libvhost-user/vhost-linux-shim.jsonc50
2 files changed, 120 insertions, 0 deletions
diff --git a/subprojects/libvhost-user/BUILD.bazel b/subprojects/libvhost-user/BUILD.bazel
new file mode 100644
index 0000000000..cd9c813ed1
--- /dev/null
+++ b/subprojects/libvhost-user/BUILD.bazel
@@ -0,0 +1,70 @@
+# This is the build file for project "libvhost-user"
+# It is autogenerated by the Meson build system.
+# Using the experimental bazel build plugin.
+cc_library(
+ name = "vhost-user",
+ srcs = ["libvhost-user.c"],
+ hdrs = [
+ "include/atomic.h",
+ "include/compiler.h",
+ "libvhost-user.h",
+ "standard-headers/linux/types.h",
+ "standard-headers/linux/virtio_config.h",
+ "standard-headers/linux/virtio_ring.h",
+ ],
+ copts = [
+ "-DF_SEAL_WRITE=0x0008",
+ "-DF_SEAL_EXEC=0x0020",
+ "-DF_SEAL_SEAL=0x0001",
+ "-DF_SEAL_SHRINK=0x0002",
+ "-DF_SEAL_GROW=0x0004",
+ "-DF_GET_SEALS=1034",
+ "-Wno-implicit-function-declaration",
+ "-DF_ADD_SEALS=1033",
+ ],
+ defines = [
+ "_GNU_SOURCE",
+ "_FILE_OFFSET_BITS=64",
+ ],
+ includes = [
+ ".",
+ "libvhost-user.a.p",
+ "platform/linux",
+ ],
+ visibility = ["//visibility:public"],
+ deps = ["//external/qemu/google/compat/linux:compat"],
+ alwayslink = True,
+)
+
+cc_library(
+ name = "vhost-user-glib",
+ srcs = ["libvhost-user-glib.c"],
+ hdrs = [
+ "libvhost-user.h",
+ "libvhost-user-glib.h",
+ "standard-headers/linux/virtio_ring.h",
+ ],
+ copts = [
+ "-DF_SEAL_WRITE=0x0008",
+ "-DF_SEAL_EXEC=0x0020",
+ "-DF_SEAL_SEAL=0x0001",
+ "-DF_SEAL_SHRINK=0x0002",
+ "-DF_SEAL_GROW=0x0004",
+ "-DF_GET_SEALS=1034",
+ "-Wno-implicit-function-declaration",
+ "-DF_ADD_SEALS=1033",
+ ],
+ defines = ["_FILE_OFFSET_BITS=64"],
+ includes = [
+ ".",
+ "libvhost-user-glib.a.p",
+ "platform/linux",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ "vhost-user",
+ "//external/qemu/google/compat/linux:compat",
+ "@glib//:glib-static",
+ "@glib//:gmodule-static",
+ ],
+)
diff --git a/subprojects/libvhost-user/vhost-linux-shim.jsonc b/subprojects/libvhost-user/vhost-linux-shim.jsonc
new file mode 100644
index 0000000000..b25b359b20
--- /dev/null
+++ b/subprojects/libvhost-user/vhost-linux-shim.jsonc
@@ -0,0 +1,50 @@
+{
+ // These are shims we should apply to the various targets
+ "shims": [
+ {
+ "target": ".*",
+ "shims": {
+ "restrict_to" : "cc_.*",
+ // Remove our compat libs
+ "-hdrs": [
+ "google.*"
+ ],
+ "-srcs": [
+ "google.*"
+ ],
+ // We are missing a bunch of defines
+ // due us having an old sysroot
+ "+copts": [
+ "-DF_ADD_SEALS=1033",
+ "-DF_GET_SEALS=1034",
+ "-DF_SEAL_SEAL=0x0001",
+ "-DF_SEAL_SHRINK=0x0002",
+ "-DF_SEAL_GROW=0x0004",
+ "-DF_SEAL_WRITE=0x0008",
+ "-DF_SEAL_EXEC=0x0020",
+ "-Wno-implicit-function-declaration"
+ ],
+ // Compat layer needed for vhost
+ "+deps": [
+ "//external/qemu/google/compat/linux:compat"
+ ]
+ }
+ }
+
+ ],
+ // These are the bazel mappings we are going to use for
+ // external dependencies. For every pkg config dependency
+ // you will need to provide a bazel target
+ "external_deps": {
+ "glib-2.0": [
+ "@glib//:glib-static",
+ "@glib//:gmodule-static"
+ ]
+ },
+ // The actual set of targets you wish to generate bazel targets for.
+ // These are the targets that will be exported.
+ "export": [
+ "vhost-user-glib",
+ "vhost-user"
+ ],
+}