diff --git a/srcpkgs/telegram-desktop/files/Telegram.cmake b/srcpkgs/telegram-desktop/files/Telegram.cmake index f6333250d0c..70fc520c45a 100644 --- a/srcpkgs/telegram-desktop/files/Telegram.cmake +++ b/srcpkgs/telegram-desktop/files/Telegram.cmake @@ -19,6 +19,7 @@ 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(USE_LIBATOMIC "Link Statically against libatomic.a" OFF) +option(USE_CUSTOM_API_ID "Use a custom Telegram API ID" OFF) find_package(LibLZMA REQUIRED) find_package(OpenAL REQUIRED) @@ -96,6 +97,8 @@ file(GLOB FLAT_SOURCE_FILES SourceFiles/profile/*.cpp SourceFiles/settings/*.cpp SourceFiles/storage/*.cpp + SourceFiles/storage/cache/*.cpp + SourceFiles/support/*cpp ${THIRD_PARTY_DIR}/emoji_suggestions/*.cpp ) file(GLOB FLAT_EXTRA_FILES @@ -104,6 +107,9 @@ file(GLOB FLAT_EXTRA_FILES SourceFiles/base/tests_main.cpp SourceFiles/passport/passport_edit_identity_box.cpp SourceFiles/passport/passport_form_row.cpp + SourceFiles/storage/*_tests.cpp + SourceFiles/storage/*_win.cpp + SourceFiles/storage/cache/*_tests.cpp ) list(REMOVE_ITEM FLAT_SOURCE_FILES ${FLAT_EXTRA_FILES}) @@ -122,6 +128,7 @@ add_executable(Telegram WIN32 ${QRC_FILES} ${FLAT_SOURCE_FILES} ${SUBDIRS_SOURCE set(TELEGRAM_COMPILE_DEFINITIONS TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION TDESKTOP_DISABLE_UNITY_INTEGRATION + NOMINMAX __STDC_FORMAT_MACROS ) @@ -139,6 +146,7 @@ set(TELEGRAM_INCLUDE_DIRS ) set(TELEGRAM_LINK_LIBRARIES + xxhash crl tgvoip OpenSSL::Crypto @@ -189,6 +197,12 @@ else() ) endif() +if(USE_CUSTOM_API_ID) + list(APPEND TELEGRAM_COMPILE_DEFINITIONS + CUSTOM_API_ID + ) +endif() + if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8") list(APPEND TELEGRAM_COMPILE_DEFINITIONS Q_OS_LINUX64 diff --git a/srcpkgs/telegram-desktop/files/ThirdParty-crl.cmake b/srcpkgs/telegram-desktop/files/ThirdParty-crl.cmake index 32f92c0bf22..7752c615108 100644 --- a/srcpkgs/telegram-desktop/files/ThirdParty-crl.cmake +++ b/srcpkgs/telegram-desktop/files/ThirdParty-crl.cmake @@ -7,6 +7,8 @@ file(GLOB CRL_SOURCE_FILES src/crl/dispatch/*.cpp src/crl/qt/*.cpp src/crl/winapi/*.cpp + src/crl/linux/*.cpp + src/crl/crl_time.cpp ) add_library(${PROJECT_NAME} STATIC ${CRL_SOURCE_FILES}) diff --git a/srcpkgs/telegram-desktop/files/ThirdParty-libtgvoip.cmake b/srcpkgs/telegram-desktop/files/ThirdParty-libtgvoip.cmake index 1604211de7f..3a73da5d69d 100644 --- a/srcpkgs/telegram-desktop/files/ThirdParty-libtgvoip.cmake +++ b/srcpkgs/telegram-desktop/files/ThirdParty-libtgvoip.cmake @@ -14,6 +14,7 @@ file(GLOB TGVOIP_SOURCE_FILES os/posix/*.cpp ) file(GLOB TGVOIP_EXTRA_FILES + audio/AudioIOCallback.cpp BufferInputStream.cpp BufferOutputStream.cpp BufferPool.cpp @@ -30,7 +31,7 @@ else() os/linux/PulseAudioLoader.cpp ) list(REMOVE_ITEM TGVOIP_SOURCE_FILES ${PULSEAUDIO_SOURCE_FILES}) - list(APPEND TGVOIP_COMPILE_DEFINITIONS TGVOIP_DISABLE_PULSEAUDIO) + list(APPEND TGVOIP_COMPILE_DEFINITIONS WITHOUT_PULSE) endif() add_library(${PROJECT_NAME} STATIC ${TGVOIP_SOURCE_FILES} $) diff --git a/srcpkgs/telegram-desktop/patches/dc1e61d09c9193386a32f70821ff841819c88379.patch b/srcpkgs/telegram-desktop/patches/dc1e61d09c9193386a32f70821ff841819c88379.patch deleted file mode 100644 index ed869e2a1bb..00000000000 --- a/srcpkgs/telegram-desktop/patches/dc1e61d09c9193386a32f70821ff841819c88379.patch +++ /dev/null @@ -1,27 +0,0 @@ -From dc1e61d09c9193386a32f70821ff841819c88379 Mon Sep 17 00:00:00 2001 -From: Nicholas Guriev -Date: Fri, 31 Aug 2018 00:28:27 +0300 -Subject: [PATCH] Workaround internal compiler error in GCC - -Fixes: #5111 ---- - Telegram/SourceFiles/apiwrap.cpp | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp -index 3301b6f04..286d2b55c 100644 ---- Telegram/SourceFiles/apiwrap.cpp -+++ Telegram/SourceFiles/apiwrap.cpp -@@ -2390,7 +2390,11 @@ void ApiWrap::requestFileReference( - - request(std::move(data)).done([=](const auto &result) { - const auto parsed = Data::GetFileReferences(result); -- for (const auto &[origin, reference] : parsed) { -+ for (const auto &p : parsed) { -+ // Unpack here the parsed pair by hand to workaround a GCC bug. -+ // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87122 -+ const FileLocationId &origin = p.first; -+ const QByteArray &reference = p.second; - const auto documentId = base::get_if( - &origin); - if (documentId) { diff --git a/srcpkgs/telegram-desktop/patches/fix-missing-use-of-pch.patch b/srcpkgs/telegram-desktop/patches/fix-missing-use-of-pch.patch new file mode 100644 index 00000000000..54b78042002 --- /dev/null +++ b/srcpkgs/telegram-desktop/patches/fix-missing-use-of-pch.patch @@ -0,0 +1,10 @@ +--- Telegram/SourceFiles/storage/cache/storage_cache_database_object.cpp 2018-09-01 17:56:09.000000000 +0200 ++++ - 2018-09-02 01:01:28.812511733 +0200 +@@ -14,6 +14,7 @@ + #include "storage/storage_encrypted_file.h" + #include "base/flat_map.h" + #include "base/algorithm.h" ++#include "base/openssl_help.h" + #include + #include + #include diff --git a/srcpkgs/telegram-desktop/patches/fix-xdg.patch b/srcpkgs/telegram-desktop/patches/fix-xdg.patch index fef7a139244..87bcb1933a4 100644 --- a/srcpkgs/telegram-desktop/patches/fix-xdg.patch +++ b/srcpkgs/telegram-desktop/patches/fix-xdg.patch @@ -23,8 +23,8 @@ index 0a80695..550b9f7 100644 Comment=Official desktop version of Telegram messaging app -Exec=telegram-desktop -- %u -Icon=telegram -+Exec=env QT_QPA_PLATFORMTHEME= SESSION_MANAGER= Telegram -externalupdater -- %u -+Icon=telegram-desktop ++Exec=env SESSION_MANAGER= Telegram -externalupdater -- %u ++Icon=telegram Terminal=false StartupWMClass=TelegramDesktop Type=Application diff --git a/srcpkgs/telegram-desktop/patches/qt5-dynamic-linking.patch b/srcpkgs/telegram-desktop/patches/qt5-dynamic-linking.patch new file mode 100644 index 00000000000..0b1ed9e29fb --- /dev/null +++ b/srcpkgs/telegram-desktop/patches/qt5-dynamic-linking.patch @@ -0,0 +1,51 @@ +From 6645b23021d169c8d3fc0f4522e1725571ace288 Mon Sep 17 00:00:00 2001 +From: John Zimmermann +Date: Wed, 26 Sep 2018 20:36:13 +0200 +Subject: [PATCH 2/7] Fix a few bugs that are caused by dynamic linking to qt5. + +--- + Telegram/SourceFiles/core/launcher.cpp | 8 ++++++++ + Telegram/SourceFiles/qt_static_plugins.cpp | 9 --------- + 2 files changed, 8 insertions(+), 9 deletions(-) + +diff --git Telegram/SourceFiles/core/launcher.cpp Telegram/SourceFiles/core/launcher.cpp +index d4bdadc17..bf9066274 100644 +--- Telegram/SourceFiles/core/launcher.cpp ++++ Telegram/SourceFiles/core/launcher.cpp +@@ -59,6 +59,14 @@ 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/qt/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/qt_static_plugins.cpp Telegram/SourceFiles/qt_static_plugins.cpp +index e29f348c8..122ff0f5d 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 +-- +2.19.0 + + diff --git a/srcpkgs/telegram-desktop/template b/srcpkgs/telegram-desktop/template index cd9ad926a2f..c2e0ecd6bb9 100644 --- a/srcpkgs/telegram-desktop/template +++ b/srcpkgs/telegram-desktop/template @@ -1,22 +1,23 @@ # Template file for 'telegram-desktop' pkgname=telegram-desktop -version=1.3.14 -revision=3 -_libtgvoip_commit=bfa1e6ab76a467c6c6bff7eabb7c213acc7a1b34 +version=1.4.3 +revision=1 +_libtgvoip_commit=9b292fdbc84f148f736407176facc920e20592f9 _GSL_commit=d846fe50a3f0bb7767c7e087a05f4be95f4da0ec _variant_commit=550ac2f159ca883d360c196149b466955c77a573 -_crl_commit=527ad273b683d52c5adf5b45b73c6466aa0d0cf0 +_crl_commit=4291015efab76bda5886a56b5007f4531be17d46 _Catch_commit=5ca44b68721833ae3731802ed99af67c6f38a53a build_style=cmake 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" + -DENABLE_PULSEAUDIO=$(vopt_if pulseaudio 'ON' 'OFF') + -DUSE_CUSTOM_API_ID=$(vopt_if custom_api_id 'ON' 'OFF')" 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 libva-devel" + libdbusmenu-glib-devel libopenal-devel minizip-devel opus-devel xxHash-devel + $(vopt_if pulseaudio 'pulseaudio-devel') qt5-devel range-v3 libva-devel" depends="qt5-imageformats" short_desc="Telegram Desktop messaging app" maintainer="John " @@ -29,14 +30,15 @@ distfiles="https://github.com/telegramdesktop/tdesktop/archive/v${version}.tar.g 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="83daeded641f79bd370b5e83be88242ab57520e7754f1371a9e5c1f3d9863f2a - 74cf9046687e88ab6074e8f8946da53d95b11abb34a51db1f042ab0ae14f1b91 +checksum="bc57654d3d014252dd128c8b5699ca843b8b6dbb926a3e31d10221be16826cc8 + cbfb0955ee56be06b519418b8d22c5a27538e2e9ae5382d558f85f78c9ca761a be81db4ab1b57102a0fa1cd0c4a6469294eb9daf24294347592245b754f65ff6 aa794dfefe0a90501587e36d977b958d0df888503117a8d9aa43dc14f8526d9d - d7e64fc8a2e284a5be8c0b0c6e7bfbaf951751081919829cb3bb290544c732e8 + aee42a2fe003888d0d0133cd208a1524f5d95af6af506c1cd7e07e268d0d9081 d24e6d9df2b8aa5739d3b9077c6b0ff0ef4d5ef8acc52c3a57e32893854d8d18" -build_options=clang +build_options="clang custom_api_id pulseaudio" +build_options_default="pulseaudio custom_api_id" if [ "$build_option_clang" ]; then CFLAGS="-fPIE -fPIC -fstack-protector-strong" @@ -87,6 +89,17 @@ post_extract() { mkdir -p ${build_wrksrc}/native cp ${FILESDIR}/TelegramCodegenTools.cmake ${build_wrksrc}/native/CMakeLists.txt + mkdir ${wrksrc}/TelegramPrivate + if [ -r "$FILESDIR/custom_api_id.h" ]; then + cp "${FILESDIR}/custom_api_id.h" "${wrksrc}/TelegramPrivate" + else + # This Keys are only intended for use in Void Linux + cat > ${wrksrc}/TelegramPrivate/custom_api_id.h <<_EOF +static const int32 ApiId = 209235; +static const char *ApiHash= "169ee702e1df4b6e66d80311db36cc43"; +_EOF + fi + # change wrksrc temporarily so that patches can be applied wrksrc="${wrksrc}/tdesktop-${version}" } @@ -99,6 +112,6 @@ pre_configure() { post_install() { for i in 16 32 48 64 128 256 512; do - vinstall 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.png done }