1
0
telegram-desktop/patch.diff

495 lines
15 KiB
Diff

diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.cpp b/Telegram/SourceFiles/platform/linux/linux_libs.cpp
index a9731ce..2bb4468 100644
--- a/Telegram/SourceFiles/platform/linux/linux_libs.cpp
+++ b/Telegram/SourceFiles/platform/linux/linux_libs.cpp
@@ -45,6 +45,7 @@ bool loadLibrary(QLibrary &lib, const char *name, int version) {
}
bool setupGtkBase(QLibrary &lib_gtk) {
+ load(lib_gtk, "gdk_set_allowed_backends", gdk_set_allowed_backends);
if (!load(lib_gtk, "gtk_init_check", gtk_init_check)) return false;
if (!load(lib_gtk, "gtk_menu_new", gtk_menu_new)) return false;
if (!load(lib_gtk, "gtk_menu_get_type", gtk_menu_get_type)) return false;
@@ -106,6 +107,10 @@ bool setupGtkBase(QLibrary &lib_gtk) {
if (!load(lib_gtk, "g_slist_free", g_slist_free)) return false;
DEBUG_LOG(("Library gtk functions loaded!"));
+ if (gdk_set_allowed_backends != nullptr) {
+ gdk_set_allowed_backends("x11");
+ }
+
if (!gtk_init_check(0, 0)) {
gtk_init_check = nullptr;
DEBUG_LOG(("Failed to gtk_init_check(0, 0)!"));
@@ -128,6 +133,7 @@ bool setupAppIndicator(QLibrary &lib_indicator) {
} // namespace
+f_gdk_set_allowed_backends gdk_set_allowed_backends = nullptr;
f_gtk_init_check gtk_init_check = nullptr;
f_gtk_menu_new gtk_menu_new = nullptr;
f_gtk_menu_get_type gtk_menu_get_type = nullptr;
diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.h b/Telegram/SourceFiles/platform/linux/linux_libs.h
index bc3dce6..07c5042 100644
--- a/Telegram/SourceFiles/platform/linux/linux_libs.h
+++ b/Telegram/SourceFiles/platform/linux/linux_libs.h
@@ -52,6 +52,9 @@ bool load(QLibrary &lib, const char *name, Function &func) {
return false;
}
+typedef void (*f_gdk_set_allowed_backends)(const gchar *backends);
+extern f_gdk_set_allowed_backends gdk_set_allowed_backends;
+
typedef gboolean (*f_gtk_init_check)(int *argc, char ***argv);
extern f_gtk_init_check gtk_init_check;
diff --git a/Telegram/gyp/Telegram.gyp b/Telegram/gyp/Telegram.gyp
index f6609c1..76cd33b 100644
--- a/Telegram/gyp/Telegram.gyp
+++ b/Telegram/gyp/Telegram.gyp
@@ -78,19 +78,17 @@
],
'defines': [
- 'AL_LIBTYPE_STATIC',
'<!@(python -c "for s in \'<(travis_defines)\'.split(\',\'): print(s)")',
+ '__STDC_FORMAT_MACROS',
+ 'TDESKTOP_DISABLE_AUTOUPDATE',
+ 'TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME',
+ 'TDESKTOP_DISABLE_UNITY_INTEGRATION',
],
'include_dirs': [
'<(src_loc)',
'<(SHARED_INTERMEDIATE_DIR)',
'<(libs_loc)/breakpad/src',
- '<(libs_loc)/lzma/C',
- '<(libs_loc)/libexif-0.6.20',
- '<(libs_loc)/zlib-1.2.8',
- '<(libs_loc)/ffmpeg',
- '<(libs_loc)/openal-soft/include',
'<(minizip_loc)',
'<(sp_media_key_tap_loc)',
],
diff --git a/Telegram/gyp/qt.gypi b/Telegram/gyp/qt.gypi
index 24ededb..bb9b56b 100644
--- a/Telegram/gyp/qt.gypi
+++ b/Telegram/gyp/qt.gypi
@@ -38,7 +38,6 @@
'Qt5Network',
'Qt5Widgets',
'Qt5Gui',
- 'qtharfbuzzng',
],
'qt_version%': '<(qt_version)',
'linux_path_qt%': '/usr/local/tdesktop/Qt-<(qt_version)',
@@ -91,19 +90,6 @@
'<@(qt_libs)',
'Qt5DBus',
'Qt5Core',
- 'qtpcre',
- 'Xi',
- 'Xext',
- 'Xfixes',
- 'SM',
- 'ICE',
- 'fontconfig',
- 'expat',
- 'freetype',
- 'xcb-shm',
- 'xcb-xfixes',
- 'xcb-render',
- 'xcb-static',
],
}],
],
@@ -208,7 +194,6 @@
'<(qt_loc)/plugins/platforminputcontexts',
],
'libraries': [
- '<(linux_path_xkbcommon)/lib/libxkbcommon.a',
'<@(qt_libs_release)',
'<(linux_lib_ssl)',
'<(linux_lib_crypto)',
@@ -221,12 +206,31 @@
'gthread-2.0',
'glib-2.0',
'pthread',
+
+ 'Xi',
+ 'Xext',
+ 'Xfixes',
+ 'SM',
+ 'ICE',
+ 'fontconfig',
+ 'expat',
+ 'freetype',
+
+ '<!(pkg-config 2> /dev/null --libs xkbcommon xkbcommon-x11)',
+ '<!(pkg-config 2> /dev/null --libs harfbuzz)',
+ '<!(pkg-config 2> /dev/null --libs libpcre16)',
+ '<!(pkg-config 2> /dev/null --libs zlib)',
+ '<!(pkg-config 2> /dev/null --libs libpng16)',
+ '<!(pkg-config 2> /dev/null --libs libjpeg)',
+ '<!(pkg-config 2> /dev/null --libs libwebp)',
+ '<!(pkg-config 2> /dev/null --libs xcb-shm xcb-xfixes xcb-render xcb-renderutil xcb-sync xcb-randr xcb-xinerama xcb-xkb xcb-icccm xcb-image xcb-shape xcb-keysyms xcb-util)',
+ 'proxy',
+ 'GL',
],
'include_dirs': [
'<(qt_loc)/mkspecs/linux-g++',
],
'ldflags': [
- '-static-libstdc++',
'-pthread',
'-g',
'-rdynamic',
diff --git a/Telegram/gyp/qt.gypi.orig b/Telegram/gyp/qt.gypi.orig
new file mode 100644
index 0000000..bb9b56b
--- /dev/null
+++ b/Telegram/gyp/qt.gypi.orig
@@ -0,0 +1,261 @@
+# This file is part of Telegram Desktop,
+# the official desktop version of Telegram messaging app, see https://telegram.org
+#
+# Telegram Desktop is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# It is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# In addition, as a special exception, the copyright holders give permission
+# to link the code of portions of this program with the OpenSSL library.
+#
+# Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
+# Copyright (c) 2014 John Preston, https://desktop.telegram.org
+
+{
+ 'variables': {
+ 'variables': {
+ 'variables': {
+ 'variables': {
+ 'variables': {
+ 'conditions': [
+ [ 'build_macold', {
+ 'qt_version%': '5.3.2',
+ }, {
+ 'qt_version%': '5.6.2',
+ }]
+ ],
+ },
+ 'qt_libs': [
+ 'qwebp',
+ 'Qt5PrintSupport',
+ 'Qt5PlatformSupport',
+ 'Qt5Network',
+ 'Qt5Widgets',
+ 'Qt5Gui',
+ ],
+ 'qt_version%': '<(qt_version)',
+ 'linux_path_qt%': '/usr/local/tdesktop/Qt-<(qt_version)',
+ },
+ 'qt_version%': '<(qt_version)',
+ 'qt_loc_unix': '<(linux_path_qt)',
+ 'conditions': [
+ [ 'build_win', {
+ 'qt_lib_prefix': '<(ld_lib_prefix)',
+ 'qt_lib_debug_postfix': 'd<(ld_lib_postfix)',
+ 'qt_lib_release_postfix': '<(ld_lib_postfix)',
+ 'qt_libs': [
+ '<@(qt_libs)',
+ 'Qt5Core',
+ 'qtmain',
+ 'qwindows',
+ 'qtfreetype',
+ 'qtpcre',
+ ],
+ }],
+ [ 'build_mac', {
+ 'qt_lib_prefix': '<(ld_lib_prefix)',
+ 'qt_lib_debug_postfix': '_debug<(ld_lib_postfix)',
+ 'qt_lib_release_postfix': '<(ld_lib_postfix)',
+ 'qt_libs': [
+ '<@(qt_libs)',
+ 'Qt5Core',
+ 'qgenericbearer',
+ 'qcocoa',
+ ],
+ }],
+ [ 'build_mac and not build_macold', {
+ 'qt_libs': [
+ '<@(qt_libs)',
+ 'Qt5Core',
+ 'qtfreetype',
+ 'qtpcre',
+ ],
+ }],
+ [ 'build_linux', {
+ 'qt_lib_prefix': 'lib',
+ 'qt_lib_debug_postfix': '.a',
+ 'qt_lib_release_postfix': '.a',
+ 'qt_libs': [
+ 'qxcb',
+ 'Qt5XcbQpa',
+ 'qconnmanbearer',
+ 'qgenericbearer',
+ 'qnmbearer',
+ '<@(qt_libs)',
+ 'Qt5DBus',
+ 'Qt5Core',
+ ],
+ }],
+ ],
+ },
+ 'qt_version%': '<(qt_version)',
+ 'qt_loc_unix': '<(qt_loc_unix)',
+ 'qt_version_loc': '<!(python -c "print(\'<(qt_version)\'.replace(\'.\', \'_\'))")',
+ 'qt_libs_debug': [
+ '<!@(python -c "for s in \'<@(qt_libs)\'.split(\' \'): print(\'<(qt_lib_prefix)\' + s + \'<(qt_lib_debug_postfix)\')")',
+ ],
+ 'qt_libs_release': [
+ '<!@(python -c "for s in \'<@(qt_libs)\'.split(\' \'): print(\'<(qt_lib_prefix)\' + s + \'<(qt_lib_release_postfix)\')")',
+ ],
+ },
+ 'qt_libs_debug': [ '<@(qt_libs_debug)' ],
+ 'qt_libs_release': [ '<@(qt_libs_release)' ],
+ 'qt_version%': '<(qt_version)',
+ 'conditions': [
+ [ 'build_win', {
+ 'qt_loc': '../../../Libraries/qt<(qt_version_loc)/qtbase',
+ }, {
+ 'qt_loc': '<(qt_loc_unix)',
+ }],
+ ],
+
+ 'linux_path_xkbcommon%': '/usr/local',
+ 'linux_lib_ssl%': '/usr/local/ssl/lib/libssl.a',
+ 'linux_lib_crypto%': '/usr/local/ssl/lib/libcrypto.a',
+ 'linux_lib_icu%': '/usr/lib/libicutu.a /usr/lib/libicui18n.a /usr/lib/libicuuc.a /usr/lib/libicudata.a',
+ },
+
+ 'configurations': {
+ 'Debug': {
+ 'conditions' : [
+ [ 'build_win', {
+ 'msvs_settings': {
+ 'VCLinkerTool': {
+ 'AdditionalDependencies': [
+ '<@(qt_libs_debug)',
+ ],
+ },
+ },
+ }],
+ [ 'build_mac', {
+ 'xcode_settings': {
+ 'OTHER_LDFLAGS': [
+ '<@(qt_libs_debug)',
+ '/usr/local/lib/libz.a',
+ ],
+ },
+ }],
+ ],
+ },
+ 'Release': {
+ 'conditions' : [
+ [ 'build_win', {
+ 'msvs_settings': {
+ 'VCLinkerTool': {
+ 'AdditionalDependencies': [
+ '<@(qt_libs_release)',
+ ],
+ },
+ },
+ }],
+ [ 'build_mac', {
+ 'xcode_settings': {
+ 'OTHER_LDFLAGS': [
+ '<@(qt_libs_release)',
+ '/usr/local/lib/libz.a',
+ ],
+ },
+ }],
+ ],
+ },
+ },
+
+ 'include_dirs': [
+ '<(qt_loc)/include',
+ '<(qt_loc)/include/QtCore',
+ '<(qt_loc)/include/QtGui',
+ '<(qt_loc)/include/QtCore/<(qt_version)',
+ '<(qt_loc)/include/QtGui/<(qt_version)',
+ '<(qt_loc)/include/QtCore/<(qt_version)/QtCore',
+ '<(qt_loc)/include/QtGui/<(qt_version)/QtGui',
+ ],
+ 'library_dirs': [
+ '<(qt_loc)/lib',
+ '<(qt_loc)/plugins',
+ '<(qt_loc)/plugins/bearer',
+ '<(qt_loc)/plugins/platforms',
+ '<(qt_loc)/plugins/imageformats',
+ ],
+ 'defines': [
+ 'QT_WIDGETS_LIB',
+ 'QT_NETWORK_LIB',
+ 'QT_GUI_LIB',
+ 'QT_CORE_LIB',
+ ],
+ 'conditions': [
+ [ 'build_linux', {
+ 'library_dirs': [
+ '<(qt_loc)/plugins/platforminputcontexts',
+ ],
+ 'libraries': [
+ '<@(qt_libs_release)',
+ '<(linux_lib_ssl)',
+ '<(linux_lib_crypto)',
+ '<!@(python -c "for s in \'<(linux_lib_icu)\'.split(\' \'): print(s)")',
+ 'xcb',
+ 'X11',
+ 'X11-xcb',
+ 'dbus-1',
+ 'dl',
+ 'gthread-2.0',
+ 'glib-2.0',
+ 'pthread',
+
+ 'Xi',
+ 'Xext',
+ 'Xfixes',
+ 'SM',
+ 'ICE',
+ 'fontconfig',
+ 'expat',
+ 'freetype',
+
+ '<!(pkg-config 2> /dev/null --libs xkbcommon xkbcommon-x11)',
+ '<!(pkg-config 2> /dev/null --libs harfbuzz)',
+ '<!(pkg-config 2> /dev/null --libs libpcre16)',
+ '<!(pkg-config 2> /dev/null --libs zlib)',
+ '<!(pkg-config 2> /dev/null --libs libpng16)',
+ '<!(pkg-config 2> /dev/null --libs libjpeg)',
+ '<!(pkg-config 2> /dev/null --libs libwebp)',
+ '<!(pkg-config 2> /dev/null --libs xcb-shm xcb-xfixes xcb-render xcb-renderutil xcb-sync xcb-randr xcb-xinerama xcb-xkb xcb-icccm xcb-image xcb-shape xcb-keysyms xcb-util)',
+ 'proxy',
+ 'GL',
+ ],
+ 'include_dirs': [
+ '<(qt_loc)/mkspecs/linux-g++',
+ ],
+ 'ldflags': [
+ '-pthread',
+ '-g',
+ '-rdynamic',
+ ],
+ }],
+ ],
+
+ 'rules': [{
+ 'rule_name': 'qt_moc',
+ 'extension': 'h',
+ 'outputs': [
+ '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/moc/moc_<(RULE_INPUT_ROOT).cpp',
+ ],
+ 'action': [
+ '<(qt_loc)/bin/moc<(exe_ext)',
+
+ # Silence "Note: No relevant classes found. No output generated."
+ '--no-notes',
+
+ '<!@(python -c "for s in \'<@(_defines)\'.split(\' \'): print(\'-D\' + s)")',
+ # '<!@(python -c "for s in \'<@(_include_dirs)\'.split(\' \'): print(\'-I\' + s)")',
+ '<(RULE_INPUT_PATH)',
+ '-o', '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/moc/moc_<(RULE_INPUT_ROOT).cpp',
+ ],
+ 'message': 'Moc-ing <(RULE_INPUT_ROOT).h..',
+ 'process_outputs_as_sources': 1,
+ }],
+}
diff --git a/Telegram/gyp/telegram_linux.gypi b/Telegram/gyp/telegram_linux.gypi
index d07b592..eeb9b25 100644
--- a/Telegram/gyp/telegram_linux.gypi
+++ b/Telegram/gyp/telegram_linux.gypi
@@ -21,11 +21,20 @@
'conditions': [[ 'build_linux', {
'variables': {
'pkgconfig_libs': [
-# In order to work libxkbcommon must be linked statically,
-# PKGCONFIG links it like "-L/usr/local/lib -lxkbcommon"
-# which makes a dynamic link which leads to segfault in
-# QApplication() -> createPlatformIntegration -> QXcbIntegrationPlugin::create
- #'xkbcommon',
+ 'liblzma',
+ 'openal',
+ 'libavformat',
+ 'libavcodec',
+ 'libswresample',
+ 'libswscale',
+ 'libavutil',
+ 'opus',
+ 'libva-x11',
+ 'libva-drm',
+ 'libva',
+ 'libdrm',
+ 'zlib',
+ 'glib-2.0',
],
'linux_path_ffmpeg%': '/usr/local',
'linux_path_openal%': '/usr/local',
@@ -34,44 +43,26 @@
'linux_path_breakpad%': '<(libs_loc)/breakpad',
},
'include_dirs': [
- '/usr/local/include',
- '<(linux_path_ffmpeg)/include',
- '<(linux_path_openal)/include',
'<(linux_path_breakpad)/include/breakpad',
+ '/usr/include',
],
'library_dirs': [
- '/usr/local/lib',
- '<(linux_path_ffmpeg)/lib',
- '<(linux_path_openal)/lib',
- '<(linux_path_libexif_lib)',
- '<(linux_path_va)/lib',
- '<(linux_path_breakpad)/lib',
+ '<(linux_path_breakpad)/src/client/linux',
+ '/usr/lib',
],
'libraries': [
- 'breakpad_client',
'composeplatforminputcontextplugin',
'ibusplatforminputcontextplugin',
'fcitxplatforminputcontextplugin',
- 'liblzma.a',
- 'libopenal.a',
- 'libavformat.a',
- 'libavcodec.a',
- 'libswresample.a',
- 'libswscale.a',
- 'libavutil.a',
- 'libopus.a',
- 'libva-x11.a',
- 'libva-drm.a',
- 'libva.a',
- 'libdrm.a',
- 'libz.a',
-# '<!(pkg-config 2> /dev/null --libs <@(pkgconfig_libs))',
+ '<!(pkg-config 2> /dev/null --libs <@(pkgconfig_libs))',
+ 'libbreakpad_client.a',
],
'cflags_cc': [
'<!(pkg-config 2> /dev/null --cflags appindicator-0.1)',
'<!(pkg-config 2> /dev/null --cflags gtk+-2.0)',
'<!(pkg-config 2> /dev/null --cflags glib-2.0)',
'<!(pkg-config 2> /dev/null --cflags dee-1.0)',
+ '<!(pkg-config 2> /dev/null --cflags <@(pkgconfig_libs))',
],
'configurations': {
'Release': {