Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37047981
en ru br
ALT Linux repositórios
S:4.10.1-alt1

Group :: Rede/Mensagens instantâneas
RPM: telegram-desktop

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

# TODO: build external, json11 separately
# Check https://github.com/EasyCoding/tgbuild for patches

%define ffmpeg_version 3.4
# require
%define tg_qt5_version 5.15.10
# upstream uses 6.5.2
#define tg_qt6_version 6.5.2
%define tg_qt6_version 6.4.2

# AppID for Basealt build

# got from https://core.telegram.org/api/obtaining_api_id
%define apiid 182015
%define apihash bb6c3f8fffd8fe6804fc5131a08e1c44

# TODO: def_with clang

%def_with qt6
%def_without wayland
%def_with x11
%def_with rlottie
%def_without gsl
%def_without ninja
%def_without ffmpeg_static
%def_without jemalloc

Name: telegram-desktop
Version: 4.10.1
Release: alt1

Summary: Telegram Desktop messaging app

License: GPLv3 with OpenSSL exception
Group: Networking/Instant messaging
Url: https://telegram.org/

# Source-url: https://github.com/telegramdesktop/tdesktop/releases/download/v%version/tdesktop-%version-full.tar.gz

Source: %name-%version.tar

# Source1-url: https://github.com/desktop-app/GSL/archive/refs/heads/main.zip

Source1: %name-gsl-%version.tar

Patch1: telegram-desktop-remove-tgvoip.patch
Patch2: telegram-desktop-set-native-window-frame.patch
Patch5: telegram-desktop-fix-missed-cstdint.patch
Patch6: telegram-desktop-disabled-icon-checkbox.patch
Patch7: telegram-desktop-fix-build-with-make.patch

# lacks few build deps, still

# [ppc64le] E: Couldn't find package libdispatch-devel
# [ppc64le] /usr/bin/ld.default: /usr/lib64/libtg_owt.a: error adding symbols: file in wrong format
ExcludeArch: ppc64le

BuildRequires(pre): rpm-macros-cmake
BuildRequires(pre): rpm-build-compat >= 2.1.5
BuildRequires(pre): rpm-build-intro >= 2.1.5
%if_with ninja
BuildRequires(pre): rpm-macros-ninja-build
%endif

# use no more than system_memory/3000 build procs (see https://bugzilla.altlinux.org/show_bug.cgi?id=35112)

%_tune_parallel_build_by_procsize 3000

# minimalize memory using

%ifarch %ix86 armh
%define optflags_debug -g0
%define optflags_lto %nil
%endif

BuildRequires: gcc-c++ libstdc++-devel
# for -lstdc++fs
BuildRequires: libstdc++%__gcc_version-devel-static

BuildRequires: python3

# cmake 3.16 as in CMakeLists.txt

BuildRequires: cmake >= 3.16
BuildRequires: extra-cmake-modules

%if_with qt6
BuildRequires(pre): rpm-macros-qt6
BuildRequires: qt6-base-devel >= %tg_qt6_version
BuildRequires: qt6-svg-devel qt6-svg
BuildRequires: qt6-charts-devel qt6-charts
BuildRequires: qt6-5compat-devel
BuildRequires: qt6-imageformats
%{?_with_wayland:BuildRequires: qt6-wayland-devel}
# needs for smiles and emojicons
Requires: qt6-imageformats
%else
BuildRequires(pre): rpm-macros-qt5
BuildRequires: qt5-base-devel >= %tg_qt5_version
BuildRequires: qt5-svg-devel
BuildRequires: libqt5-core libqt5-network libqt5-gui qt5-imageformats

BuildRequires: kf5-kcoreaddons-devel

# needs for smiles and emojicons

Requires: qt5-imageformats

# run around https://bugzilla.altlinux.org/show_bug.cgi?id=34665

Requires: libqt5-core >= %_qt5_version

# for -lQt5PlatformSupport

BuildRequires: qt5-base-devel-static

%{?_with_wayland:BuildRequires: kf5-kwayland-devel qt5-wayland-devel}
%endif

BuildRequires: libenchant2-devel
BuildRequires: libhunspell-devel

# for autoupdater (included ever if disabled)

# TODO:
BuildRequires: liblzma-devel

# for SourceFiles/mtproto/connection.cpp

BuildRequires: libzip-devel

BuildRequires: zlib-devel >= 1.2.8
BuildRequires: libxxhash-devel
BuildRequires: liblz4-devel
BuildRequires: libcrc32c-devel
BuildRequires: libfmt-devel

BuildRequires: libminizip-devel libpcre2-devel libexpat-devel libssl-devel libselinux-devel bison

%if_with x11
#BuildRequires: libxcbutil-keysyms-devel
BuildRequires: pkgconfig(xcb)
BuildRequires: pkgconfig(xcb-keysyms)
BuildRequires: pkgconfig(xcb-record)
BuildRequires: pkgconfig(xcb-screensaver)
%endif

#BuildRequires: libgtk+3-devel

BuildRequires: libglibmm2.68-devel >= 2.77
BuildRequires: gobject-introspection-devel

BuildRequires: libopus-devel
# TODO:
# libdee-devel

#BuildRequires: libopenal-devel >= 1.22.2

# p10
BuildRequires: libopenal-devel >= 1.21.1
# libportaudio2-devel libxcb-devel
# used by qt imageformats: libwebp-devel
BuildRequires: libva-devel libdrm-devel

# Telegram fork of OWT

BuildRequires: libowt-tg-devel >= 4.3.0.10
BuildRequires: librnnoise-devel
#BuildRequires: libvpx-devel
BuildRequires: libjpeg-devel

# No rule to make target '/usr/lib64/libopenh264.so', needed by 'telegram-desktop'

BuildRequires: libopenh264-devel

# No rule to make target '/usr/lib64/libXcomposite.so', needed by 'telegram-desktop'

BuildRequires: libXcomposite-devel

# No rule to make target '/usr/lib64/libXdamage.so', needed by 'telegram-desktop'

BuildRequires: libXdamage-devel
BuildRequires: libXrandr-devel libXext-devel libXfixes-devel libXrender-devel libXtst-devel


#see hack below (used directly in Telegram/ThirdParty/tgcalls/tgcalls/desktop_capturer/DesktopCaptureSourceHelper.cpp)

BuildRequires: libyuv-devel

# Just to disable noise like Package 'libffi', required by 'gobject-2.0', not found

# See https://bugzilla.altlinux.org/30001
BuildRequires: libffi-devel libmount-devel libXdmcp-devel libblkid-devel
BuildRequires: bzlib-devel libbrotli-devel gstreamer1.0-devel

BuildRequires: boost-program_options-devel

# uses forked version, tag e0ea6af518345c4a46195c4951e023e621a9eb8f

BuildRequires: librlottie-devel >= 0.1.1
BuildRequires: libqrcodegen-cpp-devel

# C++ sugar

%if_with gsl
BuildRequires: libmicrosoft-gsl-devel >= 1:4.0.0-alt2
%endif

# https://github.com/telegramdesktop/tdesktop/issues/8471

#BuildRequires: libvariant-devel
BuildRequires: libexpected-devel
BuildRequires: librange-v3-devel >= 0.11.0
BuildRequires: libdispatch-devel

# for bundled cldr3

BuildRequires: libprotobuf-devel libprotobuf-lite-devel protobuf-compiler

# need for /usr/lib64/cmake/Qt5XkbCommonSupport/Qt5XkbCommonSupportConfig.cmake

BuildRequires: libxkbcommon-devel

%if_with ninja
BuildRequires: ninja-build
%endif

# FIXME: libva need only for linking, extra deps?


Provides: telegram = %version-%release
Provides: tdesktop = %version-%release
Obsoletes: tdesktop


%if_with ffmpeg_static
BuildRequires: libffmpeg-devel-static >= %ffmpeg_version
%else
BuildRequires: libavfilter-devel >= %ffmpeg_version
BuildRequires: libavcodec-devel >= %ffmpeg_version
BuildRequires: libavformat-devel >= %ffmpeg_version
BuildRequires: libavutil-devel >= %ffmpeg_version
BuildRequires: libswscale-devel >= %ffmpeg_version
BuildRequires: libswresample-devel >= %ffmpeg_version
%endif

Requires: dbus

# instead of internal fonts OpenSans

# works with system fonts, see https://bugzilla.altlinux.org/show_bug.cgi?id=38986
#Requires: fonts-ttf-open-sans

# some problems with t_assert

%add_optflags -fpermissive -DNDEBUG

# disable some warnings

%add_optflags -Wno-strict-aliasing -Wno-unused-variable -Wno-sign-compare -Wno-switch

%add_optflags -fstack-protector-all -fstack-clash-protection -D_GLIBCXX_ASSERTIONS
%ifarch x86_64
%add_optflags -fcf-protection
%endif


%description
Telegram is a messaging app with a focus on speed and security, it's super-fast, simple and free.
You can use Telegram on all your devices at the same time - your messages
sync seamlessly across any number of your phones, tablets or computers.

With Telegram, you can send messages, photos, videos and files of any type (doc, zip, mp3, etc),
as well as create groups for up to 1000 people or channels for broadcasting to unlimited audiences.
You can write to your phone contacts and find people by their usernames.
As a result, Telegram is like SMS and email combined - and can take care of all your personal
or business messaging needs.


%prep
%setup -a1
%patch1 -p2
%patch2 -p2
%patch5 -p2
%if_without qt6
%patch6 -p2
%endif
#patch7 -p2

%if_without gsl
test -d /usr/share/cmake/Microsoft.GSL/ && echo "External Microsoft GSL is incompatible with buggy libstd++ (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106547), remove libmicrosoft-gsl-devel to correct build" && exit 1
%endif

# See https://github.com/desktop-app/tg_owt/pull/82

# TODO: there are incorrect using and linking libyuv
subst 's|third_party/libyuv/include/libyuv.h|libyuv.h|' Telegram/ThirdParty/tgcalls/tgcalls/desktop_capturer/*.cpp
# TODO: ld: lib_webview/liblib_webview.a(webview_linux_webkit_gtk.cpp.o): undefined reference to symbol 'dlclose at  at GLIBC_2.2.5
# TODO: ld: /tmp/.private/lav/ccfxvz2E.ltrans115.ltrans.o: неопределённая ссылка на символ «ARGBScale»
#subst "s|\(desktop-app::external_rnnoise\)|\1 -lyuv|" Telegram/cmake/lib_tgcalls.cmake

# Unbundling libraries...

# TODO: minizip
for i in \
%if_with gsl
Telegram/ThirdParty/GSL \
%endif
Telegram/ThirdParty/QR \
Telegram/ThirdParty/expected \
Telegram/ThirdParty/jemalloc \
Telegram/ThirdParty/fcitx5-qt \
Telegram/ThirdParty/hime \
Telegram/ThirdParty/hunspell \
Telegram/ThirdParty/lz4 \
Telegram/ThirdParty/nimf \
Telegram/ThirdParty/range-v3 \
Telegram/ThirdParty/xxHash \
%if_with rlottie
Telegram/ThirdParty/rlottie \
%endif
Telegram/ThirdParty/libtgvoip \
Telegram/ThirdParty/tgcalls/tgcalls/legacy \
%nil ; do
echo "Removing $i ..."
rm -r $i
done

%build
%if_with ffmpeg_static
export PKG_CONFIG_PATH=%_libdir/ffmpeg-static/%_lib/pkgconfig/
%endif

%if_with clang
%remove_optflags -frecord-gcc-switches
export CC=clang
%endif

# due precompiled headers

export CCACHE_SLOPPINESS=pch_defines,time_macros

# CMAKE_BUILD_TYPE should always be Release due to some hardcoded checks.

#    -DCMAKE_BUILD_TYPE=RelWithDebInfo \

%cmake_insource \
%if_with ninja
   -G Ninja \
%endif
   -DDESKTOP_APP_USE_PACKAGED=ON \
   -DCMAKE_BUILD_TYPE=Release \
   -DTDESKTOP_API_ID=%apiid \
   -DTDESKTOP_API_HASH=%apihash \
   -DDESKTOP_APP_USE_PACKAGED:BOOL=ON \
   -DDESKTOP_APP_USE_PACKAGED_FONTS:BOOL=ON \
   -DDESKTOP_APP_DISABLE_CRASH_REPORTS:BOOL=ON \
   -DDESKTOP_APP_DISABLE_SPELLCHECK:BOOL=OFF \
%if_with qt6
   -DQT_VERSION_MAJOR=6 \
%else
   -DQT_VERSION_MAJOR=5 \
%endif
%if_without jemalloc
   -DDESKTOP_APP_DISABLE_JEMALLOC=ON \
%endif
%if_with wayland
   -DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION:BOOL=OFF \
%else
   -DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION:BOOL=ON \
%endif
%if_with x11
   -DDESKTOP_APP_DISABLE_X11_INTEGRATION:BOOL=OFF \
%else
   -DDESKTOP_APP_DISABLE_X11_INTEGRATION:BOOL=ON \
%endif
%if_with rlottie
   -DDESKTOP_APP_USE_PACKAGED_RLOTTIE=ON \
# FIXME: lottie_cache.h:9:10: fatal error: ffmpeg/ffmpeg_utility.h: No such file or directory
#    -DDESKTOP_APP_LOTTIE_USE_CACHE:BOOL=OFF \
%else
   -DDESKTOP_APP_USE_PACKAGED_RLOTTIE=OFF \
%endif
   %nil

%if_with ninja
%ninja_build
%else
%make_build VERBOSE=1
%endif

%install
%if_with ninja
%ninja_install
%else
%makeinstall_std
%endif
# XDG files
#install -m644 -D lib/xdg/tg.protocol %buildroot%_Kservices/tg.protocol

ln -s %name %buildroot%_bindir/Telegram
ln -s %name %buildroot%_bindir/telegram
ln -s %name %buildroot%_bindir/telegramdesktop

%files
%_bindir/%name
%_bindir/telegramdesktop
%_bindir/Telegram
%_bindir/telegram
%_desktopdir/*.desktop
%_datadir/dbus-1/services/*.service
%_datadir/metainfo/*.metainfo.xml
%_iconsdir/hicolor/16x16/apps/telegram.png
%_iconsdir/hicolor/32x32/apps/telegram.png
%_iconsdir/hicolor/48x48/apps/telegram.png
%_iconsdir/hicolor/64x64/apps/telegram.png
%_iconsdir/hicolor/128x128/apps/telegram.png
%_iconsdir/hicolor/256x256/apps/telegram.png
%_iconsdir/hicolor/512x512/apps/telegram.png
#_man1dir/*
%doc README.md

%changelog

Todas as alterações você pod ver aqui

 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009