File telegram-desktop.spec of Package telegram-desktop

#
# spec file for package telegram-desktop
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define __builder ninja
Name:           telegram-desktop
Version:        5.2.3
Release:        0
Summary:        Messaging application with a focus on speed and security
License:        GPL-3.0-only
Group:          Productivity/Networking/Instant Messenger
URL:            https://github.com/telegramdesktop/tdesktop
Source0:        %{url}/releases/download/v%{version}/tdesktop-%{version}-full.tar.gz
Patch0:         desktop-file-fix.patch
BuildRequires:  QR-Code-generator-devel
BuildRequires:  appstream-glib
BuildRequires:  boost-devel
BuildRequires:  ccache
BuildRequires:  chrpath
BuildRequires:  clang
BuildRequires:  cmake >= 3.23
BuildRequires:  desktop-file-utils
BuildRequires:  enchant-devel
BuildRequires:  expected-devel
BuildRequires:  extra-cmake-modules
BuildRequires:  ffmpeg-5-mini-devel
BuildRequires:  freetype-devel
BuildRequires:  glibc-devel
BuildRequires:  libboost_program_options-devel
BuildRequires:  libboost_regex-devel
BuildRequires:  libdispatch-devel
BuildRequires:  libjack0
BuildRequires:  liblz4-devel
BuildRequires:  memory-constraints
BuildRequires:  ninja
BuildRequires:  pkgconfig
BuildRequires:  qt6-base-private-devel
BuildRequires:  qt6-wayland-devel
BuildRequires:  qt6-wayland-private-devel
BuildRequires:  rnnoise-devel
BuildRequires:  unzip
# BuildRequires:  xorg-x11-devel
BuildRequires:  xxhash-devel
BuildRequires:  xz
BuildRequires:  yasm
BuildRequires:  cmake(Microsoft.GSL) >= 4.0.0
# Qt6
BuildRequires:  cmake(Qt6Core)
BuildRequires:  cmake(Qt6Core5Compat)
BuildRequires:  cmake(Qt6DBus)
BuildRequires:  cmake(Qt6Gui)
BuildRequires:  cmake(Qt6Network)
BuildRequires:  cmake(Qt6OpenGL)
BuildRequires:  cmake(Qt6OpenGLWidgets)
BuildRequires:  cmake(Qt6Quick)
BuildRequires:  cmake(Qt6QuickWidgets)
BuildRequires:  cmake(Qt6Svg)
BuildRequires:  cmake(Qt6Widgets)
BuildRequires:  cmake(absl)
BuildRequires:  cmake(range-v3)
BuildRequires:  cmake(tg_owt)
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(cryptopp)
BuildRequires:  pkgconfig(expat)
BuildRequires:  pkgconfig(fmt)
BuildRequires:  pkgconfig(fontconfig)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(gdk-pixbuf-2.0)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(glibmm-2.68)
BuildRequires:  pkgconfig(gobject-introspection-1.0)
BuildRequires:  pkgconfig(gstreamer-webrtc-1.0)
BuildRequires:  pkgconfig(gtk+-3.0)
BuildRequires:  pkgconfig(harfbuzz)
BuildRequires:  pkgconfig(hunspell)
BuildRequires:  pkgconfig(jemalloc)
BuildRequires:  pkgconfig(libavcodec)
BuildRequires:  pkgconfig(libavdevice)
BuildRequires:  pkgconfig(libavfilter)
BuildRequires:  pkgconfig(libavformat)
BuildRequires:  pkgconfig(libavutil)
BuildRequires:  pkgconfig(libcrypto)
BuildRequires:  pkgconfig(libjpeg)
BuildRequires:  pkgconfig(liblzma)
BuildRequires:  pkgconfig(libmng)
BuildRequires:  pkgconfig(libpcre)
BuildRequires:  pkgconfig(libpcre16)
BuildRequires:  pkgconfig(libpcrecpp)
BuildRequires:  pkgconfig(libpcreposix)
BuildRequires:  pkgconfig(libpipewire-0.3)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(libproxy-1.0)
BuildRequires:  pkgconfig(libpulse)
BuildRequires:  pkgconfig(libswscale)
BuildRequires:  pkgconfig(libtiff-4)
BuildRequires:  pkgconfig(libturbojpeg)
BuildRequires:  pkgconfig(libva)
BuildRequires:  pkgconfig(libva-glx)
BuildRequires:  pkgconfig(libva-x11)
BuildRequires:  pkgconfig(libwebp)
BuildRequires:  pkgconfig(minizip)
BuildRequires:  pkgconfig(mtdev)
BuildRequires:  pkgconfig(openal)
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(opus)
BuildRequires:  pkgconfig(opusfile)
BuildRequires:  pkgconfig(opusurl)
BuildRequires:  pkgconfig(portaudio-2.0)
BuildRequires:  pkgconfig(portaudiocpp)
BuildRequires:  pkgconfig(protobuf)
BuildRequires:  pkgconfig(tslib)
BuildRequires:  pkgconfig(vdpau)
BuildRequires:  pkgconfig(vpx)
BuildRequires:  pkgconfig(webkit2gtk-4.0)
BuildRequires:  pkgconfig(xtst)
BuildRequires:  pkgconfig(zlib)
# Runtime requirements
Requires:       ffmpeg
Requires:       icu
Requires:       openssl
Requires:       qt6-imageformats
Recommends:     (xdg-desktop-portal-gnome if gnome-shell)
Recommends:     (xdg-desktop-portal-kde if plasma5-session)
Recommends:     (xdg-desktop-portal-wlr if wlroots)
# TDesktop can fall back to a simple GTK file picker but prefers the portal
Recommends:     xdg-desktop-portal
Provides:       bundled(dbusmenu-qt6)
Provides:       bundled(libtgvoip)
Provides:       bundled(rlottie)
BuildRequires:  wayland-devel
BuildRequires:  cmake(PlasmaWaylandProtocols)
BuildRequires:  pkgconfig(wayland-protocols)
BuildRequires:  pkgconfig(xcb)
BuildRequires:  pkgconfig(xcb-ewmh)
BuildRequires:  pkgconfig(xcb-icccm)
BuildRequires:  pkgconfig(xcb-image)
BuildRequires:  pkgconfig(xcb-keysyms)
BuildRequires:  pkgconfig(xcb-record)
BuildRequires:  pkgconfig(xcb-renderutil)
BuildRequires:  pkgconfig(xcb-screensaver)
BuildRequires:  pkgconfig(xcb-util)
BuildRequires:  pkgconfig(xfixes)
BuildRequires:  pkgconfig(xkbcommon)
BuildRequires:  pkgconfig(xkbcommon-x11)
BuildRequires:  gcc-c++

%description
Telegram is a non-profit cloud-based instant messaging service.
Users can send messages and exchange photos, videos, stickers, audio and files of any type.
Its client-side code is open-source software but the source code for recent versions is not
always immediately published, whereas its server-side code is closed-source and proprietary.
The service also provides APIs to independent developers.

%prep
%autosetup -n tdesktop-%{version}-full -p1
rm -rf Telegram/ThirdParty/{dispatch,expected,fcitx-qt5,fcitx5-qt,jemalloc,hime,hunspell,lz4,minizip,nimf,range-v3,xxHash}

%build
%limit_build -m 2048
%cmake \
 -DCMAKE_INSTALL_PREFIX=%{_prefix} \
 -DCMAKE_BUILD_TYPE=Release \
 -DTDESKTOP_API_ID=611335 \
 -DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c \
 -DDESKTOP_APP_USE_PACKAGED:BOOL=ON \
 -DDESKTOP_APP_USE_PACKAGED_FONTS:BOOL=ON \
 -DDESKTOP_APP_DISABLE_CRASH_REPORTS:BOOL=ON \
 -DBUILD_WITH_QT6:BOOL=ON \
 -DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION:BOOL=OFF \
 -DDESKTOP_APP_DISABLE_X11_INTEGRATION:BOOL=OFF \
 -DTDESKTOP_LAUNCHER_BASENAME=%{name}

%cmake_build

%install
%cmake_install

appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/*.metainfo.xml

%files
%license LICENSE LEGAL
%doc README.md changelog.txt
%{_bindir}/%{name}
%{_datadir}/applications/org.telegram.desktop.desktop
%{_datadir}/icons/hicolor
%{_datadir}/icons/hicolor/*/apps/*.png
%{_datadir}/metainfo/*.metainfo.xml
%{_datadir}/dbus-1/services/org.telegram.desktop.service

%changelog
openSUSE Build Service is sponsored by