@@ -10,8 +10,16 @@ search_libs() {
1010 # Use absolute paths to avoid confusion
1111 local component_lib_dir=" $( realpath -m " ${FLATPAK_DEST} /../lib" 2> /dev/null) "
1212 local artifacts_lib_dir=" $( realpath -m " ${FLATPAK_DEST} /lib" ) "
13-
14- SEARCH_PATHS=(" $artifacts_lib_dir " " $component_lib_dir " /app /usr/lib /usr/lib64)
13+
14+ # Add squashfs-root (AppImage extracted) if present
15+ local squashfs_root_dir=" ${component} /squashfs-root"
16+ local squashfs_lib_dir=" ${squashfs_root_dir} /lib"
17+ if [[ -d " $squashfs_root_dir " ]]; then
18+ SEARCH_PATHS=(" $artifacts_lib_dir " " $component_lib_dir " " $squashfs_lib_dir " " $squashfs_root_dir " " $squashfs_root_dir /usr/lib" /app /usr/lib /usr/lib64)
19+ else
20+ SEARCH_PATHS=(" $artifacts_lib_dir " " $component_lib_dir " /app /usr/lib /usr/lib64)
21+ fi
22+ # Exclude /run from search
1523 mkdir -p " ${FLATPAK_DEST} /lib/"
1624
1725 lib_list=" $1 "
@@ -24,21 +32,58 @@ search_libs() {
2432 # Load libraries from the provided list
2533 log d " 🔍 Searching for libraries from: \" $lib_list \" ..." " $logfile "
2634 mapfile -t all_libs < <( grep -v ' ^\s*#' " $lib_list " | sort -u)
35+
36+ # Load filtered patterns from filtered_libs.txt
37+ local filtered_libs_file=" $( dirname " $0 " ) /../filtered_libs.txt"
38+ local filtered_patterns=()
39+ if [[ -f " $filtered_libs_file " ]]; then
40+ while IFS= read -r line; do
41+ [[ -z " $line " || " $line " =~ ^[[:space:]]* # ]] && continue
42+ filtered_patterns+= (" $line " )
43+ done < " $filtered_libs_file "
44+ fi
2745 log i " 📦 Loaded ${# all_libs[@]} libraries from list" " $logfile "
2846
2947 need_to_debug= false
3048 not_found_libs= ()
3149
3250 for lib in " ${all_libs[@]} " ; do
51+ # Salta la ricerca se la libreria è filtrata
52+ local is_filtered=false
53+ for pattern in " ${filtered_patterns[@]} " ; do
54+ if [[ " $lib " == $pattern ]]; then
55+ echo " ⏭️ Skipping $lib as it's filtered in filtered_libs.txt"
56+ is_filtered=true
57+ break
58+ fi
59+ done
60+ if [[ " $is_filtered " == true ]]; then
61+ continue
62+ fi
3363 # Check if library is already present in artifacts (from AppImage extraction)
3464 if [[ -f " ${FLATPAK_DEST} /lib/$lib " ]]; then
3565 echo " 📦 Using native library from component: $lib (skipping external copy)"
3666 continue
3767 fi
38-
39- path=$( find " ${SEARCH_PATHS[@]} " -type f -name " $lib " 2> /dev/null | head -n 1)
68+ echo " [DEBUG] Searching for $lib in paths:"
69+ for search_path in " ${SEARCH_PATHS[@]} " ; do
70+ echo " - $search_path "
71+ done
72+ path=$( find " ${SEARCH_PATHS[@]} " -type f -name " $lib " \
73+ ! -path " /run/*" \
74+ ! -path " /home/*" \
75+ ! -path " /tmp/*" 2> /dev/null | tee /tmp/search_libs_debug.log | head -n 1)
76+ if [ -n " $path " ]; then
77+ echo " [DEBUG] Found $lib at: $path "
78+ fi
4079 if [ -z " $path " ]; then
41- path=$( find " ${SEARCH_PATHS[@]} " -type f -iname " *$lib *" 2> /dev/null | head -n 1)
80+ path=$( find " ${SEARCH_PATHS[@]} " -type f -iname " *$lib *" \
81+ ! -path " /run/*" \
82+ ! -path " /home/*" \
83+ ! -path " /tmp/*" 2> /dev/null | tee -a /tmp/search_libs_debug.log | head -n 1)
84+ if [ -n " $path " ]; then
85+ echo " [DEBUG] Found $lib (variant) at: $path "
86+ fi
4287 if [ -z " $path " ]; then
4388 # Special handling: if libopenh264.so.7 is requested, create symlink from .2.5.1 if available
4489 if [ " $lib " == " libopenh264.so.7" ] && [ -f " ${FLATPAK_DEST} /lib/libopenh264.so.2.5.1" ]; then
@@ -51,7 +96,6 @@ search_libs() {
5196 continue
5297 fi
5398 fi
54-
5599 dest=" ${FLATPAK_DEST} /lib/$( basename " $path " ) "
56100 if [ " $path " != " $dest " ]; then
57101 cp -fL " $path " " ${FLATPAK_DEST} /lib/"
0 commit comments