commit 1eafaf3ef9dd6068e98589213291567458c324a1
Author: Vitaly Zaitsev <vitaly(a)easycoding.org>
Date: Sat May 18 21:58:12 2019 +0200
Switched to clang as temporary workaround until GCC regression will be
resolved.
telegram-desktop-build-fixes.patch | 47 +++++++++++++--------------
telegram-desktop-pr-6025.patch | 36 +++++++++++++++++++++
telegram-desktop-rr-ddb9c8.patch | 57 +++++++++++++++++++++++++++++++++
telegram-desktop-system-fonts.patch | 2 +-
telegram-desktop-unbundle-minizip.patch | 2 +-
telegram-desktop.spec | 41 ++++++++++++++++++++----
6 files changed, 152 insertions(+), 33 deletions(-)
---
diff --git a/telegram-desktop-build-fixes.patch b/telegram-desktop-build-fixes.patch
index ff04825..5fd721e 100644
--- a/telegram-desktop-build-fixes.patch
+++ b/telegram-desktop-build-fixes.patch
@@ -1,4 +1,4 @@
-From da1d8b4e977d9b9d834fe2392bfd260d3ce85f57 Mon Sep 17 00:00:00 2001
+From 6eebdb636516c5248ca2b3f2089d575c67a4c023 Mon Sep 17 00:00:00 2001
From: Vitaly Zaitsev <vitaly(a)easycoding.org>
Date: Fri, 31 Mar 2017 14:29:58 +0200
Subject: [PATCH 1/3] Fixed build under Fedora using rpmbuild and mock.
@@ -6,7 +6,7 @@ Subject: [PATCH 1/3] Fixed build under Fedora using rpmbuild and mock.
---
Telegram/Resources/qrc/telegram.qrc | 3 -
Telegram/Resources/qrc/telegram_linux.qrc | 6 --
- Telegram/SourceFiles/core/launcher.cpp | 3 +-
+ Telegram/SourceFiles/core/launcher.cpp | 1 +
Telegram/SourceFiles/qt_functions.cpp | 94 +++++++++++++++++++++++
Telegram/gyp/CMakeLists.inj | 6 ++
Telegram/gyp/PrecompiledHeader.cmake | 4 +-
@@ -19,12 +19,12 @@ Subject: [PATCH 1/3] Fixed build under Fedora using rpmbuild and
mock.
Telegram/gyp/qt.gypi | 87 ++++++---------------
Telegram/gyp/qt_moc.gypi | 5 +-
Telegram/gyp/qt_rcc.gypi | 2 +-
- Telegram/gyp/settings_linux.gypi | 13 ----
+ Telegram/gyp/settings_linux.gypi | 25 +-----
Telegram/gyp/telegram_linux.gypi | 73 +++++-------------
Telegram/gyp/telegram_sources.txt | 2 +-
lib/xdg/telegramdesktop.appdata.xml | 2 +-
lib/xdg/telegramdesktop.desktop | 5 +-
- 20 files changed, 172 insertions(+), 189 deletions(-)
+ 20 files changed, 172 insertions(+), 199 deletions(-)
create mode 100644 Telegram/SourceFiles/qt_functions.cpp
create mode 100644 Telegram/gyp/CMakeLists.inj
@@ -56,18 +56,9 @@ index 164e8d4f2..03585ec03 100644
- </qresource>
</RCC>
diff --git a/Telegram/SourceFiles/core/launcher.cpp
b/Telegram/SourceFiles/core/launcher.cpp
-index 3efa53eba..098b1f4c0 100644
+index 3efa53eba..4427ceae6 100644
--- a/Telegram/SourceFiles/core/launcher.cpp
+++ b/Telegram/SourceFiles/core/launcher.cpp
-@@ -242,7 +242,7 @@ void Launcher::init() {
- QApplication::setApplicationName(qsl("TelegramDesktop"));
-
- #if defined(Q_OS_LINUX) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
-- QApplication::setDesktopFileName(qsl("telegramdesktop.desktop"));
-+ QApplication::setDesktopFileName(qsl("telegram-desktop.desktop"));
- #endif
- #ifndef OS_MAC_OLD
- QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
@@ -264,6 +264,7 @@ int Launcher::exec() {
Logs::start(this); // must be started before Platform is started
Platform::start(); // must be started before Sandbox is created
@@ -618,7 +609,7 @@ index f5624a82b..b644ce29f 100644
'-no-compress',
'<(RULE_INPUT_PATH)',
diff --git a/Telegram/gyp/settings_linux.gypi b/Telegram/gyp/settings_linux.gypi
-index 22160515c..2ee5cc7ab 100644
+index 22160515c..ca44eeb16 100644
--- a/Telegram/gyp/settings_linux.gypi
+++ b/Telegram/gyp/settings_linux.gypi
@@ -9,10 +9,6 @@
@@ -632,17 +623,25 @@ index 22160515c..2ee5cc7ab 100644
'-fPIC',
'-Wno-unused-variable',
'-Wno-unused-parameter',
-@@ -47,9 +43,6 @@
- }], [ '"<!(uname -p)" == "x86_64"', {
- # 32 bit version can't be linked with debug info or LTO,
- # virtual memory exhausted :(
+@@ -44,24 +40,10 @@
+ 'sources': [
'__Wrong_Official_Build_Target_<(official_build_target)_' ],
+ }],
+ ],
+- }], [ '"<!(uname -p)" == "x86_64"', {
+- # 32 bit version can't be linked with debug info or LTO,
+- # virtual memory exhausted :(
- 'cflags_c': [ '-g' ],
- 'cflags_cc': [ '-g' ],
- 'ldflags': [ '-g' ],
- 'configurations': {
- 'Release': {
- 'cflags_c': [ '-flto' ],
-@@ -61,7 +54,6 @@
+- 'configurations': {
+- 'Release': {
+- 'cflags_c': [ '-flto' ],
+- 'cflags_cc': [ '-flto' ],
+- 'ldflags': [ '-flto', '-fuse-linker-plugin' ],
+- },
+- },
+- }]
++ }],
],
'defines': [
'_REENTRANT',
@@ -650,7 +649,7 @@ index 22160515c..2ee5cc7ab 100644
'QT_PLUGIN',
],
'cflags_c': [
-@@ -73,11 +65,6 @@
+@@ -73,11 +55,6 @@
'-std=c++1z',
'-Wno-register',
],
diff --git a/telegram-desktop-pr-6025.patch b/telegram-desktop-pr-6025.patch
new file mode 100644
index 0000000..5c13ba5
--- /dev/null
+++ b/telegram-desktop-pr-6025.patch
@@ -0,0 +1,36 @@
+From 59deda0ff8ede93f7e22ad2fc000c3f4f155a4ed Mon Sep 17 00:00:00 2001
+From: Vitaly Zaitsev <vitaly(a)easycoding.org>
+Date: Sat, 18 May 2019 20:47:23 +0200
+Subject: [PATCH] Fixed building of PCH using Clang compiler.
+
+Signed-off-by: Vitaly Zaitsev <vitaly(a)easycoding.org>
+---
+ Telegram/gyp/PrecompiledHeader.cmake | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/Telegram/gyp/PrecompiledHeader.cmake b/Telegram/gyp/PrecompiledHeader.cmake
+index a0e1e0489..dfe1193be 100644
+--- a/Telegram/gyp/PrecompiledHeader.cmake
++++ b/Telegram/gyp/PrecompiledHeader.cmake
+@@ -81,7 +81,7 @@ function(export_all_flags _filename _source_name_for_flags)
+ endfunction()
+
+ function(add_precompiled_header _target _input)
+- if(CMAKE_COMPILER_IS_GNUCXX)
++ if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU|Clang")
+ get_filename_component(_name ${_input} NAME)
+ set(_pch_header "${CMAKE_CURRENT_SOURCE_DIR}/${_input}")
+ set(_pch_binary_dir "${CMAKE_CURRENT_BINARY_DIR}/${_target}_pch")
+@@ -163,5 +163,11 @@ function(add_precompiled_header _target _input)
+ OBJECT_DEPENDS "${_object_depends}")
+ endif()
+ endforeach()
+- endif(CMAKE_COMPILER_IS_GNUCXX)
++
++ if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
++ if(NOT _PCH_FORCEINCLUDE)
++ set(_PCH_FORCEINCLUDE ON)
++ endif()
++ endif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
++ endif(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU|Clang")
+ endfunction()
diff --git a/telegram-desktop-rr-ddb9c8.patch b/telegram-desktop-rr-ddb9c8.patch
new file mode 100644
index 0000000..c57530d
--- /dev/null
+++ b/telegram-desktop-rr-ddb9c8.patch
@@ -0,0 +1,57 @@
+From 69960a47da0756be34e539975edad8f0a738d2ad Mon Sep 17 00:00:00 2001
+From: John Preston <johnprestonmail(a)gmail.com>
+Date: Fri, 10 May 2019 09:22:21 +0300
+Subject: [PATCH 3/4] Apply telegram-wayland-icon.patch from Flatpak version.
+
+---
+ Telegram/SourceFiles/core/launcher.cpp | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/Telegram/SourceFiles/core/launcher.cpp
b/Telegram/SourceFiles/core/launcher.cpp
+index 3efa53eba..f0273bfdd 100644
+--- a/Telegram/SourceFiles/core/launcher.cpp
++++ b/Telegram/SourceFiles/core/launcher.cpp
+@@ -241,7 +241,9 @@ void Launcher::init() {
+
+ QApplication::setApplicationName(qsl("TelegramDesktop"));
+
+-#if defined(Q_OS_LINUX) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
++#ifdef TDESKTOP_FLATPAK_BUILD
++ QApplication::setDesktopFileName(qsl("org.telegram.desktop.desktop"));
++#elif defined(Q_OS_LINUX) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
+ QApplication::setDesktopFileName(qsl("telegramdesktop.desktop"));
+ #endif
+ #ifndef OS_MAC_OLD
+
+From ddb9c84a1d4994e8c7a9ae04aacd4e890826a871 Mon Sep 17 00:00:00 2001
+From: Vitaly Zaitsev <vitaly(a)easycoding.org>
+Date: Fri, 10 May 2019 08:54:07 +0200
+Subject: [PATCH 4/4] Allow GNU/Linux maintainers to forward launcher name.
+
+Use optional compiler directive -DTDESKTOP_LAUNCHER_FILENAME to forward
+required XDG desktop file name.
+
+If not specified, fallback to default value will be used.
+
+Signed-off-by: Vitaly Zaitsev <vitaly(a)easycoding.org>
+---
+ Telegram/SourceFiles/core/launcher.cpp | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/Telegram/SourceFiles/core/launcher.cpp
b/Telegram/SourceFiles/core/launcher.cpp
+index f0273bfdd..b1246588a 100644
+--- a/Telegram/SourceFiles/core/launcher.cpp
++++ b/Telegram/SourceFiles/core/launcher.cpp
+@@ -241,8 +241,10 @@ void Launcher::init() {
+
+ QApplication::setApplicationName(qsl("TelegramDesktop"));
+
+-#ifdef TDESKTOP_FLATPAK_BUILD
+- QApplication::setDesktopFileName(qsl("org.telegram.desktop.desktop"));
++#ifdef TDESKTOP_LAUNCHER_FILENAME
++#define TDESKTOP_LAUNCHER_FILENAME_TO_STRING_HELPER(V) #V
++#define TDESKTOP_LAUNCHER_FILENAME_TO_STRING(V)
TDESKTOP_LAUNCHER_FILENAME_TO_STRING_HELPER(V)
++ QApplication::setDesktopFileName(qsl(TDESKTOP_LAUNCHER_FILENAME_TO_STRING(TDESKTOP_LAUNCHER_FILENAME)));
+ #elif defined(Q_OS_LINUX) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
+ QApplication::setDesktopFileName(qsl("telegramdesktop.desktop"));
+ #endif
diff --git a/telegram-desktop-system-fonts.patch b/telegram-desktop-system-fonts.patch
index a9d411c..192f1d1 100644
--- a/telegram-desktop-system-fonts.patch
+++ b/telegram-desktop-system-fonts.patch
@@ -1,4 +1,4 @@
-From bc70c8fce71b80f2cefcc537298a2529506ce2a0 Mon Sep 17 00:00:00 2001
+From 3f9ccbabc7b6d8074786c953f95f08c1356d4edb Mon Sep 17 00:00:00 2001
From: Vitaly Zaitsev <vitaly(a)easycoding.org>
Date: Sun, 24 Jun 2018 22:59:34 +0200
Subject: [PATCH 2/3] Backported and rebased patch from Debian maintainer
diff --git a/telegram-desktop-unbundle-minizip.patch
b/telegram-desktop-unbundle-minizip.patch
index 5a132bf..5f0f201 100644
--- a/telegram-desktop-unbundle-minizip.patch
+++ b/telegram-desktop-unbundle-minizip.patch
@@ -1,4 +1,4 @@
-From 3e81539f998510cde8376db4e5da3dc59cfaaf9a Mon Sep 17 00:00:00 2001
+From b455e4b41ef600fc9d274aa6d76c2db9e39d29d6 Mon Sep 17 00:00:00 2001
From: Vitaly Zaitsev <vitaly(a)easycoding.org>
Date: Wed, 17 Oct 2018 17:57:59 +0200
Subject: [PATCH 3/3] Use packaged version of minizip on Fedora <= 29.
diff --git a/telegram-desktop.spec b/telegram-desktop.spec
index 0ad03bc..1038ffc 100644
--- a/telegram-desktop.spec
+++ b/telegram-desktop.spec
@@ -1,5 +1,6 @@
# Build conditionals...
%bcond_without gtk3
+%bcond_without clang
# Telegram Desktop's constants...
%global appname tdesktop
@@ -13,10 +14,15 @@
# Decrease debuginfo verbosity to reduce memory consumption...
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
+# Applying workaround to RHBZ#1559007...
+%if %{with clang}
+%global optflags %(echo %{optflags} | sed -e 's/-mcet//g' -e
's/-fcf-protection//g' -e 's/-fstack-clash-protection//g')
+%endif
+
Summary: Telegram Desktop official messaging app
Name: telegram-desktop
Version: 1.7.0
-Release: 1%{?dist}
+Release: 2%{?dist}
# Application and 3rd-party modules licensing:
# * S0 (Telegram Desktop) - GPLv3+ with OpenSSL exception -- main source;
@@ -35,6 +41,9 @@ Patch0: %{name}-build-fixes.patch
Patch1: %{name}-system-fonts.patch
Patch2: %{name}-unbundle-minizip.patch
+Patch100: %{name}-pr-6025.patch
+Patch101: %{name}-rr-ddb9c8.patch
+
%{?_qt5:Requires: %{_qt5}%{?_isa} = %{_qt5_version}}
Requires: qt5-qtimageformats%{?_isa}
Requires: hicolor-icon-theme
@@ -74,6 +83,12 @@ BuildRequires: dee-devel
Requires: gtk3%{?_isa}
%endif
+%if %{with clang}
+BuildRequires: compiler-rt
+BuildRequires: clang
+BuildRequires: llvm
+%endif
+
%if 0%{?fedora} >= 30
BuildRequires: minizip-compat-devel
%else
@@ -127,14 +142,23 @@ popd
LEN=$(($(wc -l < out/Release/CMakeLists.txt) - 2))
sed -i "$LEN r Telegram/gyp/CMakeLists.inj" out/Release/CMakeLists.txt
-# Exporting correct paths to AR and RANLIB in order to use LTO optimizations...
-%ifarch x86_64
-sed -e '/set(configuration "Release")/a\' -e 'set(CMAKE_AR
"%{_bindir}/gcc-ar")\' -e 'set(CMAKE_RANLIB
"%{_bindir}/gcc-ranlib")\' -e 'set(CMAKE_NM
"%{_bindir}/gcc-nm")' -i out/Release/CMakeLists.txt
-%endif
-
# Building Telegram Desktop using cmake...
pushd out/Release
- %cmake .
+ %cmake \
+%if %{with clang}
+ -DCMAKE_C_COMPILER=clang \
+ -DCMAKE_CXX_COMPILER=clang++ \
+ -DCMAKE_AR=%{_bindir}/llvm-ar \
+ -DCMAKE_RANLIB=%{_bindir}/llvm-ranlib \
+ -DCMAKE_LINKER=%{_bindir}/llvm-ld \
+ -DCMAKE_OBJDUMP=%{_bindir}/llvm-objdump \
+ -DCMAKE_NM=%{_bindir}/llvm-nm \
+%else
+ -DCMAKE_AR=%{_bindir}/gcc-ar \
+ -DCMAKE_RANLIB=%{_bindir}/gcc-ranlib \
+ -DCMAKE_NM=%{_bindir}/gcc-nm \
+%endif
+ .
%make_build
popd
@@ -170,6 +194,9 @@ appstream-util validate-relax --nonet
%{buildroot}%{_metainfodir}/%{name}.appdat
%{_metainfodir}/%{name}.appdata.xml
%changelog
+* Sat May 18 2019 Vitaly Zaitsev <vitaly(a)easycoding.org> - 1.7.0-2
+- Switched to clang as temporary workaround.
+
* Thu May 09 2019 Vitaly Zaitsev <vitaly(a)easycoding.org> - 1.7.0-1
- Updated to 1.7.0.