commit:     7010cb3306f0fb2e63fd1f52d256ada4c9cfb9e6
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Aug  8 08:51:17 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Aug  8 09:54:21 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7010cb33

games-emulation/dolphin: Make bundled dep removal less reverse

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../dolphin/dolphin-5.0_p20210506-r1.ebuild           | 19 ++++++++++---------
 games-emulation/dolphin/dolphin-9999.ebuild           | 17 +++++++++--------
 2 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/games-emulation/dolphin/dolphin-5.0_p20210506-r1.ebuild 
b/games-emulation/dolphin/dolphin-5.0_p20210506-r1.ebuild
index 83548704203..009f64178fa 100644
--- a/games-emulation/dolphin/dolphin-5.0_p20210506-r1.ebuild
+++ b/games-emulation/dolphin/dolphin-5.0_p20210506-r1.ebuild
@@ -78,7 +78,7 @@ src_prepare() {
 
        # Remove all the bundled libraries that support system-installed
        # preference. See CMakeLists.txt for conditional 'add_subdirectory' 
calls.
-       local KEEP_SOURCES=(
+       local keep_sources=(
                Bochs_disasm
                FreeSurround
 
@@ -111,16 +111,17 @@ src_prepare() {
                # No code to detect shared library.
                zstd
        )
-       local s
-       for s in "${KEEP_SOURCES[@]}"; do
-               mv -v "Externals/${s}" . || die
-       done
-       einfo "removing sources: $(echo Externals/*)"
-       rm -r Externals/* || die "Failed to delete Externals dir."
-       for s in "${KEEP_SOURCES[@]}"; do
-               mv -v "${s}" "Externals/" || die
+       local s remove=()
+       for s in Externals/*; do
+               [[ -f ${s} ]] && continue
+               if ! has "${s#Externals/}" "${keep_sources[@]}"; then
+                       remove+=( "${s}" )
+               fi
        done
 
+       einfo "removing sources: ${remove[*]}"
+       rm -r "${remove[@]}" || die
+
        # About 50% compile-time speedup
        if ! use vulkan; then
                sed -i -e '/Externals\/glslang/d' CMakeLists.txt || die

diff --git a/games-emulation/dolphin/dolphin-9999.ebuild 
b/games-emulation/dolphin/dolphin-9999.ebuild
index c37e6af106c..28cc6679d93 100644
--- a/games-emulation/dolphin/dolphin-9999.ebuild
+++ b/games-emulation/dolphin/dolphin-9999.ebuild
@@ -113,16 +113,17 @@ src_prepare() {
                # This is a stripped-down mGBA for integrated GBA support
                mGBA
        )
-       local s
-       for s in "${KEEP_SOURCES[@]}"; do
-               mv -v "Externals/${s}" . || die
-       done
-       einfo "removing sources: $(echo Externals/*)"
-       rm -r Externals/* || die "Failed to delete Externals dir."
-       for s in "${KEEP_SOURCES[@]}"; do
-               mv -v "${s}" "Externals/" || die
+       local s remove=()
+       for s in Externals/*; do
+               [[ -f ${s} ]] && continue
+               if ! has "${s#Externals/}" "${keep_sources[@]}"; then
+                       remove+=( "${s}" )
+               fi
        done
 
+       einfo "removing sources: ${remove[*]}"
+       rm -r "${remove[@]}" || die
+
        # About 50% compile-time speedup
        if ! use vulkan; then
                sed -i -e '/Externals\/glslang/d' CMakeLists.txt || die

Reply via email to