Skip to content

Commit

Permalink
remove more Qt libs on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
MAKOMO committed Sep 19, 2024
1 parent 683c650 commit 9ca4fcc
Showing 1 changed file with 27 additions and 33 deletions.
60 changes: 27 additions & 33 deletions src/build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,52 +127,46 @@ mkdir dist/Icons
find includes/Icons -name '.*.aset' -exec rm -r {} \;
cp -R includes/Icons/* dist/Icons

# remove automatically collected PyQt6 libs that are not used to save space
# with pyinstaller 6.0 it seems not to needed any longer to remove unused Qt libs:
#keep_qt_modules="libQt6Core libQt6Gui libQt6Widgets libQt6Svg libQt6PrintSupport
# libQt6Network libQt6DBus libQt6Bluetooth libQt6Concurrent libQt6WebEngineWidgets
# libQt6WebEngineCore libQt6WebEngine libQt6Quick libQt6QuickWidgets libQt6Qml
# libQt6QmlModels libQt6WebChannel libQt6Positioning libQt6OpenGL libQt6WaylandClient"
#
#for qtlib in dist/_internal/libQt6*.so.*; do
# match=0
# for item in ${keep_qt_modules}; do
# if [ ${qtlib} = dist/_internal/${item}.so.* ]; then
# match=1
# break
# fi
# done
# if [ $match = 0 ]; then
## rm -f ${qtlib}
# echo ${qtlib}
# fi
#done

# remove unused Qt modules

keep_qt_modules="libQt6Bluetooth libQt6Concurrent libQt6Core libQt6DBus libQt6Gui libQt6Network
libQt6OpenGL libQt6Positioning libQt6PrintSupport libQt6Qml libQt6QmlModels libQt6Quick libQt6QuickWidgets
libQt6Svg libQt6WaylandClient libQt6WaylandEglClientHwIntegration libQt6WebChannel libQt6WebEngineCore
libQt6WebEngineWidgets libQt6Widgets libQt6WlShellIntegration libQt6XcbQpa"

for qtlib in dist/_internal/libQt6*.so.*; do
match=0
for item in ${keep_qt_modules}; do
if [ ${qtlib} = dist/_internal/${item}.so.* ]; then
match=1
break
fi
done
if [ $match = 0 ]; then
# rm -f ${qtlib}
echo ${qtlib}
fi
done

# remove Qt5 libs
rm -rf dist/_internal/libQt5*
rm -rf dist/_internal/PyQt5

# remove unused Qt modules
##rm -rf dist/_internal/PyQt6/Qt6/lib/libQt6Quick.so.6
##rm -rf dist/_internal/PyQt6/Qt6/lib/libQt6Qml.so.6
##rm -rf dist/_internal/PyQt6/Qt6/lib/libQt6QmlModels.so.6
#rm -rf dist/_internal/PyQt6/Qt6/lib/libQt6Pdf.so.6
##rm -rf dist/_internal/PyQt6/Qt6/lib/libQt6Positioning.so.6
##rm -rf dist/_internal/PyQt6/Qt6/lib/libQt6WebChannel.so.6
## rm -rf dist/_internal/PyQt6/Qt6/lib/libQt6OpenGL.so.6 # (don't remove! No window decorations without this one!)

# remove unused Qt plugins
rm -rf dist/_internal/PyQt6/Qt6/plugins/imageformats/libqwebp.so
rm -rf dist/_internal/PyQt6/Qt6/plugins/imageformats/libqtiff.so
rm -rf dist/_internal/PyQt6/Qt6/plugins/imageformats/libqgif.so
rm -rf dist/_internal/PyQt6/Qt6/plugins/imageformats/libqwbmp.so
rm -rf dist/_internal/PyQt6/Qt6/plugins/imageformats/libqtga.so

qt_imageformats="libqwebp libqtiff libqgif libqwbmp libqtga"
for x in qt_imageformats; do
rm -rf "dist/_internal/PyQt6/Qt6/plugins/imageformats/${x}.so"



SUPPORTED_LANGUAGES="ar da de el en es fa fi fr gd he hu id it ja ko lv nl no pl pt_BR pt sk sv th tr uk vi zh_CN zh_TW"

# remove unused Qt translations

# the following produces a (harmless) warning log entry on generating PDF reports as locales cannot be found
rm -rf dist/_internal/PyQt6/Qt6/translations/qtwebengine_locales

for qttrans in $(find dist/_internal/PyQt6/Qt6/translations -type f -name "*.qm"); do
Expand Down

0 comments on commit 9ca4fcc

Please sign in to comment.