obsolete cleanup 2

This commit is contained in:
TheK0tYaRa 2025-09-27 08:04:35 +03:00
parent 0054db520c
commit a57673c7a1
262 changed files with 194 additions and 27353 deletions

View file

@ -1,4 +0,0 @@
DIST tdesktop-4.14.0-full.tar.gz 67902326 BLAKE2B 2fe6985b5b328393cbba9ed2573ce7136db0ba6730f7de4d39d567e5ebd651d6e99814f0011c24bd975af3a831e1fcff5ac6c7686b15f94ca20244aca24975c5 SHA512 3f0e8a77dc3487f4968a381911859953289d5580a3962ac25f09ac9a5d4bd65208530df04bb9db734e05fbd9f7a15c32e5e7a7dc79250a67efc00c6b46aead1b
DIST tdesktop-4.14.1-full.tar.gz 67924653 BLAKE2B 623fb3ac4e0bc6c96f4b3038f5f8378b24b867749a486d6fe9f1ef00d4fedc978b6e745be6402aa91d1f5360ca056401d2f4888c50ea0c835d92e10ee57e328c SHA512 e6c25253acee137e03af42e60c2f5ca8a92220e7ed2175a0a20ed49e3d310a724a1fa9e24e5a94c77e70be3d9dc49ccfbe3790bd9074a0417355af54636f7631
DIST tdesktop-4.14.2-full.tar.gz 67924788 BLAKE2B a891dce4afad173a55b9e60f91089e31655c16860917e5ee252ab1a9038a60b46739bfc361bdf586b0c4e47808f3cf60cf727d13469f5734c803127955152f43 SHA512 7ab1f8b93d4c1efcb08ca42f9b4604a17a22517d6616ba973018a4b7ef63de3d6650deeb74d752548ec7fce8b3581a73b974c6bc6d2c16e4f31049bc11d87b7a
DIST tdesktop-4.15.2-full.tar.gz 69539402 BLAKE2B 95d6cd3eead56f7cb2aeafd0cc1a05d740ec243644e6d318f415a7fa6c8ad94d3a95cfc9082ba04507a024c81bfc15700ad6adcbfd932ca1993a3310744ac196 SHA512 6e65183d5e77d17e11d0c70e1654373e69f6243f2879cf403701e23acd5aed9df6c6892a1c7c83fd975a858e90e20d73824d0754a2f96ad5af6e3de6515e2627

View file

@ -1,12 +0,0 @@
add_library(external_breakpad INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_breakpad ALIAS external_breakpad)
find_package(PkgConfig REQUIRED)
pkg_check_modules(BREAKPAD REQUIRED breakpad-client)
target_include_directories(
external_breakpad INTERFACE ${BREAKPAD_INCLUDE_DIRS}
)
target_link_libraries(
external_breakpad INTERFACE ${BREAKPAD_LIBRARIES}
)

View file

@ -1,22 +0,0 @@
https://bugs.gentoo.org/830180
--- tdesktop-3.3.0-full.orig/Telegram/lib_spellcheck/spellcheck/platform/linux/spellcheck_linux.cpp
+++ tdesktop-3.3.0-full/Telegram/lib_spellcheck/spellcheck/platform/linux/spellcheck_linux.cpp
@@ -34,7 +34,7 @@
auto IsHebrew(const QString &word) {
// Words with mixed scripts will be automatically ignored,
// so this check should be fine.
- return ::Spellchecker::WordScript(&word) == QChar::Script_Hebrew;
+ return ::Spellchecker::WordScript(word) == QChar::Script_Hebrew;
}
class EnchantSpellChecker {
@@ -154,7 +154,7 @@
}
auto EnchantSpellChecker::findSuggestions(const QString &word) {
- const auto wordScript = ::Spellchecker::WordScript(&word);
+ const auto wordScript = ::Spellchecker::WordScript(word);
auto w = word.toStdString();
std::vector<QString> result;
if (!_validators.size()) {

View file

@ -1,33 +0,0 @@
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;

View file

@ -1,43 +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.
https://bugs.gentoo.org/802624
--- 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}

View file

@ -1,75 +0,0 @@
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);

View file

@ -1,55 +0,0 @@
Fix compatibility with kwayland-5.93.0
The header files were moved, the include directory wasn't being added correctly.
https://bugs.gentoo.org/837569
--- tdesktop-3.6.1-full.orig/Telegram/SourceFiles/platform/linux/linux_wayland_integration.cpp
+++ tdesktop-3.6.1-full/Telegram/SourceFiles/platform/linux/linux_wayland_integration.cpp
@@ -9,10 +9,10 @@
#include "base/platform/base_platform_info.h"
-#include <connection_thread.h>
-#include <registry.h>
-#include <surface.h>
-#include <plasmashell.h>
+#include <KWayland/Client/connection_thread.h>
+#include <KWayland/Client/registry.h>
+#include <KWayland/Client/surface.h>
+#include <KWayland/Client/plasmashell.h>
using namespace KWayland::Client;
--- tdesktop-3.6.1-full.orig/Telegram/lib_base/base/platform/linux/base_linux_wayland_integration.cpp
+++ tdesktop-3.6.1-full/Telegram/lib_base/base/platform/linux/base_linux_wayland_integration.cpp
@@ -13,11 +13,11 @@
#include <QtCore/QPointer>
#include <QtGui/QWindow>
-#include <connection_thread.h>
-#include <registry.h>
-#include <surface.h>
-#include <xdgforeign.h>
-#include <idleinhibit.h>
+#include <KWayland/Client/connection_thread.h>
+#include <KWayland/Client/registry.h>
+#include <KWayland/Client/surface.h>
+#include <KWayland/Client/xdgforeign.h>
+#include <KWayland/Client/idleinhibit.h>
using namespace KWayland::Client;
--- tdesktop-3.6.1-full.orig/Telegram/lib_ui/ui/platform/linux/ui_linux_wayland_integration.cpp
+++ tdesktop-3.6.1-full/Telegram/lib_ui/ui/platform/linux/ui_linux_wayland_integration.cpp
@@ -24,8 +24,8 @@
#include <private/qwaylandwindow_p.h>
#include <private/qwaylandshellsurface_p.h>
-#include <connection_thread.h>
-#include <registry.h>
+#include <KWayland/Client/connection_thread.h>
+#include <KWayland/Client/registry.h>
Q_DECLARE_METATYPE(QMargins);

View file

@ -1,44 +0,0 @@
Description: Do not capture buttons in AccountsList that belong to inner VerticalLayout widget
This fixes a use-after-free error (double destruction) in the main menu right after account switching.
Bug-Debian: https://bugs.debian.org/1008156
Bug-Ubuntu: https://launchpad.net/bugs/1967673
Forwarded: https://github.com/telegramdesktop/tdesktop/pull/24301
Author: Nicholas Guriev <guriev-ns@ya.ru>
Last-Update: Sat, 09 Apr 2022 13:47:55 +0300
--- tdesktop-3.6.1-full.orig/Telegram/SourceFiles/settings/settings_information.cpp
+++ tdesktop-3.6.1-full/Telegram/SourceFiles/settings/settings_information.cpp
@@ -78,9 +78,7 @@
int _outerIndex = 0;
Ui::SlideWrap<Ui::SettingsButton> *_addAccount = nullptr;
- base::flat_map<
- not_null<Main::Account*>,
- base::unique_qptr<Ui::SettingsButton>> _watched;
+ base::flat_map<not_null<Main::Account*>, Ui::SettingsButton*> _watched;
base::unique_qptr<Ui::PopupMenu> _contextMenu;
std::unique_ptr<Ui::VerticalLayoutReorder> _reorder;
@@ -730,7 +728,7 @@
order.reserve(inner->count());
for (auto i = 0; i < inner->count(); i++) {
for (const auto &[account, button] : _watched) {
- if (button.get() == inner->widgetAt(i)) {
+ if (button == inner->widgetAt(i)) {
order.push_back(account->session().uniqueId());
}
}
@@ -769,11 +767,11 @@
account,
std::move(activate));
};
- button.reset(inner->add(MakeAccountButton(
+ button = inner->add(MakeAccountButton(
inner,
_controller,
account,
- std::move(callback))));
+ std::move(callback)));
}
}
inner->resizeToWidth(_outer->width());

View file

@ -1,32 +0,0 @@
Use system cppgir
https://github.com/desktop-app/cmake_helpers/issues/282
https://github.com/desktop-app/cmake_helpers/pull/305
--- tdesktop-4.10.0-full.orig/cmake/external/glib/CMakeLists.txt
+++ tdesktop-4.10.0-full/cmake/external/glib/CMakeLists.txt
@@ -7,14 +7,6 @@
add_library(external_glib INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_glib ALIAS external_glib)
-function(add_cppgir) # isolate scope
- set(BUILD_TESTING OFF)
- set(BUILD_DOC OFF)
- set(BUILD_EXAMPLES OFF)
- add_subdirectory(cppgir EXCLUDE_FROM_ALL)
-endfunction()
-add_cppgir()
-
include(generate_cppgir.cmake)
generate_cppgir(external_glib Gio-2.0)
--- tdesktop-4.10.0-full.orig/cmake/external/glib/generate_cppgir.cmake
+++ tdesktop-4.10.0-full/cmake/external/glib/generate_cppgir.cmake
@@ -4,6 +4,8 @@
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL
+find_package(CppGir REQUIRED)
+
function(generate_cppgir target_name gir)
# cppgir generates all the dependent headers everytime, better to have a global folder
set(gen_dst ${CMAKE_BINARY_DIR}/gen)

View file

@ -1,12 +0,0 @@
diff --git a/Telegram/lib_base/base/qt/qt_compare.h b/Telegram/lib_base/base/qt/qt_compare.h
index ca03fa2..d1eb6ab 100644
--- a/Telegram/lib_base/base/qt/qt_compare.h
+++ b/Telegram/lib_base/base/qt/qt_compare.h
@@ -10,6 +10,7 @@
#include <gsl/pointers>
#include <QString>
+#include <variant>
#if !defined(__apple_build_version__) || (__apple_build_version__ > 12000032)

View file

@ -1,43 +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.
https://bugs.gentoo.org/802624
--- tdesktop-4.2.4-full.orig/Telegram/CMakeLists.txt
+++ tdesktop-4.2.4-full/Telegram/CMakeLists.txt
@@ -1478,6 +1478,14 @@
desktop-app::external_wayland_client
)
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-4.2.4-full.orig/cmake/options_linux.cmake
+++ tdesktop-4.2.4-full/cmake/options_linux.cmake
@@ -78,14 +78,6 @@
)
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()
-
if (DESKTOP_APP_USE_ALLOCATION_TRACER)
target_link_options(common_options
INTERFACE

View file

@ -1,43 +0,0 @@
Fix building without spellcheck
Upcoming changes to tdesktop include language recognition, which is a bit of a
doozy, and as is tradition, "unusual" compilation flags go untested.
Regular builds would always return false here, anyway, as linux isn't a
priority with these things.
/var/tmp/portage/net-im/telegram-desktop-4.3.4/work/tdesktop-4.3.4-full/Telegram/SourceFiles/boxes/translate_box.cpp:18:10: fatal error: spellcheck/platform/platform_language.h: No such file or directory
18 | #include "spellcheck/platform/platform_language.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
--- tdesktop-4.3.4-full.orig/Telegram/SourceFiles/boxes/translate_box.cpp
+++ tdesktop-4.3.4-full/Telegram/SourceFiles/boxes/translate_box.cpp
@@ -15,7 +15,9 @@
#include "main/main_session.h"
#include "mtproto/sender.h"
#include "settings/settings_common.h"
+#ifndef TDESKTOP_DISABLE_SPELLCHECK
#include "spellcheck/platform/platform_language.h"
+#endif
#include "ui/effects/loading_element.h"
#include "ui/layers/generic_box.h"
#include "ui/widgets/buttons.h"
@@ -331,6 +333,7 @@
if (!hasLetters) {
return true;
}
+#ifndef TDESKTOP_DISABLE_SPELLCHECK
const auto result = Platform::Language::Recognize(text);
if (result.unknown) {
return false;
@@ -343,6 +346,9 @@
? QLocale::English
: settingsLang;
return (result.locale.language() == skip);
+#else
+ return false;
+#endif
}
} // namespace Ui

View file

@ -1,42 +0,0 @@
Disable portal-related event loop with qt5
QEventLoop::ApplicationExec is undocumented, but only present in qt6, so I have
no idea if the functionality can be preserved in qt5. Upstream code indicates
that not using it at all is safe, and unlikely to cause problems in
distribution packaging.
Yet another reminder that qt5 is dying.
/var/tmp/portage/net-im/telegram-desktop-4.3.4/work/tdesktop-4.3.4-full/Telegram/SourceFiles/platform/linux/specific_linux.cpp: In lambda function:
/var/tmp/portage/net-im/telegram-desktop-4.3.4/work/tdesktop-4.3.4-full/Telegram/SourceFiles/platform/linux/specific_linux.cpp:294:55: error: ApplicationExec is not a member of QEventLoop
294 | loop.exec(QEventLoop::ApplicationExec);
| ^~~~~~~~~~~~~~~
--- tdesktop-4.3.4-full.orig/Telegram/SourceFiles/platform/linux/specific_linux.cpp
+++ tdesktop-4.3.4-full/Telegram/SourceFiles/platform/linux/specific_linux.cpp
@@ -229,6 +229,7 @@
}
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
void LaunchGApplication() {
const auto connection = [] {
try {
@@ -401,6 +402,7 @@
});
}
}
+#endif // QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
bool GenerateDesktopFile(
const QString &targetPath,
@@ -862,7 +864,9 @@
LOG(("Fallback icon theme: %1").arg(QIcon::fallbackThemeName()));
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
+#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
LaunchGApplication();
+#endif // QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
}

View file

@ -1,28 +0,0 @@
Disable unused incompatible overload with qt5
Neither Qt nore C++ are my forte, but this code is unused with the packaged
distro version, anyway.
/var/tmp/portage/net-im/telegram-desktop-4.3.4/work/tdesktop-4.3.4-full/Telegram/SourceFiles/platform/linux/specific_linux.cpp: In lambda function:
/var/tmp/portage/net-im/telegram-desktop-4.3.4/work/tdesktop-4.3.4-full/Telegram/SourceFiles/platform/linux/specific_linux.cpp:705:74: error: call of overloaded arg(QByteArray&) is ambiguous
705 | return qsl("org.telegram.desktop.%1.desktop").arg(md5Hash);
| ^
--- tdesktop-4.3.4-full.orig/Telegram/SourceFiles/platform/linux/specific_linux.cpp
+++ tdesktop-4.3.4-full/Telegram/SourceFiles/platform/linux/specific_linux.cpp
@@ -692,6 +692,7 @@
+ qsl(".desktop");
}
+#if !(defined(TDESKTOP_DISABLE_AUTOUPDATE) && QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
if (!Core::UpdaterDisabled()) {
QByteArray md5Hash(h);
if (!Launcher::Instance().customWorkingDir()) {
@@ -706,6 +707,7 @@
return qsl("org.telegram.desktop.%1.desktop").arg(md5Hash);
}
+#endif // !(defined(TDESKTOP_DISABLE_AUTOUPDATE) && QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
return qsl("org.telegram.desktop.desktop");
}());

View file

@ -1,26 +0,0 @@
From 37e03fb4289a3f46a5201caaebbdce8e441d55f5 Mon Sep 17 00:00:00 2001
From: John Helmert III <ajak@gentoo.org>
Date: Sun, 11 Dec 2022 14:21:32 -0600
Subject: [PATCH] fix duplicate main declaration
Bug: https://bugs.gentoo.org/883935
Signed-off-by: John Helmert III <ajak@gentoo.org>
---
cmake/external/cld3/CMakeLists.txt | 1 -
1 file changed, 1 deletion(-)
diff --git a/cmake/external/cld3/CMakeLists.txt b/cmake/external/cld3/CMakeLists.txt
index f351ca1..54c524b 100644
--- a/cmake/external/cld3/CMakeLists.txt
+++ b/cmake/external/cld3/CMakeLists.txt
@@ -80,7 +80,6 @@ PRIVATE
script_span/generated_entities.cc
script_span/getonescriptspan.cc
script_span/getonescriptspan.h
- script_span/getonescriptspan_test.cc
script_span/utf8statetable.cc
script_span/offsetmap.cc
script_span/text_processing.cc
--
2.38.1

View file

@ -1,20 +0,0 @@
https://bugs.gentoo.org/840526
--- a/src/modules/rtp_rtcp/source/rtp_packetizer_av1_test_helper.cc
+++ b/src/modules/rtp_rtcp/source/rtp_packetizer_av1_test_helper.cc
@@ -10,6 +10,7 @@
#include "modules/rtp_rtcp/source/rtp_packetizer_av1_test_helper.h"
+#include <cstddef>
#include <stdint.h>
#include <initializer_list>
@@ -42,7 +43,7 @@ std::vector<uint8_t> BuildAv1Frame(std::initializer_list<Av1Obu> obus) {
}
if (obu.header_ & kAv1ObuSizePresentBit) {
// write size in leb128 format.
- size_t payload_size = obu.payload_.size();
+ std::size_t payload_size = obu.payload_.size();
while (payload_size >= 0x80) {
raw.push_back(0x80 | (payload_size & 0x7F));
payload_size >>= 7;

View file

@ -1,44 +0,0 @@
https://bugs.gentoo.org/840526
https://github.com/desktop-app/tg_owt/pull/101
From 86d2bcd7afb8706663d29e30f65863de5a626142 Mon Sep 17 00:00:00 2001
From: Xiretza <xiretza@xiretza.xyz>
Date: Sun, 15 May 2022 12:47:41 +0200
Subject: [PATCH] fix(h265_pps_parser): fix missing cstdint include
--- a/src/common_video/h265/h265_pps_parser.h
+++ b/src/common_video/h265/h265_pps_parser.h
@@ -12,6 +12,7 @@
#define COMMON_VIDEO_H265_PPS_PARSER_H_
#include "absl/types/optional.h"
+#include <cstdint>
namespace rtc {
class BitBuffer;
From c358917ff8deac2015586356113dae75d076d1e3 Mon Sep 17 00:00:00 2001
From: peeweep <peeweep@0x0.ee>
Date: Mon, 27 Jun 2022 15:07:04 +0000
Subject: [PATCH] fix(module_common_types_public): fix missing cstdint include
Signed-off-by: peeweep <peeweep@0x0.ee>
---
src/modules/include/module_common_types_public.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/modules/include/module_common_types_public.h b/src/modules/include/module_common_types_public.h
index 345e45ce..8338a514 100644
--- a/src/modules/include/module_common_types_public.h
+++ b/src/modules/include/module_common_types_public.h
@@ -11,6 +11,7 @@
#ifndef MODULES_INCLUDE_MODULE_COMMON_TYPES_PUBLIC_H_
#define MODULES_INCLUDE_MODULE_COMMON_TYPES_PUBLIC_H_
+#include <cstdint>
#include <limits>
#include "absl/types/optional.h"
--
2.35.1

View file

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person" proxied="yes">
<email>esteve.varela@gmail.com</email>
<name>Esteve Varela Colominas</name>
</maintainer>
<maintainer type="person" proxied="proxy">
<email>dlan@gentoo.org</email>
<name>Yixun Lan</name>
</maintainer>
<maintainer type="project" proxied="proxy">
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
<use>
<flag name="enchant">Use the <pkg>app-text/enchant</pkg> spell-checking backend instead of <pkg>app-text/hunspell</pkg></flag>
<flag name="fonts">Use builtin patched copy of open-sans fonts (overrides fontconfig)</flag>
<flag name="qt6">Build with Qt6 support</flag>
<flag name="qt6-imageformats">Add support for HEIF, AVIF and JpegXL by bundling kde-frameworks/kimageformats</flag>
</use>
<upstream>
<remote-id type="github">telegramdesktop/tdesktop</remote-id>
<bugs-to>https://github.com/telegramdesktop/tdesktop/issues</bugs-to>
<changelog>https://github.com/telegramdesktop/tdesktop/releases</changelog>
</upstream>
</pkgmetadata>

View file

@ -1,233 +0,0 @@
# Copyright 2020-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} )
inherit xdg cmake python-any-r1 optfeature flag-o-matic
DESCRIPTION="Official desktop client for Telegram"
HOMEPAGE="https://desktop.telegram.org"
MY_P="tdesktop-${PV}-full"
SRC_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v${PV}/${MY_P}.tar.gz"
S="${WORKDIR}/${MY_P}"
LICENSE="BSD GPL-3-with-openssl-exception LGPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~loong ~riscv"
IUSE="dbus enchant +fonts screencast qt6 qt6-imageformats wayland webkit +X"
REQUIRED_USE="
qt6-imageformats? ( qt6 )
"
KIMAGEFORMATS_RDEPEND="
media-libs/libavif:=
media-libs/libheif:=
>=media-libs/libjxl-0.8.0
"
CDEPEND="
!net-im/telegram-desktop-bin
app-arch/lz4:=
dev-cpp/abseil-cpp:=
>=dev-cpp/glibmm-2.77:2.68
dev-libs/glib:2
dev-libs/libdispatch
dev-libs/openssl:=
dev-libs/protobuf
dev-libs/xxhash
media-libs/libjpeg-turbo:=
~media-libs/libtgvoip-2.4.4_p20221208
media-libs/openal
media-libs/opus
media-libs/rnnoise
~media-libs/tg_owt-0_pre20230921:=[screencast=,X=]
media-video/ffmpeg:=[opus,vpx]
sys-libs/zlib:=[minizip]
virtual/opengl
!enchant? ( >=app-text/hunspell-1.7:= )
enchant? ( app-text/enchant:= )
!qt6? (
>=dev-qt/qtcore-5.15:5=
>=dev-qt/qtgui-5.15:5=[dbus?,jpeg,png,wayland?,X?]
>=dev-qt/qtimageformats-5.15:5
>=dev-qt/qtnetwork-5.15:5[ssl]
>=dev-qt/qtsvg-5.15:5
>=dev-qt/qtwidgets-5.15:5[png,X?]
kde-frameworks/kcoreaddons:5
webkit? (
>=dev-qt/qtdeclarative-5.15:5
>=dev-qt/qtwayland-5.15:5
)
)
qt6? (
>=dev-qt/qtbase-6.5:6=[dbus?,gui,network,opengl,wayland?,widgets,X?]
>=dev-qt/qtimageformats-6.5:6
>=dev-qt/qtsvg-6.5:6
webkit? (
>=dev-qt/qtdeclarative-6.5:6
>=dev-qt/qtwayland-6.5:6[compositor]
)
qt6-imageformats? (
>=dev-qt/qtimageformats-6.5:6=
${KIMAGEFORMATS_RDEPEND}
)
)
X? (
x11-libs/libxcb:=
x11-libs/xcb-util-keysyms
)
"
RDEPEND="${CDEPEND}
webkit? ( net-libs/webkit-gtk:4.1 net-libs/webkit-gtk:6 )
"
DEPEND="${CDEPEND}
>dev-cpp/cppgir-0_p20230926
>=dev-cpp/ms-gsl-4
dev-cpp/range-v3
"
BDEPEND="
${PYTHON_DEPS}
>dev-cpp/cppgir-0_p20230926
>=dev-build/cmake-3.16
dev-util/gdbus-codegen
virtual/pkgconfig
wayland? ( dev-util/wayland-scanner )
"
PATCHES=(
# "${FILESDIR}/tdesktop-4.10.0-system-cppgir.patch"
"${FILESDIR}/tdesktop-4.10.5-qt_compare.patch"
)
pkg_pretend() {
if has ccache ${FEATURES}; then
ewarn "ccache does not work with ${PN} out of the box"
ewarn "due to usage of precompiled headers"
ewarn "check bug https://bugs.gentoo.org/715114 for more info"
ewarn
fi
}
src_prepare() {
# Bundle kde-frameworks/kimageformats for qt6, since it's impossible to
# build in gentoo right now.
if use qt6-imageformats; then
sed -e 's/DESKTOP_APP_USE_PACKAGED_LAZY/TRUE/' -i \
cmake/external/kimageformats/CMakeLists.txt || die
printf '%s\n' \
'Q_IMPORT_PLUGIN(QAVIFPlugin)' \
'Q_IMPORT_PLUGIN(HEIFPlugin)' \
'Q_IMPORT_PLUGIN(QJpegXLPlugin)' \
>> cmake/external/qt/qt_static_plugins/qt_static_plugins.cpp || die
fi
# kde-frameworks/kcoreaddons is bundled when using qt6.
# Happily fail if libraries aren't found...
find -type f \( -name 'CMakeLists.txt' -o -name '*.cmake' \) \
\! -path './Telegram/lib_webview/CMakeLists.txt' \
\! -path './cmake/external/expected/CMakeLists.txt' \
\! -path './cmake/external/kcoreaddons/CMakeLists.txt' \
\! -path './cmake/external/qt/package.cmake' \
-print0 | xargs -0 sed -i \
-e '/pkg_check_modules(/s/[^ ]*)/REQUIRED &/' \
-e '/find_package(/s/)/ REQUIRED)/' || die
# Make sure to check the excluded files for new
# CMAKE_DISABLE_FIND_PACKAGE entries.
# Control QtDBus dependency from here, to avoid messing with QtGui.
if ! use dbus; then
sed -e '/find_package(Qt[^ ]* OPTIONAL_COMPONENTS/s/DBus *//' \
-i cmake/external/qt/package.cmake || die
fi
cmake_src_prepare
}
src_configure() {
# Having user paths sneak into the build environment through the
# XDG_DATA_DIRS variable causes all sorts of weirdness with cppgir:
# - bug 909038: can't read from flatpak directories (fixed upstream)
# - bug 920819: system-wide directories ignored when variable is set
export XDG_DATA_DIRS="${EPREFIX}/usr/share"
# Evil flag (bug #919201)
filter-flags -fno-delete-null-pointer-checks
# The ABI of media-libs/tg_owt breaks if the -DNDEBUG flag doesn't keep
# the same state across both projects.
# See https://bugs.gentoo.org/866055
append-cppflags '-DNDEBUG'
local qt=$(usex qt6 6 5)
local mycmakeargs=(
-DQT_VERSION_MAJOR=${qt}
# Control automagic dependencies on certain packages
## Header-only lib, some git version.
-DCMAKE_DISABLE_FIND_PACKAGE_tl-expected=ON
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}Quick=$(usex !webkit)
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}QuickWidgets=$(usex !webkit)
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}WaylandClient=$(usex !wayland)
## Only used in Telegram/lib_webview/CMakeLists.txt
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}WaylandCompositor=$(usex !webkit)
## KF6CoreAddons is currently unavailable in ::gentoo
-DCMAKE_DISABLE_FIND_PACKAGE_KF${qt}CoreAddons=$(usex qt6)
-DDESKTOP_APP_DISABLE_X11_INTEGRATION=$(usex !X)
-DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION=$(usex !wayland)
## Enables enchant and disables hunspell
-DDESKTOP_APP_USE_ENCHANT=$(usex enchant)
## Use system fonts instead of bundled ones
-DDESKTOP_APP_USE_PACKAGED_FONTS=$(usex !fonts)
)
if [[ -n ${MY_TDESKTOP_API_ID} && -n ${MY_TDESKTOP_API_HASH} ]]; then
einfo "Found custom API credentials"
mycmakeargs+=(
-DTDESKTOP_API_ID="${MY_TDESKTOP_API_ID}"
-DTDESKTOP_API_HASH="${MY_TDESKTOP_API_HASH}"
)
else
# https://github.com/telegramdesktop/tdesktop/blob/dev/snap/snapcraft.yaml
# Building with snapcraft API credentials by default
# Custom API credentials can be obtained here:
# https://github.com/telegramdesktop/tdesktop/blob/dev/docs/api_credentials.md
# After getting credentials you can export variables:
# export MY_TDESKTOP_API_ID="17349""
# export MY_TDESKTOP_API_HASH="344583e45741c457fe1862106095a5eb"
# and restart the build"
# you can set above variables (without export) in /etc/portage/env/net-im/telegram-desktop
# portage will use custom variable every build automatically
mycmakeargs+=(
-DTDESKTOP_API_ID="611335"
-DTDESKTOP_API_HASH="d524b414d21f4d37f08684c1df41ac9c"
)
fi
cmake_src_configure
}
pkg_postinst() {
xdg_pkg_postinst
if ! use X && ! use screencast; then
ewarn "both the 'X' and 'screencast' USE flags are disabled, screen sharing won't work!"
ewarn
fi
if use wayland && ! use qt6; then
ewarn "Wayland-specific integrations have been deprecated with Qt5."
ewarn "The app will continue to function under wayland, but some"
ewarn "functionality may be reduced."
ewarn "These integrations are only supported when built with Qt6."
ewarn
fi
if use qt6 && ! use qt6-imageformats; then
elog "Enable USE=qt6-imageformats for AVIF, HEIF and JpegXL support"
elog
fi
optfeature_header
if ! use qt6; then
optfeature "AVIF, HEIF and JpegXL image support" kde-frameworks/kimageformats[avif,heif,jpegxl]
fi
}

View file

@ -1,233 +0,0 @@
# Copyright 2020-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} )
inherit xdg cmake python-any-r1 optfeature flag-o-matic
DESCRIPTION="Official desktop client for Telegram"
HOMEPAGE="https://desktop.telegram.org"
MY_P="tdesktop-${PV}-full"
SRC_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v${PV}/${MY_P}.tar.gz"
S="${WORKDIR}/${MY_P}"
LICENSE="BSD GPL-3-with-openssl-exception LGPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~loong ~riscv"
IUSE="dbus enchant +fonts screencast qt6 qt6-imageformats wayland webkit +X"
REQUIRED_USE="
qt6-imageformats? ( qt6 )
"
KIMAGEFORMATS_RDEPEND="
media-libs/libavif:=
media-libs/libheif:=
>=media-libs/libjxl-0.8.0
"
CDEPEND="
!net-im/telegram-desktop-bin
app-arch/lz4:=
dev-cpp/abseil-cpp:=
>=dev-cpp/glibmm-2.77:2.68
dev-libs/glib:2
dev-libs/libdispatch
dev-libs/openssl:=
dev-libs/protobuf
dev-libs/xxhash
media-libs/libjpeg-turbo:=
~media-libs/libtgvoip-2.4.4_p20221208
media-libs/openal
media-libs/opus
media-libs/rnnoise
~media-libs/tg_owt-0_pre20230921:=[screencast=,X=]
media-video/ffmpeg:=[opus,vpx]
sys-libs/zlib:=[minizip]
virtual/opengl
!enchant? ( >=app-text/hunspell-1.7:= )
enchant? ( app-text/enchant:= )
!qt6? (
>=dev-qt/qtcore-5.15:5=
>=dev-qt/qtgui-5.15:5=[dbus?,jpeg,png,wayland?,X?]
>=dev-qt/qtimageformats-5.15:5
>=dev-qt/qtnetwork-5.15:5[ssl]
>=dev-qt/qtsvg-5.15:5
>=dev-qt/qtwidgets-5.15:5[png,X?]
kde-frameworks/kcoreaddons:5
webkit? (
>=dev-qt/qtdeclarative-5.15:5
>=dev-qt/qtwayland-5.15:5
)
)
qt6? (
>=dev-qt/qtbase-6.5:6=[dbus?,gui,network,opengl,wayland?,widgets,X?]
>=dev-qt/qtimageformats-6.5:6
>=dev-qt/qtsvg-6.5:6
webkit? (
>=dev-qt/qtdeclarative-6.5:6
>=dev-qt/qtwayland-6.5:6[compositor]
)
qt6-imageformats? (
>=dev-qt/qtimageformats-6.5:6=
${KIMAGEFORMATS_RDEPEND}
)
)
X? (
x11-libs/libxcb:=
x11-libs/xcb-util-keysyms
)
"
RDEPEND="${CDEPEND}
webkit? ( net-libs/webkit-gtk:4.1 net-libs/webkit-gtk:6 )
"
DEPEND="${CDEPEND}
>dev-cpp/cppgir-0_p20230926
>=dev-cpp/ms-gsl-4
dev-cpp/range-v3
"
BDEPEND="
${PYTHON_DEPS}
>dev-cpp/cppgir-0_p20230926
>=dev-build/cmake-3.16
dev-util/gdbus-codegen
virtual/pkgconfig
wayland? ( dev-util/wayland-scanner )
"
PATCHES=(
# "${FILESDIR}/tdesktop-4.10.0-system-cppgir.patch"
"${FILESDIR}/tdesktop-4.10.5-qt_compare.patch"
)
pkg_pretend() {
if has ccache ${FEATURES}; then
ewarn "ccache does not work with ${PN} out of the box"
ewarn "due to usage of precompiled headers"
ewarn "check bug https://bugs.gentoo.org/715114 for more info"
ewarn
fi
}
src_prepare() {
# Bundle kde-frameworks/kimageformats for qt6, since it's impossible to
# build in gentoo right now.
if use qt6-imageformats; then
sed -e 's/DESKTOP_APP_USE_PACKAGED_LAZY/TRUE/' -i \
cmake/external/kimageformats/CMakeLists.txt || die
printf '%s\n' \
'Q_IMPORT_PLUGIN(QAVIFPlugin)' \
'Q_IMPORT_PLUGIN(HEIFPlugin)' \
'Q_IMPORT_PLUGIN(QJpegXLPlugin)' \
>> cmake/external/qt/qt_static_plugins/qt_static_plugins.cpp || die
fi
# kde-frameworks/kcoreaddons is bundled when using qt6.
# Happily fail if libraries aren't found...
find -type f \( -name 'CMakeLists.txt' -o -name '*.cmake' \) \
\! -path './Telegram/lib_webview/CMakeLists.txt' \
\! -path './cmake/external/expected/CMakeLists.txt' \
\! -path './cmake/external/kcoreaddons/CMakeLists.txt' \
\! -path './cmake/external/qt/package.cmake' \
-print0 | xargs -0 sed -i \
-e '/pkg_check_modules(/s/[^ ]*)/REQUIRED &/' \
-e '/find_package(/s/)/ REQUIRED)/' || die
# Make sure to check the excluded files for new
# CMAKE_DISABLE_FIND_PACKAGE entries.
# Control QtDBus dependency from here, to avoid messing with QtGui.
if ! use dbus; then
sed -e '/find_package(Qt[^ ]* OPTIONAL_COMPONENTS/s/DBus *//' \
-i cmake/external/qt/package.cmake || die
fi
cmake_src_prepare
}
src_configure() {
# Having user paths sneak into the build environment through the
# XDG_DATA_DIRS variable causes all sorts of weirdness with cppgir:
# - bug 909038: can't read from flatpak directories (fixed upstream)
# - bug 920819: system-wide directories ignored when variable is set
export XDG_DATA_DIRS="${EPREFIX}/usr/share"
# Evil flag (bug #919201)
filter-flags -fno-delete-null-pointer-checks
# The ABI of media-libs/tg_owt breaks if the -DNDEBUG flag doesn't keep
# the same state across both projects.
# See https://bugs.gentoo.org/866055
append-cppflags '-DNDEBUG'
local qt=$(usex qt6 6 5)
local mycmakeargs=(
-DQT_VERSION_MAJOR=${qt}
# Control automagic dependencies on certain packages
## Header-only lib, some git version.
-DCMAKE_DISABLE_FIND_PACKAGE_tl-expected=ON
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}Quick=$(usex !webkit)
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}QuickWidgets=$(usex !webkit)
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}WaylandClient=$(usex !wayland)
## Only used in Telegram/lib_webview/CMakeLists.txt
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}WaylandCompositor=$(usex !webkit)
## KF6CoreAddons is currently unavailable in ::gentoo
-DCMAKE_DISABLE_FIND_PACKAGE_KF${qt}CoreAddons=$(usex qt6)
-DDESKTOP_APP_DISABLE_X11_INTEGRATION=$(usex !X)
-DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION=$(usex !wayland)
## Enables enchant and disables hunspell
-DDESKTOP_APP_USE_ENCHANT=$(usex enchant)
## Use system fonts instead of bundled ones
-DDESKTOP_APP_USE_PACKAGED_FONTS=$(usex !fonts)
)
if [[ -n ${MY_TDESKTOP_API_ID} && -n ${MY_TDESKTOP_API_HASH} ]]; then
einfo "Found custom API credentials"
mycmakeargs+=(
-DTDESKTOP_API_ID="${MY_TDESKTOP_API_ID}"
-DTDESKTOP_API_HASH="${MY_TDESKTOP_API_HASH}"
)
else
# https://github.com/telegramdesktop/tdesktop/blob/dev/snap/snapcraft.yaml
# Building with snapcraft API credentials by default
# Custom API credentials can be obtained here:
# https://github.com/telegramdesktop/tdesktop/blob/dev/docs/api_credentials.md
# After getting credentials you can export variables:
# export MY_TDESKTOP_API_ID="17349""
# export MY_TDESKTOP_API_HASH="344583e45741c457fe1862106095a5eb"
# and restart the build"
# you can set above variables (without export) in /etc/portage/env/net-im/telegram-desktop
# portage will use custom variable every build automatically
mycmakeargs+=(
-DTDESKTOP_API_ID="611335"
-DTDESKTOP_API_HASH="d524b414d21f4d37f08684c1df41ac9c"
)
fi
cmake_src_configure
}
pkg_postinst() {
xdg_pkg_postinst
if ! use X && ! use screencast; then
ewarn "both the 'X' and 'screencast' USE flags are disabled, screen sharing won't work!"
ewarn
fi
if use wayland && ! use qt6; then
ewarn "Wayland-specific integrations have been deprecated with Qt5."
ewarn "The app will continue to function under wayland, but some"
ewarn "functionality may be reduced."
ewarn "These integrations are only supported when built with Qt6."
ewarn
fi
if use qt6 && ! use qt6-imageformats; then
elog "Enable USE=qt6-imageformats for AVIF, HEIF and JpegXL support"
elog
fi
optfeature_header
if ! use qt6; then
optfeature "AVIF, HEIF and JpegXL image support" kde-frameworks/kimageformats[avif,heif,jpegxl]
fi
}

View file

@ -1,233 +0,0 @@
# Copyright 2020-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} )
inherit xdg cmake python-any-r1 optfeature flag-o-matic
DESCRIPTION="Official desktop client for Telegram"
HOMEPAGE="https://desktop.telegram.org"
MY_P="tdesktop-${PV}-full"
SRC_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v${PV}/${MY_P}.tar.gz"
S="${WORKDIR}/${MY_P}"
LICENSE="BSD GPL-3-with-openssl-exception LGPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~loong ~riscv"
IUSE="dbus enchant +fonts screencast qt6 qt6-imageformats wayland webkit +X"
REQUIRED_USE="
qt6-imageformats? ( qt6 )
"
KIMAGEFORMATS_RDEPEND="
media-libs/libavif:=
media-libs/libheif:=
>=media-libs/libjxl-0.8.0
"
CDEPEND="
!net-im/telegram-desktop-bin
app-arch/lz4:=
dev-cpp/abseil-cpp:=
>=dev-cpp/glibmm-2.77:2.68
dev-libs/glib:2
dev-libs/libdispatch
dev-libs/openssl:=
dev-libs/protobuf
dev-libs/xxhash
media-libs/libjpeg-turbo:=
~media-libs/libtgvoip-2.4.4_p20221208
media-libs/openal
media-libs/opus
media-libs/rnnoise
~media-libs/tg_owt-0_pre20230921:=[screencast=,X=]
media-video/ffmpeg:=[opus,vpx]
sys-libs/zlib:=[minizip]
virtual/opengl
!enchant? ( >=app-text/hunspell-1.7:= )
enchant? ( app-text/enchant:= )
!qt6? (
>=dev-qt/qtcore-5.15:5=
>=dev-qt/qtgui-5.15:5=[dbus?,jpeg,png,wayland?,X?]
>=dev-qt/qtimageformats-5.15:5
>=dev-qt/qtnetwork-5.15:5[ssl]
>=dev-qt/qtsvg-5.15:5
>=dev-qt/qtwidgets-5.15:5[png,X?]
kde-frameworks/kcoreaddons:5
webkit? (
>=dev-qt/qtdeclarative-5.15:5
>=dev-qt/qtwayland-5.15:5
)
)
qt6? (
>=dev-qt/qtbase-6.5:6=[dbus?,gui,network,opengl,wayland?,widgets,X?]
>=dev-qt/qtimageformats-6.5:6
>=dev-qt/qtsvg-6.5:6
webkit? (
>=dev-qt/qtdeclarative-6.5:6
>=dev-qt/qtwayland-6.5:6[compositor]
)
qt6-imageformats? (
>=dev-qt/qtimageformats-6.5:6=
${KIMAGEFORMATS_RDEPEND}
)
)
X? (
x11-libs/libxcb:=
x11-libs/xcb-util-keysyms
)
"
RDEPEND="${CDEPEND}
webkit? ( net-libs/webkit-gtk:4.1 net-libs/webkit-gtk:6 )
"
DEPEND="${CDEPEND}
>dev-cpp/cppgir-0_p20230926
>=dev-cpp/ms-gsl-4
dev-cpp/range-v3
"
BDEPEND="
${PYTHON_DEPS}
>dev-cpp/cppgir-0_p20230926
>=dev-build/cmake-3.16
dev-util/gdbus-codegen
virtual/pkgconfig
wayland? ( dev-util/wayland-scanner )
"
PATCHES=(
# "${FILESDIR}/tdesktop-4.10.0-system-cppgir.patch"
"${FILESDIR}/tdesktop-4.10.5-qt_compare.patch"
)
pkg_pretend() {
if has ccache ${FEATURES}; then
ewarn "ccache does not work with ${PN} out of the box"
ewarn "due to usage of precompiled headers"
ewarn "check bug https://bugs.gentoo.org/715114 for more info"
ewarn
fi
}
src_prepare() {
# Bundle kde-frameworks/kimageformats for qt6, since it's impossible to
# build in gentoo right now.
if use qt6-imageformats; then
sed -e 's/DESKTOP_APP_USE_PACKAGED_LAZY/TRUE/' -i \
cmake/external/kimageformats/CMakeLists.txt || die
printf '%s\n' \
'Q_IMPORT_PLUGIN(QAVIFPlugin)' \
'Q_IMPORT_PLUGIN(HEIFPlugin)' \
'Q_IMPORT_PLUGIN(QJpegXLPlugin)' \
>> cmake/external/qt/qt_static_plugins/qt_static_plugins.cpp || die
fi
# kde-frameworks/kcoreaddons is bundled when using qt6.
# Happily fail if libraries aren't found...
find -type f \( -name 'CMakeLists.txt' -o -name '*.cmake' \) \
\! -path './Telegram/lib_webview/CMakeLists.txt' \
\! -path './cmake/external/expected/CMakeLists.txt' \
\! -path './cmake/external/kcoreaddons/CMakeLists.txt' \
\! -path './cmake/external/qt/package.cmake' \
-print0 | xargs -0 sed -i \
-e '/pkg_check_modules(/s/[^ ]*)/REQUIRED &/' \
-e '/find_package(/s/)/ REQUIRED)/' || die
# Make sure to check the excluded files for new
# CMAKE_DISABLE_FIND_PACKAGE entries.
# Control QtDBus dependency from here, to avoid messing with QtGui.
if ! use dbus; then
sed -e '/find_package(Qt[^ ]* OPTIONAL_COMPONENTS/s/DBus *//' \
-i cmake/external/qt/package.cmake || die
fi
cmake_src_prepare
}
src_configure() {
# Having user paths sneak into the build environment through the
# XDG_DATA_DIRS variable causes all sorts of weirdness with cppgir:
# - bug 909038: can't read from flatpak directories (fixed upstream)
# - bug 920819: system-wide directories ignored when variable is set
export XDG_DATA_DIRS="${EPREFIX}/usr/share"
# Evil flag (bug #919201)
filter-flags -fno-delete-null-pointer-checks
# The ABI of media-libs/tg_owt breaks if the -DNDEBUG flag doesn't keep
# the same state across both projects.
# See https://bugs.gentoo.org/866055
append-cppflags '-DNDEBUG'
local qt=$(usex qt6 6 5)
local mycmakeargs=(
-DQT_VERSION_MAJOR=${qt}
# Control automagic dependencies on certain packages
## Header-only lib, some git version.
-DCMAKE_DISABLE_FIND_PACKAGE_tl-expected=ON
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}Quick=$(usex !webkit)
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}QuickWidgets=$(usex !webkit)
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}WaylandClient=$(usex !wayland)
## Only used in Telegram/lib_webview/CMakeLists.txt
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}WaylandCompositor=$(usex !webkit)
## KF6CoreAddons is currently unavailable in ::gentoo
-DCMAKE_DISABLE_FIND_PACKAGE_KF${qt}CoreAddons=$(usex qt6)
-DDESKTOP_APP_DISABLE_X11_INTEGRATION=$(usex !X)
-DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION=$(usex !wayland)
## Enables enchant and disables hunspell
-DDESKTOP_APP_USE_ENCHANT=$(usex enchant)
## Use system fonts instead of bundled ones
-DDESKTOP_APP_USE_PACKAGED_FONTS=$(usex !fonts)
)
if [[ -n ${MY_TDESKTOP_API_ID} && -n ${MY_TDESKTOP_API_HASH} ]]; then
einfo "Found custom API credentials"
mycmakeargs+=(
-DTDESKTOP_API_ID="${MY_TDESKTOP_API_ID}"
-DTDESKTOP_API_HASH="${MY_TDESKTOP_API_HASH}"
)
else
# https://github.com/telegramdesktop/tdesktop/blob/dev/snap/snapcraft.yaml
# Building with snapcraft API credentials by default
# Custom API credentials can be obtained here:
# https://github.com/telegramdesktop/tdesktop/blob/dev/docs/api_credentials.md
# After getting credentials you can export variables:
# export MY_TDESKTOP_API_ID="17349""
# export MY_TDESKTOP_API_HASH="344583e45741c457fe1862106095a5eb"
# and restart the build"
# you can set above variables (without export) in /etc/portage/env/net-im/telegram-desktop
# portage will use custom variable every build automatically
mycmakeargs+=(
-DTDESKTOP_API_ID="611335"
-DTDESKTOP_API_HASH="d524b414d21f4d37f08684c1df41ac9c"
)
fi
cmake_src_configure
}
pkg_postinst() {
xdg_pkg_postinst
if ! use X && ! use screencast; then
ewarn "both the 'X' and 'screencast' USE flags are disabled, screen sharing won't work!"
ewarn
fi
if use wayland && ! use qt6; then
ewarn "Wayland-specific integrations have been deprecated with Qt5."
ewarn "The app will continue to function under wayland, but some"
ewarn "functionality may be reduced."
ewarn "These integrations are only supported when built with Qt6."
ewarn
fi
if use qt6 && ! use qt6-imageformats; then
elog "Enable USE=qt6-imageformats for AVIF, HEIF and JpegXL support"
elog
fi
optfeature_header
if ! use qt6; then
optfeature "AVIF, HEIF and JpegXL image support" kde-frameworks/kimageformats[avif,heif,jpegxl]
fi
}

View file

@ -1,336 +0,0 @@
# Copyright 2020-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} )
inherit xdg cmake python-any-r1 optfeature flag-o-matic
DESCRIPTION="Official desktop client for Telegram"
HOMEPAGE="https://desktop.telegram.org"
MY_P="tdesktop-${PV}-full"
SRC_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v${PV}/${MY_P}.tar.gz"
S="${WORKDIR}/${MY_P}"
LICENSE="BSD GPL-3-with-openssl-exception LGPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~loong ~ppc64 ~riscv"
IUSE="
dbus
enchant +hunspell
+fonts +jemalloc lto debug
+pipewire pulseaudio screencast
+system-libtgvoip +system-libyuv
qt6 qt6-imageformats
wayland webkit +X
"
REQUIRED_USE="
^^ ( enchant hunspell )
qt6-imageformats? ( qt6 )
"
KIMAGEFORMATS_RDEPEND="
media-libs/libavif:=
media-libs/libheif:=
media-libs/libjxl
"
CDEPEND="
!net-im/telegram-desktop-bin
app-arch/lz4:=
dev-cpp/abseil-cpp:=
>=dev-cpp/glibmm-2.77:2.68
>=dev-libs/glib-2.77:2
>=dev-libs/gobject-introspection-1.77
dev-libs/libdispatch
dev-libs/openssl:=
dev-libs/protobuf
dev-libs/xxhash
media-libs/libjpeg-turbo:=
system-libtgvoip? ( >media-libs/libtgvoip-2.4.4:=[pulseaudio(-)=,pipewire(-)=] )
media-libs/openal:=[pipewire=]
media-libs/opus:=
media-libs/rnnoise:=
media-video/ffmpeg:=[opus,vpx]
sys-libs/zlib:=[minizip]
virtual/opengl
enchant? ( app-text/enchant:= )
hunspell? ( >=app-text/hunspell-1.7:= )
jemalloc? ( dev-libs/jemalloc:=[-lazy-lock] )
!qt6? (
>=dev-qt/qtcore-5.15:5=
>=dev-qt/qtgui-5.15:5=[dbus?,jpeg,png,wayland?,X?]
>=dev-qt/qtimageformats-5.15:5=
>=dev-qt/qtnetwork-5.15:5=[ssl]
>=dev-qt/qtsvg-5.15:5=
>=dev-qt/qtwidgets-5.15:5=[png,X?]
kde-frameworks/kcoreaddons:=
wayland? (
dev-qt/qtwayland:5=
)
webkit? (
>=dev-qt/qtdeclarative-5.15:5=
>=dev-qt/qtwayland-5.15:5=
)
dev-qt/qtdbus:5=
dev-libs/libdbusmenu-qt[qt5(+)]
)
qt6? (
>=dev-qt/qtbase-6.5:6=[dbus?,gui,network,opengl,wayland?,widgets,X?]
>=dev-qt/qtimageformats-6.5:6=
>=dev-qt/qtsvg-6.5:6=
wayland? ( >=dev-qt/qtwayland-6.5:6=[compositor] )
webkit? (
>=dev-qt/qtdeclarative-6.5:6
>=dev-qt/qtwayland-6.5:6[compositor]
)
qt6-imageformats? (
>=dev-qt/qtimageformats-6.5:6=
${KIMAGEFORMATS_RDEPEND}
)
)
X? (
x11-libs/libxcb:=
x11-libs/xcb-util-keysyms
)
dev-libs/boost:=
dev-libs/libsigc++:2
dev-libs/libfmt:=
!fonts? ( media-fonts/open-sans )
media-libs/fontconfig:=
system-libyuv? ( media-libs/libyuv:= )
pulseaudio? (
!pipewire? ( media-sound/pulseaudio-daemon )
)
pipewire? (
media-video/pipewire[sound-server(+)]
!media-sound/pulseaudio-daemon
)
>=media-libs/tg_owt-0_pre20230401:=[pipewire(-)=,screencast=,X=]
wayland? (
kde-plasma/kwayland:=
dev-libs/wayland-protocols:=
dev-libs/plasma-wayland-protocols:=
)
"
RDEPEND="
${CDEPEND}
webkit? ( net-libs/webkit-gtk:= )
"
DEPEND="
${CDEPEND}
>=dev-cpp/range-v3-0.10.0:=
"
# >=dev-cpp/cppgir-0_p20240110
# >=dev-cpp/ms-gsl-4
# dev-cpp/expected-lite
BDEPEND="
${PYTHON_DEPS}
dev-util/gdbus-codegen
virtual/pkgconfig
"
# >=dev-build/cmake-3.16
# >=dev-cpp/cppgir-0_p20230926
# wayland? ( dev-util/wayland-scanner )
PATCHES=(
"${FILESDIR}/tdesktop-4.10.0-system-cppgir.patch"
"${FILESDIR}/tdesktop-4.10.5-qt_compare.patch"
)
pkg_pretend() {
if has ccache ${FEATURES}; then
ewarn "ccache does not work with ${PN} out of the box"
ewarn "due to usage of precompiled headers"
ewarn "check bug https://bugs.gentoo.org/715114 for more info"
ewarn
fi
}
src_prepare() {
# Bundle kde-frameworks/kimageformats for qt6, since it's impossible to
# build in gentoo right now.
if use qt6-imageformats; then
sed -e 's/DESKTOP_APP_USE_PACKAGED_LAZY/TRUE/' -i \
cmake/external/kimageformats/CMakeLists.txt || die
printf '%s\n' \
'Q_IMPORT_PLUGIN(QAVIFPlugin)' \
'Q_IMPORT_PLUGIN(HEIFPlugin)' \
'Q_IMPORT_PLUGIN(QJpegXLPlugin)' \
>> cmake/external/qt/qt_static_plugins/qt_static_plugins.cpp || die
fi
# kde-frameworks/kcoreaddons is bundled when using qt6.
# Happily fail if libraries aren't found...
find -type f \( -name 'CMakeLists.txt' -o -name '*.cmake' \) \
\! -path './Telegram/lib_webview/CMakeLists.txt' \
\! -path './cmake/external/expected/CMakeLists.txt' \
\! -path './cmake/external/kcoreaddons/CMakeLists.txt' \
\! -path './cmake/external/qt/package.cmake' \
-print0 | xargs -0 sed -i \
-e '/pkg_check_modules(/s/[^ ]*)/REQUIRED &/' \
-e '/find_package(/s/)/ REQUIRED)/' || die
# Make sure to check the excluded files for new
# CMAKE_DISABLE_FIND_PACKAGE entries.
# Control QtDBus dependency from here, to avoid messing with QtGui.
if ! use dbus; then
sed -e '/find_package(Qt[^ ]* OPTIONAL_COMPONENTS/s/DBus *//' \
-i cmake/external/qt/package.cmake || die
fi
if use system-libyuv; then
sed -e 's/"third_party\/libyuv\/include\/libyuv.h"/<libyuv.h>/' \
-i Telegram/ThirdParty/tgcalls/tgcalls/desktop_capturer/DesktopCaptureSourceHelper.cpp \
-i Telegram/ThirdParty/tgcalls/tgcalls/desktop_capturer/DesktopCaptureSourceManager.cpp || die
fi
cmake_src_prepare
}
src_configure() {
# Having user paths sneak into the build environment through the
# XDG_DATA_DIRS variable causes all sorts of weirdness with cppgir:
# - bug 909038: can't read from flatpak directories (fixed upstream)
# - bug 920819: system-wide directories ignored when variable is set
export XDG_DATA_DIRS="${EPREFIX}/usr/share"
# Evil flag (bug #919201)
filter-flags -fno-delete-null-pointer-checks
# The ABI of media-libs/tg_owt breaks if the -DNDEBUG flag doesn't keep
# the same state across both projects.
# See https://bugs.gentoo.org/866055
append-cppflags '-DNDEBUG'
# is this even needed?
if use system-libyuv; then
# append-cppflags '-lyuv' # what do you mean "unused" ?
append-ldflags $(test-flag-CCLD '-Wl,--copy-dt-needed-entries')
fi
sed -i \
-e '/-W.*/d' \
-e '/PIC/a-Wno-error\n-Wno-all' \
-e "$(usex debug '' 's@-g[a-zA-Z0-9]*@@')" \
-e "$(usex lto '' 's@-flto@@')" \
-e "s@-Ofast@@" \
cmake/options_linux.cmake || die
# use lto && (
# append-flags '-flto'
# append-ldflags '-flto'
# )
local mycxxflags=(
${CXXFLAGS}
-Wno-error=deprecated-declarations
-Wno-deprecated-declarations
-Wno-switch
-DLIBDIR="$(get_libdir)"
-DTDESKTOP_DISABLE_AUTOUPDATE
)
local qt=$(usex qt6 6 5)
local mycmakeargs=(
-DQT_VERSION_MAJOR=${qt}
# Override new cmake.eclass defaults (https://bugs.gentoo.org/921939)
# Upstream never tests this any other way
-DCMAKE_DISABLE_PRECOMPILE_HEADERS=OFF
# Control automagic dependencies on certain packages
## Header-only lib, some git version.
-DCMAKE_DISABLE_FIND_PACKAGE_tl-expected=ON
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}Quick=$(usex !webkit)
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}QuickWidgets=$(usex !webkit)
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}WaylandClient=$(usex !wayland)
## Only used in Telegram/lib_webview/CMakeLists.txt
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}WaylandCompositor=$(usex !webkit)
## KF6CoreAddons is currently unavailable in ::gentoo
-DCMAKE_DISABLE_FIND_PACKAGE_KF${qt}CoreAddons=$(usex qt6)
-DCMAKE_CXX_FLAGS:="${mycxxflags[*]}"
# Upstream does not need crash reports from custom builds anyway
-DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON
-DDESKTOP_APP_USE_ENCHANT=$(usex enchant) # enables enchant and disables hunspell
# Unbundling:
-DDESKTOP_APP_USE_PACKAGED=ON # Main
-DDESKTOP_APP_DISABLE_JEMALLOC=$(usex !jemalloc)
-DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION="$(usex !wayland)"
-DDESKTOP_APP_DISABLE_X11_INTEGRATION=$(usex !X)
$(usex lto "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON" '')
-DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION=$(usex !wayland)
## Enables enchant and disables hunspell
-DDESKTOP_APP_USE_ENCHANT=$(usex enchant)
## Use system fonts instead of bundled ones
-DDESKTOP_APP_USE_PACKAGED_FONTS=$(usex !fonts)
# -DDESKTOP_APP_LOTTIE_USE_CACHE=NO
# # in case of caching bugs. Maybe also useful with system-rlottie[cache]. TODO: test that idea.
)
if [[ -n ${MY_TDESKTOP_API_ID} && -n ${MY_TDESKTOP_API_HASH} ]]; then
einfo "Found custom API credentials"
mycmakeargs+=(
-DTDESKTOP_API_ID="${MY_TDESKTOP_API_ID}"
-DTDESKTOP_API_HASH="${MY_TDESKTOP_API_HASH}"
)
else
# https://github.com/telegramdesktop/tdesktop/blob/dev/snap/snapcraft.yaml
# Building with snapcraft API credentials by default
# Custom API credentials can be obtained here:
# https://github.com/telegramdesktop/tdesktop/blob/dev/docs/api_credentials.md
# After getting credentials you can export variables:
# export MY_TDESKTOP_API_ID="17349""
# export MY_TDESKTOP_API_HASH="344583e45741c457fe1862106095a5eb"
# and restart the build"
# you can set above variables (without export) in /etc/portage/env/net-im/telegram-desktop
# portage will use custom variable every build automatically
mycmakeargs+=(
-DTDESKTOP_API_ID="611335"
-DTDESKTOP_API_HASH="d524b414d21f4d37f08684c1df41ac9c"
)
fi
cmake_src_configure
}
pkg_preinst() {
xdg_pkg_preinst
}
pkg_postinst() {
xdg_pkg_postinst
if ! use X && ! use screencast; then
ewarn "both the 'X' and 'screencast' USE flags are disabled, screen sharing won't work!"
ewarn
fi
if use wayland && ! use qt6; then
ewarn "Wayland-specific integrations have been deprecated with Qt5."
ewarn "The app will continue to function under wayland, but some"
ewarn "functionality may be reduced."
ewarn "These integrations are only supported when built with Qt6."
ewarn
fi
if use qt6 && ! use qt6-imageformats; then
elog "Enable USE=qt6-imageformats for AVIF, HEIF and JpegXL support"
elog
fi
optfeature_header
if ! use qt6; then
optfeature "AVIF, HEIF and JpegXL image support" kde-frameworks/kimageformats[avif,heif,jpegxl]
fi
}
pkg_postrm() {
xdg_pkg_postrm
}

View file

@ -1,421 +0,0 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit xdg cmake optfeature flag-o-matic
inherit git-r3
# ^ TODO: conditional (only for 9999)? maybe port to tarballs before moving to gentoo repo.
#inherit patches
# ^ TODO: drop before moving to gentoo repo, and port to manual selection
DESCRIPTION="Official desktop client for Telegram"
HOMEPAGE="https://desktop.telegram.org"
EGIT_REPO_URI="https://github.com/telegramdesktop/tdesktop.git"
EGIT_SUBMODULES=(
'*'
-Telegram/ThirdParty/{xxHash,Catch,lz4,libdbusmenu-qt,fcitx{5,}-qt{,5},hime,hunspell,nimf,qt5ct,range-v3,jemalloc,dispatch}
#,plasma-wayland-protocols,wayland-protocols,kimageformats,kcoreaddons}
)
if [[ "${PV}" == 9999 ]]; then
EGIT_BRANCH="dev"
else
# TODO: tarballs
EGIT_COMMIT="v${PV}"
KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
# ~arm # blocked by dispatch in gentoo-repo
# ~mipsel # blocked by all :(
fi
LICENSE="GPL-3-with-openssl-exception"
SLOT="0"
#IUSE="custom-api-id debug enchant +hunspell +jemalloc lto pipewire pulseaudio qt6 qt6-imageformats +screencast system-gsl +system-expected +system-libtgvoip system-rlottie test +wayland +X"
IUSE="custom-api-id dbus debug enchant +fonts +hunspell +jemalloc lto pipewire pulseaudio qt6 qt6-imageformats +screencast +system-libtgvoip test +wayland +webkit +X"
REQUIRED_USE="
^^ ( enchant hunspell )
qt6-imageformats? ( qt6 )
"
MYPATCHES=(
"hide-banned"
"hide-sponsored-messages"
"wide-baloons"
"chat-ids"
"increase-limits"
"ignore-restrictions"
)
USE_EXPAND_VALUES_TDESKTOP_PATCHES="${MYPATCHES[@]}"
for p in ${MYPATCHES[@]}; do
IUSE="${IUSE} tdesktop_patches_${p}"
done
KIMAGEFORMATS_RDEPEND="
media-libs/libavif:=
media-libs/libheif:=
media-libs/libjxl
"
# kde-frameworks/kimageformats
# kde-frameworks/kcoreaddons
COMMON_DEPEND="
!net-im/telegram-desktop-bin
app-arch/lz4:=
dev-cpp/abseil-cpp:=
>=dev-cpp/glibmm-2.77:2.68
>=dev-libs/glib-2.77:2
>=dev-libs/gobject-introspection-1.77
dev-libs/libdispatch
dev-libs/openssl:=
dev-libs/protobuf
dev-libs/xxhash
media-libs/libjpeg-turbo:=
system-libtgvoip? ( >media-libs/libtgvoip-2.4.4:=[pulseaudio(-)=,pipewire(-)=] )
media-libs/openal:=[pipewire=]
media-libs/opus:=
media-libs/rnnoise:=
media-video/ffmpeg:=[opus,vpx]
sys-libs/zlib:=[minizip]
virtual/opengl
enchant? ( app-text/enchant:= )
hunspell? ( >=app-text/hunspell-1.7:= )
jemalloc? ( dev-libs/jemalloc:=[-lazy-lock] )
!qt6? (
>=dev-qt/qtcore-5.15:5=
>=dev-qt/qtgui-5.15:5=[dbus,jpeg,png,wayland?,X?]
>=dev-qt/qtimageformats-5.15:5=
>=dev-qt/qtnetwork-5.15:5=[ssl]
>=dev-qt/qtsvg-5.15:5=
>=dev-qt/qtwidgets-5.15:5=[png,X?]
kde-frameworks/kcoreaddons:=
wayland? (
dev-qt/qtwayland:5=
)
webkit? (
>=dev-qt/qtdeclarative-5.15:5=
>=dev-qt/qtwayland-5.15:5=
)
dev-qt/qtdbus:5=
dev-libs/libdbusmenu-qt[qt5(+)]
)
qt6? (
>=dev-qt/qtbase-6.5:6=[dbus,gui,network,opengl,wayland?,widgets,X?]
>=dev-qt/qtimageformats-6.5:6=
>=dev-qt/qtsvg-6.5:6=
wayland? ( >=dev-qt/qtwayland-6.5:6=[compositor] )
webkit? (
>=dev-qt/qtdeclarative-6.5:6
>=dev-qt/qtwayland-6.5:6[compositor]
)
qt6-imageformats? (
>=dev-qt/qtimageformats-6.5:6=
${KIMAGEFORMATS_RDEPEND}
)
)
X? (
x11-libs/libxcb:=
x11-libs/xcb-util-keysyms
)
dev-libs/boost:=
dev-libs/libsigc++:2
dev-libs/libfmt:=
!fonts? ( media-fonts/open-sans )
media-libs/fontconfig:=
media-libs/libyuv:=
pulseaudio? (
!pipewire? ( media-sound/pulseaudio-daemon )
)
pipewire? (
media-video/pipewire[sound-server(+)]
!media-sound/pulseaudio-daemon
)
media-libs/libyuv:=
>=media-libs/tg_owt-0_pre20230401:=[pipewire(-)=,screencast=,X=]
wayland? (
kde-plasma/kwayland:=
dev-libs/wayland-protocols:=
dev-libs/plasma-wayland-protocols:=
)
"
RDEPEND="
${COMMON_DEPEND}
webkit? ( net-libs/webkit-gtk:= )
"
DEPEND="
${COMMON_DEPEND}
>=dev-cpp/range-v3-0.10.0:=
"
# system-gsl? ( >dev-cpp/ms-gsl-2.0.0:= )
# ^ TG upstream uses patched bundled version.
# >=dev-cpp/cppgir-0_p20230926
# ^ WFM even without it 🤷
BDEPEND="
>=dev-util/gdbus-codegen-2.77
virtual/pkgconfig
amd64? ( dev-lang/yasm )
"
# system-rlottie? ( >=media-libs/rlottie-0_pre20190818:=[threads(-),-cache(-)] )
# ^ TG upstream uses patched bundled version.
# system-expected? ( >dev-cpp/tl-expected-1.0.0:= )
# ^ TG upstream uses patched bundled version.
RESTRICT="!test? ( test )"
PATCHES=(
"${FILESDIR}/tdesktop-4.10.0-system-cppgir.patch"
"${FILESDIR}/tdesktop-4.10.5-qt_compare.patch"
)
pkg_pretend() {
for p in ${MYPATCHES[@]}; do
if use "tdesktop_patches_${p}"; then
tdesktop_patches_warn=1
fi
done
if [[ -n "${tdesktop_patches_warn}" ]]; then
ewarn "!!!!!!!!!!!!!!!!!!!!!!!!!"
ewarn "!!!!!!!! WARNNING !!!!!!!"
ewarn "!!!!!!!!!!!!!!!!!!!!!!!!!"
ewarn "You have enabled some custom patches!"
ewarn "Some of them can violate TOS of Telegram and can (but non necessary will) lead to ban of your account on TG main network."
ewarn "Please, be careful."
einfo "Also, note that none of that patches have any chance to be ported to ${PN} ebuild in Gentoo repo"
fi
if ! use wayland || ! use qt6; then
ewarn ""
ewarn "Keep in mind that embedded webview (based on webkit), may not work in runtime."
ewarn "Upstream has reworked it in sych way that it only guaranteed to work under Wayland+Qt6"
ewarn ""
fi
if use custom-api-id; then
if [[ -n "${TELEGRAM_CUSTOM_API_ID}" ]] && [[ -n "${TELEGRAM_CUSTOM_API_HASH}" ]]; then
einfo ""
einfo "${P} was built with your custom ApiId and ApiHash"
einfo ""
else
eerror ""
eerror "It seems you did not set one or both of TELEGRAM_CUSTOM_API_ID and TELEGRAM_CUSTOM_API_HASH variables,"
eerror "which are required for custom-api-id USE-flag."
eerror "You can set them either in:"
eerror "- /etc/portage/make.conf (globally, so all applications you'll build will see that ID and HASH"
eerror "- /etc/portage/env/${CATEGORY}/${PN} (privately for this package builds)"
eerror ""
die "You should correctly set both TELEGRAM_CUSTOM_API_ID and TELEGRAM_CUSTOM_API_HASH variables"
fi
fi
# if use system-rlottie; then
# eerror ""
# eerror "Currently, ${PN} is totally incompatible with Samsung's rlottie, and uses custom bundled fork."
# eerror "Build will definitelly fail. You've been warned!"
# eerror "Even if you have custom patches to make it build, there is another issue:"
# ewarn ""
# ewarn "Unfortunately, ${PN} uses custom modifications over rlottie"
# ewarn "(which aren't accepted by upstream, since they made it another way)."
# ewarn "This leads to following facts:"
# ewarn " - Colors replacement maps are not working when you link against system rlottie package."
# ewarn " That means, for example, that 'giant animated emojis' will ignore skin-tone colors"
# ewarn " and will always be yellow"
# ewarn " Ref: https://github.com/Samsung/rlottie/pull/252"
# ewarn " - Crashes on some stickerpacks"
# ewarn " Probably related to: https://github.com/Samsung/rlottie/pull/262"
# ewarn ""
# fi
}
src_unpack() {
# Temporary (?) broken (has a bug in std::variant), and fixed in bundled version.
# use system-gsl && EGIT_SUBMODULES+=(-Telegram/ThirdParty/GSL)
# # XXX: maybe de-unbundle those? Anyway, they're header-only libraries...
# # Moreover, upstream recommends to use bundled versions to avoid artefacts 🤷
# use system-expected && EGIT_SUBMODULES+=(-Telegram/ThirdParty/expected)
use system-libtgvoip && EGIT_SUBMODULES+=(-Telegram/ThirdParty/libtgvoip)
# use system-rlottie && EGIT_SUBMODULES+=(-Telegram/{lib_rlottie,ThirdParty/rlottie})
# ^ Ref: https://bugs.gentoo.org/752417
git-r3_src_unpack
}
src_prepare() {
# use system-rlottie || (
# # Ref: https://bugs.gentoo.org/752417
# sed -i \
# -e 's/DESKTOP_APP_USE_PACKAGED/0/' \
# cmake/external/rlottie/CMakeLists.txt || die
# )
sed -i \
-e '/-W.*/d' \
-e '/PIC/a-Wno-error\n-Wno-all' \
-e "$(usex debug '' 's@-g[a-zA-Z0-9]*@@')" \
-e "$(usex lto '' 's@-flto@@')" \
-e "s@-Ofast@@" \
cmake/options_linux.cmake || die
# echo > cmake/options_linux.cmake
# ^ Maybe just wipe it out instead of trying to fix?
# ^ There are not so mush useful compiler flags, actually.
# Bundle kde-frameworks/kimageformats for qt6, since it's impossible to
# build in gentoo right now.
if use qt6-imageformats; then
sed -e 's/DESKTOP_APP_USE_PACKAGED_LAZY/TRUE/' -i \
cmake/external/kimageformats/CMakeLists.txt || die
printf "%s\n" \
'Q_IMPORT_PLUGIN(QAVIFPlugin)' \
'Q_IMPORT_PLUGIN(HEIFPlugin)' \
'Q_IMPORT_PLUGIN(QJpegXLPlugin)' \
>> cmake/external/qt/qt_static_plugins/qt_static_plugins.cpp || die
fi
# kde-frameworks/kcoreaddons is bundled when using qt6, see:
# cmake/external/kcoreaddons/CMakeLists.txt
# Happily fail if libraries aren't found...
find -type f \( -name 'CMakeLists.txt' -o -name '*.cmake' \) \
\! -path "./cmake/external/expected/CMakeLists.txt" \
\! -path './cmake/external/qt/package.cmake' \
\! -path './Telegram/lib_webview/CMakeLists.txt' \
-print0 | xargs -0 sed -i \
-e '/pkg_check_modules(/s/[^ ]*)/REQUIRED &/' \
-e '/find_package(/s/)/ REQUIRED)/' || die
# Make sure to check the excluded files for new
# CMAKE_DISABLE_FIND_PACKAGE entries.
# Control QtDBus dependency from here, to avoid messing with QtGui.
if ! use dbus; then
sed -e '/find_package(Qt[^ ]* OPTIONAL_COMPONENTS/s/DBus *//' \
-i cmake/external/qt/package.cmake || die
fi
# patches_src_prepare
cmake_src_prepare
# ^ to be used when will be ported to gentoo repo
}
src_configure() {
filter-flags '-DDEBUG' # produces bugs in bundled forks of 3party code
append-cppflags '-DNDEBUG' # Telegram sets that in code
# (and I also forced that here and in libtgvoip ebuild to have the same behaviour),
# and segfaults on voice calls on mismatch
# (if tg was built with it, and deps are built without it, and vice versa)
use lto && (
append-flags '-flto'
append-ldflags '-flto'
)
local mycxxflags=(
${CXXFLAGS}
-Wno-error=deprecated-declarations
-Wno-deprecated-declarations
-Wno-switch
-DLIBDIR="$(get_libdir)"
-DTDESKTOP_DISABLE_AUTOUPDATE
)
local qt=$(usex qt6 6 5)
local mycmakeargs=(
# -DCMAKE_DISABLE_FIND_PACKAGE_tl-expected=$(usex !system-expected)
# ^ header only lib, some git version. prevents warnings.
-DQT_VERSION_MAJOR=${qt}
# Control automagic dependencies on certain packages
## Header-only lib, some git version.
-DCMAKE_DISABLE_FIND_PACKAGE_tl-expected=ON
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}Quick=$(usex !webkit)
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}QuickWidgets=$(usex !webkit)
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}WaylandClient=$(usex !wayland)
## Only used in Telegram/lib_webview/CMakeLists.txt
-DCMAKE_DISABLE_FIND_PACKAGE_Qt${qt}WaylandCompositor=$(usex !webkit)
-DCMAKE_CXX_FLAGS:="${mycxxflags[*]}"
# Upstream does not need crash reports from custom builds anyway
-DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON
-DDESKTOP_APP_USE_ENCHANT=$(usex enchant) # enables enchant and disables hunspell
# Unbundling:
-DDESKTOP_APP_USE_PACKAGED=ON # Main
-DDESKTOP_APP_DISABLE_JEMALLOC=$(usex !jemalloc)
-DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION="$(usex !wayland)"
-DDESKTOP_APP_DISABLE_X11_INTEGRATION=$(usex !X)
$(usex lto "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON" '')
-DTDESKTOP_API_TEST=$(usex test)
## Use system fonts instead of bundled ones
-DDESKTOP_APP_USE_PACKAGED_FONTS=$(usex !fonts)
# Snapcraft (snap, flatpack, whatever) API keys:
# As of my discussion with John Preston, he specifically asked TG servers owners to never ban snap's keys:
# TODO: (!!!!!!!) Ask Gentoo Council (or whatever) to get "official" Gentoo keys.
-DTDESKTOP_API_ID=$(usex custom-api-id "${TELEGRAM_CUSTOM_API_ID}" "611335")
-DTDESKTOP_API_HASH=$(usex custom-api-id "${TELEGRAM_CUSTOM_API_HASH}" "d524b414d21f4d37f08684c1df41ac9c")
# -DDESKTOP_APP_LOTTIE_USE_CACHE=NO
# # in case of caching bugs. Maybe also useful with system-rlottie[cache]. TODO: test that idea.
)
cmake_src_configure
}
pkg_preinst() {
xdg_pkg_preinst
}
pkg_postinst() {
xdg_pkg_postinst
if ! use X && ! use screencast; then
ewarn "both the 'X' and 'screencast' USE flags are disabled, screen sharing won't work!"
ewarn
fi
if has_version '<dev-qt/qtcore-5.15.2-r10'; then
ewarn "Versions of dev-qt/qtcore lower than 5.15.2-r10 might cause telegram"
ewarn "to crash when pasting big images from the clipboard."
ewarn
fi
if ! use jemalloc && use elibc_glibc; then
# https://github.com/telegramdesktop/tdesktop/issues/16084
# https://github.com/desktop-app/cmake_helpers/pull/91#issuecomment-881788003
ewarn "Disabling USE=jemalloc on glibc systems may cause very high RAM usage!"
ewarn "Do NOT report issues about RAM usage without enabling this flag first."
ewarn
fi
if use qt6; then
ewarn "Qt6 support in gentoo is experimental."
ewarn "Please report any issues you may find, but don't expect"
ewarn "everything to work correctly as of yet."
ewarn
fi
if use wayland && ! use qt6; then
ewarn "Wayland-specific integrations have been deprecated with Qt5."
ewarn "The app will continue to function under wayland, but some"
ewarn "functionality may be reduced."
ewarn "These integrations are only supported when built with Qt6."
ewarn
fi
if use qt6 && ! use qt6-imageformats; then
elog "Enable USE=qt6-imageformats for AVIF, HEIF and JpegXL support"
elog
fi
optfeature_header
if ! use qt6; then
optfeature "AVIF, HEIF and JpegXL image support" kde-frameworks/kimageformats[avif,heif,jpegxl]
fi
}
pkg_postrm() {
xdg_pkg_postrm
}

View file

@ -1,376 +0,0 @@
# Copyright 2020-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{9..11} )
inherit xdg cmake python-any-r1 optfeature flag-o-matic toolchain-funcs
DESCRIPTION="Official desktop client for Telegram"
HOMEPAGE="https://desktop.telegram.org"
if [[ ${PV} == 9999 ]]
then
inherit git-r3
EGIT_BRANCH="dev"
EGIT_REPO_URI="https://github.com/telegramdesktop/tdesktop.git"
EGIT_SUBMODULES=(
'*'
'-Telegram/ThirdParty/hunspell'
'-Telegram/ThirdParty/jemalloc'
'-Telegram/ThirdParty/libdbusmenu-qt'
'-Telegram/ThirdParty/lz4'
)
KEYWORDS=""
else
MY_PN="tdesktop"
MY_P="${MY_PN}-${PV}-full"
ABSEIL_VER="20220623.1"
CRC32C_VER="1.1.2"
QTBASE_VER="5.15.2"
LIBYUV_COMMIT="00950840d1c9bcbb3eb6ebc5aac5793e71166c8b"
TG_OWT_COMMIT="5098730b9eb6173f0b52068fe2555b7c1015123a"
SRC_URI="
https://github.com/telegramdesktop/${MY_PN}/releases/download/v${PV}/${MY_P}.tar.gz
https://github.com/abseil/abseil-cpp/archive/refs/tags/${ABSEIL_VER}.tar.gz -> abseil-cpp-${ABSEIL_VER}.tar.gz
https://github.com/google/crc32c/archive/refs/tags/${CRC32C_VER}.tar.gz -> crc32c-${CRC32C_VER}.tar.gz
https://download.qt.io/official_releases/qt/${QTBASE_VER%.*}/${QTBASE_VER}/submodules/qtbase-everywhere-src-${QTBASE_VER}.tar.xz
https://gitlab.com/chromiumsrc/libyuv/-/archive/${LIBYUV_COMMIT}/libyuv-${LIBYUV_COMMIT}.tar.gz -> libyuv-${LIBYUV_COMMIT::7}.tar.gz
https://github.com/desktop-app/tg_owt/archive/${TG_OWT_COMMIT}.tar.gz -> tg_owt-${TG_OWT_COMMIT::7}.tar.gz
"
KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv"
S="${WORKDIR}/${MY_P}"
fi
LICENSE="BSD GPL-3-with-openssl-exception LGPL-2+"
SLOT="0"
IUSE="+dbus enchant +fonts +hunspell +lto wayland +X"
# alsa crashreporter custom-api-id
REQUIRED_USE="
enchant? ( !hunspell )
"
RDEPEND="
!net-im/telegram-desktop-bin
app-arch/lz4:=
dbus? ( dev-cpp/glibmm:2.68 )
>=dev-cpp/abseil-cpp-20220623.1:=
dev-libs/crc32c
dev-libs/glib:2
dev-libs/jemalloc:=[-lazy-lock]
dev-libs/libevent:=
dev-libs/openssl:=
dev-libs/protobuf:=
>=dev-qt/qtcore-5.15:5
>=dev-qt/qtgui-5.15:5[dbus?,jpeg,png,wayland?,X?]
>=dev-qt/qtimageformats-5.15:5
>=dev-qt/qtnetwork-5.15:5[ssl]
>=dev-qt/qtsvg-5.15:5
>=dev-qt/qtwidgets-5.15:5[png,X?]
enchant? ( app-text/enchant:= )
hunspell? ( >=app-text/hunspell-1.7:= )
kde-frameworks/kcoreaddons:=
media-fonts/open-sans
media-libs/fontconfig:=
media-libs/libjpeg-turbo:=
>=media-libs/libvpx-1.10.0:=
media-libs/openal
media-libs/openh264:=
media-libs/opus:=
media-libs/rnnoise
media-sound/pulseaudio
media-video/ffmpeg:=[opus]
media-video/pipewire:=
net-libs/usrsctp
sys-libs/zlib:=[minizip]
X? (
x11-libs/libX11
x11-libs/libXcomposite
x11-libs/libXdamage
x11-libs/libXext
x11-libs/libXfixes
x11-libs/libXrender
x11-libs/libXrandr
x11-libs/libXtst
x11-libs/libxcb:=
)
"
# alsa? ( media-libs/alsa-lib )
# crashreporter? ( dev-util/google-breakpad )
DEPEND="${RDEPEND}"
BDEPEND="
${PYTHON_DEPS}
>=dev-util/cmake-3.16
virtual/pkgconfig
"
PATCHES=(
"${FILESDIR}/tdesktop-4.3.4-qt5-incompatibility-2.patch"
"${FILESDIR}/tdesktop-4.4.1-fix-dupe-main-decl.patch"
)
TG_OWT_PATCHES=(
"${FILESDIR}/tg_owt-0_pre20220209-gcc-12-cstddef.patch"
"${FILESDIR}/tg_owt-0_pre20220209-gcc-12-cstdint.patch"
)
# Current desktop-file-utils-0.26 does not understand Version=1.5
QA_DESKTOP_FILE="usr/share/applications/${PN}.desktop"
QTBASE_DIR="${WORKDIR}"/Libraries/qtbase
TG_OWT_DIR="${WORKDIR}"/Libraries/tg_owt
pkg_pretend() {
# if use custom-api-id
# then
# [[ -n "${TDESKTOP_API_ID}" ]] && \
# [[ -n "${TDESKTOP_API_HASH}" ]] && (
# einfo "Will be used custom 'api_id' and 'api_hash':"
# einfo "TDESKTOP_API_ID=${TDESKTOP_API_ID}"
# einfo "TDESKTOP_API_HASH=${TDESKTOP_API_HASH//[!\*]/*}"
# ) || (
# eerror "It seems you did not set one or both of"
# eerror "TDESKTOP_API_ID and TDESKTOP_API_HASH variables,"
# eerror "which are required for custom-api-id USE-flag."
# eerror "You can set them either in your env or bashrc."
# die
# )
#
# echo ${TDESKTOP_API_ID} | grep -q "^[0-9]\+$" || (
# eerror "Please check your TDESKTOP_API_ID variable"
# eerror "It should consist of decimal numbers only"
# die
# )
#
# echo ${TDESKTOP_API_HASH} | grep -q "^[0-9A-Fa-f]\{32\}$" || (
# eerror "Please check your TDESKTOP_API_HASH variable"
# eerror "It should consist of 32 hex numbers only"
# die
# )
# fi
if tc-is-gcc && [[ $(gcc-major-version) -lt 7 ]]
then
die "At least gcc 7.0 is required"
fi
}
git_unpack() {
git-r3_src_unpack
unset EGIT_BRANCH
unset EGIT_SUBMODULES
EGIT_COMMIT_DATE=$(GIT_DIR="${S}/.git" git show -s --format=%ct || die)
EGIT_REPO_URI="https://code.qt.io/qt/qtbase.git"
EGIT_CHECKOUT_DIR="${QTBASE_DIR}"
git-r3_src_unpack
EGIT_REPO_URI="https://github.com/desktop-app/tg_owt.git"
EGIT_CHECKOUT_DIR="${TG_OWT_DIR}"
git-r3_src_unpack
}
src_unpack() {
if [[ ${PV} == 9999 ]]
then
git_unpack
return
fi
unpack "${MY_P}.tar.gz"
local commit=$(
cat "${MY_P}"/Telegram/build/docker/centos_env/Dockerfile \
| sed '/^RUN.*git.*init.*tg_owt/,/git.*fetch/!d' \
| tail -n1 | sed 's/.*\([0-9a-zA-Z]\{40\}\).*/\1/'
)
if [[ "${commit}" != "${TG_OWT_COMMIT}" ]]
then
die "You should update \${TG_OWT_COMMIT} to ${commit}"
fi
mkdir Libraries || die
cd Libraries || die
unpack "qtbase-everywhere-src-${QTBASE_VER}.tar.xz"
mv "qtbase-everywhere-src-${QTBASE_VER}" "qtbase" || die
unpack "tg_owt-${TG_OWT_COMMIT::7}.tar.gz"
mv "tg_owt-${TG_OWT_COMMIT}" "tg_owt" || die
cd "tg_owt/src/third_party" || die
unpack "abseil-cpp-${ABSEIL_VER}.tar.gz"
rmdir "abseil-cpp" || die
mv "abseil-cpp-${ABSEIL_VER}" "abseil-cpp" || die
unpack "crc32c-${CRC32C_VER}.tar.gz"
rmdir "crc32c/src" || die
mv "crc32c-${CRC32C_VER}" "crc32c/src" || die
unpack "libyuv-${LIBYUV_COMMIT::7}.tar.gz"
rmdir "libyuv" || die
mv "libyuv-${LIBYUV_COMMIT}" "libyuv" || die
}
qt_prepare() {
local qt_src="${QTBASE_DIR}"/src
local qt_fun="${S}"/Telegram/lib_ui/ui/text/qtextitemint.cpp
echo "#include <QtGui/private/qtextengine_p.h>" > "${qt_fun}"
sed '/^QTextItemInt::QTextItemInt.*QGlyphLayout/,/^\}/!d' \
"${qt_src}"/gui/text/qtextengine.cpp >> "${qt_fun}"
sed '/^void.*QTextItemInt::initWithScriptItem.*QScriptItem/,/^\}/!d' \
"${qt_src}"/gui/text/qtextengine.cpp >> "${qt_fun}"
}
tg_owt_prepare() {
local PATCHES=( "${TG_OWT_PATCHES[@]}" )
pushd "${TG_OWT_DIR}" >/dev/null || die
sed -i -e '/include.*libopenh264/d' \
CMakeLists.txt || die
BUILD_DIR="${TG_OWT_DIR}/out" CMAKE_USE_DIR="${TG_OWT_DIR}" \
cmake_src_prepare
popd >/dev/null || die
}
src_prepare() {
qt_prepare
tg_owt_prepare
cp "${FILESDIR}"/breakpad.cmake \
cmake/external/crash_reports/breakpad/CMakeLists.txt || die
sed -i -e 's:DESKTOP_APP_USE_PACKAGED:False:' \
cmake/external/{expected,gsl,ranges,variant,xxhash}/CMakeLists.txt \
Telegram/cmake/lib_tgvoip.cmake || die
sed -i -e 's:find_package.*tg_owt:\0 PATHS ${libs_loc}/tg_owt/out:' \
cmake/external/webrtc/CMakeLists.txt || die
sed -i -e '/find_package/ s:Qt6::' \
cmake/external/qt/package.cmake || die
# TDESKTOP_API_{ID,HASH} related:
sed -i -e 's:if.*TDESKTOP_API_[A-Z]*.*:if(False):' \
Telegram/cmake/telegram_options.cmake || die
sed -i -e '/TDESKTOP_API_[A-Z]*/d' \
Telegram/CMakeLists.txt || die
# if use custom-api-id
# then
# local -A api_defs=(
# [ID]="#define TDESKTOP_API_ID ${TDESKTOP_API_ID}"
# [HASH]="#define TDESKTOP_API_HASH ${TDESKTOP_API_HASH}"
# )
# else
if true
then
local -A api_defs=(
[ID]=$(
cat snap/snapcraft.yaml \
| ( grep TDESKTOP_API_ID || die ) \
| sed 's:.*=\(.*\):#define TDESKTOP_API_ID \1:'
)
[HASH]=$(
cat snap/snapcraft.yaml \
| ( grep TDESKTOP_API_HASH || die ) \
| sed 's:.*=\(.*\):#define TDESKTOP_API_HASH \1:'
)
)
fi
sed -i \
-e "/#if.*defined.*TDESKTOP_API_ID/i ${api_defs[ID]}" \
-e "/#if.*defined.*TDESKTOP_API_HASH/i ${api_defs[HASH]}" \
Telegram/SourceFiles/config.h || die
cmake_src_prepare
}
tg_owt_configure() {
local mycmakeargs=(
-DBUILD_SHARED_LIBS=OFF
-DTG_OWT_BUILD_AUDIO_BACKENDS=OFF
-DTG_OWT_USE_PROTOBUF=ON
)
BUILD_DIR="${TG_OWT_DIR}/out" CMAKE_USE_DIR="${TG_OWT_DIR}" \
cmake_src_configure
}
src_configure() {
local mycxxflags=(
-Wno-array-bounds
-Wno-free-nonheap-object
-Wno-uninitialized
)
append-cxxflags ${mycxxflags[@]}
tg_owt_configure
local mycmakeargs=(
-DDESKTOP_APP_USE_PACKAGED=ON
-DDESKTOP_APP_USE_PACKAGED_RLOTTIE=OFF
-DLIBTGVOIP_DISABLE_PULSEAUDIO=OFF
# -DDESKTOP_APP_DISABLE_CRASH_REPORTS=$(usex !crashreporter)
-DDESKTOP_APP_DISABLE_DBUS_INTEGRATION=$(usex !dbus)
-DDESKTOP_APP_DISABLE_SPELLCHECK=$(usex !enchant $(usex !hunspell))
-DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION=$(usex !wayland)
-DDESKTOP_APP_DISABLE_X11_INTEGRATION=$(usex !X)
-DDESKTOP_APP_USE_ENCHANT=$(usex enchant)
-DDESKTOP_APP_USE_PACKAGED_FONTS=$(usex !fonts)
# -DLIBTGVOIP_DISABLE_ALSA=$(usex !alsa)
)
if use lto; then
mycmakeargs+=(
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
)
fi
cmake_src_configure
}
src_compile() {
BUILD_DIR="${TG_OWT_DIR}/out" CMAKE_USE_DIR="${TG_OWT_DIR}" \
cmake_src_compile
cmake_src_compile
}
pkg_postinst() {
xdg_pkg_postinst
if has_version '<dev-qt/qtcore-5.15.2-r10'; then
ewarn "Versions of dev-qt/qtcore lower than 5.15.2-r10 might cause telegram"
ewarn "to crash when pasting big images from the clipboard."
fi
optfeature_header
optfeature "shop payment support (requires USE=dbus enabled)" net-libs/webkit-gtk
}