diff options
Diffstat (limited to 'net-im/telegram-desktop/files')
7 files changed, 253 insertions, 54 deletions
diff --git a/net-im/telegram-desktop/files/tdesktop-3.1.0-fix-openssl3.patch b/net-im/telegram-desktop/files/tdesktop-3.1.0-fix-openssl3.patch deleted file mode 100644 index 2b92e8adce4f..000000000000 --- a/net-im/telegram-desktop/files/tdesktop-3.1.0-fix-openssl3.patch +++ /dev/null @@ -1,19 +0,0 @@ -Fix openssl 3.x compatibility - -FIPS_mode_set was merely used to clean up resources. This isn't necessary -anymore on the newer openssl version. - -There's still a lot of functions that are used that were deprecated. I hope -upstream can fix those, as I'm unsure what to do with them. - ---- tdesktop-3.1.0-full.orig/Telegram/SourceFiles/core/utils.cpp -+++ tdesktop-3.1.0-full/Telegram/SourceFiles/core/utils.cpp -@@ -124,7 +124,7 @@ - - void finish() { - CRYPTO_cleanup_all_ex_data(); --#ifndef LIBRESSL_VERSION_NUMBER -+#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x20000000L - FIPS_mode_set(0); - #endif - ENGINE_cleanup(); diff --git a/net-im/telegram-desktop/files/tdesktop-3.1.0-jemalloc-only-telegram.patch b/net-im/telegram-desktop/files/tdesktop-3.1.0-jemalloc-only-telegram.patch deleted file mode 100644 index 7ad3e75e49ba..000000000000 --- a/net-im/telegram-desktop/files/tdesktop-3.1.0-jemalloc-only-telegram.patch +++ /dev/null @@ -1,35 +0,0 @@ -Only link jemalloc for the Telegram binary - -Some combination of factors is making the different codegen tools hang when -jemalloc is linked for those, and they're ran under portage's sandbox. Since -this is only used during build-time, and jemalloc is merely necessary to -improve runtime memory use, it's unnecessary to use it for anything else. - ---- tdesktop-3.1.0-full.orig/Telegram/CMakeLists.txt -+++ tdesktop-3.1.0-full/Telegram/CMakeLists.txt -@@ -1256,6 +1256,11 @@ - endif() - endif() - else() -+ target_link_libraries(Telegram -+ PRIVATE -+ desktop-app::external_jemalloc -+ ) -+ - if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) - target_link_libraries(Telegram - PRIVATE ---- tdesktop-3.1.0-full.orig/cmake/options_linux.cmake -+++ tdesktop-3.1.0-full/cmake/options_linux.cmake -@@ -45,11 +45,6 @@ - target_link_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-g -flto -fuse-linker-plugin>) - endif() - --target_link_libraries(common_options --INTERFACE -- desktop-app::external_jemalloc --) -- - if (DESKTOP_APP_USE_ALLOCATION_TRACER) - target_link_options(common_options - INTERFACE diff --git a/net-im/telegram-desktop/files/tdesktop-3.5.2-jemalloc-only-telegram.patch b/net-im/telegram-desktop/files/tdesktop-3.5.2-jemalloc-only-telegram.patch new file mode 100644 index 000000000000..4f5c7017e6ac --- /dev/null +++ b/net-im/telegram-desktop/files/tdesktop-3.5.2-jemalloc-only-telegram.patch @@ -0,0 +1,33 @@ +Only link jemalloc for the Telegram binary + +Some combination of factors is making the different codegen tools hang when +jemalloc is linked for those, and they're ran under portage's sandbox. Since +this is only used during build-time, and jemalloc is merely necessary to +improve runtime memory use, it's unnecessary to use it for anything else. + +--- tdesktop-3.5.2-full.orig/Telegram/CMakeLists.txt ++++ tdesktop-3.5.2-full/Telegram/CMakeLists.txt +@@ -1357,6 +1357,12 @@ + desktop-app::external_kwayland + ) + endif() ++ ++ target_link_libraries(Telegram ++ PRIVATE ++ desktop-app::linux_jemalloc_helper ++ $<TARGET_OBJECTS:desktop-app::linux_jemalloc_helper> ++ ) + endif() + + if (build_macstore) +--- tdesktop-3.5.2-full.orig/cmake/options_linux.cmake ++++ tdesktop-3.5.2-full/cmake/options_linux.cmake +@@ -64,8 +64,6 @@ + + target_link_libraries(common_options + INTERFACE +- desktop-app::linux_jemalloc_helper +- $<TARGET_OBJECTS:desktop-app::linux_jemalloc_helper> + ${CMAKE_DL_LIBS} + ) + diff --git a/net-im/telegram-desktop/files/tdesktop-3.5.2-jemalloc-optional.patch b/net-im/telegram-desktop/files/tdesktop-3.5.2-jemalloc-optional.patch new file mode 100644 index 000000000000..bd3595858c20 --- /dev/null +++ b/net-im/telegram-desktop/files/tdesktop-3.5.2-jemalloc-optional.patch @@ -0,0 +1,71 @@ +Optionally disable jemalloc + +Telegram upstream heavily insists you use the jemalloc allocator. This is due +to the high memory usage resulting from the glibc allocator. It is unknown why +this affects telegram the way it does, but upstream solved the issue by using a +different allocator. Initially they used mallocng, now jemalloc. + +However, other libcs don't necessarily need this, and as such this should be +optional. As mallocng is a fork of musl's allocator, and this was used before +the switch to jemalloc, the musl allocator should still be OK. + +Please warn glibc users about disabling jemalloc, don't report bugs about +memory usage upstream unless you're using jemalloc. + +Related info: +https://github.com/telegramdesktop/tdesktop/issues/16084 +https://github.com/desktop-app/cmake_helpers/pull/91#issuecomment-881788003 + +--- tdesktop-3.5.2-full.orig/Telegram/CMakeLists.txt ++++ tdesktop-3.5.2-full/Telegram/CMakeLists.txt +@@ -1358,11 +1358,13 @@ + ) + endif() + +- target_link_libraries(Telegram +- PRIVATE +- desktop-app::linux_jemalloc_helper +- $<TARGET_OBJECTS:desktop-app::linux_jemalloc_helper> +- ) ++ if (NOT DESKTOP_APP_DISABLE_JEMALLOC) ++ target_link_libraries(Telegram ++ PRIVATE ++ desktop-app::linux_jemalloc_helper ++ $<TARGET_OBJECTS:desktop-app::linux_jemalloc_helper> ++ ) ++ endif() + endif() + + if (build_macstore) +--- tdesktop-3.5.2-full.orig/cmake/CMakeLists.txt ++++ tdesktop-3.5.2-full/cmake/CMakeLists.txt +@@ -5,7 +5,7 @@ + # https://github.com/desktop-app/legal/blob/master/LEGAL + + add_subdirectory(external) +-if (LINUX) ++if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC) + add_subdirectory(linux_jemalloc_helper) + endif() + if (LINUX AND NOT DESKTOP_APP_USE_PACKAGED) +--- tdesktop-3.5.2-full.orig/cmake/external/CMakeLists.txt ++++ tdesktop-3.5.2-full/cmake/external/CMakeLists.txt +@@ -37,7 +37,7 @@ + add_checked_subdirectory(hunspell) + endif() + add_checked_subdirectory(iconv) +-if (LINUX) ++if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC) + add_checked_subdirectory(jemalloc) + endif() + add_checked_subdirectory(jpeg) +--- tdesktop-3.5.2-full.orig/cmake/variables.cmake ++++ tdesktop-3.5.2-full/cmake/variables.cmake +@@ -26,6 +26,7 @@ + option(DESKTOP_APP_USE_PACKAGED_FONTS "Use preinstalled fonts instead of bundled patched ones." OFF) + option(DESKTOP_APP_USE_PACKAGED_RLOTTIE "Find rlottie using CMake instead of bundled patched one." OFF) + option(DESKTOP_APP_DISABLE_SPELLCHECK "Disable spellcheck library." OFF) ++option(DESKTOP_APP_DISABLE_JEMALLOC "Disable use of the jemalloc allocator (Linux only)." OFF) + option(DESKTOP_APP_DISABLE_CRASH_REPORTS "Disable crash report generation." ${no_special_target}) + option(DESKTOP_APP_DISABLE_AUTOUPDATE "Disable autoupdate." ${disable_autoupdate}) + option(DESKTOP_APP_USE_HUNSPELL_ONLY "Disable system spellchecker and use bundled Hunspell only. (For debugging purposes)" OFF) diff --git a/net-im/telegram-desktop/files/tdesktop-3.5.2-musl.patch b/net-im/telegram-desktop/files/tdesktop-3.5.2-musl.patch new file mode 100644 index 000000000000..4c34d107913e --- /dev/null +++ b/net-im/telegram-desktop/files/tdesktop-3.5.2-musl.patch @@ -0,0 +1,33 @@ +Stub out some glibc-specific functions + +This allows support for alternative libcs like musl + +--- tdesktop-3.5.2-full.orig/Telegram/lib_base/base/platform/linux/base_info_linux.cpp ++++ tdesktop-3.5.2-full/Telegram/lib_base/base/platform/linux/base_info_linux.cpp +@@ -22,7 +22,7 @@ + + #include <sys/utsname.h> + +-#ifdef Q_OS_LINUX ++#if defined(Q_OS_LINUX) && defined(__GLIBC__) + #include <gnu/libc-version.h> + #endif // Q_OS_LINUX + +@@ -200,7 +200,7 @@ + } + + QString GetLibcName() { +-#ifdef Q_OS_LINUX ++#if defined(Q_OS_LINUX) && defined(__GLIBC__) + return "glibc"; + #endif // Q_OS_LINUX + +@@ -208,7 +208,7 @@ + } + + QString GetLibcVersion() { +-#ifdef Q_OS_LINUX ++#if defined(Q_OS_LINUX) && defined(__GLIBC__) + static const auto result = [&] { + const auto version = QString::fromLatin1(gnu_get_libc_version()); + return QVersionNumber::fromString(version).isNull() ? QString() : version; diff --git a/net-im/telegram-desktop/files/tdesktop-3.6.0-jemalloc-only-telegram.patch b/net-im/telegram-desktop/files/tdesktop-3.6.0-jemalloc-only-telegram.patch new file mode 100644 index 000000000000..6836e6935049 --- /dev/null +++ b/net-im/telegram-desktop/files/tdesktop-3.6.0-jemalloc-only-telegram.patch @@ -0,0 +1,41 @@ +Only link jemalloc for the Telegram binary + +Some combination of factors is making the different codegen tools hang when +jemalloc is linked for those, and they're ran under portage's sandbox. Since +this is only used during build-time, and jemalloc is merely necessary to +improve runtime memory use, it's unnecessary to use it for anything else. + +--- tdesktop-3.6.0-full.orig/Telegram/CMakeLists.txt ++++ tdesktop-3.6.0-full/Telegram/CMakeLists.txt +@@ -1376,6 +1376,14 @@ + desktop-app::external_kwayland + ) + endif() ++ ++ if (NOT DESKTOP_APP_DISABLE_JEMALLOC) ++ target_link_libraries(Telegram ++ INTERFACE ++ $<TARGET_OBJECTS:desktop-app::linux_jemalloc_helper> ++ $<LINK_ONLY:desktop-app::external_jemalloc> ++ ) ++ endif() + endif() + + if (build_macstore) +--- tdesktop-3.6.0-full.orig/cmake/options_linux.cmake ++++ tdesktop-3.6.0-full/cmake/options_linux.cmake +@@ -62,14 +62,6 @@ + target_link_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-g -flto -fuse-linker-plugin>) + endif() + +-if (NOT DESKTOP_APP_DISABLE_JEMALLOC) +- target_link_libraries(common_options +- INTERFACE +- $<TARGET_OBJECTS:desktop-app::linux_jemalloc_helper> +- $<LINK_ONLY:desktop-app::external_jemalloc> +- ) +-endif() +- + target_link_libraries(common_options + INTERFACE + ${CMAKE_DL_LIBS} diff --git a/net-im/telegram-desktop/files/tdesktop-3.6.0-support-ffmpeg5.patch b/net-im/telegram-desktop/files/tdesktop-3.6.0-support-ffmpeg5.patch new file mode 100644 index 000000000000..32959acd5482 --- /dev/null +++ b/net-im/telegram-desktop/files/tdesktop-3.6.0-support-ffmpeg5.patch @@ -0,0 +1,75 @@ +Support FFmpeg 5 + +I'm not comfortable changing the _durationInMilliseconds formula on older +versions of ffmpeg. Doing that only for newer versions also reduces the amount +of testing this patch needs (of which it'll get very minimal amounts, this is a +job better left for upstream when they get to it). + +Also it doesn't compile under ffmpeg 4 if the variables are constants :/ + +--- tdesktop-3.6.0-full.orig/Telegram/ThirdParty/tgcalls/tgcalls/group/AudioStreamingPartInternal.cpp ++++ tdesktop-3.6.0-full/Telegram/ThirdParty/tgcalls/tgcalls/group/AudioStreamingPartInternal.cpp +@@ -104,7 +104,11 @@ + + _frame = av_frame_alloc(); + ++#if LIBAVFORMAT_VERSION_MAJOR >= 59 ++ const AVInputFormat *inputFormat = av_find_input_format(container.c_str()); ++#else + AVInputFormat *inputFormat = av_find_input_format(container.c_str()); ++#endif + if (!inputFormat) { + _didReadToEnd = true; + return; +@@ -144,7 +148,11 @@ + + _streamId = i; + ++#if LIBAVFORMAT_VERSION_MAJOR >= 59 ++ _durationInMilliseconds = inStream->duration * 1000 / 48000; ++#else + _durationInMilliseconds = (int)((inStream->duration + inStream->first_dts) * 1000 / 48000); ++#endif + + if (inStream->metadata) { + AVDictionaryEntry *entry = av_dict_get(inStream->metadata, "TG_META", nullptr, 0); +--- tdesktop-3.6.0-full.orig/Telegram/ThirdParty/tgcalls/tgcalls/group/AudioStreamingPartPersistentDecoder.cpp ++++ tdesktop-3.6.0-full/Telegram/ThirdParty/tgcalls/tgcalls/group/AudioStreamingPartPersistentDecoder.cpp +@@ -32,7 +32,11 @@ + AudioStreamingPartPersistentDecoderState(AVCodecParameters const *codecParameters, AVRational timeBase) : + _codecParameters(codecParameters), + _timeBase(timeBase) { ++#ifdef LIBAVCODEC_VERSION_MAJOR >= 59 ++ const AVCodec *codec = avcodec_find_decoder(codecParameters->codec_id); ++#else + AVCodec *codec = avcodec_find_decoder(codecParameters->codec_id); ++#endif + if (codec) { + _codecContext = avcodec_alloc_context3(codec); + int ret = avcodec_parameters_to_context(_codecContext, codecParameters); +--- tdesktop-3.6.0-full.orig/Telegram/ThirdParty/tgcalls/tgcalls/group/VideoStreamingPart.cpp ++++ tdesktop-3.6.0-full/Telegram/ThirdParty/tgcalls/tgcalls/group/VideoStreamingPart.cpp +@@ -280,7 +280,11 @@ + + int ret = 0; + ++#if LIBAVFORMAT_VERSION_MAJOR >= 59 ++ const AVInputFormat *inputFormat = av_find_input_format(container.c_str()); ++#else + AVInputFormat *inputFormat = av_find_input_format(container.c_str()); ++#endif + if (!inputFormat) { + _didReadToEnd = true; + return; +@@ -323,7 +327,11 @@ + } + + if (videoCodecParameters && videoStream) { ++#if LIBAVCODEC_VERSION_MAJOR >= 59 ++ const AVCodec *codec = avcodec_find_decoder(videoCodecParameters->codec_id); ++#else + AVCodec *codec = avcodec_find_decoder(videoCodecParameters->codec_id); ++#endif + if (codec) { + _codecContext = avcodec_alloc_context3(codec); + ret = avcodec_parameters_to_context(_codecContext, videoCodecParameters); |