From 0851624a8b4ea07bf53b613dc24e8947e219dc40 Mon Sep 17 00:00:00 2001
From: XargonWan <XargonWan@gmail.com>
Date: Tue, 10 Dec 2024 10:52:21 +0900
Subject: [PATCH] MISSING_LIBS_EXTRACTOR: fixed

---
 automation_tools/search_missing_libs.sh | 6 +++---
 net.retrodeck.retrodeck.yml             | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/automation_tools/search_missing_libs.sh b/automation_tools/search_missing_libs.sh
index e9e206a1..8f1652b2 100755
--- a/automation_tools/search_missing_libs.sh
+++ b/automation_tools/search_missing_libs.sh
@@ -2,13 +2,13 @@
 
 # Search for missing libraries
 missing_libs=$(flatpak run --command=sh net.retrodeck.retrodeck -c \
-"find \${FLATPAK_DEST}/bin -type f -exec ldd {} + 2>/dev/null | grep 'not found' | awk '{print \$1}' | sort | uniq")
+"find /app/bin -type f -exec ldd {} + 2>/dev/null | grep 'not found' | awk '{print \$2}' | tr -d ':' | xargs -n 1 basename | sort | uniq | tr '\n' ' '")
 
-# If there is any missing library it will be printed and the step will fail
+# If there is any missing library, it will be printed, and the step will fail
 if [ -n "$missing_libs" ]; then
     echo "The following libraries are missing:"
     echo "$missing_libs"
     exit 1
 else
     echo "TEST OK: No missing libraries are found"
-fi     
\ No newline at end of file
+fi
diff --git a/net.retrodeck.retrodeck.yml b/net.retrodeck.retrodeck.yml
index 6a0e6c65..6ef3feb9 100644
--- a/net.retrodeck.retrodeck.yml
+++ b/net.retrodeck.retrodeck.yml
@@ -682,7 +682,7 @@ modules:
     build-commands:
       - |
           # Search for missing libraries in our libtmp folder
-          missing_libs=$(find "${FLATPAK_DEST}/bin" -type f -exec ldd {} + 2>/dev/null | grep "not found" | awk '{print $1}' | sort | uniq)
+          missing_libs=$("find /app/bin -type f -exec ldd {} + 2>/dev/null | grep 'not found' | awk '{print \$2}' | tr -d ':' | xargs -n 1 basename | sort | uniq | tr '\n' ' '")
           
           # Manually specified libraries that are not automatically detected
           manually_imported="libpostproc.so.56 libswscale.so.6 libshaderc_shared.so.1 libbz2.so.1.0 libaio.so.1 ld-linux.so.2 libvpx.so.9 libzmusic.so.1 libicuuc.so.73 libLLVM.so.18.1"