telegram-desktop: update to 1.3.9.

This commit is contained in:
John 2018-07-03 12:26:22 +02:00 committed by maxice8
parent ff45553dce
commit 1ab6c781b1
19 changed files with 842 additions and 723 deletions

View file

@ -1,14 +0,0 @@
# ------------- debian/CMakeLists.inj begin -------------
# The text will be putted into the appropriate CMakeLists by debian/rules script
# Avoid rpath compiler parameter
set_target_properties(Telegram PROPERTIES SKIP_BUILD_RPATH TRUE)
# This makes up for patch of gyp utility, supporting precompiled headers. If
# Telegram/Patches/gyp.diff file will be changed in future, please check these
# lines.
include(../../Telegram/gyp/PrecompiledHeader.cmake)
add_precompiled_header(Telegram ../../Telegram/SourceFiles/stdafx.h)
# vim: ft=cmake
# -------------- debian/CMakeLists.inj end --------------

View file

@ -0,0 +1,19 @@
find_path(BREAKPAD_CLIENT_INCLUDE_DIR
NAMES client/linux/handler/exception_handler.h
PATH_SUFFIXES breakpad
)
find_library(BREAKPAD_CLIENT_LIBRARY
NAMES breakpad_client
)
find_package_handle_standard_args(Breakpad DEFAULT_MSG
BREAKPAD_CLIENT_LIBRARY
BREAKPAD_CLIENT_INCLUDE_DIR
)
add_library(breakpad_client STATIC IMPORTED)
add_dependencies(breakpad_client breakpad_build)
set_property(TARGET breakpad_client PROPERTY IMPORTED_LOCATION ${BREAKPAD_CLIENT_LIBRARY})
set_property(TARGET breakpad_client PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${BREAKPAD_CLIENT_INCLUDE_DIR})

View file

@ -0,0 +1,216 @@
cmake_minimum_required(VERSION 3.8)
project(TelegramDesktop)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
include(GNUInstallDirs)
list(APPEND CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/gyp
${CMAKE_SOURCE_DIR}/cmake
)
option(BUILD_TESTS "Build all available test suites" OFF)
option(ENABLE_CRASH_REPORTS "Enable crash reports" ON)
option(ENABLE_GTK_INTEGRATION "Enable GTK integration" ON)
option(ENABLE_64BIT "Enable 64bit build" OFF)
find_package(LibLZMA REQUIRED)
find_package(OpenAL REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(Threads REQUIRED)
find_package(X11 REQUIRED)
find_package(ZLIB REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS Core DBus Gui Widgets Network)
get_target_property(QTCORE_INCLUDE_DIRS Qt5::Core INTERFACE_INCLUDE_DIRECTORIES)
list(GET QTCORE_INCLUDE_DIRS 0 QT_INCLUDE_DIR)
foreach(__qt_module IN ITEMS QtCore QtGui)
list(APPEND QT_PRIVATE_INCLUDE_DIRS
${QT_INCLUDE_DIR}/${__qt_module}/${Qt5_VERSION}
${QT_INCLUDE_DIR}/${__qt_module}/${Qt5_VERSION}/${__qt_module}
)
endforeach()
message(STATUS "Using Qt private include directories: ${QT_PRIVATE_INCLUDE_DIRS}")
find_package(PkgConfig REQUIRED)
pkg_check_modules(FFMPEG REQUIRED libavcodec libavformat libavutil libswresample libswscale)
pkg_check_modules(LIBDRM REQUIRED libdrm)
pkg_check_modules(LIBVA REQUIRED libva libva-drm libva-x11)
pkg_check_modules(MINIZIP REQUIRED minizip)
set(THIRD_PARTY_DIR ${CMAKE_SOURCE_DIR}/ThirdParty)
list(APPEND THIRD_PARTY_INCLUDE_DIRS
${THIRD_PARTY_DIR}/crl/src
${THIRD_PARTY_DIR}/GSL/include
${THIRD_PARTY_DIR}/emoji_suggestions
${THIRD_PARTY_DIR}/libtgvoip
${THIRD_PARTY_DIR}/variant/include
)
add_subdirectory(${THIRD_PARTY_DIR}/crl)
add_subdirectory(${THIRD_PARTY_DIR}/libtgvoip)
set(TELEGRAM_SOURCES_DIR ${CMAKE_SOURCE_DIR}/SourceFiles)
set(TELEGRAM_RESOURCES_DIR ${CMAKE_SOURCE_DIR}/Resources)
include_directories(${TELEGRAM_SOURCES_DIR})
set(GENERATED_DIR ${CMAKE_BINARY_DIR}/generated)
file(MAKE_DIRECTORY ${GENERATED_DIR})
include(TelegramCodegen)
set_property(SOURCE ${TELEGRAM_GENERATED_SOURCES} PROPERTY SKIP_AUTOMOC ON)
set(QRC_FILES
Resources/qrc/telegram.qrc
Resources/qrc/telegram_emoji.qrc
Resources/qrc/telegram_emoji_large.qrc
# This only disables system plugin search path
# We do not want this behavior for system build
# Resources/qrc/telegram_linux.qrc
)
file(GLOB FLAT_SOURCE_FILES
SourceFiles/*.cpp
SourceFiles/base/*.cpp
SourceFiles/calls/*.cpp
SourceFiles/chat_helpers/*.cpp
SourceFiles/core/*.cpp
SourceFiles/data/*.cpp
SourceFiles/dialogs/*.cpp
SourceFiles/history/*.cpp
SourceFiles/inline_bots/*.cpp
SourceFiles/intro/*.cpp
SourceFiles/lang/*.cpp
SourceFiles/mtproto/*.cpp
SourceFiles/overview/*.cpp
SourceFiles/passport/*.cpp
SourceFiles/platform/linux/*.cpp
SourceFiles/profile/*.cpp
SourceFiles/settings/*.cpp
SourceFiles/storage/*.cpp
${THIRD_PARTY_DIR}/emoji_suggestions/*.cpp
)
file(GLOB FLAT_EXTRA_FILES
SourceFiles/qt_static_plugins.cpp
SourceFiles/base/*_tests.cpp
SourceFiles/base/tests_main.cpp
SourceFiles/passport/passport_edit_identity_box.cpp
SourceFiles/passport/passport_form_row.cpp
)
list(REMOVE_ITEM FLAT_SOURCE_FILES ${FLAT_EXTRA_FILES})
file(GLOB_RECURSE SUBDIRS_SOURCE_FILES
SourceFiles/boxes/*.cpp
SourceFiles/export/*.cpp
SourceFiles/history/*.cpp
SourceFiles/info/*.cpp
SourceFiles/media/*.cpp
SourceFiles/ui/*.cpp
SourceFiles/window/*.cpp
)
add_executable(Telegram WIN32 ${QRC_FILES} ${FLAT_SOURCE_FILES} ${SUBDIRS_SOURCE_FILES})
set(TELEGRAM_COMPILE_DEFINITIONS
TDESKTOP_DISABLE_AUTOUPDATE
TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION
TDESKTOP_DISABLE_UNITY_INTEGRATION
__STDC_FORMAT_MACROS
)
set(TELEGRAM_INCLUDE_DIRS
${FFMPEG_INCLUDE_DIRS}
${GENERATED_DIR}
${LIBDRM_INCLUDE_DIRS}
${LIBLZMA_INCLUDE_DIRS}
${LIBVA_INCLUDE_DIRS}
${MINIZIP_INCLUDE_DIRS}
${OPENAL_INCLUDE_DIR}
${QT_PRIVATE_INCLUDE_DIRS}
${THIRD_PARTY_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIR}
)
set(TELEGRAM_LINK_LIBRARIES
crl
tgvoip
OpenSSL::Crypto
OpenSSL::SSL
Qt5::DBus
Qt5::Network
Qt5::Widgets
Threads::Threads
${FFMPEG_LIBRARIES}
${LIBDRM_LIBRARIES}
${LIBLZMA_LIBRARIES}
${LIBVA_LIBRARIES}
${MINIZIP_LIBRARIES}
${OPENAL_LIBRARY}
${X11_X11_LIB}
${ZLIB_LIBRARY_RELEASE}
)
if(ENABLE_CRASH_REPORTS)
find_package(Breakpad REQUIRED)
list(APPEND TELEGRAM_LINK_LIBRARIES
breakpad_client
)
else()
list(APPEND TELEGRAM_COMPILE_DEFINITIONS
TDESKTOP_DISABLE_CRASH_REPORTS
)
endif()
if(ENABLE_GTK_INTEGRATION)
pkg_check_modules(APPINDICATOR REQUIRED appindicator3-0.1)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
list(APPEND TELEGRAM_INCLUDE_DIRS
${APPINDICATOR_INCLUDE_DIRS}
${GTK3_INCLUDE_DIRS}
)
list(APPEND TELEGRAM_LINK_LIBRARIES
${APPINDICATOR_LIBRARIES}
${GTK3_LIBRARIES}
)
else()
list(APPEND TELEGRAM_COMPILE_DEFINITIONS
TDESKTOP_DISABLE_GTK_INTEGRATION
)
endif()
if(ENABLE_64BIT)
list(APPEND TELEGRAM_COMPILE_DEFINITIONS
Q_OS_LINUX64
)
else()
list(APPEND TELEGRAM_COMPILE_DEFINITIONS
Q_OS_LINUX32
)
endif()
target_sources(Telegram PRIVATE ${TELEGRAM_GENERATED_SOURCES})
add_dependencies(Telegram telegram_codegen)
include(PrecompiledHeader)
add_precompiled_header(Telegram SourceFiles/stdafx.h)
target_compile_definitions(Telegram PUBLIC ${TELEGRAM_COMPILE_DEFINITIONS})
target_include_directories(Telegram PUBLIC ${TELEGRAM_INCLUDE_DIRS})
target_link_libraries(Telegram ${TELEGRAM_LINK_LIBRARIES})
set_target_properties(Telegram PROPERTIES AUTOMOC_MOC_OPTIONS -bTelegram_pch/stdafx.h)
if(BUILD_TESTS)
include(TelegramTests)
endif()
install(TARGETS Telegram RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${CMAKE_SOURCE_DIR}/../lib/xdg/telegram-desktop.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)

View file

@ -0,0 +1,96 @@
set(TELEGRAM_GENERATED_SOURCES)
set(IMPORT_EXECUTABLES "native/ImportExecutables.cmake" CACHE FILEPATH "POINT")
INCLUDE(${IMPORT_EXECUTABLES})
add_custom_command(
OUTPUT
${GENERATED_DIR}/scheme.h
${GENERATED_DIR}/scheme.cpp
COMMAND python ${TELEGRAM_SOURCES_DIR}/codegen/scheme/codegen_scheme.py -o${GENERATED_DIR} ${TELEGRAM_RESOURCES_DIR}/scheme.tl
DEPENDS ${CMAKE_SOURCE_DIR}/Resources/scheme.tl
COMMENT "Codegen scheme.tl"
)
list(APPEND TELEGRAM_GENERATED_SOURCES
${GENERATED_DIR}/scheme.h
${GENERATED_DIR}/scheme.cpp
)
file(GLOB_RECURSE STYLES
${TELEGRAM_RESOURCES_DIR}/*.palette
${TELEGRAM_RESOURCES_DIR}/*.style
${TELEGRAM_SOURCES_DIR}/*.style
)
set(GENERATED_STYLES)
foreach(STYLE ${STYLES})
get_filename_component(STYLE_FILENAME ${STYLE} NAME)
get_filename_component(STYLE_NAME ${STYLE} NAME_WE)
if (${STYLE} MATCHES \\.palette$)
set(THIS_GENERATED_STYLES
${GENERATED_DIR}/styles/palette.h
${GENERATED_DIR}/styles/palette.cpp
)
else()
set(THIS_GENERATED_STYLES
${GENERATED_DIR}/styles/style_${STYLE_NAME}.h
${GENERATED_DIR}/styles/style_${STYLE_NAME}.cpp
)
endif()
# style generator does not like '-' in file path, so let's use relative paths...
add_custom_command(
OUTPUT ${THIS_GENERATED_STYLES}
COMMAND codegen_style -IResources -ISourceFiles -o${GENERATED_DIR}/styles ${STYLE}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
DEPENDS codegen_style ${STYLE}
COMMENT "Codegen style ${STYLE_FILENAME}"
)
set(GENERATED_STYLES ${GENERATED_STYLES} ${THIS_GENERATED_STYLES})
endforeach()
list(APPEND TELEGRAM_GENERATED_SOURCES ${GENERATED_STYLES})
add_custom_command(
OUTPUT
${GENERATED_DIR}/emoji.h
${GENERATED_DIR}/emoji.cpp
${GENERATED_DIR}/emoji_suggestions_data.h
${GENERATED_DIR}/emoji_suggestions_data.cpp
COMMAND codegen_emoji -o${GENERATED_DIR} ${TELEGRAM_RESOURCES_DIR}/emoji_autocomplete.json
DEPENDS codegen_emoji
COMMENT "Codegen emoji"
)
list(APPEND TELEGRAM_GENERATED_SOURCES
${GENERATED_DIR}/emoji.h
${GENERATED_DIR}/emoji.cpp
${GENERATED_DIR}/emoji_suggestions_data.h
${GENERATED_DIR}/emoji_suggestions_data.cpp
)
add_custom_command(
OUTPUT
${GENERATED_DIR}/lang_auto.h
${GENERATED_DIR}/lang_auto.cpp
COMMAND codegen_lang -o${GENERATED_DIR} ${TELEGRAM_RESOURCES_DIR}/langs/lang.strings
DEPENDS codegen_lang
COMMENT "Codegen lang"
)
list(APPEND TELEGRAM_GENERATED_SOURCES
${GENERATED_DIR}/lang_auto.h
${GENERATED_DIR}/lang_auto.cpp
)
add_custom_command(
OUTPUT
${GENERATED_DIR}/numbers.h
${GENERATED_DIR}/numbers.cpp
COMMAND codegen_numbers -o${GENERATED_DIR} ${TELEGRAM_RESOURCES_DIR}/numbers.txt
DEPENDS codegen_numbers
COMMENT "Codegen numbers"
)
list(APPEND TELEGRAM_GENERATED_SOURCES
${GENERATED_DIR}/numbers.h
${GENERATED_DIR}/numbers.cpp
)
add_custom_target(telegram_codegen DEPENDS ${TELEGRAM_GENERATED_SOURCES})

View file

@ -0,0 +1,32 @@
cmake_minimum_required(VERSION 3.8)
project(TelegramCodegen)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5 REQUIRED Core Gui)
set(TELEGRAM_SOURCES_DIR ${CMAKE_SOURCE_DIR}/../SourceFiles)
include_directories(${TELEGRAM_SOURCES_DIR})
file(GLOB CODEGEN_COMMON_SOURCES
${TELEGRAM_SOURCES_DIR}/codegen/common/*.h
${TELEGRAM_SOURCES_DIR}/codegen/common/*.cpp
)
add_library(codegen_common OBJECT ${CODEGEN_COMMON_SOURCES})
target_include_directories(codegen_common PUBLIC $<TARGET_PROPERTY:Qt5::Core,INTERFACE_INCLUDE_DIRECTORIES>)
target_compile_options(codegen_common PUBLIC $<TARGET_PROPERTY:Qt5::Core,INTERFACE_COMPILE_OPTIONS>)
foreach(TOOL emoji lang numbers style)
file(GLOB CODEGEN_${TOOL}_SOURCES
${TELEGRAM_SOURCES_DIR}/codegen/${TOOL}/*.h
${TELEGRAM_SOURCES_DIR}/codegen/${TOOL}/*.cpp
)
add_executable(codegen_${TOOL} ${CODEGEN_${TOOL}_SOURCES} $<TARGET_OBJECTS:codegen_common>)
target_link_libraries(codegen_${TOOL} Qt5::Core Qt5::Gui)
endforeach()
EXPORT(TARGETS codegen_emoji codegen_lang codegen_numbers codegen_style FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake )

View file

@ -0,0 +1,61 @@
#find_package(catch REQUIRED)
set(catch_INCLUDE /usr/include/catch)
file(GLOB LIST_TESTS_PY gyp/tests/list_tests.py)
file(GLOB TESTS_LIST_TXT gyp/tests/tests_list.txt)
add_executable(tests_algorithm
SourceFiles/base/algorithm_tests.cpp
SourceFiles/base/tests_main.cpp
)
add_executable(tests_flags
SourceFiles/base/flags_tests.cpp
SourceFiles/base/tests_main.cpp
)
add_executable(tests_flat_map
SourceFiles/base/flat_map_tests.cpp
SourceFiles/base/tests_main.cpp
)
add_executable(tests_flat_set
SourceFiles/base/flat_set_tests.cpp
SourceFiles/base/tests_main.cpp
)
add_executable(tests_rpl
SourceFiles/rpl/operators_tests.cpp
SourceFiles/rpl/producer_tests.cpp
SourceFiles/rpl/variable_tests.cpp
SourceFiles/base/tests_main.cpp
)
target_link_libraries(tests_algorithm Qt5::Core)
target_link_libraries(tests_flags Qt5::Core)
target_link_libraries(tests_flat_map Qt5::Core)
target_link_libraries(tests_flat_set Qt5::Core)
target_link_libraries(tests_rpl Qt5::Core)
target_include_directories(tests_algorithm PUBLIC
${catch_INCLUDE}
)
target_include_directories(tests_flags PUBLIC
${catch_INCLUDE}
)
target_include_directories(tests_flat_map PUBLIC
${catch_INCLUDE}
${THIRD_PARTY_DIR}/GSL/include
${THIRD_PARTY_DIR}/variant/include
)
target_include_directories(tests_flat_set PUBLIC
${catch_INCLUDE}
)
target_include_directories(tests_rpl PUBLIC
${catch_INCLUDE}
${THIRD_PARTY_DIR}/GSL/include
${THIRD_PARTY_DIR}/variant/include
)
enable_testing()
add_test(tests python ${LIST_TESTS_PY} --input ${TESTS_LIST_TXT})

View file

@ -0,0 +1,15 @@
project(crl)
find_package(Qt5 REQUIRED COMPONENTS Core)
file(GLOB CRL_SOURCE_FILES
src/crl/common/*.cpp
src/crl/dispatch/*.cpp
src/crl/qt/*.cpp
src/crl/winapi/*.cpp
)
add_library(${PROJECT_NAME} STATIC ${CRL_SOURCE_FILES})
target_include_directories(${PROJECT_NAME} PUBLIC src)
target_link_libraries(${PROJECT_NAME} Qt5::Core)

View file

@ -0,0 +1,93 @@
project(webrtc)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
list(APPEND WEBRTC_C_SOURCE_FILES
"common_audio/fft4g.c"
"common_audio/ring_buffer.c"
"common_audio/signal_processing/auto_corr_to_refl_coef.c"
"common_audio/signal_processing/auto_correlation.c"
"common_audio/signal_processing/complex_bit_reverse.c"
"common_audio/signal_processing/complex_fft.c"
"common_audio/signal_processing/copy_set_operations.c"
"common_audio/signal_processing/cross_correlation.c"
"common_audio/signal_processing/division_operations.c"
"common_audio/signal_processing/dot_product_with_scale.c"
"common_audio/signal_processing/downsample_fast.c"
"common_audio/signal_processing/energy.c"
"common_audio/signal_processing/filter_ar.c"
"common_audio/signal_processing/filter_ar_fast_q12.c"
"common_audio/signal_processing/filter_ma_fast_q12.c"
"common_audio/signal_processing/get_hanning_window.c"
"common_audio/signal_processing/get_scaling_square.c"
"common_audio/signal_processing/ilbc_specific_functions.c"
"common_audio/signal_processing/levinson_durbin.c"
"common_audio/signal_processing/lpc_to_refl_coef.c"
"common_audio/signal_processing/min_max_operations.c"
"common_audio/signal_processing/randomization_functions.c"
"common_audio/signal_processing/real_fft.c"
"common_audio/signal_processing/refl_coef_to_lpc.c"
"common_audio/signal_processing/resample.c"
"common_audio/signal_processing/resample_48khz.c"
"common_audio/signal_processing/resample_by_2.c"
"common_audio/signal_processing/resample_by_2_internal.c"
"common_audio/signal_processing/resample_fractional.c"
"common_audio/signal_processing/spl_init.c"
"common_audio/signal_processing/spl_inl.c"
"common_audio/signal_processing/spl_sqrt.c"
"common_audio/signal_processing/spl_sqrt_floor.c"
"common_audio/signal_processing/splitting_filter_impl.c"
"common_audio/signal_processing/sqrt_of_one_minus_x_squared.c"
"common_audio/signal_processing/vector_scaling_operations.c"
"modules/audio_processing/agc/legacy/analog_agc.c"
"modules/audio_processing/agc/legacy/digital_agc.c"
"modules/audio_processing/ns/noise_suppression.c"
"modules/audio_processing/ns/noise_suppression_x.c"
"modules/audio_processing/ns/ns_core.c"
"modules/audio_processing/ns/nsx_core.c"
"modules/audio_processing/ns/nsx_core_c.c"
)
list(APPEND WEBRTC_CXX_SOURCE_FILES
"base/checks.cc"
"base/stringutils.cc"
"common_audio/audio_util.cc"
"common_audio/channel_buffer.cc"
"common_audio/sparse_fir_filter.cc"
"common_audio/wav_file.cc"
"common_audio/wav_header.cc"
"modules/audio_processing/splitting_filter.cc"
"modules/audio_processing/three_band_filter_bank.cc"
"modules/audio_processing/aec/aec_core.cc"
"modules/audio_processing/aec/aec_core_sse2.cc"
"modules/audio_processing/aec/aec_resampler.cc"
"modules/audio_processing/aec/echo_cancellation.cc"
"modules/audio_processing/aecm/aecm_core.cc"
"modules/audio_processing/aecm/aecm_core_c.cc"
"modules/audio_processing/aecm/echo_control_mobile.cc"
"modules/audio_processing/logging/apm_data_dumper.cc"
"modules/audio_processing/splitting_filter.cc"
"modules/audio_processing/three_band_filter_bank.cc"
"modules/audio_processing/utility/block_mean_calculator.cc"
"modules/audio_processing/utility/delay_estimator.cc"
"modules/audio_processing/utility/delay_estimator_wrapper.cc"
"modules/audio_processing/utility/ooura_fft.cc"
"modules/audio_processing/utility/ooura_fft_sse2.cc"
"system_wrappers/source/cpu_features.cc"
)
add_library(${PROJECT_NAME} OBJECT ${WEBRTC_C_SOURCE_FILES} ${WEBRTC_CXX_SOURCE_FILES})
target_compile_definitions(${PROJECT_NAME} PUBLIC
WEBRTC_APM_DEBUG_DUMP=0
WEBRTC_POSIX
)
if( "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2")
endif( "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686" )
# TODO: drop include dirs with latest webrtc
target_include_directories(${PROJECT_NAME} PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/.."
)

View file

@ -0,0 +1,44 @@
project(tgvoip)
option(ENABLE_PULSEAUDIO "Enable pulseaudio" ON)
add_subdirectory("${PROJECT_SOURCE_DIR}/webrtc_dsp/webrtc")
find_package(PkgConfig REQUIRED)
pkg_check_modules(OPUS REQUIRED opus)
file(GLOB TGVOIP_SOURCE_FILES
*.cpp
audio/*.cpp
os/linux/*.cpp
os/posix/*.cpp
)
file(GLOB TGVOIP_EXTRA_FILES
BufferInputStream.cpp
BufferOutputStream.cpp
BufferPool.cpp
)
list(REMOVE_ITEM TGVOIP_SOURCE_FILES ${TGVOIP_EXTRA_FILES})
set(TGVOIP_COMPILE_DEFINITIONS TGVOIP_USE_DESKTOP_DSP)
if(ENABLE_PULSEAUDIO)
pkg_check_modules(LIBPULSE REQUIRED libpulse)
else()
file(GLOB PULSEAUDIO_SOURCE_FILES
os/linux/AudioInputPulse.cpp
os/linux/AudioOutputPulse.cpp
os/linux/PulseAudioLoader.cpp
)
list(REMOVE_ITEM TGVOIP_SOURCE_FILES ${PULSEAUDIO_SOURCE_FILES})
list(APPEND TGVOIP_COMPILE_DEFINITIONS TGVOIP_DISABLE_PULSEAUDIO)
endif()
add_library(${PROJECT_NAME} STATIC ${TGVOIP_SOURCE_FILES} $<TARGET_OBJECTS:webrtc>)
target_compile_definitions(${PROJECT_NAME} PUBLIC ${TGVOIP_COMPILE_DEFINITIONS})
target_include_directories(${PROJECT_NAME} PUBLIC
"${OPUS_INCLUDE_DIRS}"
"${CMAKE_CURRENT_LIST_DIR}/webrtc_dsp"
"${CMAKE_CURRENT_LIST_DIR}/webrtc_dsp/webrtc"
)
target_link_libraries(${PROJECT_NAME} dl ${OPUS_LIBRARIES})

View file

@ -1,556 +0,0 @@
diff --git Telegram/Resources/qrc/telegram_linux.qrc Telegram/Resources/qrc/telegram_linux.qrc
index 0554fa17..3ea02740 100644
--- Telegram/Resources/qrc/telegram_linux.qrc
+++ Telegram/Resources/qrc/telegram_linux.qrc
@@ -1,5 +1,4 @@
<RCC>
<qresource prefix="/qt">
- <file alias="etc/qt.conf">../etc/qt_linux.conf</file>
</qresource>
</RCC>
diff --git Telegram/SourceFiles/core/launcher.cpp Telegram/SourceFiles/core/launcher.cpp
index 7f173565..1bc26fed 100644
--- Telegram/SourceFiles/core/launcher.cpp
+++ Telegram/SourceFiles/core/launcher.cpp
@@ -31,9 +31,10 @@ void Launcher::init() {
QCoreApplication::setApplicationName(qsl("TelegramDesktop"));
-#ifndef OS_MAC_OLD
+#if !defined(Q_OS_MAC) && QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
+ // Retina display support is working fine, others are not.
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
-#endif // OS_MAC_OLD
+#endif // not defined Q_OS_MAC and QT_VERSION >= 5.6.0
initHook();
}
@@ -51,6 +52,13 @@ int Launcher::exec() {
Logs::start(this); // must be started before Platform is started
Platform::start(); // must be started before QApplication is created
+ // I don't know why path is not in QT_PLUGIN_PATH by default
+ QCoreApplication::addLibraryPath("/usr/lib/qt5/plugins");
+ // without this Telegram doesn't start on Ubuntu 17.04 due GTK errors
+ setenv("QT_STYLE_OVERRIDE", "qwerty", false);
+ // Telegram doesn't start when extraordinary theme is set, see launchpad.net/bugs/1680943
+ unsetenv("QT_QPA_PLATFORMTHEME");
+
auto result = executeApplication();
DEBUG_LOG(("Telegram finished, result: %1").arg(result));
diff --git Telegram/SourceFiles/platform/linux/linux_libs.h Telegram/SourceFiles/platform/linux/linux_libs.h
index 6f93d69c..df185d5a 100644
--- Telegram/SourceFiles/platform/linux/linux_libs.h
+++ Telegram/SourceFiles/platform/linux/linux_libs.h
@@ -17,7 +17,7 @@ extern "C" {
} // extern "C"
#ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION
-#include <unity/unity/unity.h>
+typedef void UnityLauncherEntry;
#endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
diff --git Telegram/SourceFiles/qt_functions.cpp Telegram/SourceFiles/qt_functions.cpp
new file mode 100644
index 00000000..4a722b8d
--- /dev/null
+++ Telegram/SourceFiles/qt_functions.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file contains some parts of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/* TODO: find a dynamic library with these symbols. */
+
+/* Debian maintainer: this function is taken from qfiledialog.cpp */
+/*
+ Makes a list of filters from ;;-separated text.
+ Used by the mac and windows implementations
+*/
+QStringList qt_make_filter_list(const QString &filter)
+{
+ QString f(filter);
+
+ if (f.isEmpty())
+ return QStringList();
+
+ QString sep(QLatin1String(";;"));
+ int i = f.indexOf(sep, 0);
+ if (i == -1) {
+ if (f.indexOf(QLatin1Char('\n'), 0) != -1) {
+ sep = QLatin1Char('\n');
+ i = f.indexOf(sep, 0);
+ }
+ }
+
+ return f.split(sep);
+}
+
+/* Debian maintainer: this constructor is taken from qtextengine.cpp for TextPainter::drawLine */
+QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe, const QTextCharFormat &format)
+ : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), charFormat(format),
+ num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe)
+{
+}
+
+/* Debian maintainer: this method is also taken from qtextengine.cpp */
+// Fix up flags and underlineStyle with given info
+void QTextItemInt::initWithScriptItem(const QScriptItem &si)
+{
+ // explicitly initialize flags so that initFontAttributes can be called
+ // multiple times on the same TextItem
+ flags = 0;
+ if (si.analysis.bidiLevel %2)
+ flags |= QTextItem::RightToLeft;
+ ascent = si.ascent;
+ descent = si.descent;
+
+ if (charFormat.hasProperty(QTextFormat::TextUnderlineStyle)) {
+ underlineStyle = charFormat.underlineStyle();
+ } else if (charFormat.boolProperty(QTextFormat::FontUnderline)
+ || f->d->underline) {
+ underlineStyle = QTextCharFormat::SingleUnderline;
+ }
+
+ // compat
+ if (underlineStyle == QTextCharFormat::SingleUnderline)
+ flags |= QTextItem::Underline;
+
+ if (f->d->overline || charFormat.fontOverline())
+ flags |= QTextItem::Overline;
+ if (f->d->strikeOut || charFormat.fontStrikeOut())
+ flags |= QTextItem::StrikeOut;
+}
diff --git Telegram/SourceFiles/qt_static_plugins.cpp Telegram/SourceFiles/qt_static_plugins.cpp
index e29f348c..122ff0f5 100644
--- Telegram/SourceFiles/qt_static_plugins.cpp
+++ Telegram/SourceFiles/qt_static_plugins.cpp
@@ -15,13 +15,4 @@ Q_IMPORT_PLUGIN(QWebpPlugin)
Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)
Q_IMPORT_PLUGIN(QGenericEnginePlugin)
#elif defined Q_OS_LINUX // Q_OS_WIN | Q_OS_MAC
-Q_IMPORT_PLUGIN(QWebpPlugin)
-Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
-Q_IMPORT_PLUGIN(QConnmanEnginePlugin)
-Q_IMPORT_PLUGIN(QGenericEnginePlugin)
-Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin)
-Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin)
-Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin)
-Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin)
-Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin)
#endif // Q_OS_WIN | Q_OS_MAC | Q_OS_LINUX
diff --git Telegram/SourceFiles/ui/text/text.cpp Telegram/SourceFiles/ui/text/text.cpp
index 61af38ce..c75a9af7 100644
--- Telegram/SourceFiles/ui/text/text.cpp
+++ Telegram/SourceFiles/ui/text/text.cpp
@@ -1735,11 +1735,11 @@ private:
if (item == -1)
return;
-#ifdef OS_MAC_OLD
+#if defined(OS_MAC_OLD) || QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
auto end = _e->findItem(line.from + line.length - 1);
-#else // OS_MAC_OLD
+#else
auto end = _e->findItem(line.from + line.length - 1, item);
-#endif // OS_MAC_OLD
+#endif
auto blockIndex = _lineStartBlock;
auto currentBlock = _t->_blocks[blockIndex].get();
diff --git Telegram/SourceFiles/ui/text/text_block.cpp Telegram/SourceFiles/ui/text/text_block.cpp
index d39addab..abdcd239 100644
--- Telegram/SourceFiles/ui/text/text_block.cpp
+++ Telegram/SourceFiles/ui/text/text_block.cpp
@@ -320,6 +320,9 @@ TextBlock::TextBlock(const style::font &font, const QString &str, QFixed minResi
QStackTextEngine engine(part, blockFont->f);
BlockParser parser(&engine, this, minResizeWidth, _from, part);
+ QTextLayout layout(part, blockFont->f);
+ layout.beginLayout();
+ layout.createLine();
CrashReports::ClearAnnotationRef("CrashString");
}
diff --git Telegram/SourceFiles/ui/twidget.cpp Telegram/SourceFiles/ui/twidget.cpp
index 1441ea47..033b7b58 100644
--- Telegram/SourceFiles/ui/twidget.cpp
+++ Telegram/SourceFiles/ui/twidget.cpp
@@ -235,9 +235,9 @@ void sendSynteticMouseEvent(QWidget *widget, QEvent::Type type, Qt::MouseButton
, button
, QGuiApplication::mouseButtons() | button
, QGuiApplication::keyboardModifiers()
-#ifndef OS_MAC_OLD
+#if !defined(OS_MAC_OLD) && QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
, Qt::MouseEventSynthesizedByApplication
-#endif // OS_MAC_OLD
+#endif
);
ev.setTimestamp(getms());
QGuiApplication::sendEvent(windowHandle, &ev);
diff --git Telegram/gyp/PrecompiledHeader.cmake Telegram/gyp/PrecompiledHeader.cmake
index 5d6830e9..c3f08d3f 100644
--- Telegram/gyp/PrecompiledHeader.cmake
+++ Telegram/gyp/PrecompiledHeader.cmake
@@ -112,7 +112,7 @@ function(add_precompiled_header _target _input)
set(_compiler_FLAGS "@${_pch_c_flags_file}")
add_custom_command(
OUTPUT "${_output_c}"
- COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} -x c-header -o "${_output_c}" -c "${_pchfile}"
+ COMMAND "${CMAKE_C_COMPILER}" "$(C_DEFINES)" "$(C_INCLUDES)" "$(C_FLAGS)" -x c-header -o "${_output_c}" -c "${_pchfile}"
DEPENDS "${_pchfile}" "${_pch_c_flags_file}"
IMPLICIT_DEPENDS C "${_pch_header}"
COMMENT "Precompiling ${_name} for ${_target} (C)")
@@ -123,7 +123,7 @@ function(add_precompiled_header _target _input)
set(_compiler_FLAGS "@${_pch_cpp_flags_file}")
add_custom_command(
OUTPUT "${_output_cxx}"
- COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} -x c++-header -o "${_output_cxx}" -c "${_pchfile}"
+ COMMAND "${CMAKE_CXX_COMPILER}" "$(CXX_DEFINES)" "$(CXX_INCLUDES)" "$(CXX_FLAGS)" -x c++-header -o "${_output_cxx}" -c "${_pchfile}"
DEPENDS "${_pchfile}" "${_pch_cpp_flags_file}"
IMPLICIT_DEPENDS CXX "${_pch_header}"
COMMENT "Precompiling ${_name} for ${_target} (C++)")
diff --git Telegram/gyp/Telegram.gyp Telegram/gyp/Telegram.gyp
index 62a4197f..aef8683f 100644
--- Telegram/gyp/Telegram.gyp
+++ Telegram/gyp/Telegram.gyp
@@ -69,13 +69,11 @@
'codegen.gyp:codegen_numbers',
'codegen.gyp:codegen_style',
'tests/tests.gyp:tests',
- 'utils.gyp:Updater',
'../ThirdParty/libtgvoip/libtgvoip.gyp:libtgvoip',
'crl.gyp:crl',
],
'defines': [
- 'AL_LIBTYPE_STATIC',
'AL_ALEXT_PROTOTYPES',
'TGVOIP_USE_CXX11_LIB',
'<!@(python -c "for s in \'<(build_defines)\'.split(\',\'): print(s)")',
@@ -84,15 +82,7 @@
'include_dirs': [
'<(src_loc)',
'<(SHARED_INTERMEDIATE_DIR)',
- '<(libs_loc)/breakpad/src',
- '<(libs_loc)/lzma/C',
- '<(libs_loc)/zlib',
- '<(libs_loc)/ffmpeg',
- '<(libs_loc)/openal-soft/include',
- '<(libs_loc)/opus/include',
- '<(libs_loc)/range-v3/include',
- '<(minizip_loc)',
- '<(sp_media_key_tap_loc)',
+ '/usr/include/minizip',
'<(emoji_suggestions_loc)',
'<(submodules_loc)/GSL/include',
'<(submodules_loc)/variant/include',
diff --git Telegram/gyp/qt.gypi Telegram/gyp/qt.gypi
index 0b783ec2..c9eca6ad 100644
--- Telegram/gyp/qt.gypi
+++ Telegram/gyp/qt.gypi
@@ -14,25 +14,21 @@
[ 'build_macold', {
'qt_version%': '5.3.2',
}, {
- 'qt_version%': '5.6.2',
+ 'qt_version%': '<!(echo /usr/include/qt5/QtCore/*/ | sed -r "s/([^/]+\/){4}//; s/\///g")',
}]
],
},
'qt_libs': [
- 'qwebp',
- 'Qt5PrintSupport',
- 'Qt5PlatformSupport',
'Qt5Network',
'Qt5Widgets',
'Qt5Gui',
- 'qtharfbuzzng',
],
'qt_version%': '<(qt_version)',
'conditions': [
[ 'build_macold', {
'linux_path_qt%': '/usr/local/macold/Qt-<(qt_version)',
}, {
- 'linux_path_qt%': '/usr/local/tdesktop/Qt-<(qt_version)',
+ 'linux_path_qt%': '/usr/lib/qt5',
}]
]
},
@@ -72,32 +68,13 @@
],
}],
[ 'build_linux', {
- 'qt_lib_prefix': 'lib',
- 'qt_lib_debug_postfix': '.a',
- 'qt_lib_release_postfix': '.a',
+ 'qt_lib_prefix': '',
+ 'qt_lib_debug_postfix': '',
+ 'qt_lib_release_postfix': '',
'qt_libs': [
- 'qxcb',
- 'Qt5XcbQpa',
- 'qconnmanbearer',
- 'qgenericbearer',
- 'qnmbearer',
'<@(qt_libs)',
'Qt5DBus',
'Qt5Core',
- 'qtpcre',
- 'Xi',
- 'Xext',
- 'Xfixes',
- 'SM',
- 'ICE',
- 'fontconfig',
- 'expat',
- 'freetype',
- 'z',
- 'xcb-shm',
- 'xcb-xfixes',
- 'xcb-render',
- 'xcb-static',
],
}],
],
@@ -127,11 +104,6 @@
# '<!@(python <(DEPTH)/list_sources.py [sources] <(qt_moc_list_sources_arg))'
# where [sources] contains all your source files
'qt_moc_list_sources_arg': '--moc-prefix SHARED_INTERMEDIATE_DIR/<(_target_name)/moc/moc_',
-
- '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%': 'libicutu.a libicui18n.a libicuuc.a libicudata.a',
},
'configurations': {
@@ -180,14 +152,14 @@
},
'include_dirs': [
- '<(qt_loc)/include',
- '<(qt_loc)/include/QtCore',
- '<(qt_loc)/include/QtGui',
- '<(qt_loc)/include/QtDBus',
- '<(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',
+ '/usr/include/qt5',
+ '/usr/include/qt5/QtCore',
+ '/usr/include/qt5/QtGui',
+ '/usr/include/qt5/QtDBus',
+ '/usr/include/qt5/QtCore/<(qt_version)',
+ '/usr/include/qt5/QtGui/<(qt_version)',
+ '/usr/include/qt5/QtCore/<(qt_version)/QtCore',
+ '/usr/include/qt5/QtGui/<(qt_version)/QtGui',
],
'library_dirs': [
'<(qt_loc)/lib',
@@ -212,17 +184,10 @@
],
'libraries': [
'<(PRODUCT_DIR)/obj.target/liblinux_glibc_wraps.a',
- '<(linux_path_xkbcommon)/lib/libxkbcommon.a',
'<@(qt_libs_release)',
- '<(linux_lib_ssl)',
- '<(linux_lib_crypto)',
- '<!@(python -c "for s in \'<(linux_lib_icu)\'.split(\' \'): print(s)")',
- '-lxcb',
+ '-lcrypto',
'-lX11',
- '-lX11-xcb',
- '-ldbus-1',
'-ldl',
- '-lgthread-2.0',
'-lglib-2.0',
'-lpthread',
],
@@ -230,7 +195,6 @@
'<(qt_loc)/mkspecs/linux-g++',
],
'ldflags': [
- '-static-libstdc++',
'-pthread',
'-rdynamic',
],
diff --git Telegram/gyp/qt_moc.gypi Telegram/gyp/qt_moc.gypi
index 464d3c81..f350da8f 100644
--- Telegram/gyp/qt_moc.gypi
+++ Telegram/gyp/qt_moc.gypi
@@ -12,7 +12,7 @@
'<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/moc/moc_<(RULE_INPUT_ROOT).cpp',
],
'action': [
- '<(qt_loc)/bin/moc<(exe_ext)',
+ '/usr/bin/moc',
# Silence "Note: No relevant classes found. No output generated."
'--no-notes',
diff --git Telegram/gyp/qt_rcc.gypi Telegram/gyp/qt_rcc.gypi
index f5624a82..1129a95c 100644
--- Telegram/gyp/qt_rcc.gypi
+++ Telegram/gyp/qt_rcc.gypi
@@ -15,7 +15,7 @@
'<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/qrc/qrc_<(RULE_INPUT_ROOT).cpp',
],
'action': [
- '<(qt_loc)/bin/rcc<(exe_ext)',
+ '/usr/bin/rcc',
'-name', '<(RULE_INPUT_ROOT)',
'-no-compress',
'<(RULE_INPUT_PATH)',
diff --git Telegram/gyp/settings_linux.gypi Telegram/gyp/settings_linux.gypi
index 03284c1d..b3a779ee 100644
--- Telegram/gyp/settings_linux.gypi
+++ Telegram/gyp/settings_linux.gypi
@@ -11,7 +11,6 @@
'linux_common_flags': [
'-pipe',
'-Wall',
- '-Werror',
'-W',
'-fPIC',
'-Wno-unused-variable',
@@ -47,7 +46,6 @@
],
'defines': [
'_REENTRANT',
- 'QT_STATICPLUGIN',
'QT_PLUGIN',
],
'cflags_c': [
diff --git Telegram/gyp/telegram_linux.gypi Telegram/gyp/telegram_linux.gypi
index a5b4b197..a755fc58 100644
--- Telegram/gyp/telegram_linux.gypi
+++ Telegram/gyp/telegram_linux.gypi
@@ -20,10 +20,11 @@
'linux_path_va%': '/usr/local',
'linux_path_vdpau%': '/usr/local',
'linux_path_breakpad%': '/usr/local',
- 'linux_path_opus_include%': '<(libs_loc)/opus/include',
+ 'linux_path_opus_include%': '/usr/include/opus',
'linux_path_range%': '/usr/local',
},
'include_dirs': [
+ '/usr/include/openssl-1.0',
'/usr/local/include',
'<(linux_path_ffmpeg)/include',
'<(linux_path_openal)/include',
@@ -32,6 +33,7 @@
'<(linux_path_range)/include',
],
'library_dirs': [
+ '/usr/lib/openssl-1.0',
'/usr/local/lib',
'<(linux_path_ffmpeg)/lib',
'<(linux_path_openal)/lib',
@@ -40,25 +42,15 @@
'<(linux_path_breakpad)/lib',
],
'libraries': [
- 'breakpad_client',
- 'composeplatforminputcontextplugin',
- 'ibusplatforminputcontextplugin',
- 'fcitxplatforminputcontextplugin',
- 'himeplatforminputcontextplugin',
- 'liblzma.a',
- 'libopenal.a',
- 'libavformat.a',
- 'libavcodec.a',
- 'libswresample.a',
- 'libswscale.a',
- 'libavutil.a',
- 'libopus.a',
- 'libva-x11.a',
- 'libva-drm.a',
- 'libva.a',
- 'libvdpau.a',
- 'libdrm.a',
- 'libz.a',
+ 'openal',
+ 'avformat',
+ 'avcodec',
+ 'swresample',
+ 'swscale',
+ 'avutil',
+ 'minizip',
+ 'opus',
+ 'z',
# '<!(pkg-config 2> /dev/null --libs <@(pkgconfig_libs))',
],
'cflags_cc': [
@@ -86,7 +78,7 @@
},
},
'conditions': [
- [ '"<!(uname -p)" == "x86_64"', {
+ [ '"<!(uname -m)" == "x86_64"', {
# 32 bit version can't be linked with debug info or LTO,
# virtual memory exhausted :(
'cflags_c': [ '-g' ],
@@ -105,10 +97,8 @@
],
}], ['not_need_gtk!="True"', {
'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 appindicator3-0.1)',
+ '<!(pkg-config 2> /dev/null --cflags gtk+-3.0)',
],
}]
],
diff --git Telegram/gyp/telegram_sources.txt Telegram/gyp/telegram_sources.txt
index a9c36e09..26b2bb18 100644
--- Telegram/gyp/telegram_sources.txt
+++ Telegram/gyp/telegram_sources.txt
@@ -760,14 +760,7 @@
<(emoji_suggestions_loc)/emoji_suggestions.cpp
<(emoji_suggestions_loc)/emoji_suggestions.h
-platforms: !win
-<(minizip_loc)/crypt.h
-<(minizip_loc)/ioapi.c
-<(minizip_loc)/ioapi.h
-<(minizip_loc)/zip.c
-<(minizip_loc)/zip.h
-<(minizip_loc)/unzip.c
-<(minizip_loc)/unzip.h
+<(src_loc)/qt_functions.cpp
platforms: mac
<(sp_media_key_tap_loc)/SPMediaKeyTap.m

View file

@ -1,28 +0,0 @@
diff -Naur tdesktop-1.2.6.orig/Telegram/SourceFiles/platform/linux/linux_libs.cpp tdesktop-1.2.6/Telegram/SourceFiles/platform/linux/linux_libs.cpp
--- Telegram/SourceFiles/platform/linux/linux_libs.cpp 2017-12-30 11:13:48.000000000 +0100
+++ Telegram/SourceFiles/platform/linux/linux_libs.cpp 2018-01-17 11:41:49.593275952 +0100
@@ -253,24 +253,12 @@
indicatorLoaded = setupAppIndicator(lib_indicator);
}
}
- if (!gtkLoaded || !indicatorLoaded) {
- if (loadLibrary(lib_indicator, "appindicator", 1)) {
- if (loadLibrary(lib_gtk, "gtk-x11-2.0", 0)) {
- gtkLoaded = indicatorLoaded = false;
- gtkLoaded = setupGtkBase(lib_gtk);
- indicatorLoaded = setupAppIndicator(lib_indicator);
- }
- }
- }
// If no appindicator, try at least load gtk.
if (!gtkLoaded && !indicatorLoaded) {
if (loadLibrary(lib_gtk, "gtk-3", 0)) {
gtkLoaded = setupGtkBase(lib_gtk);
}
- if (!gtkLoaded && loadLibrary(lib_gtk, "gtk-x11-2.0", 0)) {
- gtkLoaded = setupGtkBase(lib_gtk);
- }
}
if (gtkLoaded) {

View file

@ -1,18 +0,0 @@
diff --git libtgvoip.gyp libtgvoip.gyp
index 52fbea1..9a4dfb7 100644
--- Telegram/ThirdParty/libtgvoip/libtgvoip.gyp
+++ libtgvoip.gyp
@@ -13,11 +13,12 @@
'variables': {
'tgvoip_src_loc': '.',
'official_build_target%': '',
- 'linux_path_opus_include%': '<(DEPTH)/../../../Libraries/opus/include',
+ 'linux_path_opus_include%': '/usr/include/opus',
},
'include_dirs': [
'<(tgvoip_src_loc)/webrtc_dsp',
'<(linux_path_opus_include)',
+ '/usr/include/openssl-1.0'
],
'direct_dependent_settings': {
'include_dirs': [

View file

@ -1,25 +0,0 @@
--- Telegram/ThirdParty/libtgvoip/os/linux/AudioInputPulse.cpp 2018-02-18 16:15:10.850216642 +0100
+++ - 2018-02-18 16:17:18.277060386 +0100
@@ -4,6 +4,9 @@
// you should have received with this source code distribution.
//
+#if !defined(__GLIBC__)
+# include <libgen.h>
+#endif
#include <assert.h>
#include <dlfcn.h>
#include <unistd.h>
--- Telegram/ThirdParty/libtgvoip/os/linux/AudioOutputPulse.cpp 2017-12-27 19:47:58.000000000 +0100
+++ - 2018-02-18 16:18:27.461801108 +0100
@@ -4,7 +4,9 @@
// you should have received with this source code distribution.
//
-
+#if !defined(__GLIBC__)
+# include <libgen.h>
+#endif
#include <assert.h>
#include <dlfcn.h>
#include <unistd.h>

View file

@ -1,44 +0,0 @@
diff --git Telegram/gyp/qt.gypi Telegram/gyp/qt.gypi
index c9eca6ad1..1404f91b1 100644
--- Telegram/gyp/qt.gypi
+++ Telegram/gyp/qt.gypi
@@ -176,14 +176,10 @@
],
'conditions': [
[ 'build_linux', {
- 'dependencies': [
- '<(DEPTH)/linux_glibc_wraps.gyp:linux_glibc_wraps',
- ],
'library_dirs': [
'<(qt_loc)/plugins/platforminputcontexts',
],
'libraries': [
- '<(PRODUCT_DIR)/obj.target/liblinux_glibc_wraps.a',
'<@(qt_libs_release)',
'-lcrypto',
'-lX11',
diff --git Telegram/gyp/telegram_linux.gypi Telegram/gyp/telegram_linux.gypi
index 1e1185387..328424225 100644
--- Telegram/gyp/telegram_linux.gypi
+++ Telegram/gyp/telegram_linux.gypi
@@ -58,9 +58,6 @@
'-Wno-maybe-uninitialized',
],
'ldflags': [
- '-Wl,-wrap,aligned_alloc',
- '-Wl,-wrap,secure_getenv',
- '-Wl,-wrap,clock_gettime',
'-Wl,--no-as-needed,-lrt',
],
'configurations': {
@@ -92,10 +89,6 @@
'ldflags': [ '-flto' ],
},
},
- }, {
- 'ldflags': [
- '-Wl,-wrap,__divmoddi4',
- ],
}], ['not_need_gtk!="True"', {
'cflags_cc': [
'<!(pkg-config 2> /dev/null --cflags appindicator3-0.1)',

View file

@ -0,0 +1,34 @@
--- Telegram/gyp/PrecompiledHeader.cmake
+++ Telegram/gyp/PrecompiledHeader.cmake
@@ -79,7 +79,6 @@ function(export_all_flags _filename _source_name_for_flags)
endfunction()
function(add_precompiled_header _target _input)
- if(CMAKE_COMPILER_IS_GNUCXX)
get_filename_component(_name ${_input} NAME)
set(_pch_header "${CMAKE_CURRENT_SOURCE_DIR}/${_input}")
set(_pch_binary_dir "${CMAKE_CURRENT_BINARY_DIR}/${_target}_pch")
@@ -112,7 +111,7 @@ function(add_precompiled_header _target _input)
set(_compiler_FLAGS "@${_pch_c_flags_file}")
add_custom_command(
OUTPUT "${_output_c}"
- COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} -x c-header -o "${_output_c}" -c "${_pchfile}"
+ COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} "$(C_FLAGS)" -x c-header -o "${_output_c}" -c "${_pchfile}"
DEPENDS "${_pchfile}" "${_pch_c_flags_file}"
IMPLICIT_DEPENDS C "${_pch_header}"
COMMENT "Precompiling ${_name} for ${_target} (C)")
@@ -123,7 +122,7 @@ function(add_precompiled_header _target _input)
set(_compiler_FLAGS "@${_pch_cpp_flags_file}")
add_custom_command(
OUTPUT "${_output_cxx}"
- COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} -x c++-header -o "${_output_cxx}" -c "${_pchfile}"
+ COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} "$(CXX_FLAGS)" -x c++-header -o "${_output_cxx}" -c "${_pchfile}"
DEPENDS "${_pchfile}" "${_pch_cpp_flags_file}"
IMPLICIT_DEPENDS CXX "${_pch_header}"
COMMENT "Precompiling ${_name} for ${_target} (C++)")
@@ -161,5 +160,4 @@ function(add_precompiled_header _target _input)
OBJECT_DEPENDS "${_object_depends}")
endif()
endforeach()
- endif(CMAKE_COMPILER_IS_GNUCXX)
endfunction()

View file

@ -0,0 +1,100 @@
diff --git a/Telegram/SourceFiles/qt_functions.cpp Telegram/SourceFiles/qt_functions.cpp
new file mode 100644
index 0000000..4a722b8
--- /dev/null
+++ Telegram/SourceFiles/qt_functions.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file contains some parts of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/* TODO: find a dynamic library with these symbols. */
+
+/* Debian maintainer: this function is taken from qfiledialog.cpp */
+/*
+ Makes a list of filters from ;;-separated text.
+ Used by the mac and windows implementations
+*/
+QStringList qt_make_filter_list(const QString &filter)
+{
+ QString f(filter);
+
+ if (f.isEmpty())
+ return QStringList();
+
+ QString sep(QLatin1String(";;"));
+ int i = f.indexOf(sep, 0);
+ if (i == -1) {
+ if (f.indexOf(QLatin1Char('\n'), 0) != -1) {
+ sep = QLatin1Char('\n');
+ i = f.indexOf(sep, 0);
+ }
+ }
+
+ return f.split(sep);
+}
+
+/* Debian maintainer: this constructor is taken from qtextengine.cpp for TextPainter::drawLine */
+QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe, const QTextCharFormat &format)
+ : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), charFormat(format),
+ num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe)
+{
+}
+
+/* Debian maintainer: this method is also taken from qtextengine.cpp */
+// Fix up flags and underlineStyle with given info
+void QTextItemInt::initWithScriptItem(const QScriptItem &si)
+{
+ // explicitly initialize flags so that initFontAttributes can be called
+ // multiple times on the same TextItem
+ flags = 0;
+ if (si.analysis.bidiLevel %2)
+ flags |= QTextItem::RightToLeft;
+ ascent = si.ascent;
+ descent = si.descent;
+
+ if (charFormat.hasProperty(QTextFormat::TextUnderlineStyle)) {
+ underlineStyle = charFormat.underlineStyle();
+ } else if (charFormat.boolProperty(QTextFormat::FontUnderline)
+ || f->d->underline) {
+ underlineStyle = QTextCharFormat::SingleUnderline;
+ }
+
+ // compat
+ if (underlineStyle == QTextCharFormat::SingleUnderline)
+ flags |= QTextItem::Underline;
+
+ if (f->d->overline || charFormat.fontOverline())
+ flags |= QTextItem::Overline;
+ if (f->d->strikeOut || charFormat.fontStrikeOut())
+ flags |= QTextItem::StrikeOut;
+}

View file

@ -0,0 +1,41 @@
diff --git a/lib/xdg/telegramdesktop.appdata.xml lib/xdg/telegramdesktop.appdata.xml
index 7bcf8d8..4508c01 100644
--- a/lib/xdg/telegramdesktop.appdata.xml
+++ lib/xdg/telegramdesktop.appdata.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<component type="desktop">
- <id>org.telegram.desktop</id>
+ <id>telegram-desktop.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0</project_license>
<name>Telegram Desktop</name>
diff --git a/lib/xdg/telegramdesktop.desktop lib/xdg/telegramdesktop.desktop
index 0a80695..550b9f7 100644
--- a/lib/xdg/telegramdesktop.desktop
+++ lib/xdg/telegramdesktop.desktop
@@ -1,9 +1,11 @@
[Desktop Entry]
Version=1.0
Name=Telegram Desktop
+GenericName=Telegram Desktop
+Keywords=IM;Chat;
Comment=Official desktop version of Telegram messaging app
-Exec=telegram-desktop -- %u
-Icon=telegram
+Exec=Telegram -- %u
+Icon=telegram-desktop
Terminal=false
StartupWMClass=TelegramDesktop
Type=Application
diff --git a/lib/xdg/tg.protocol lib/xdg/tg.protocol
index 0a80695..550b9f7 100644
--- a/lib/xdg/tg.protocol
+++ lib/xdg/tg.protocol
@@ -1,5 +1,5 @@
[Protocol]
-exec=/usr/bin/telegram-desktop -- %u
+exec=Telegram -- %u
protocol=tg
input=none
output=none

View file

@ -0,0 +1,38 @@
diff --git a/Telegram/SourceFiles/export/data/export_data_types.cpp Telegram/SourceFiles/export/data/export_data_types.cpp
index 0cc79f7e2..b54065ba1 100644
--- a/Telegram/SourceFiles/export/data/export_data_types.cpp
+++ Telegram/SourceFiles/export/data/export_data_types.cpp
@@ -179,7 +179,8 @@ Image ParseMaxImage(
result.width = data.vw.v;
result.height = data.vh.v;
result.file.location = ParseLocation(data.vlocation);
- if constexpr (MTPDphotoCachedSize::Is<decltype(data)>()) {
+ constexpr bool is = MTPDphotoCachedSize::Is<decltype(data)>();
+ if constexpr (is) {
result.file.content = data.vbytes.v;
result.file.size = result.file.content.size();
} else {
diff --git a/Telegram/SourceFiles/export/export_api_wrap.cpp Telegram/SourceFiles/export/export_api_wrap.cpp
index 34ddd1b5a..21816472a 100644
--- a/Telegram/SourceFiles/export/export_api_wrap.cpp
+++ Telegram/SourceFiles/export/export_api_wrap.cpp
@@ -710,7 +710,8 @@ void ApiWrap::handleUserpicsSlice(const MTPphotos_Photos &result) {
Expects(_userpicsProcess != nullptr);
result.match([&](const auto &data) {
- if constexpr (MTPDphotos_photos::Is<decltype(data)>()) {
+ constexpr bool is = MTPDphotos_photos::Is<decltype(data)>();
+ if constexpr (is) {
_userpicsProcess->lastSlice = true;
}
loadUserpicsFiles(Data::ParseUserpicsSlice(
@@ -1128,7 +1129,8 @@ void ApiWrap::requestMessagesSlice() {
result.match([&](const MTPDmessages_messagesNotModified &data) {
error("Unexpected messagesNotModified received.");
}, [&](const auto &data) {
- if constexpr (MTPDmessages_messages::Is<decltype(data)>()) {
+ constexpr bool is = MTPDmessages_messages::Is<decltype(data)>();
+ if constexpr (is) {
_chatProcess->lastSlice = true;
}
loadMessagesFiles(Data::ParseMessagesSlice(

View file

@ -1,38 +1,40 @@
# Template file for 'telegram-desktop'
pkgname=telegram-desktop
version=1.3.7
revision=2
version=1.3.9
revision=1
_libtgvoip_commit=6ba1241cfef6c3ddf4e50e82f67afde0abc02285
_GSL_commit=9d65e74400976b3509833f49b16d401600c7317d
_GSL_commit=d846fe50a3f0bb7767c7e087a05f4be95f4da0ec
_variant_commit=550ac2f159ca883d360c196149b466955c77a573
_crl_commit=f893c36427993e22181c8b3ec382dedb5563dc08
_crl_commit=9bc641f2d4ab140a84aea64c7f2d4669f7633246
_Catch_commit=5ca44b68721833ae3731802ed99af67c6f38a53a
build_style=cmake
wrksrc="tdesktop-${version}"
build_wrksrc="out/Release"
hostmakedepends="gyp pkg-config"
create_wrksrc=yes
build_wrksrc="tdesktop-${version}/Telegram"
cmake_builddir="build-telegram"
configure_args="-DENABLE_CRASH_REPORTS=OFF -DENABLE_GTK_INTEGRATION=ON
-DENABLE_PULSEAUDIO=ON"
hostmakedepends="pkg-config qt5-qmake qt5-host-tools python"
makedepends="alsa-lib-devel ffmpeg-devel gtk+3-devel libappindicator-devel
libdbusmenu-glib-devel libopenal-devel minizip-devel opus-devel
pulseaudio-devel qt5-devel range-v3"
pulseaudio-devel qt5-devel range-v3 libva-devel"
depends="qt5-imageformats"
short_desc="Telegram Desktop messaging app"
maintainer="John <johnz@posteo.net>"
license="GPL-3.0-or-later"
#changelog"https://github.com/telegramdesktop/tdesktop/blob/v${version}/changelog.txt"
license="GPL-3.0-or-later WITH OpenSSL"
homepage="https://desktop.telegram.org/"
changelog="https://github.com/telegramdesktop/tdesktop/blob/v${version}/changelog.txt"
distfiles="https://github.com/telegramdesktop/tdesktop/archive/v${version}.tar.gz
https://github.com/telegramdesktop/libtgvoip/archive/${_libtgvoip_commit}.tar.gz
https://github.com/Microsoft/GSL/archive/${_GSL_commit}.tar.gz
https://github.com/mapbox/variant/archive/${_variant_commit}.tar.gz
https://github.com/telegramdesktop/crl/archive/${_crl_commit}.tar.gz
https://github.com/catchorg/Catch2/archive/${_Catch_commit}.tar.gz"
checksum="cbb30bad15496848beda2db3481700a7292de6c453ee616cc62a2189a32dd7d8
checksum="fd52433dac14a6643114e8f5ff9d38c709141bfca8461cce47fa93e9ef8b45b2
ba233ea1550b3abdbbe4a25055070553b04e0f4633453fa8d15f0313a15bd3b2
1aab15abd08fd377524df9dc6a71c977f8617d4a2a8f8a2aa1ce07f3c3ff4371
be81db4ab1b57102a0fa1cd0c4a6469294eb9daf24294347592245b754f65ff6
aa794dfefe0a90501587e36d977b958d0df888503117a8d9aa43dc14f8526d9d
1357cab18cf4e6798b7586c0ff0948676c44ccd2424d7fbcf1f260aa3087393a
d827499de19cd6a8ff922a88a700663f41eb49c3ac98a975bab55307cb662b95
d24e6d9df2b8aa5739d3b9077c6b0ff0ef4d5ef8acc52c3a57e32893854d8d18"
nocross="gyp build script doesn't support cross compiling"
case $XBPS_TARGET_MACHINE in
i686*) nodebug=yes;; # ENOMEM
@ -40,36 +42,49 @@ case $XBPS_TARGET_MACHINE in
mips*) broken="unsupported";;
esac
case $XBPS_TARGET_MACHINE in
aarch64* | x86_64*) configure_args+=" ENABLE_64BIT=ON";;
esac
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" qt5-devel"
fi
post_extract() {
mv ${wrksrc}/../libtgvoip-${_libtgvoip_commit}/* ${wrksrc}/Telegram/ThirdParty/libtgvoip
mv ${wrksrc}/../GSL-${_GSL_commit}/* ${wrksrc}/Telegram/ThirdParty/GSL
mv ${wrksrc}/../variant-${_variant_commit}/* ${wrksrc}/Telegram/ThirdParty/variant
mv ${wrksrc}/../crl-${_crl_commit}/* ${wrksrc}/Telegram/ThirdParty/crl
mv ${wrksrc}/../Catch2-${_Catch_commit}/* ${wrksrc}/Telegram/ThirdParty/Catch
mkdir out/Release -p
cp -rup ${wrksrc}/libtgvoip-${_libtgvoip_commit}/* ${build_wrksrc}/ThirdParty/libtgvoip
cp -rup ${wrksrc}/GSL-${_GSL_commit}/* ${build_wrksrc}/ThirdParty/GSL
cp -rup ${wrksrc}/variant-${_variant_commit}/* ${build_wrksrc}/ThirdParty/variant
cp -rup ${wrksrc}/crl-${_crl_commit}/* ${build_wrksrc}/ThirdParty/crl
cp -rup ${wrksrc}/Catch2-${_Catch_commit}/* ${build_wrksrc}/ThirdParty/Catch
cp ${FILESDIR}/Telegram.cmake ${build_wrksrc}/CMakeLists.txt
cp ${FILESDIR}/ThirdParty-crl.cmake ${build_wrksrc}/ThirdParty/crl/CMakeLists.txt
cp ${FILESDIR}/ThirdParty-libtgvoip.cmake ${build_wrksrc}/ThirdParty/libtgvoip/CMakeLists.txt
cp ${FILESDIR}/ThirdParty-libtgvoip-webrtc.cmake \
${build_wrksrc}/ThirdParty/libtgvoip/webrtc_dsp/webrtc/CMakeLists.txt
mkdir -p ${build_wrksrc}/cmake
cp ${FILESDIR}/FindBreakpad.cmake ${build_wrksrc}/cmake
cp ${FILESDIR}/TelegramCodegen.cmake ${build_wrksrc}/cmake
cp ${FILESDIR}/TelegramTests.cmake ${build_wrksrc}/cmake
mkdir -p ${build_wrksrc}/native
cp ${FILESDIR}/TelegramCodegenTools.cmake ${build_wrksrc}/native/CMakeLists.txt
# change wrksrc temporarily so that patches can be applied
wrksrc="${wrksrc}/tdesktop-${version}"
}
pre_configure() {
export GYP_DEFINES="TDESKTOP_DISABLE_CRASH_REPORTS,TDESKTOP_DISABLE_AUTOUPDATE,TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME,TDESKTOP_DISABLE_UNITY_INTEGRATION"
cd ${wrksrc} && \
gyp2 \
-Dbuild_defines=${GYP_DEFINES} \
-Gconfig=Release \
--depth=Telegram/gyp --generator-output=../.. \
-Goutput_dir=out Telegram/gyp/Telegram.gyp --format=cmake
[ -f ../lib/xdg/telegram-desktop.desktop ] || mv ../lib/xdg/telegram{,-}desktop.desktop
NUM=$(($(wc -l < out/Release/CMakeLists.txt) - 2))
sed -i "$NUM r ${FILESDIR}/CMakeLists.inj" out/Release/CMakeLists.txt
export ASM=gcc
cd native
CC= CXX= CPP= LD= AR= AS= RANLIB= CFLAGS= CXXFLAGS= LDFLAGS= cmake .
make ${makejobs}
}
do_install() {
vbin build/Telegram telegram-desktop
post_install() {
for i in 16 32 48 64 128 256 512; do
vinstall ${wrksrc}/Telegram/Resources/art/icon$i.png 644 usr/share/icons/hicolor/${i}x${i} telegram-desktop.png
vinstall Resources/art/icon$i.png 644 usr/share/icons/hicolor/${i}x${i} telegram-desktop.png
done
vinstall ${wrksrc}/lib/xdg/telegramdesktop.desktop 644 usr/share/applications/
vinstall ${wrksrc}/lib/xdg/tg.protocol 644 usr/share/kservice5/
vinstall ${wrksrc}/lib/xdg/telegramdesktop.appdata.xml 644 usr/share/metainfo
}