commit:     ab7568044fe114f18bd3e7a824916da9bedda044
Author:     Adel KARA SLIMANE <adel.ks <AT> zegrapher <DOT> com>
AuthorDate: Mon Nov 27 22:11:59 2023 +0000
Commit:     Adel KARA SLIMANE <adel <AT> karaslimane <DOT> com>
CommitDate: Mon Nov 27 22:13:09 2023 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=ab756804

games-util/mangohud: replace patches with sed calls

less maintenance like this.

Signed-off-by: Adel KARA SLIMANE <adel.ks <AT> zegrapher.com>

 .../files/implot-v0.16-imgui-include-fix.patch     | 45 ----------------------
 .../files/mangohud-v0.7.0-imgui-include-fix.patch  | 13 -------
 games-util/mangohud/mangohud-0.7.0.ebuild          |  7 ++--
 games-util/mangohud/mangohud-9999.ebuild           |  8 ++--
 4 files changed, 8 insertions(+), 65 deletions(-)

diff --git a/games-util/mangohud/files/implot-v0.16-imgui-include-fix.patch 
b/games-util/mangohud/files/implot-v0.16-imgui-include-fix.patch
deleted file mode 100644
index 7da397ce44..0000000000
--- a/games-util/mangohud/files/implot-v0.16-imgui-include-fix.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-diff --git a/.github/example_implot.cpp b/.github/example_implot.cpp
-index 9339bab..13bcf8c 100644
---- a/.github/example_implot.cpp
-+++ b/.github/example_implot.cpp
-@@ -1,12 +1,12 @@
- // Sample app built with Dear ImGui and ImPlot
- // This app uses implot and imgui, but does not output to any backend! It 
only serves as a proof that an app can be built, linked, and run.
- 
--#include "imgui.h"
-+#include "imgui/imgui.h"
- #include "implot.h"
- #include "stdio.h"
- 
- int main(int, char**)
--{    
-+{
-     printf("sample_implot: start\n");
- 
-     IMGUI_CHECKVERSION();
-diff --git a/implot.h b/implot.h
-index 36c0d40..5dabc9d 100644
---- a/implot.h
-+++ b/implot.h
-@@ -45,7 +45,7 @@
- // [SECTION] Obsolete API
- 
- #pragma once
--#include "imgui.h"
-+#include "imgui/imgui.h"
- 
- 
//-----------------------------------------------------------------------------
- // [SECTION] Macros and Defines
-diff --git a/implot_internal.h b/implot_internal.h
-index fb01204..4e58767 100644
---- a/implot_internal.h
-+++ b/implot_internal.h
-@@ -32,7 +32,7 @@
- #pragma once
- 
- #include <time.h>
--#include "imgui_internal.h"
-+#include "imgui/imgui_internal.h"
- 
- #ifndef IMPLOT_VERSION
- #error Must include implot.h before implot_internal.h

diff --git a/games-util/mangohud/files/mangohud-v0.7.0-imgui-include-fix.patch 
b/games-util/mangohud/files/mangohud-v0.7.0-imgui-include-fix.patch
deleted file mode 100644
index 1d5d32e2f1..0000000000
--- a/games-util/mangohud/files/mangohud-v0.7.0-imgui-include-fix.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/src/overlay.h b/src/overlay.h
-index 8b53285..127c3db 100644
---- a/src/overlay.h
-+++ b/src/overlay.h
-@@ -7,7 +7,7 @@
- #include <vector>
- #include <deque>
- #include <imgui.h>
--#include "imgui_internal.h"
-+#include "imgui/imgui_internal.h"
- #include "overlay_params.h"
- #include "hud_elements.h"
- #include "engine_types.h"

diff --git a/games-util/mangohud/mangohud-0.7.0.ebuild 
b/games-util/mangohud/mangohud-0.7.0.ebuild
index f257c749b7..4735f458e9 100644
--- a/games-util/mangohud/mangohud-0.7.0.ebuild
+++ b/games-util/mangohud/mangohud-0.7.0.ebuild
@@ -78,7 +78,6 @@ RDEPEND="
 
 PATCHES=(
        "${FILESDIR}/mangohud-v0.7.0-meson-fix-imgui-dep.patch"
-       "${FILESDIR}/mangohud-v0.7.0-imgui-include-fix.patch"
 )
 
 src_unpack() {
@@ -99,8 +98,10 @@ src_unpack() {
 src_prepare() {
        default
        # replace all occurences of "#include <imgui.h>" to "#include 
<imgui/imgui.h>"
-       find . -type f -exec sed -i 's/#include <imgui.h>/#include 
<imgui\/imgui.h>/g' {} \;
-       find . -type f -exec sed -i 's/#include "imgui.h"/#include 
<imgui\/imgui.h>/g' {} \;
+       find . -type f -exec sed -i 's|<imgui.h>|<imgui/imgui.h>|g' {} \; || die
+       find . -type f -exec sed -i 's|"imgui.h"|<imgui/imgui.h>|g' {} \; || die
+       find . -type f -exec sed -i 
's|<imgui_internal.h>|<imgui/imgui_internal.h>|g' {} \; || die
+       find . -type f -exec sed -i 
's|"imgui_internal.h"|<imgui/imgui_internal.h>|g' {} \; || die
 }
 
 src_configure() {

diff --git a/games-util/mangohud/mangohud-9999.ebuild 
b/games-util/mangohud/mangohud-9999.ebuild
index d68169da01..3fba65ec23 100644
--- a/games-util/mangohud/mangohud-9999.ebuild
+++ b/games-util/mangohud/mangohud-9999.ebuild
@@ -85,7 +85,6 @@ RDEPEND="
 
 PATCHES=(
        "${FILESDIR}/mangohud-v0.7.0-meson-fix-imgui-dep.patch"
-       "${FILESDIR}/mangohud-v0.7.0-imgui-include-fix.patch"
 )
 
 src_unpack() {
@@ -108,14 +107,15 @@ src_unpack() {
 
        cd "${S}/subprojects/implot-${IMPLOT_VER}" || die
        eapply "${FILESDIR}/implot-v0.16-fix-imgui-dep.patch"
-       eapply "${FILESDIR}/implot-v0.16-imgui-include-fix.patch"
 }
 
 src_prepare() {
        default
        # replace all occurences of "#include <imgui.h>" to "#include 
<imgui/imgui.h>"
-       find . -type f -exec sed -i 's/#include <imgui.h>/#include 
<imgui\/imgui.h>/g' {} \;
-       find . -type f -exec sed -i 's/#include "imgui.h"/#include 
<imgui\/imgui.h>/g' {} \;
+       find . -type f -exec sed -i 's|<imgui.h>|<imgui/imgui.h>|g' {} \; || die
+       find . -type f -exec sed -i 's|"imgui.h"|<imgui/imgui.h>|g' {} \; || die
+       find . -type f -exec sed -i 
's|<imgui_internal.h>|<imgui/imgui_internal.h>|g' {} \; || die
+       find . -type f -exec sed -i 
's|"imgui_internal.h"|<imgui/imgui_internal.h>|g' {} \; || die
 }
 
 src_configure() {

Reply via email to