From 1ab6c781b17ba8b285a1043a3d8bdef57b582c61 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 3 Jul 2018 12:26:22 +0200 Subject: [PATCH] telegram-desktop: update to 1.3.9. --- srcpkgs/telegram-desktop/files/CMakeLists.inj | 14 - .../telegram-desktop/files/FindBreakpad.cmake | 19 + srcpkgs/telegram-desktop/files/Telegram.cmake | 216 +++++++ .../files/TelegramCodegen.cmake | 96 +++ .../files/TelegramCodegenTools.cmake | 32 + .../files/TelegramTests.cmake | 61 ++ .../files/ThirdParty-crl.cmake | 15 + .../files/ThirdParty-libtgvoip-webrtc.cmake | 93 +++ .../files/ThirdParty-libtgvoip.cmake | 44 ++ .../patches/01-tdesktop.patch | 556 ------------------ .../telegram-desktop/patches/02-no-gtk2.patch | 28 - .../patches/03-libtgvoip.patch | 18 - .../telegram-desktop/patches/05-musl.patch | 25 - .../patches/06-remove-GLIBC-2.15-compat.patch | 44 -- .../patches/PrecompiledHeader-cmake.patch | 34 ++ .../patches/add-private-qt-functions.patch | 100 ++++ .../telegram-desktop/patches/fix-xdg.patch | 41 ++ .../patches/gcc-if-constexpr-tmpfix.patch | 38 ++ srcpkgs/telegram-desktop/template | 91 +-- 19 files changed, 842 insertions(+), 723 deletions(-) delete mode 100644 srcpkgs/telegram-desktop/files/CMakeLists.inj create mode 100644 srcpkgs/telegram-desktop/files/FindBreakpad.cmake create mode 100644 srcpkgs/telegram-desktop/files/Telegram.cmake create mode 100644 srcpkgs/telegram-desktop/files/TelegramCodegen.cmake create mode 100644 srcpkgs/telegram-desktop/files/TelegramCodegenTools.cmake create mode 100644 srcpkgs/telegram-desktop/files/TelegramTests.cmake create mode 100644 srcpkgs/telegram-desktop/files/ThirdParty-crl.cmake create mode 100644 srcpkgs/telegram-desktop/files/ThirdParty-libtgvoip-webrtc.cmake create mode 100644 srcpkgs/telegram-desktop/files/ThirdParty-libtgvoip.cmake delete mode 100644 srcpkgs/telegram-desktop/patches/01-tdesktop.patch delete mode 100644 srcpkgs/telegram-desktop/patches/02-no-gtk2.patch delete mode 100644 srcpkgs/telegram-desktop/patches/03-libtgvoip.patch delete mode 100644 srcpkgs/telegram-desktop/patches/05-musl.patch delete mode 100644 srcpkgs/telegram-desktop/patches/06-remove-GLIBC-2.15-compat.patch create mode 100644 srcpkgs/telegram-desktop/patches/PrecompiledHeader-cmake.patch create mode 100644 srcpkgs/telegram-desktop/patches/add-private-qt-functions.patch create mode 100644 srcpkgs/telegram-desktop/patches/fix-xdg.patch create mode 100644 srcpkgs/telegram-desktop/patches/gcc-if-constexpr-tmpfix.patch diff --git a/srcpkgs/telegram-desktop/files/CMakeLists.inj b/srcpkgs/telegram-desktop/files/CMakeLists.inj deleted file mode 100644 index e039cb1585..0000000000 --- a/srcpkgs/telegram-desktop/files/CMakeLists.inj +++ /dev/null @@ -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 -------------- diff --git a/srcpkgs/telegram-desktop/files/FindBreakpad.cmake b/srcpkgs/telegram-desktop/files/FindBreakpad.cmake new file mode 100644 index 0000000000..42da3f50cd --- /dev/null +++ b/srcpkgs/telegram-desktop/files/FindBreakpad.cmake @@ -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}) diff --git a/srcpkgs/telegram-desktop/files/Telegram.cmake b/srcpkgs/telegram-desktop/files/Telegram.cmake new file mode 100644 index 0000000000..9d71b7725b --- /dev/null +++ b/srcpkgs/telegram-desktop/files/Telegram.cmake @@ -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) diff --git a/srcpkgs/telegram-desktop/files/TelegramCodegen.cmake b/srcpkgs/telegram-desktop/files/TelegramCodegen.cmake new file mode 100644 index 0000000000..4abfebfbe5 --- /dev/null +++ b/srcpkgs/telegram-desktop/files/TelegramCodegen.cmake @@ -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}) diff --git a/srcpkgs/telegram-desktop/files/TelegramCodegenTools.cmake b/srcpkgs/telegram-desktop/files/TelegramCodegenTools.cmake new file mode 100644 index 0000000000..2021cb9a64 --- /dev/null +++ b/srcpkgs/telegram-desktop/files/TelegramCodegenTools.cmake @@ -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_compile_options(codegen_common PUBLIC $) + +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_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 ) diff --git a/srcpkgs/telegram-desktop/files/TelegramTests.cmake b/srcpkgs/telegram-desktop/files/TelegramTests.cmake new file mode 100644 index 0000000000..a2193d93dd --- /dev/null +++ b/srcpkgs/telegram-desktop/files/TelegramTests.cmake @@ -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}) diff --git a/srcpkgs/telegram-desktop/files/ThirdParty-crl.cmake b/srcpkgs/telegram-desktop/files/ThirdParty-crl.cmake new file mode 100644 index 0000000000..32f92c0bf2 --- /dev/null +++ b/srcpkgs/telegram-desktop/files/ThirdParty-crl.cmake @@ -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) diff --git a/srcpkgs/telegram-desktop/files/ThirdParty-libtgvoip-webrtc.cmake b/srcpkgs/telegram-desktop/files/ThirdParty-libtgvoip-webrtc.cmake new file mode 100644 index 0000000000..836138998b --- /dev/null +++ b/srcpkgs/telegram-desktop/files/ThirdParty-libtgvoip-webrtc.cmake @@ -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}/.." +) diff --git a/srcpkgs/telegram-desktop/files/ThirdParty-libtgvoip.cmake b/srcpkgs/telegram-desktop/files/ThirdParty-libtgvoip.cmake new file mode 100644 index 0000000000..1604211de7 --- /dev/null +++ b/srcpkgs/telegram-desktop/files/ThirdParty-libtgvoip.cmake @@ -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_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}) diff --git a/srcpkgs/telegram-desktop/patches/01-tdesktop.patch b/srcpkgs/telegram-desktop/patches/01-tdesktop.patch deleted file mode 100644 index 75235c562a..0000000000 --- a/srcpkgs/telegram-desktop/patches/01-tdesktop.patch +++ /dev/null @@ -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 @@ - - -- ../etc/qt_linux.conf - - -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 -+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', - ' /dev/null --libs <@(pkgconfig_libs))', - ], - 'cflags_cc': [ -@@ -86,7 +78,7 @@ - }, - }, - 'conditions': [ -- [ '" /dev/null --cflags appindicator-0.1)', -- ' /dev/null --cflags gtk+-2.0)', -- ' /dev/null --cflags glib-2.0)', -- ' /dev/null --cflags dee-1.0)', -+ ' /dev/null --cflags appindicator3-0.1)', -+ ' /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 diff --git a/srcpkgs/telegram-desktop/patches/02-no-gtk2.patch b/srcpkgs/telegram-desktop/patches/02-no-gtk2.patch deleted file mode 100644 index ba1ae4d27b..0000000000 --- a/srcpkgs/telegram-desktop/patches/02-no-gtk2.patch +++ /dev/null @@ -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) { diff --git a/srcpkgs/telegram-desktop/patches/03-libtgvoip.patch b/srcpkgs/telegram-desktop/patches/03-libtgvoip.patch deleted file mode 100644 index 505fb54d9b..0000000000 --- a/srcpkgs/telegram-desktop/patches/03-libtgvoip.patch +++ /dev/null @@ -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': [ diff --git a/srcpkgs/telegram-desktop/patches/05-musl.patch b/srcpkgs/telegram-desktop/patches/05-musl.patch deleted file mode 100644 index d3faf9296a..0000000000 --- a/srcpkgs/telegram-desktop/patches/05-musl.patch +++ /dev/null @@ -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 -+#endif - #include - #include - #include ---- 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 -+#endif - #include - #include - #include diff --git a/srcpkgs/telegram-desktop/patches/06-remove-GLIBC-2.15-compat.patch b/srcpkgs/telegram-desktop/patches/06-remove-GLIBC-2.15-compat.patch deleted file mode 100644 index 05bc47b910..0000000000 --- a/srcpkgs/telegram-desktop/patches/06-remove-GLIBC-2.15-compat.patch +++ /dev/null @@ -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': [ - ' /dev/null --cflags appindicator3-0.1)', diff --git a/srcpkgs/telegram-desktop/patches/PrecompiledHeader-cmake.patch b/srcpkgs/telegram-desktop/patches/PrecompiledHeader-cmake.patch new file mode 100644 index 0000000000..37f7b31214 --- /dev/null +++ b/srcpkgs/telegram-desktop/patches/PrecompiledHeader-cmake.patch @@ -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() diff --git a/srcpkgs/telegram-desktop/patches/add-private-qt-functions.patch b/srcpkgs/telegram-desktop/patches/add-private-qt-functions.patch new file mode 100644 index 0000000000..71803f8055 --- /dev/null +++ b/srcpkgs/telegram-desktop/patches/add-private-qt-functions.patch @@ -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; ++} diff --git a/srcpkgs/telegram-desktop/patches/fix-xdg.patch b/srcpkgs/telegram-desktop/patches/fix-xdg.patch new file mode 100644 index 0000000000..b7528da756 --- /dev/null +++ b/srcpkgs/telegram-desktop/patches/fix-xdg.patch @@ -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 @@ + + +- org.telegram.desktop ++ telegram-desktop.desktop + CC0-1.0 + GPL-3.0 + Telegram Desktop +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 diff --git a/srcpkgs/telegram-desktop/patches/gcc-if-constexpr-tmpfix.patch b/srcpkgs/telegram-desktop/patches/gcc-if-constexpr-tmpfix.patch new file mode 100644 index 0000000000..aa3dee5b02 --- /dev/null +++ b/srcpkgs/telegram-desktop/patches/gcc-if-constexpr-tmpfix.patch @@ -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()) { ++ constexpr bool is = MTPDphotoCachedSize::Is(); ++ 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()) { ++ constexpr bool is = MTPDphotos_photos::Is(); ++ 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()) { ++ constexpr bool is = MTPDmessages_messages::Is(); ++ if constexpr (is) { + _chatProcess->lastSlice = true; + } + loadMessagesFiles(Data::ParseMessagesSlice( diff --git a/srcpkgs/telegram-desktop/template b/srcpkgs/telegram-desktop/template index 5c5adae132..aa23dc7c3a 100644 --- a/srcpkgs/telegram-desktop/template +++ b/srcpkgs/telegram-desktop/template @@ -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 " -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 }