From 1aed33a48b4fd3b3c6d2107fc56eee8afa272298 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Fri, 24 Nov 2023 03:28:17 -0500 Subject: [PATCH] Improve Flatpak Build [skip ci] --- CMakeLists.txt | 3 +++ dependencies/qemu/CMakeLists.txt | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b789e76ca..c083873ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,7 @@ endif() option(MCPI_IS_MIXED_BUILD "Whether The Architecture-Independent And ARM Code Are Different Architecture" FALSE) option(MCPI_OPEN_SOURCE_ONLY "Only Install Open-Source Code (Will Result In Broken Install)" FALSE) option(MCPI_IS_APPIMAGE_BUILD "AppImage Build" FALSE) +option(MCPI_IS_FLATPAK_BUILD "Flatpak Build" FALSE) # Server/Headless Builds option(MCPI_SERVER_MODE "Server Mode" FALSE) @@ -137,6 +138,8 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(DEFAULT_PREFIX "/usr") if(MCPI_IS_APPIMAGE_BUILD) set(DEFAULT_PREFIX "/") + elseif(MCPI_IS_FLATPAK_BUILD) + set(DEFAULT_PREFIX "/app") endif() set(CMAKE_INSTALL_PREFIX "${DEFAULT_PREFIX}" CACHE PATH "" FORCE) set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE) diff --git a/dependencies/qemu/CMakeLists.txt b/dependencies/qemu/CMakeLists.txt index 5664268bf..5bf20ffd3 100644 --- a/dependencies/qemu/CMakeLists.txt +++ b/dependencies/qemu/CMakeLists.txt @@ -5,6 +5,12 @@ project(qemu) # Version set(QEMU_VERSION "8.1.3") +# Flatpak Support +set(QEMU_PATCH "") +if(MCPI_IS_FLATPAK_BUILD) + set(QEMU_PATCH "sed" "-i" "s/libdrm/libdrm-dis/g" "/meson.build") +endif() + # Build include(ProcessorCount) ProcessorCount(NPROC) @@ -29,6 +35,7 @@ ExternalProject_Add(qemu USES_TERMINAL_BUILD TRUE INSTALL_COMMAND "" TEST_COMMAND "" + PATCH_COMMAND ${QEMU_PATCH} BUILD_BYPRODUCTS "/qemu-arm" )