name: telegram-desktop adopt-info: telegram icon: Telegram/Resources/art/icon512@2x.png base: core20 grade: stable confinement: strict architectures: - build-on: amd64 - build-on: arm64 - build-on: armhf - build-on: ppc64el apps: telegram-desktop: command: bin/desktop-launch telegram-desktop common-id: org.telegram.desktop desktop: usr/share/applications/telegram-desktop_telegram-desktop.desktop environment: # Tell glib to use portals on file associations handling. GTK_USE_PORTAL: 1 plugs: - alsa - audio-playback - audio-record - camera - desktop - desktop-legacy - home - network - network-manager-observe - opengl - pulseaudio - removable-media - unity7 - wayland - x11 plugs: # Support for common GTK themes # https://forum.snapcraft.io/t/how-to-use-the-system-gtk-theme-via-the-gtk-common-themes-snap/6235 gsettings: gtk-3-themes: interface: content target: $SNAP/data-dir/themes default-provider: gtk-common-themes icon-themes: interface: content target: $SNAP/data-dir/icons default-provider: gtk-common-themes sound-themes: interface: content target: $SNAP/data-dir/sounds default-provider: gtk-common-themes layout: /usr/share/alsa: bind: $SNAP/usr/share/alsa /usr/share/X11: bind: $SNAP/usr/share/X11 parts: telegram: plugin: cmake source: . source-type: git parse-info: [usr/share/metainfo/telegram-desktop_telegram-desktop.appdata.xml] build-packages: - python - qtbase5-private-dev - libasound2-dev - libglib2.0-dev - libgtk-3-dev - liblzma-dev - libopus-dev - libpulse-dev - libqt5svg5-dev - libqt5waylandclient5-dev - libssl-dev - libxcb1-dev - libxcb-screensaver0-dev - zlib1g-dev stage-packages: - qt5-image-formats-plugins - qtwayland5 - libasound2 - libgtk-3-0 - liblzma5 - libopus0 - libpulse0 - libqt5svg5 - libqt5waylandclient5 - libssl1.1 - libxcb1 - libxcb-screensaver0 - zlib1g cmake-parameters: - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_INSTALL_PREFIX=/usr - -DTDESKTOP_API_ID=611335 - -DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c - -DDESKTOP_APP_USE_PACKAGED_LAZY=ON - -DDESKTOP_APP_QTWAYLANDCLIENT_PRIVATE_HEADERS=$SNAPCRAFT_STAGE/usr/include/$SNAPCRAFT_ARCH_TRIPLET/qt5/QtWaylandClient/5.12.8 - -DTDESKTOP_LAUNCHER_BASENAME=telegram-desktop_telegram-desktop override-pull: | snapcraftctl pull version_file=Telegram/build/version version=$(sed -n "s/AppVersionStr[ ]\+\(.*\)\+/\1/p" $version_file) beta=$(sed -n "s/BetaChannel[ ]\+\(.*\)\+/\1/p" $version_file) if [ "$beta" != "0" ]; then version="$version-beta" fi version="${version}$(git describe --tags | sed 's,^v[^-]\+,,')" snapcraftctl set-version "$version" sed -i 's|^Icon=.*|Icon=${SNAP}/meta/gui/icon.png|g' lib/xdg/telegramdesktop.desktop override-build: | snapcraftctl build rm -rf "$SNAPCRAFT_PART_INSTALL/usr/share/icons" stage: - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libjpeg.so.8.2.2 after: - desktop-qt5 - ffmpeg - mozjpeg - openal - qtwayland - webrtc desktop-qt5: source: https://github.com/ubuntu/snapcraft-desktop-helpers.git source-subdir: qt plugin: make make-parameters: ["FLAVOR=qt5"] build-packages: - build-essential - qtbase5-dev - dpkg-dev stage-packages: - libxkbcommon0 - ttf-ubuntu-font-family - dmz-cursor-theme - light-themes - adwaita-icon-theme - gnome-themes-standard - shared-mime-info - libqt5gui5 - libgdk-pixbuf2.0-0 - libqt5svg5 # for loading icon themes which are svg - try: [appmenu-qt5] # not available on core18 - locales-all - xdg-user-dirs - fcitx-frontend-qt5 stage: - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libjpeg.so.8.2.2 after: - mozjpeg qt5-xdgdesktopportal-platform: plugin: nil stage-packages: - qt5-xdgdesktopportal-platformtheme stage: - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libjpeg.so.8.2.2 after: - mozjpeg # Qt checks that ibus-daemon binary is present, otherwise doesn't work ibus: plugin: nil stage-packages: - ibus stage: - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libjpeg.so.8.2.2 after: - mozjpeg ffmpeg: plugin: nil build-packages: - libavcodec-dev - libavformat-dev - libavutil-dev - libswresample-dev - libswscale-dev stage-packages: - libavcodec58 - libavformat58 - libavutil56 - libswresample3 - libswscale5 stage: - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libjpeg.so.8.2.2 after: - mozjpeg mozjpeg: source: https://github.com/mozilla/mozjpeg.git source-depth: 1 source-tag: v4.0.1-rc2 plugin: cmake cmake-parameters: - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_INSTALL_PREFIX=/usr - -DENABLE_STATIC=OFF - -DWITH_JPEG8=ON - -DPNG_SUPPORTED=OFF prime: - -./usr/bin - -./usr/include - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pkgconfig - -./usr/share openal: source: https://github.com/kcat/openal-soft.git source-depth: 1 source-tag: openal-soft-1.20.1 plugin: cmake build-packages: - libasound2-dev - libpulse-dev - libsndio-dev - portaudio19-dev stage-packages: - libasound2 - libpulse0 - libportaudio2 - libsndio7.0 cmake-parameters: - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_INSTALL_PREFIX=/usr - -DALSOFT_EXAMPLES=OFF - -DALSOFT_TESTS=OFF - -DALSOFT_UTILS=OFF - -DALSOFT_CONFIG=OFF prime: - -./usr/include - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/cmake - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pkgconfig qtwayland: source: https://github.com/qt/qtwayland.git source-depth: 1 source-tag: v5.12.8 plugin: dump override-build: | qmake make -j$(nproc) make INSTALL_ROOT="$SNAPCRAFT_PART_INSTALL" install stage: [-./usr/lib] prime: [-./*] after: - desktop-qt5 webrtc: source: https://github.com/desktop-app/tg_owt.git source-depth: 1 source-commit: 12f4a27f2f02f9dd40f9891d8ec6e58bc1ff5263 plugin: cmake build-packages: - yasm - libopus-dev - libssl-dev stage-packages: - libopus0 - libssl1.1 cmake-parameters: - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_INSTALL_PREFIX=/usr - -DBUILD_SHARED_LIBS=OFF - -DJPEG_LIBRARY_RELEASE=$SNAPCRAFT_STAGE/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libjpeg.so - -DJPEG_INCLUDE_DIR=$SNAPCRAFT_STAGE/usr/include prime: [-./*] after: - ffmpeg - mozjpeg