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/telegramdesktop.desktop environment: # Use GTK3 cursor theme, icon theme and open/save file dialogs. QT_QPA_PLATFORMTHEME: gtk3 plugs: - alsa - audio-playback - audio-record - desktop - desktop-legacy - home - network - network-manager - 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/telegramdesktop.appdata.xml] build-environment: - LD_LIBRARY_PATH: $SNAPCRAFT_STAGE/usr/lib build-packages: - qtbase5-private-dev - libasound2-dev - libglib2.0-dev - libgtk-3-dev - liblzma-dev - libopus-dev - libpulse-dev - libqt5svg5-dev - libqt5waylandclient5-dev - libqt5x11extras5-dev - libssl-dev - zlib1g-dev stage-packages: - qt5-image-formats-plugins - qtwayland5 - libasound2 - libgtk-3-0 - liblzma5 - libopus0 - libpulse0 - libqt5svg5 - libqt5waylandclient5 - libqt5x11extras5 - libssl1.1 - 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_USE_PACKAGED_FONTS=OFF - -DTDESKTOP_USE_GTK_FILE_DIALOG=ON - -DDESKTOP_APP_QTWAYLANDCLIENT_PRIVATE_HEADERS=$SNAPCRAFT_STAGE/usr/include/$SNAPCRAFT_ARCH_TRIPLET/qt5/QtWaylandClient/5.12.8 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=/usr/share/icons/hicolor/512x512/apps/telegram.png|g' lib/xdg/telegramdesktop.desktop after: - desktop-qt5 - ffmpeg - openal - qtwayland 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 qt5-xdgdesktopportal-platform: plugin: nil stage-packages: - qt5-xdgdesktopportal-platformtheme # Qt checks that ibus-daemon binary is present, otherwise doesn't work ibus: plugin: nil stage-packages: - ibus dav1d: source: https://github.com/videolan/dav1d.git source-depth: 1 source-tag: 0.6.0 plugin: meson build-packages: - nasm meson-parameters: - --prefix=/usr - --libdir=lib - -Denable_tools=false - -Denable_tests=false prime: - -./usr/include - -./usr/lib/pkgconfig ffmpeg: source: https://github.com/FFmpeg/FFmpeg.git source-depth: 1 source-branch: release/4.3 plugin: autotools build-packages: - nasm - libopus-dev - libva-dev - libvdpau-dev stage-packages: - libopus0 - libva2 - libva-drm2 - libvdpau1 autotools-configure-parameters: - --prefix=/usr - --disable-static - --disable-debug - --disable-programs - --disable-doc - --disable-network - --disable-autodetect - --disable-everything - --disable-neon - --disable-alsa - --disable-iconv - --enable-shared - --enable-libdav1d - --enable-libopus - --enable-vaapi - --enable-vdpau - --enable-protocol=file - --enable-hwaccel=h264_vaapi - --enable-hwaccel=h264_vdpau - --enable-hwaccel=mpeg4_vaapi - --enable-hwaccel=mpeg4_vdpau - --enable-decoder=aac - --enable-decoder=aac_fixed - --enable-decoder=aac_latm - --enable-decoder=aasc - --enable-decoder=alac - --enable-decoder=flac - --enable-decoder=gif - --enable-decoder=h264 - --enable-decoder=hevc - --enable-decoder=libdav1d - --enable-decoder=mp1 - --enable-decoder=mp1float - --enable-decoder=mp2 - --enable-decoder=mp2float - --enable-decoder=mp3 - --enable-decoder=mp3adu - --enable-decoder=mp3adufloat - --enable-decoder=mp3float - --enable-decoder=mp3on4 - --enable-decoder=mp3on4float - --enable-decoder=mpeg4 - --enable-decoder=msmpeg4v2 - --enable-decoder=msmpeg4v3 - --enable-decoder=opus - --enable-decoder=pcm_alaw - --enable-decoder=pcm_f32be - --enable-decoder=pcm_f32le - --enable-decoder=pcm_f64be - --enable-decoder=pcm_f64le - --enable-decoder=pcm_lxf - --enable-decoder=pcm_mulaw - --enable-decoder=pcm_s16be - --enable-decoder=pcm_s16be_planar - --enable-decoder=pcm_s16le - --enable-decoder=pcm_s16le_planar - --enable-decoder=pcm_s24be - --enable-decoder=pcm_s24daud - --enable-decoder=pcm_s24le - --enable-decoder=pcm_s24le_planar - --enable-decoder=pcm_s32be - --enable-decoder=pcm_s32le - --enable-decoder=pcm_s32le_planar - --enable-decoder=pcm_s64be - --enable-decoder=pcm_s64le - --enable-decoder=pcm_s8 - --enable-decoder=pcm_s8_planar - --enable-decoder=pcm_u16be - --enable-decoder=pcm_u16le - --enable-decoder=pcm_u24be - --enable-decoder=pcm_u24le - --enable-decoder=pcm_u32be - --enable-decoder=pcm_u32le - --enable-decoder=pcm_u8 - --enable-decoder=pcm_zork - --enable-decoder=vorbis - --enable-decoder=wavpack - --enable-decoder=wmalossless - --enable-decoder=wmapro - --enable-decoder=wmav1 - --enable-decoder=wmav2 - --enable-decoder=wmavoice - --enable-encoder=libopus - --enable-parser=aac - --enable-parser=aac_latm - --enable-parser=flac - --enable-parser=h264 - --enable-parser=hevc - --enable-parser=mpeg4video - --enable-parser=mpegaudio - --enable-parser=opus - --enable-parser=vorbis - --enable-demuxer=aac - --enable-demuxer=flac - --enable-demuxer=gif - --enable-demuxer=h264 - --enable-demuxer=hevc - --enable-demuxer=m4v - --enable-demuxer=mov - --enable-demuxer=mp3 - --enable-demuxer=ogg - --enable-demuxer=wav - --enable-muxer=ogg - --enable-muxer=opus prime: - -./usr/include - -./usr/lib/pkgconfig after: - dav1d 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/cmake - -./usr/lib/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 after: - desktop-qt5 stage: [-./usr/lib] prime: [-./*]