Browse Source

build appimage: make binary somewhat smaller by excluding stuff

4.1.5->4.2.1, the appimage grew 54M->66M. This change shrinks it back to 58M.
```
$ ls -lah
total 224M
drwxrwxr-x  5 user user 4.0K Mar 27 18:18 .
drwxrwxr-x 16 user user 4.0K Mar 23 16:02 ..
-rwxrw-r--  1 user user  48M Dec 18  2020 electrum-4.0.9-x86_64.AppImage
-rwxrw-r--  1 user user  54M Jan 19 14:25 electrum-4.1.5-x86_64.AppImage
-rwxr-xr-x  1 user user  58M Mar 27 18:12 electrum-4.2.1-dirty-x86_64.AppImage
-rwxrw-r--  1 user user  66M Mar 27 15:00 electrum-4.2.1-x86_64.AppImage
```
I've used the great `ncdu` tool to investigate file sizes.
```
$ du squashfs-root-415/usr/lib/python3.7/ --max-depth=1 | sort -nr | head -n8
154608	squashfs-root-415/usr/lib/python3.7/
138864	squashfs-root-415/usr/lib/python3.7/site-packages
4720	squashfs-root-415/usr/lib/python3.7/lib-dynload
1744	squashfs-root-415/usr/lib/python3.7/encodings
664	squashfs-root-415/usr/lib/python3.7/pydoc_data
460	squashfs-root-415/usr/lib/python3.7/distutils
460	squashfs-root-415/usr/lib/python3.7/asyncio
436	squashfs-root-415/usr/lib/python3.7/email

$ du squashfs-root-421/usr/lib/python3.9/ --max-depth=1 | sort -nr | head -n8
194088	squashfs-root-421/usr/lib/python3.9/
143512	squashfs-root-421/usr/lib/python3.9/site-packages
33824	squashfs-root-421/usr/lib/python3.9/config-3.9-x86_64-linux-gnu
5244	squashfs-root-421/usr/lib/python3.9/lib-dynload
1720	squashfs-root-421/usr/lib/python3.9/encodings
696	squashfs-root-421/usr/lib/python3.9/pydoc_data
520	squashfs-root-421/usr/lib/python3.9/asyncio
464	squashfs-root-421/usr/lib/python3.9/distutils
```
We should delete `usr/lib/python3.9/config-3.9-x86_64-linux-gnu/` (which is 33M unpacked)
With py3.7 (electrum 4.1.5), this folder was named `config-3.7m-x86_64-linux-gnu`,
presumably because the default config to compile py3.7 was `--with-pymalloc`,
but maybe it is not for py3.9... ? not sure. (see https://peps.python.org/pep-3149/ )
patch-4
SomberNight 3 years ago
parent
commit
634611272a
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 2
      contrib/build-linux/appimage/make_appimage.sh

2
contrib/build-linux/appimage/make_appimage.sh

@ -197,7 +197,7 @@ PYDIR="$APPDIR"/usr/lib/python3.9
rm -rf "$PYDIR"/{test,ensurepip,lib2to3,idlelib,turtledemo}
rm -rf "$PYDIR"/{ctypes,sqlite3,tkinter,unittest}/test
rm -rf "$PYDIR"/distutils/{command,tests}
rm -rf "$PYDIR"/config-3.9m-x86_64-linux-gnu
rm -rf "$PYDIR"/config-3.*-x86_64-linux-gnu
rm -rf "$PYDIR"/site-packages/{opt,pip,setuptools,wheel}
rm -rf "$PYDIR"/site-packages/Cryptodome/SelfTest
rm -rf "$PYDIR"/site-packages/{psutil,qrcode,websocket}/tests

Loading…
Cancel
Save