aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Labatut <plabatut@google.com>2023-10-31 11:20:41 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-10-31 11:20:41 +0000
commit6617df6d3075e72bab2501843bc503a5b9b527c6 (patch)
tree93bfdb4368f8c4fd824f11546cc17099cfbb78d8
parent4fe054916bfd39086bdd3fe74fef21c728b5462d (diff)
parent57593be157047b681088d55ab940002c9e307315 (diff)
downloadcuttlefish_vmm-6617df6d3075e72bab2501843bc503a5b9b527c6.tar.gz
Use meson to build gfxstream. am: 57593be157
Original change: https://android-review.googlesource.com/c/device/google/cuttlefish_vmm/+/2804953 Change-Id: I36f642713b4a99961c5d9861eafe7016019ab84c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--qemu/scripts/genrepo.py13
-rwxr-xr-xqemu/scripts/rebuild.py74
-rw-r--r--qemu/third_party/gfxstream-build/CMakeLists.txt12
l---------qemu/third_party/gfxstream-build/egl1
l---------qemu/third_party/gfxstream-build/gfxstream1
5 files changed, 55 insertions, 46 deletions
diff --git a/qemu/scripts/genrepo.py b/qemu/scripts/genrepo.py
index 8654c2a..099eeab 100644
--- a/qemu/scripts/genrepo.py
+++ b/qemu/scripts/genrepo.py
@@ -156,12 +156,12 @@ class Project:
def GetAllSubmodules(path):
"""Yields a Submodule for each module recursively found in the specified repo."""
- origin = (
- subprocess.check_output(["git", "remote", "get-url", "origin"])
- .decode()
- .strip()
+
+ yield Submodule(
+ ".",
+ "https://android.googlesource.com/device/google/cuttlefish_vmm",
+ "main",
)
- yield Submodule(".", origin, "main")
output = subprocess.check_output([
"git",
@@ -179,9 +179,6 @@ def MatchProject(url):
prefix_to_remote = {
"https://android.googlesource.com/": AOSP_HOST,
"persistent-https://android.git.corp.google.com/": AOSP_HOST,
- "sso://experimental-qemu-build-internal/": (
- "experimental-qemu-build-internal"
- ),
}
for prefix, remote in prefix_to_remote.items():
if url.startswith(prefix):
diff --git a/qemu/scripts/rebuild.py b/qemu/scripts/rebuild.py
index 4192f26..4892316 100755
--- a/qemu/scripts/rebuild.py
+++ b/qemu/scripts/rebuild.py
@@ -802,29 +802,41 @@ def build_task_for_libdrm(build: BuildConfig):
@project.task([
- build_task_for_make,
build_task_for_meson,
build_task_for_aemu_base,
build_task_for_flatbuffers,
build_task_for_libdrm,
])
def build_task_for_gfxstream(build: BuildConfig):
- dir_name = Path("gfxstream-build")
- out_dir = build.make_subdir(dir_name)
- cmd_args = [
- "cmake",
- "-DDEPENDENCY_RESOLUTION=SYSTEM",
- build.third_party_dir / dir_name,
- ]
- build.run(cmd_args, dir_name)
- build.run_make_build(dir_name, ["gfxstream_backend"])
- build.copy_file(
- build.clang_dir / "lib" / "libc++.so.1",
- build.install_dir / "usr" / "lib" / "libc++.so.1",
+ dir_name = Path("gfxstream")
+ src_dir = build.third_party_dir / dir_name
+ build_dir = build.make_subdir(dir_name)
+ build.copy_dir(
+ build.third_party_dir / "egl" / "api" / "EGL",
+ build.sysroot_dir / "usr" / "include" / "EGL",
)
- build.copy_file(
- out_dir / "libgfxstream_backend.so",
- build.install_dir / "usr" / "lib" / "libgfxstream_backend.so",
+ build.run(
+ [
+ "meson",
+ "setup",
+ f"--prefix={build.install_dir}/usr",
+ build_dir,
+ src_dir,
+ ],
+ )
+ build.run(
+ [
+ "meson",
+ "compile",
+ ],
+ build_dir,
+ )
+ build.run(
+ [
+ "meson",
+ "install",
+ ],
+ build_dir,
)
@@ -844,7 +856,7 @@ def build_task_for_rutabaga(build: BuildConfig):
]
env = {
"CARGO_TARGET_DIR": str(out_dir),
- "GFXSTREAM_PATH": str(build.build_dir / "gfxstream-build"),
+ "GFXSTREAM_PATH": str(build.build_dir / "gfxstream" / "host"),
"PATH": f"{build.install_dir}/usr/bin:{os.environ['PATH']}",
"CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER": (
f"{build.clang_dir}/bin/clang"
@@ -860,8 +872,8 @@ def build_task_for_rutabaga(build: BuildConfig):
build.install_dir / "usr" / "lib" / "librutabaga_gfx_ffi.so",
)
build.run(
- [ "ln", "-sf", "librutabaga_gfx_ffi.so", "librutabaga_gfx_ffi.so.0"],
- build.install_dir / "usr" / "lib"
+ ["ln", "-sf", "librutabaga_gfx_ffi.so", "librutabaga_gfx_ffi.so.0"],
+ build.install_dir / "usr" / "lib",
)
build.copy_file(
rutabaga_src_dir / "src" / "share" / "rutabaga_gfx_ffi.pc",
@@ -889,8 +901,9 @@ def build_task_for_rutabaga(build: BuildConfig):
])
def build_task_for_qemu(build: BuildConfig):
target_list = [
+ "aarch64-softmmu",
"riscv64-softmmu",
- # "x86_64-softmmu",
+ "x86_64-softmmu",
]
src_dir = build.third_party_dir / "qemu"
build_dir = build.make_subdir(Path("qemu"))
@@ -919,15 +932,28 @@ def build_task_for_qemu_portable(build: BuildConfig):
build.build_dir / "qemu", use_DESTDIR=True, dest_dir=package_dir
)
bin_dir = package_dir / "usr" / "bin"
- build.run(["patchelf", "--set-rpath", "$ORIGIN"] + list(bin_dir.glob("*")))
-
files = [
"dest-install/usr/lib/libz.so.1",
"dest-install/usr/lib/librutabaga_gfx_ffi.so.0",
- "dest-install/usr/lib/libgfxstream_backend.so",
- "dest-install/usr/lib/libc++.so.1",
+ "dest-install/usr/lib64/libc++.so.1",
]
+ # Meson install directory depends on the system and differs between podman and
+ # the developer's workstation. Probe the file system to pick the right location.
+ either_or = [
+ "dest-install/usr/lib/x86_64-linux-gnu/libgfxstream_backend.so.0",
+ "dest-install/usr/lib/libgfxstream_backend.so.0",
+ ]
+ try:
+ files.append(
+ next(
+ path for path in either_or if os.path.isfile(build.build_dir / path)
+ )
+ )
+ except StopIteration:
+ raise FileNotFoundError(f"None of the paths exist: {either_or}")
+
build.run(["cp", "-t", bin_dir] + files)
+ build.run(["patchelf", "--set-rpath", "$ORIGIN"] + list(bin_dir.glob("*")))
build.run(
["tar", "-czvf", "qemu-portable.tar.gz", "qemu-portable"], build.build_dir
)
diff --git a/qemu/third_party/gfxstream-build/CMakeLists.txt b/qemu/third_party/gfxstream-build/CMakeLists.txt
deleted file mode 100644
index 9504b8f..0000000
--- a/qemu/third_party/gfxstream-build/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-cmake_minimum_required(VERSION 3.22)
-project(gfx-streaming-kit)
-
-# The shared library will search for `.so` dependencies
-# in the same directory as the file. This is useful to
-# find libc++.so.1
-set(CMAKE_BUILD_WITH_INSTALL_RPATH true)
-set(CMAKE_INSTALL_RPATH "$ORIGIN")
-add_library(gfxstream_egl_headers INTERFACE)
-target_include_directories(gfxstream_egl_headers INTERFACE "egl/api")
-
-add_subdirectory(gfxstream) \ No newline at end of file
diff --git a/qemu/third_party/gfxstream-build/egl b/qemu/third_party/gfxstream-build/egl
deleted file mode 120000
index 34539d4..0000000
--- a/qemu/third_party/gfxstream-build/egl
+++ /dev/null
@@ -1 +0,0 @@
-../egl \ No newline at end of file
diff --git a/qemu/third_party/gfxstream-build/gfxstream b/qemu/third_party/gfxstream-build/gfxstream
deleted file mode 120000
index b40b293..0000000
--- a/qemu/third_party/gfxstream-build/gfxstream
+++ /dev/null
@@ -1 +0,0 @@
-../gfxstream \ No newline at end of file