@ -17,7 +17,9 @@
#~ set -x
export _PREFIX = "/usr"
export _LIB_DIRS = "lib64 lib"
export _QT_PLUGIN_PATH = " ${ _PREFIX } /lib64/qt5/plugins "
# Changed to support both Qt5 and Qt6 plugin directories
export _QT5_PLUGIN_PATH = " ${ _PREFIX } /lib64/qt5/plugins "
export _QT6_PLUGIN_PATH = " ${ _PREFIX } /lib64/qt6/plugins "
export _EXCLUDES = " ld-linux.so.2 ld-linux-x86-64.so.2 libanl.so.1 libBrokenLocale.so.1 libcidn.so.1 \
libc.so.6 libdl.so.2 libm.so.6 libmvec.so.1 libnss_compat.so.2 libnss_dns.so.2 libnss_files.so.2 \
libnss_hesiod.so.2 libnss_nisplus.so.2 libnss_nis.so.2 libpthread.so.0 libresolv.so.2 librt.so.1 \
@ -112,25 +114,94 @@ mkdir -p $LIB_DIR
_NOT_FOUND = $( get_deps $_EXECUTABLE $LIB_DIR )
if [ " ${ DEPLOY_QT } " = = "1" ] ; then
# Find Qt path from search paths
# Find Qt path from search paths - try Qt6 first, then fallback to Qt5
_QT_VERSION = 0
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)
if [ -n " ${ _QT_CORE_LIB } " ] ; then
_QT_VERSION = 5
_QT_PATH = $( dirname ${ _QT_CORE_LIB } ) /../
echo " Found Qt5 at ${ _QT_PATH } "
break
fi
done
_QT_PLUGIN_PATH = $( readlink -e $( find ${ _QT_PATH } -type d -regex '.*/plugins/platforms' | head -n 1) /../)
if [ " ${ _QT_VERSION } " -eq 0 ] ; then
echo "WARNING: No Qt libraries found. Continuing without Qt deployment."
else
# Find plugin directory with multiple search strategies
_QT_PLUGIN_CANDIDATES = ( )
# Try standard plugin paths first
_QT_PLUGIN_CANDIDATES += ( " ${ _QT_PATH } /plugins " )
_QT_PLUGIN_CANDIDATES += ( " ${ _QT_PATH } /qt ${ _QT_VERSION } /plugins " )
# Try platform-specific paths next
if [ " ${ _QT_VERSION } " -eq 6 ] ; then
_QT_PLUGIN_CANDIDATES += ( " ${ _PREFIX } /lib64/qt6/plugins " )
_QT_PLUGIN_CANDIDATES += ( " ${ _PREFIX } /lib/qt6/plugins " )
else
_QT_PLUGIN_CANDIDATES += ( " ${ _PREFIX } /lib64/qt5/plugins " )
_QT_PLUGIN_CANDIDATES += ( " ${ _PREFIX } /lib/qt5/plugins " )
fi
# Look for the plugins/platforms directory to find the plugin root
for candidate in " ${ _QT_PLUGIN_CANDIDATES [@] } " ; do
if [ -d " ${ candidate } /platforms " ] ; then
_QT_PLUGIN_PATH = " ${ candidate } "
echo " Found Qt ${ _QT_VERSION } plugin directory at ${ _QT_PLUGIN_PATH } "
break
fi
done
# If not found using the above method, try finding it by searching for platforms directory
if [ -z " ${ _QT_PLUGIN_PATH } " ] ; then
_PLATFORMS_DIR = $( find ${ _QT_PATH } -type d -regex '.*/plugins/platforms' | head -n 1)
if [ -n " ${ _PLATFORMS_DIR } " ] ; then
_QT_PLUGIN_PATH = $( dirname ${ _PLATFORMS_DIR } )
echo " Found Qt plugin directory via platforms subdirectory at ${ _QT_PLUGIN_PATH } "
fi
fi
# If still not found, try using platform-specific default paths
if [ -z " ${ _QT_PLUGIN_PATH } " ] ; then
if [ " ${ _QT_VERSION } " -eq 6 ] ; then
if [ -d " ${ _QT6_PLUGIN_PATH } " ] ; then
_QT_PLUGIN_PATH = " ${ _QT6_PLUGIN_PATH } "
echo " Using default Qt6 plugin path: ${ _QT_PLUGIN_PATH } "
fi
else
if [ -d " ${ _QT5_PLUGIN_PATH } " ] ; then
_QT_PLUGIN_PATH = " ${ _QT5_PLUGIN_PATH } "
echo " Using default Qt5 plugin path: ${ _QT_PLUGIN_PATH } "
fi
fi
fi
if [ -z " ${ _QT_PLUGIN_PATH } " ] ; then
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 }
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 libraries
_NOT_FOUND += $( find ${ LIB_DIR } /../plugins/${ i } -type f -exec bash -c " get_deps {} $LIB_DIR " ';' )
# Find any remaining libraries needed for Qt plugins
_NOT_FOUND += $( find ${ LIB_DIR } /../plugins/${ i } -type f -exec bash -c " get_deps {} $LIB_DIR " ';' 2>/dev/null || echo "" )
fi
done
# Create qt.conf
_QT_CONF = ${ LIB_DIR } /../bin/qt.conf
echo "[Paths]" > ${ _QT_CONF }
echo "Prefix = ../" >> ${ _QT_CONF }
@ -138,6 +209,8 @@ if [ "${DEPLOY_QT}" == "1" ]; then
echo "Imports = qml" >> ${ _QT_CONF }
echo "Qml2Imports = qml" >> ${ _QT_CONF }
fi
fi
fi
# Fix rpath of libraries and executable so they can find the packaged libraries
find ${ LIB_DIR } -type f -exec patchelf --set-rpath '$ORIGIN' { } ';'
@ -146,8 +219,8 @@ patchelf --set-rpath '$ORIGIN/../lib' $_EXECUTABLE
_APPDIR = $2
cd ${ _APPDIR }
cp -nvs $( find -type f -regex '.*/icons/.*\.svg' || head -n 1) ./
cp -nvs $( find -type f -regex '.*/applications/.*\.desktop' || head -n 1) ./
cp -nvs $( find -type f -regex '.*/icons/.*\.svg' 2>/dev/null || echo "" ) ./ || echo "No SVG icons found"
cp -nvs $( find -type f -regex '.*/applications/.*\.desktop' 2>/dev/null || echo "" ) ./ || echo "No desktop files found"
if [ " ${ _NOT_FOUND } " != "" ] ; then
>& 2 echo "WARNING: failed to find the following libraries:"