From b856df86380b1c084fff8eae512ad3f2520f53d1 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 25 Nov 2024 15:59:05 +0100 Subject: [PATCH] Re-apply patches if list changed --- .github/workflows/Build.yml | 2 +- CMakeLists.txt | 8 +++++--- flatpak/io.github.wivrn.wivrn.yml.in | 2 +- patches/apply.sh | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 20e332fe..2f4927a4 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -324,7 +324,7 @@ jobs: - name: Patch monado working-directory: wivrn/monado-src - run: ../patches/apply.sh ../patches/monado + run: ../patches/apply.sh ../patches/monado/* - name: Edit changelog (nightly) if: ${{ ! startsWith(github.ref, 'refs/tags/') }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 5555f4fd..649e39d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -227,21 +227,23 @@ FetchContent_Declare(spdlog EXCLUDE_FROM_ALL SYSTEM URL https://github.co FetchContent_Declare(stb EXCLUDE_FROM_ALL SYSTEM URL https://github.com/nothings/stb/archive/013ac3beddff3dbffafd5177e7972067cd2b5083.zip) FetchContent_Declare(libktx EXCLUDE_FROM_ALL SYSTEM URL https://github.com/KhronosGroup/KTX-Software/archive/refs/tags/v4.3.0.tar.gz) FetchContent_Declare(implot EXCLUDE_FROM_ALL SYSTEM URL https://github.com/epezent/implot/archive/refs/tags/v0.16.tar.gz) +file(GLOB IMGUI_PATCHES CONFIGURE_DEPENDS patches/imgui/*) FetchContent_Declare(imgui EXCLUDE_FROM_ALL SYSTEM URL https://github.com/ocornut/imgui/archive/refs/tags/v1.91.3.tar.gz - PATCH_COMMAND ${CMAKE_CURRENT_LIST_DIR}/patches/apply.sh ${CMAKE_CURRENT_LIST_DIR}/patches/imgui/ + PATCH_COMMAND ${CMAKE_CURRENT_LIST_DIR}/patches/apply.sh ${IMGUI_PATCHES} ) # Use the docking branch of imgui to use multi-viewport # FetchContent_Declare(imgui EXCLUDE_FROM_ALL URL https://github.com/ocornut/imgui/archive/ce0d0ac8298ce164b5d862577e8b087d92f6e90e.zip) FetchContent_Declare(uni-algo EXCLUDE_FROM_ALL SYSTEM URL https://github.com/uni-algo/uni-algo/archive/v1.2.0.tar.gz) +file(GLOB MONADO_PATCHES CONFIGURE_DEPENDS patches/monado/*) # Server dependencies FetchContent_Declare(monado GIT_REPOSITORY https://gitlab.freedesktop.org/monado/monado # The flatpak manifest is updated automatically GIT_TAG 8aea7b8691061bbc01c37808e3f3d55b47797fa6 - PATCH_COMMAND ${CMAKE_CURRENT_LIST_DIR}/patches/apply.sh ${CMAKE_CURRENT_LIST_DIR}/patches/monado/ + PATCH_COMMAND ${CMAKE_CURRENT_LIST_DIR}/patches/apply.sh ${MONADO_PATCHES} EXCLUDE_FROM_ALL - ) +) add_subdirectory(external) add_subdirectory(common) diff --git a/flatpak/io.github.wivrn.wivrn.yml.in b/flatpak/io.github.wivrn.wivrn.yml.in index d7984521..7111d044 100644 --- a/flatpak/io.github.wivrn.wivrn.yml.in +++ b/flatpak/io.github.wivrn.wivrn.yml.in @@ -178,7 +178,7 @@ modules: dest: deps/monado-src - type: shell commands: - - cd deps/monado-src && ../../patches/apply.sh ../../patches/monado + - cd deps/monado-src && ../../patches/apply.sh ../../patches/monado/* - name: opencomposite buildsystem: cmake-ninja diff --git a/patches/apply.sh b/patches/apply.sh index 31ce3bfc..09b2ea8c 100755 --- a/patches/apply.sh +++ b/patches/apply.sh @@ -5,12 +5,12 @@ if [ -d ".git" ] ; then git config user.name > /dev/null || git config user.name "no name" git config --local commit.gpgsign false git checkout . - exec git am "$@"/* + exec git am "$@" fi # There is no reliable way to apply a patch and succeed if it was # already applied. Just ignore errors... -for f in "$@"/* ; do +for f in "$@" ; do patch -p1 --forward < "$f" done