name: telegram-desktop adopt-info: telegram icon: Telegram/Resources/art/icon512@2x.png base: core22 grade: stable confinement: strict compression: lzo architectures: - build-on: amd64 - build-on: arm64 - build-on: armhf - build-on: ppc64el apps: telegram-desktop: command: usr/bin/telegram-desktop command-chain: - bin/desktop-launch common-id: org.telegram.desktop desktop: usr/share/applications/org.telegram.desktop.desktop autostart: telegram-desktop_telegram-desktop.desktop plugs: - alsa - audio-playback - audio-record - camera - desktop - desktop-legacy - gsettings - hardware-observe - home - network - network-bind - network-status - opengl - removable-media - unity7 - wayland - x11 slots: - mpris hooks: configure: command-chain: - bin/hooks-configure-desktop plugs: - desktop plugs: desktop: mount-host-font-cache: false # Support for common GTK themes # https://forum.snapcraft.io/t/how-to-use-the-system-gtk-theme-via-the-gtk-common-themes-snap/6235 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/pipewire: bind: $SNAP/usr/share/pipewire /usr/share/X11: bind: $SNAP/usr/share/X11 /usr/lib/$CRAFT_ARCH_TRIPLET/gtk-3.0: bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/gtk-3.0 /usr/lib/$CRAFT_ARCH_TRIPLET/pipewire-0.3: bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/pipewire-0.3 /usr/lib/$CRAFT_ARCH_TRIPLET/spa-0.2: bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/spa-0.2 /usr/lib/$CRAFT_ARCH_TRIPLET/webkit2gtk-4.1: bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/webkit2gtk-4.1 package-repositories: - type: apt ppa: kisak/kisak-mesa parts: telegram: plugin: cmake source: . source-type: git parse-info: [usr/share/metainfo/org.telegram.desktop.metainfo.xml] build-environment: - LD_LIBRARY_PATH: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} - LDFLAGS: ${LDFLAGS:+$LDFLAGS} -s build-packages: - clang - libtool-bin - python3 - libasound2-dev - libavif-dev - libboost-program-options-dev - libfmt-dev - libgirepository1.0-dev - libheif-dev - libopus-dev - libpulse-dev - libssl-dev - libwayland-dev - libxcb1-dev - libxcb-keysyms1-dev - libxcb-record0-dev - libxcb-screensaver0-dev - zlib1g-dev stage-packages: - libasound2 - libavif13 - libheif1 - libopus0 - libpulse0 - libssl3 - libwayland-client0 - libwebkit2gtk-4.1-0 - libxcb1 - libxcb-keysyms1 - libxcb-record0 - libxcb-screensaver0 - zlib1g - glib-networking - systemd cmake-generator: Ninja cmake-parameters: - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_INSTALL_PREFIX=/usr - -DTDESKTOP_API_ID=611335 - -DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c - -DDESKTOP_APP_USE_PACKAGED_LAZY=ON override-pull: | craftctl default 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[^-]\+,,')" craftctl set version="$version" sed -i 's|^Icon=telegram$|Icon=${SNAP}/meta/gui/icon.png|g' lib/xdg/org.telegram.desktop.desktop override-build: | craftctl default rm -rf "$CRAFT_PART_INSTALL/usr/share/icons" stage: - -./usr/lib/$CRAFT_ARCH_TRIPLET/libjpeg.so.8.2.2 prime: - -./lib/systemd after: - ffmpeg - libjxl - glibmm - mozjpeg - openal - protobuf - qt - rnnoise - webrtc patches: source: https://github.com/desktop-app/patches.git source-depth: 1 plugin: dump override-pull: | craftctl default cp -r . "$CRAFT_STAGE/patches" override-prime: | rm -rf patches stage: [-./*] desktop-qt: source: https://github.com/desktop-app/snapcraft-desktop-helpers.git source-subdir: qt plugin: make make-parameters: ["FLAVOR=qt5"] build-environment: - LD_LIBRARY_PATH: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} build-packages: - build-essential - dpkg-dev - gtk-update-icon-cache - libglib2.0-bin - libgtk-3-0 stage-packages: - libc-bin - libgdk-pixbuf-2.0-0 - libxkbcommon0 - locales-all - shared-mime-info - xdg-user-dirs override-prime: | craftctl default update-mime-database usr/share/mime glib-compile-schemas usr/share/glib-2.0/schemas for theme in usr/share/icons/*; do if [ -f "$theme/index.theme" ] && [ ! -f "$theme/icon-theme.cache" ]; then update-icon-caches "$theme" fi done GTK_PATH=$PWD/usr/lib/$CRAFT_ARCH_TRIPLET/gtk-3.0 /usr/lib/$CRAFT_ARCH_TRIPLET/libgtk-3-0/gtk-query-immodules-3.0 > usr/lib/$CRAFT_ARCH_TRIPLET/gtk-3.0/3.0.0/immodules/immodules.cache stage: - -./usr/lib/$CRAFT_ARCH_TRIPLET/libjpeg.so.8.2.2 after: - telegram ffmpeg: plugin: nil build-packages: - libavcodec-dev - libavfilter-dev - libavformat-dev - libavutil-dev - libswresample-dev - libswscale-dev stage-packages: - libavcodec58 - libavfilter7 - libavformat58 - libavutil56 - libswresample3 - libswscale5 override-build: | craftctl default mv "$CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET/blas/"* "$CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET" rmdir "$CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET/blas" mv "$CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET/lapack/"* "$CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET" rmdir "$CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET/lapack" stage: - -./usr/lib/$CRAFT_ARCH_TRIPLET/libjpeg.so.8.2.2 after: - mozjpeg glibmm: source: https://github.com/GNOME/glibmm.git source-depth: 1 source-tag: 2.77.0 plugin: meson build-packages: - meson - mm-common - ninja-build - libxml-parser-perl meson-parameters: - --buildtype=release - --prefix=/usr - --strip - -Dbuild-documentation=false - -Dbuild-examples=false - -Dsigc++-3.0:build-documentation=false - -Dsigc++-3.0:build-examples=false - -Dsigc++-3.0:validation=false prime: - -./usr/include - -./usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig - -./usr/lib/$CRAFT_ARCH_TRIPLET/*.so libjxl: source: https://github.com/libjxl/libjxl.git source-depth: 1 source-tag: v0.8.2 plugin: cmake build-environment: - LDFLAGS: ${LDFLAGS:+$LDFLAGS} -s cmake-generator: Ninja cmake-parameters: - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_INSTALL_PREFIX=/usr - -DBUILD_TESTING=OFF - -DJPEGXL_ENABLE_DEVTOOLS=OFF - -DJPEGXL_ENABLE_TOOLS=OFF - -DJPEGXL_ENABLE_JPEGLI_LIBJPEG=OFF - -DJPEGXL_ENABLE_DOXYGEN=OFF - -DJPEGXL_ENABLE_MANPAGES=OFF - -DJPEGXL_ENABLE_BENCHMARK=OFF - -DJPEGXL_ENABLE_EXAMPLES=OFF - -DJPEGXL_ENABLE_JNI=OFF - -DJPEGXL_ENABLE_SJPEG=OFF - -DJPEGXL_ENABLE_OPENEXR=OFF - -DJPEGXL_ENABLE_SKCMS=OFF stage: - -./usr/lib/$CRAFT_ARCH_TRIPLET/libbrotli* prime: - -./usr/bin - -./usr/include - -./usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig - -./usr/lib/$CRAFT_ARCH_TRIPLET/*.a - -./usr/lib/$CRAFT_ARCH_TRIPLET/*.so - -./usr/share mozjpeg: source: https://github.com/mozilla/mozjpeg.git source-depth: 1 source-tag: v4.0.3 plugin: cmake build-environment: - LDFLAGS: ${LDFLAGS:+$LDFLAGS} -s cmake-generator: Ninja 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/$CRAFT_ARCH_TRIPLET/pkgconfig - -./usr/lib/$CRAFT_ARCH_TRIPLET/*.so - -./usr/share openal: source: https://github.com/kcat/openal-soft.git source-depth: 1 source-tag: 1.23.0 plugin: cmake build-environment: - LDFLAGS: ${LDFLAGS:+$LDFLAGS} -s build-packages: - libasound2-dev - libdbus-1-dev - libpipewire-0.3-dev - libpulse-dev stage-packages: - libasound2 - libdbus-1-3 - libpulse0 - pipewire cmake-generator: Ninja cmake-parameters: - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_INSTALL_PREFIX=/usr - -DALSOFT_EXAMPLES=OFF - -DALSOFT_UTILS=OFF - -DALSOFT_INSTALL_CONFIG=OFF prime: - -./usr/include - -./usr/lib/$CRAFT_ARCH_TRIPLET/cmake - -./usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig - -./usr/lib/$CRAFT_ARCH_TRIPLET/*.so protobuf: source: https://github.com/protocolbuffers/protobuf.git source-depth: 1 source-tag: v21.9 plugin: cmake build-environment: - LDFLAGS: ${LDFLAGS:+$LDFLAGS} -s build-packages: - zlib1g-dev stage-packages: - zlib1g cmake-generator: Ninja cmake-parameters: - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_INSTALL_PREFIX=/usr - -DBUILD_SHARED_LIBS=ON - -Dprotobuf_BUILD_TESTS=OFF prime: - -./usr/bin - -./usr/include - -./usr/lib/$CRAFT_ARCH_TRIPLET/cmake - -./usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig - -./usr/lib/$CRAFT_ARCH_TRIPLET/*.so qt: plugin: nil build-environment: - LDFLAGS: ${LDFLAGS:+$LDFLAGS} -s build-packages: - libdbus-1-dev - libegl-dev - libfontconfig1-dev - libfreetype-dev - libglx-dev - libgtk-3-dev - libharfbuzz-dev - libice-dev - libicu-dev - liblcms2-dev - libopengl-dev - libpcre2-dev - libpng-dev - libsm-dev - libssl-dev - libvulkan-dev - libwayland-dev - libx11-dev - libx11-xcb-dev - libxcb1-dev - libxcb-cursor-dev - libxcb-glx0-dev - libxcb-icccm4-dev - libxcb-image0-dev - libxcb-keysyms1-dev - libxcb-randr0-dev - libxcb-render0-dev - libxcb-render-util0-dev - libxcb-shape0-dev - libxcb-shm0-dev - libxcb-sync-dev - libxcb-util-dev - libxcb-xfixes0-dev - libxcb-xkb-dev - libxkbcommon-dev - libxkbcommon-x11-dev - zlib1g-dev stage-packages: - libdbus-1-3 - libegl1 - libfontconfig1 - libfreetype6 - libglx0 - libgtk-3-0 - libharfbuzz0b - libice6 - libicu70 - liblcms2-2 - libopengl0 - libpcre2-16-0 - libpng16-16 - libsm6 - libssl3 - libvulkan1 - libwayland-client0 - libwayland-cursor0 - libwayland-egl1 - libwayland-server0 - libx11-6 - libx11-xcb1 - libxcb1 - libxcb-cursor0 - libxcb-glx0 - libxcb-icccm4 - libxcb-image0 - libxcb-keysyms1 - libxcb-randr0 - libxcb-render0 - libxcb-render-util0 - libxcb-shape0 - libxcb-shm0 - libxcb-sync1 - libxcb-util1 - libxcb-xfixes0 - libxcb-xkb1 - libxkbcommon0 - libxkbcommon-x11-0 - zlib1g override-pull: | QT=6.5.2 git clone -b v${QT} --depth=1 https://code.qt.io/qt/qt5.git . git submodule update --init --recursive --depth=1 qtbase qtdeclarative qtwayland qtimageformats qtsvg qtshadertools cd qtbase find $CRAFT_STAGE/patches/qtbase_${QT} -type f -print0 | sort -z | xargs -r0 git apply cd ../qtwayland sed -i 's/qMin(version, 8)/qMin(version, 7)/' src/client/qwaylandinputdevice.cpp cd .. override-build: | ./configure \ -prefix /usr \ -libdir /usr/lib/$CRAFT_ARCH_TRIPLET \ -release \ -opensource \ -confirm-license \ -no-feature-getentropy \ -no-feature-renameat2 \ -no-feature-statx \ -no-feature-egl-extension-platform-wayland \ -openssl-linked \ -nomake examples \ -nomake tests cmake --build . -j$CRAFT_PARALLEL_BUILD_COUNT DESTDIR="$CRAFT_PART_INSTALL" cmake --install . stage: - -./usr/lib/$CRAFT_ARCH_TRIPLET/libjpeg.so.8.2.2 prime: - -./usr/bin - -./usr/doc - -./usr/include - -./usr/lib/$CRAFT_ARCH_TRIPLET/cmake - -./usr/lib/$CRAFT_ARCH_TRIPLET/metatypes - -./usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig - -./usr/lib/$CRAFT_ARCH_TRIPLET/*.a - -./usr/lib/$CRAFT_ARCH_TRIPLET/*.la - -./usr/lib/$CRAFT_ARCH_TRIPLET/*.prl - -./usr/lib/$CRAFT_ARCH_TRIPLET/*.so - -./usr/libexec - -./usr/mkspecs - -./usr/modules after: - glibmm - mozjpeg - patches rnnoise: source: https://gitlab.xiph.org/xiph/rnnoise.git source-depth: 1 source-commit: 7f449bf8bd3b933891d12c30112268c4090e4d59 plugin: autotools build-environment: - CFLAGS: -O2 -s autotools-configure-parameters: - --prefix=/usr - --libdir=\${exec_prefix}/lib/$CRAFT_ARCH_TRIPLET - --disable-static - --disable-examples - --disable-doc prime: - -./usr/include - -./usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig - -./usr/lib/$CRAFT_ARCH_TRIPLET/*.la - -./usr/lib/$CRAFT_ARCH_TRIPLET/*.so - -./usr/share webrtc: source: https://github.com/desktop-app/tg_owt.git source-depth: 1 source-commit: dcb5069ff76bd293e86928804208737e6cee2ccc plugin: cmake build-environment: - LDFLAGS: ${LDFLAGS:+$LDFLAGS} -s build-packages: - yasm - libdrm-dev - libegl-dev - libgbm-dev - libgl-dev - libopenh264-dev - libopus-dev - libpipewire-0.3-dev - libssl-dev - libvpx-dev - libx11-dev - libxcomposite-dev - libxdamage-dev - libxext-dev - libxfixes-dev - libxrender-dev - libxrandr-dev - libxtst-dev stage-packages: - libdrm2 - libegl1 - libgbm1 - libgl1 - libopenh264-6 - libopus0 - libssl3 - libvpx7 - libx11-6 - libxcomposite1 - libxdamage1 - libxext6 - libxfixes3 - libxrender1 - libxrandr2 - libxtst6 - pipewire cmake-generator: Ninja cmake-parameters: - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_INSTALL_PREFIX=/usr prime: - -./usr/include - -./usr/lib/$CRAFT_ARCH_TRIPLET/cmake - -./usr/lib/$CRAFT_ARCH_TRIPLET/*.a after: - ffmpeg - glibmm - mozjpeg