Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimized Appimage Size #130

Closed
Paullux opened this issue May 18, 2021 · 1 comment
Closed

Optimized Appimage Size #130

Paullux opened this issue May 18, 2021 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@Paullux
Copy link

Paullux commented May 18, 2021

My project is : https://github.com/handyopensource/dvkbuntu-easy-menu-qt/tree/Am%C3%A9lioration_et_vers_Appimage (this branch)

I would like optimized my recipe and my appimage, can you help me ? now the appimage size is 400 Mo.

# appimage-builder recipe see https://appimage-builder.readthedocs.io for details
version: 1
script: |
    # remove any existent binaries
    rm -rf AppDir | true

    # compile and install binaries into AppDir
    cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
    make install DESTDIR=AppDir
AppDir:
  path: ./AppDir
  app_info:
    id: dvkbuntu-easy-menu
    name: Easy menu
    icon: dvkbuntu-easy-menu
    version: '4.16'
    exec: usr/bin/dvkbuntu-easy-menu
    exec_args: $@
  runtime:
    env:
      # Disable webengine sandboxing
      QTWEBENGINE_DISABLE_SANDBOX: 1
  apt:
    arch: amd64
    allow_unauthenticated: true
    sources:
    - sourceline: deb http://fr.archive.ubuntu.com/ubuntu/ hirsute main restricted
    - sourceline: deb http://fr.archive.ubuntu.com/ubuntu/ hirsute-updates main restricted
    - sourceline: deb http://fr.archive.ubuntu.com/ubuntu/ hirsute universe
    - sourceline: deb http://fr.archive.ubuntu.com/ubuntu/ hirsute-updates universe
    - sourceline: deb http://fr.archive.ubuntu.com/ubuntu/ hirsute multiverse
    - sourceline: deb http://fr.archive.ubuntu.com/ubuntu/ hirsute-updates multiverse
    - sourceline: deb http://fr.archive.ubuntu.com/ubuntu/ hirsute-backports main
        restricted universe multiverse
    - sourceline: deb http://security.ubuntu.com/ubuntu hirsute-security main restricted
    - sourceline: deb http://security.ubuntu.com/ubuntu hirsute-security universe
    - sourceline: deb http://security.ubuntu.com/ubuntu hirsute-security multiverse
    include:
    - kimageformat-plugins
    - libpcre2-8-0
    - tzdata
    - qt5-gtk-platformtheme
    - libpci3
    - libxshmfence1
    - libxrender1
    - libxdmcp6
    - libxxf86vm1
    - gstreamer1.0-x
    - qttranslations5-l10n
    - kde-style-breeze
    - libxfixes3
    - gstreamer1.0-plugins-bad
    - plasma-integration
    - liblz4-1
    - gstreamer1.0-plugins-base
    - qtwayland5
    - qt5-image-formats-plugins
    - libfam0
    - libxv1
    - libqt5webenginewidgets5
    - libxext6
    - libsm6
    - libxcb-xinerama0
    - libc-bin
    - qtspeech5-flite-plugin
    - libdebuginfod1
    - plasma-workspace-data
    - libjpeg-turbo8
    - kde-style-oxygen-qt5
    - qtspeech5-speechd-plugin
    - libxrandr2
    - libxcb-xkb1
    - libqt5multimedia5-plugins
    - libsystemd0
    - libxcb-sync1
    - libxcb-render-util0
    - kubuntu-settings-desktop
    - libxtst6
    - qtvirtualkeyboard-plugin
    - breeze-cursor-theme
    - language-selector-common
    - libunwind8
    - hwdata
    - gstreamer1.0-plugins-good
    - language-pack-fr-base
    exclude: []
  files:
    include: []
    exclude:
    - usr/share/man
    - usr/share/doc/*/README.*
    - usr/share/doc/*/changelog.*
    - usr/share/doc/*/NEWS.*
    - usr/share/doc/*/TODO.*
  test:
    fedora:
      image: appimagecrafters/tests-env:fedora-30
      command: ./AppRun
      use_host_x: true
    debian:
      image: appimagecrafters/tests-env:debian-stable
      command: ./AppRun
      use_host_x: true
    arch:
      image: appimagecrafters/tests-env:archlinux-latest
      command: ./AppRun
      use_host_x: true
    centos:
      image: appimagecrafters/tests-env:centos-7
      command: ./AppRun
      use_host_x: true
    ubuntu:
      image: appimagecrafters/tests-env:ubuntu-xenial
      command: ./AppRun
      use_host_x: true
AppImage:
  arch: x86_64
  update-information: guess
  sign-key: None
@azubieta
Copy link
Contributor

azubieta commented May 18, 2021

The original recipes are usually huge because half of your desktop environment gets embed. This happens because at runtime some style plugins are loaded and those plugins depend on the rest of the DE. Those packages are not excluded by default because some users may need them.

Here is an initial check list for packages to remove:

  • desktop environment packages (in your case plasma and kde packages)
  • icons (your app is capable of using the icons from the system icon theme, therefore you will not need to embed 40mb of icons)
  • fonts (while fonts doesn't consume too much space it's safe to remove them too)

After you remove those the size of the bundle should be reduced considerably. In some cases when you remove a package from the include list it may not be removed from the final bundle because it's a dependency of other package. You can use the AppDir > apt > exclude section to force it.

Also notice that there is a file inside your bundle named .bundle.yml which contains the whole list of packages deployed. You may want to inspect it for additional optimization opportunities.

Remember to always run the tests after modifying the included packages.

@azubieta azubieta added question Further information is requested documentation Improvements or additions to documentation and removed question Further information is requested labels May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants