commit f59a4f85dbbe820e4dfe12437941dd5c6880f2db
parent 6c203403384724ada56be494fc1c7922e11a3166
Author: ghost43 <somber.night@protonmail.com>
Date: Sun, 9 Dec 2018 05:09:28 +0100
win/mac build: strip parts of pyqt5 from binaries to reduce size (#4901)
When bumping pyinstaller to 3.4, binary sizes had increased drastically.
The main reason seems to be that pyinstaller is pulling in "all" of qt.
based on Electron-Cash/Electron-Cash@4b0996959420dfca3d53f178d86205616d8c568b
Diffstat:
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/contrib/build-wine/deterministic.spec b/contrib/build-wine/deterministic.spec
@@ -78,6 +78,24 @@ for d in a.datas:
a.datas.remove(d)
break
+# Strip out parts of Qt that we never use. Reduces binary size by tens of MBs. see #4815
+qt_bins2remove=('qt5web', 'qt53d', 'qt5game', 'qt5designer', 'qt5quick',
+ 'qt5location', 'qt5test', 'qt5xml', r'pyqt5\qt\qml\qtquick')
+print("Removing Qt binaries:", *qt_bins2remove)
+for x in a.binaries.copy():
+ for r in qt_bins2remove:
+ if x[0].lower().startswith(r):
+ a.binaries.remove(x)
+ print('----> Removed x =', x)
+
+qt_data2remove=(r'pyqt5\qt\translations\qtwebengine_locales', )
+print("Removing Qt datas:", *qt_data2remove)
+for x in a.datas.copy():
+ for r in qt_data2remove:
+ if x[0].lower().startswith(r):
+ a.datas.remove(x)
+ print('----> Removed x =', x)
+
# hotfix for #3171 (pre-Win10 binaries)
a.binaries = [x for x in a.binaries if not x[1].lower().startswith(r'c:\windows')]
diff --git a/contrib/osx/osx.spec b/contrib/osx/osx.spec
@@ -81,6 +81,15 @@ for d in a.datas:
a.datas.remove(d)
break
+# Strip out parts of Qt that we never use. Reduces binary size by tens of MBs. see #4815
+qt_bins2remove=('qtweb', 'qt3d', 'qtgame', 'qtdesigner', 'qtquick', 'qtlocation', 'qttest', 'qtxml')
+print("Removing Qt binaries:", *qt_bins2remove)
+for x in a.binaries.copy():
+ for r in qt_bins2remove:
+ if x[0].lower().startswith(r):
+ a.binaries.remove(x)
+ print('----> Removed x =', x)
+
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(pyz,