# Find Qt path from search paths - try Qt6 first, then fallback to Qt5
_QT_VERSION=0
for i in ${_SEARCH_PATHS};do
for i in ${_SEARCH_PATHS};do
# Check for Qt6 first
_QT_CORE_LIB=$(find ${i} -type f -regex '.*/libQt6Core\.so.*'| head -n 1)
if[ -n "${_QT_CORE_LIB}"];then
_QT_VERSION=6
_QT_PATH=$(dirname ${_QT_CORE_LIB})/../
echo"Found Qt6 at ${_QT_PATH}"
break
fi
# Fallback to Qt5
_QT_CORE_LIB=$(find ${i} -type f -regex '.*/libQt5Core\.so.*'| head -n 1)
_QT_CORE_LIB=$(find ${i} -type f -regex '.*/libQt5Core\.so.*'| head -n 1)
if[ -n "${_QT_CORE_LIB}"];then
if[ -n "${_QT_CORE_LIB}"];then
_QT_VERSION=5
_QT_PATH=$(dirname ${_QT_CORE_LIB})/../
_QT_PATH=$(dirname ${_QT_CORE_LIB})/../
echo"Found Qt5 at ${_QT_PATH}"
break
break
fi
fi
done
done
_QT_PLUGIN_PATH=$(readlink -e $(find ${_QT_PATH} -type d -regex '.*/plugins/platforms'| head -n 1)/../)
for i in audio bearer imageformats mediaservice platforminputcontexts platformthemes xcbglintegrations platforms wayland-decoration-client wayland-graphics-integration-client wayland-graphics-integration-server wayland-shell-integration;do
echo"WARNING: Could not find Qt${_QT_VERSION} plugin directory. Skipping plugin deployment."
else
# Process Qt plugins
for i in audio bearer imageformats mediaservice platforminputcontexts platformthemes xcbglintegrations platforms wayland-decoration-client wayland-graphics-integration-client wayland-graphics-integration-server wayland-shell-integration;do
if[ -d "${_QT_PLUGIN_PATH}/${i}"];then
mkdir -p ${LIB_DIR}/../plugins/${i}
cp -rnv ${_QT_PLUGIN_PATH}/${i}/*.so ${LIB_DIR}/../plugins/${i}||echo"No Qt plugins found in ${i}"
find ${LIB_DIR}/../plugins/ -type f -regex '.*\.so' -exec patchelf --set-rpath '$ORIGIN/../../lib:$ORIGIN'{}';'
# Find any remaining libraries needed for Qt plugins