From 3ec7fa2ad16116f2a25f5fd9231fa72a3f629ecc Mon Sep 17 00:00:00 2001 From: Georgy Yakovlev Date: Tue, 31 Mar 2020 05:03:02 -0700 Subject: net-im/telegram-desktop: bump to 2.0.1 Package-Manager: Portage-2.3.96, Repoman-2.3.22 Signed-off-by: Georgy Yakovlev --- net-im/telegram-desktop/Manifest | 2 +- net-im/telegram-desktop/files/2.0.0-fixes.patch | 410 --------------------- .../telegram-desktop/telegram-desktop-2.0.0.ebuild | 143 ------- .../telegram-desktop/telegram-desktop-2.0.1.ebuild | 143 +++++++ 4 files changed, 144 insertions(+), 554 deletions(-) delete mode 100644 net-im/telegram-desktop/files/2.0.0-fixes.patch delete mode 100644 net-im/telegram-desktop/telegram-desktop-2.0.0.ebuild create mode 100644 net-im/telegram-desktop/telegram-desktop-2.0.1.ebuild (limited to 'net-im/telegram-desktop') diff --git a/net-im/telegram-desktop/Manifest b/net-im/telegram-desktop/Manifest index e0809eb234ae..dddf94c4141e 100644 --- a/net-im/telegram-desktop/Manifest +++ b/net-im/telegram-desktop/Manifest @@ -1,3 +1,3 @@ DIST tdesktop-1.9.14-full.tar.gz 25324084 BLAKE2B 45c071aa573541b6e483d2ae712b7f3b672c1294e8e7e624d9292f7176482f4d68069c35541019dc27fdb1c66134c29fb4d3667f1197e7085e4f8a80c8ca603c SHA512 56efa64048d23b280782b51319c0071c6cef833cb7e2584e52c6e45488577755beb85185ec9187029c425cc8d4c9c1887142687c744697e7731a15abe2846056 DIST tdesktop-1.9.21-full.tar.gz 25848026 BLAKE2B 503e22bcc83a64721aa4c4c6e8bca89c4c976703c338b1615c5ab1599098e98cbd220a94cffdbe24d9c305b44ffef7719ad1c2d2ad81f4ec6edc8377e1afa4ef SHA512 ea02fc69e88ed6244ed420516bb7a93827cb85efaa0a7e9af7562aa1bc29184c5a2102caca8693c976b25d374832e0deb2ccbf00144d5340b5ffacbdc9dcebf1 -DIST tdesktop-2.0.0-full.tar.gz 26106238 BLAKE2B 0634e66384b786cfaf6d3608bdf6f64985bc433a272d6eb86f4e787a9ee7e25dfaae89a6cb0a5aa2e73a2e1f3593a8a776d12457ab90f0a7c3ef6d0f254e254d SHA512 53ea3bb0e1d7cb1fc9d8c8725801295e89f8765b6560f046065dde89aef501d7ddb8aa268aa82f33e3674164a825506c4276cd07c0b59c242dd78ab59d659508 +DIST tdesktop-2.0.1-full.tar.gz 26106949 BLAKE2B 3975e7d42af8b323a86408e2301b292d94b308413bb92d135673fb12851cd6672156dcf9b631482fa9b8dc9361d9593dc1104c8c335e0c610706b308414db01b SHA512 99cd7c5ca1e9dd75ecd98d272522b0e4aab2d46525e3d0c306503b7a00c9d25c1646e9d7462182682a58947c7435864af805a3b6f85906d8b21e5675cc8383cb diff --git a/net-im/telegram-desktop/files/2.0.0-fixes.patch b/net-im/telegram-desktop/files/2.0.0-fixes.patch deleted file mode 100644 index 2040a9da6688..000000000000 --- a/net-im/telegram-desktop/files/2.0.0-fixes.patch +++ /dev/null @@ -1,410 +0,0 @@ -From 2f7563767dc7214ec3c9a4d0c4d4b50e62c5927f Mon Sep 17 00:00:00 2001 -From: John Preston -Date: Mon, 30 Mar 2020 21:04:49 +0400 -Subject: [PATCH 1/3] Fix crash in archive / pinned in folder management. - ---- - Telegram/SourceFiles/history/history.cpp | 16 ++++------------ - 1 file changed, 4 insertions(+), 12 deletions(-) - -diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp -index d1d0bcb43c..fa69e0a9de 100644 ---- a/Telegram/SourceFiles/history/history.cpp -+++ b/Telegram/SourceFiles/history/history.cpp -@@ -1948,12 +1948,6 @@ void History::setFolderPointer(Data::Folder *folder) { - const auto wasInList = inChatList(); - if (wasInList) { - removeFromChatList(0, owner().chatsList(this->folder())); -- for (const auto &filter : filters.list()) { -- const auto id = filter.id(); -- if (inChatList(id)) { -- removeFromChatList(id, filters.chatsList(id)); -- } -- } - } - const auto was = _folder.value_or(nullptr); - _folder = folder; -@@ -1962,12 +1956,10 @@ void History::setFolderPointer(Data::Folder *folder) { - } - if (wasInList) { - addToChatList(0, owner().chatsList(folder)); -- for (const auto &filter : filters.list()) { -- if (filter.contains(this)) { -- const auto id = filter.id(); -- addToChatList(id, filters.chatsList(id)); -- } -- } -+ -+ owner().chatsFilters().refreshHistory(this); -+ updateChatListEntry(); -+ - owner().chatsListChanged(was); - owner().chatsListChanged(folder); - } else if (!wasKnown) { - -From c2ff27793a56241135fde194256a2ebf7bc5ec90 Mon Sep 17 00:00:00 2001 -From: John Preston -Date: Mon, 30 Mar 2020 23:34:07 +0400 -Subject: [PATCH 2/3] Try to use Ctrl+1..Ctrl+8 for folders. - ---- - Telegram/SourceFiles/core/shortcuts.cpp | 78 ++++++++++++------- - Telegram/SourceFiles/core/shortcuts.h | 18 ++--- - .../dialogs/dialogs_inner_widget.cpp | 60 +++++++------- - 3 files changed, 86 insertions(+), 70 deletions(-) - -diff --git a/Telegram/SourceFiles/core/shortcuts.cpp b/Telegram/SourceFiles/core/shortcuts.cpp -index 76bc4bd0d3..f8c10e4ee8 100644 ---- a/Telegram/SourceFiles/core/shortcuts.cpp -+++ b/Telegram/SourceFiles/core/shortcuts.cpp -@@ -113,7 +113,7 @@ class Manager { - void fill(); - void clear(); - -- std::optional lookup(int shortcutId) const; -+ [[nodiscard]] std::vector lookup(int shortcutId) const; - void toggleMedia(bool toggled); - void toggleSupport(bool toggled); - -@@ -124,14 +124,14 @@ class Manager { - void writeDefaultFile(); - bool readCustomFile(); - -- void set(const QString &keys, Command command); -+ void set(const QString &keys, Command command, bool replace = false); - void remove(const QString &keys); - void unregister(base::unique_qptr shortcut); - - QStringList _errors; - - base::flat_map> _shortcuts; -- base::flat_map _commandByShortcutId; -+ base::flat_multi_map _commandByShortcutId; - - base::flat_set _mediaShortcuts; - base::flat_set _supportShortcuts; -@@ -206,11 +206,14 @@ const QStringList &Manager::errors() const { - return _errors; - } - --std::optional Manager::lookup(int shortcutId) const { -- const auto i = _commandByShortcutId.find(shortcutId); -- return (i != end(_commandByShortcutId)) -- ? base::make_optional(i->second) -- : std::nullopt; -+std::vector Manager::lookup(int shortcutId) const { -+ auto result = std::vector(); -+ auto i = _commandByShortcutId.findFirst(shortcutId); -+ const auto end = _commandByShortcutId.end(); -+ for (; i != end && (i->first == shortcutId); ++i) { -+ result.push_back(i->second); -+ } -+ return result; - } - - void Manager::toggleMedia(bool toggled) { -@@ -278,7 +281,7 @@ bool Manager::readCustomFile() { - const auto name = (*command).toString(); - const auto i = CommandByName.find(name); - if (i != end(CommandByName)) { -- set((*keys).toString(), i->second); -+ set((*keys).toString(), i->second, true); - } else { - LOG(("Shortcut Warning: " - "could not find shortcut command handler '%1'" -@@ -343,7 +346,7 @@ void Manager::fillDefaults() { - ranges::view::ints(1, ranges::unreachable)); - - for (const auto [command, index] : folders) { -- set(qsl("%1+shift+%2").arg(ctrl).arg(index > 9 ? 0 : index), command); -+ set(qsl("%1+%2").arg(ctrl).arg(index), command); - } - - set(qsl("%1+shift+down").arg(ctrl), Command::FolderNext); -@@ -373,10 +376,12 @@ void Manager::writeDefaultFile() { - shortcuts.push_back(version); - - for (const auto &[sequence, shortcut] : _shortcuts) { -- const auto i = _commandByShortcutId.find(shortcut->id()); -- if (i != end(_commandByShortcutId)) { -+ const auto shortcutId = shortcut->id(); -+ auto i = _commandByShortcutId.findFirst(shortcutId); -+ const auto end = _commandByShortcutId.end(); -+ for (; i != end && i->first == shortcutId; ++i) { - const auto j = CommandNames.find(i->second); -- if (j != end(CommandNames)) { -+ if (j != CommandNames.end()) { - QJsonObject entry; - entry.insert(qsl("keys"), sequence.toString().toLower()); - entry.insert(qsl("command"), j->second); -@@ -390,7 +395,7 @@ void Manager::writeDefaultFile() { - file.write(document.toJson(QJsonDocument::Indented)); - } - --void Manager::set(const QString &keys, Command command) { -+void Manager::set(const QString &keys, Command command, bool replace) { - if (keys.isEmpty()) { - return; - } -@@ -415,22 +420,25 @@ void Manager::set(const QString &keys, Command command) { - if (isMediaShortcut || isSupportShortcut) { - shortcut->setEnabled(false); - } -- const auto id = shortcut->id(); -- if (!id) { -- _errors.push_back(qsl("Could not create shortcut '%1'!").arg(keys)); -- return; -- } -+ auto id = shortcut->id(); - auto i = _shortcuts.find(result); - if (i == end(_shortcuts)) { - i = _shortcuts.emplace(result, std::move(shortcut)).first; -- } else { -+ } else if (replace) { - unregister(std::exchange(i->second, std::move(shortcut))); -+ } else { -+ shortcut = nullptr; -+ id = i->second->id(); -+ } -+ if (!id) { -+ _errors.push_back(qsl("Could not create shortcut '%1'!").arg(keys)); -+ return; - } - _commandByShortcutId.emplace(id, command); -- if (isMediaShortcut) { -+ if (shortcut && isMediaShortcut) { - _mediaShortcuts.emplace(i->second.get()); - } -- if (isSupportShortcut) { -+ if (shortcut && isSupportShortcut) { - _supportShortcuts.emplace(i->second.get()); - } - } -@@ -465,11 +473,13 @@ Manager Data; - - } // namespace - --Request::Request(Command command) : _command(command) { -+Request::Request(std::vector commands) -+: _commands(std::move(commands)) { - } - - bool Request::check(Command command, int priority) { -- if (_command == command && priority > _handlerPriority) { -+ if (ranges::contains(_commands, command) -+ && priority > _handlerPriority) { - _handlerPriority = priority; - return true; - } -@@ -481,12 +491,16 @@ bool Request::handle(FnMut handler) { - return true; - } - --FnMut RequestHandler(Command command) { -- auto request = Request(command); -+FnMut RequestHandler(std::vector commands) { -+ auto request = Request(std::move(commands)); - RequestsStream.fire(&request); - return std::move(request._handler); - } - -+FnMut RequestHandler(Command command) { -+ return RequestHandler(std::vector{ command }); -+} -+ - bool Launch(Command command) { - if (auto handler = RequestHandler(command)) { - return handler(); -@@ -494,6 +508,13 @@ bool Launch(Command command) { - return false; - } - -+bool Launch(std::vector commands) { -+ if (auto handler = RequestHandler(std::move(commands))) { -+ return handler(); -+ } -+ return false; -+} -+ - rpl::producer> Requests() { - return RequestsStream.events(); - } -@@ -509,10 +530,7 @@ const QStringList &Errors() { - } - - bool HandleEvent(not_null event) { -- if (const auto command = Data.lookup(event->shortcutId())) { -- return Launch(*command); -- } -- return false; -+ return Launch(Data.lookup(event->shortcutId())); - } - - void ToggleMediaShortcuts(bool toggled) { -diff --git a/Telegram/SourceFiles/core/shortcuts.h b/Telegram/SourceFiles/core/shortcuts.h -index fbce7c9ced..4bdf9bca44 100644 ---- a/Telegram/SourceFiles/core/shortcuts.h -+++ b/Telegram/SourceFiles/core/shortcuts.h -@@ -35,16 +35,14 @@ enum class Command { - ChatPinned4, - ChatPinned5, - -+ ShowAllChats, - ShowFolder1, - ShowFolder2, - ShowFolder3, - ShowFolder4, - ShowFolder5, - ShowFolder6, -- ShowFolder7, -- ShowFolder8, -- ShowFolder9, -- ShowFolder10, -+ ShowFolderLast, - - FolderNext, - FolderPrevious, -@@ -63,16 +61,14 @@ enum class Command { - }; - - constexpr auto kShowFolder = { -+ Command::ShowAllChats, - Command::ShowFolder1, - Command::ShowFolder2, - Command::ShowFolder3, - Command::ShowFolder4, - Command::ShowFolder5, - Command::ShowFolder6, -- Command::ShowFolder7, -- Command::ShowFolder8, -- Command::ShowFolder9, -- Command::ShowFolder10, -+ Command::ShowFolderLast, - }; - - [[nodiscard]] FnMut RequestHandler(Command command); -@@ -83,13 +79,13 @@ class Request { - bool handle(FnMut handler); - - private: -- explicit Request(Command command); -+ explicit Request(std::vector commands); - -- Command _command; -+ std::vector _commands; - int _handlerPriority = -1; - FnMut _handler; - -- friend FnMut RequestHandler(Command command); -+ friend FnMut RequestHandler(std::vector commands); - - }; - -diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp -index 6ad29fc53f..c1e30d385d 100644 ---- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp -+++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp -@@ -3008,6 +3008,27 @@ void InnerWidget::setupShortcuts() { - return false; - }); - -+ const auto filters = &session().data().chatsFilters().list(); -+ if (const auto filtersCount = int(filters->size())) { -+ auto &&folders = ranges::view::zip( -+ Shortcuts::kShowFolder, -+ ranges::view::ints(0, ranges::unreachable)); -+ -+ for (const auto [command, index] : folders) { -+ const auto select = (command == Command::ShowFolderLast) -+ ? filtersCount -+ : std::clamp(index, 0, filtersCount); -+ request->check(command) && request->handle([=] { -+ if (select <= filtersCount) { -+ _controller->setActiveChatsFilter((select > 0) -+ ? (*filters)[select - 1].id() -+ : 0); -+ } -+ return true; -+ }); -+ } -+ } -+ - static const auto kPinned = { - Command::ChatPinned1, - Command::ChatPinned2, -@@ -3036,42 +3057,23 @@ void InnerWidget::setupShortcuts() { - }); - } - -- auto &&folders = ranges::view::zip( -- Shortcuts::kShowFolder, -- ranges::view::ints(0, ranges::unreachable)); -- -- for (const auto [command, index] : folders) { -- request->check(command) && request->handle([=, index = index] { -- const auto list = &session().data().chatsFilters().list(); -- if (index >= list->size()) { -- return false; -- } -- const auto filterId = list->at(index).id(); -- _controller->setActiveChatsFilter((filterId == _filterId) -- ? 0 -- : filterId); -- return true; -- }); -- } -- - const auto nearFolder = [=](bool isNext) { - const auto id = _controller->activeChatsFilterCurrent(); - const auto list = &session().data().chatsFilters().list(); -- const auto it = (id == 0) -- ? begin(*list) - 1 -- : ranges::find(*list, id, &Data::ChatFilter::id); -- if (it == end(*list) && id != 0) { -+ const auto index = (id != 0) -+ ? int(ranges::find(*list, id, &Data::ChatFilter::id) -+ - begin(*list)) -+ : -1; -+ if (index == list->size() && id != 0) { - return false; - } -- const auto i = isNext ? 1 : -1; -- const auto index = it - begin(*list) + i; -- if (index >= (int)list->size() || index < -1) { -+ const auto changed = index + (isNext ? 1 : -1); -+ if (changed >= int(list->size()) || changed < -1) { - return false; - } -- const auto filterId = (index == -1) -- ? 0 -- : list->at(index).id(); -- _controller->setActiveChatsFilter(filterId); -+ _controller->setActiveChatsFilter((changed >= 0) -+ ? (*list)[changed].id() -+ : 0); - return true; - }; - - -From 9ef41062d316be092fbd07a4aef05eb076622556 Mon Sep 17 00:00:00 2001 -From: John Preston -Date: Mon, 30 Mar 2020 23:53:10 +0400 -Subject: [PATCH 3/3] Ignore whitespaces in dice sending. - ---- - Telegram/SourceFiles/api/api_sending.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Telegram/SourceFiles/api/api_sending.cpp b/Telegram/SourceFiles/api/api_sending.cpp -index d0c5315ac0..eaac3957e7 100644 ---- a/Telegram/SourceFiles/api/api_sending.cpp -+++ b/Telegram/SourceFiles/api/api_sending.cpp -@@ -200,7 +200,7 @@ void SendExistingPhoto( - - bool SendDice(Api::MessageToSend &message) { - static const auto kDiceString = QString::fromUtf8("\xF0\x9F\x8E\xB2"); -- if (message.textWithTags.text != kDiceString) { -+ if (message.textWithTags.text.midRef(0).trimmed() != kDiceString) { - return false; - } - const auto history = message.action.history; diff --git a/net-im/telegram-desktop/telegram-desktop-2.0.0.ebuild b/net-im/telegram-desktop/telegram-desktop-2.0.0.ebuild deleted file mode 100644 index d84a55c83c39..000000000000 --- a/net-im/telegram-desktop/telegram-desktop-2.0.0.ebuild +++ /dev/null @@ -1,143 +0,0 @@ -# Copyright 2020 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -PYTHON_COMPAT=( python3_{6,7} ) - -inherit cmake desktop flag-o-matic python-any-r1 xdg-utils - -MY_P="tdesktop-${PV}-full" - -DESCRIPTION="Official desktop client for Telegram" -HOMEPAGE="https://desktop.telegram.org" -SRC_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v${PV}/${MY_P}.tar.gz" - -LICENSE="GPL-3-with-openssl-exception" -SLOT="0" -KEYWORDS="~amd64 ~ppc64" -IUSE="+alsa +dbus enchant +hunspell libressl pulseaudio +spell" - -RDEPEND=" - !net-im/telegram-desktop-bin - app-arch/lz4:= - app-arch/xz-utils - !libressl? ( dev-libs/openssl:0= ) - libressl? ( dev-libs/libressl:0= ) - >=dev-cpp/ms-gsl-2.1.0 - dev-cpp/range-v3 - dev-libs/xxhash - dev-qt/qtcore:5 - dev-qt/qtimageformats:5 - dev-qt/qtnetwork:5 - dev-qt/qtsvg:5 - media-libs/fontconfig:= - >=media-libs/libtgvoip-2.4.4_p20200301[alsa?,pulseaudio?] - media-libs/openal[alsa?,pulseaudio?] - media-libs/opus:= - media-video/ffmpeg:=[opus] - sys-libs/zlib[minizip] - virtual/libiconv - x11-libs/libva:=[X,drm] - x11-libs/libX11 - || ( - dev-qt/qtgui:5[jpeg,png,X(-)] - dev-qt/qtgui:5[jpeg,png,xcb(-)] - ) - || ( - dev-qt/qtwidgets:5[png,X(-)] - dev-qt/qtwidgets:5[png,xcb(-)] - ) - dbus? ( - dev-qt/qtdbus:5 - dev-libs/libdbusmenu-qt[qt5(+)] - ) - enchant? ( app-text/enchant:= ) - hunspell? ( >=app-text/hunspell-1.7:= ) - pulseaudio? ( media-sound/pulseaudio ) -" - -DEPEND=" - ${PYTHON_DEPS} - ${RDEPEND} -" - -BDEPEND=" - >=dev-util/cmake-3.16 - virtual/pkgconfig -" - -REQUIRED_USE="|| ( alsa pulseaudio ) - spell? ( - ^^ ( enchant hunspell ) - ) -" - -S="${WORKDIR}/${MY_P}" - -PATCHES=( - "${FILESDIR}/2.0.0-fixes.patch" -) - -src_configure() { - local mycxxflags=( - -Wno-deprecated-declarations - -Wno-error=deprecated-declarations - -Wno-switch - ) - - append-cxxflags "${mycxxflags[@]}" - - # TODO: unbundle header-only libs, ofc telegram uses git versions... - # it fals with tl-expected-1.0.0, so we use bundled for now to avoid git rev snapshots - # EXPECTED VARIANT - local mycmakeargs=( - -DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON - -DDESKTOP_APP_USE_GLIBC_WRAPS=OFF - -DDESKTOP_APP_USE_PACKAGED=ON - -DDESKTOP_APP_USE_PACKAGED_EXPECTED=OFF - -DDESKTOP_APP_USE_PACKAGED_RLOTTIE=OFF - -DDESKTOP_APP_USE_PACKAGED_VARIANT=OFF - -DTDESKTOP_LAUNCHER_BASENAME="${PN}" - -DDESKTOP_APP_DISABLE_DBUS_INTEGRATION="$(usex dbus OFF ON)" - -DDESKTOP_APP_DISABLE_SPELLCHECK="$(usex spell OFF ON)" # enables hunspell - -DDESKTOP_APP_USE_ENCHANT="$(usex enchant ON OFF)" # enables enchant and disables hunspell - ) - - 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_desktop_database_update - xdg_icon_cache_update - xdg_mimeinfo_database_update -} - -pkg_postrm() { - xdg_desktop_database_update - xdg_icon_cache_update - xdg_mimeinfo_database_update -} diff --git a/net-im/telegram-desktop/telegram-desktop-2.0.1.ebuild b/net-im/telegram-desktop/telegram-desktop-2.0.1.ebuild new file mode 100644 index 000000000000..d84a55c83c39 --- /dev/null +++ b/net-im/telegram-desktop/telegram-desktop-2.0.1.ebuild @@ -0,0 +1,143 @@ +# Copyright 2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{6,7} ) + +inherit cmake desktop flag-o-matic python-any-r1 xdg-utils + +MY_P="tdesktop-${PV}-full" + +DESCRIPTION="Official desktop client for Telegram" +HOMEPAGE="https://desktop.telegram.org" +SRC_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v${PV}/${MY_P}.tar.gz" + +LICENSE="GPL-3-with-openssl-exception" +SLOT="0" +KEYWORDS="~amd64 ~ppc64" +IUSE="+alsa +dbus enchant +hunspell libressl pulseaudio +spell" + +RDEPEND=" + !net-im/telegram-desktop-bin + app-arch/lz4:= + app-arch/xz-utils + !libressl? ( dev-libs/openssl:0= ) + libressl? ( dev-libs/libressl:0= ) + >=dev-cpp/ms-gsl-2.1.0 + dev-cpp/range-v3 + dev-libs/xxhash + dev-qt/qtcore:5 + dev-qt/qtimageformats:5 + dev-qt/qtnetwork:5 + dev-qt/qtsvg:5 + media-libs/fontconfig:= + >=media-libs/libtgvoip-2.4.4_p20200301[alsa?,pulseaudio?] + media-libs/openal[alsa?,pulseaudio?] + media-libs/opus:= + media-video/ffmpeg:=[opus] + sys-libs/zlib[minizip] + virtual/libiconv + x11-libs/libva:=[X,drm] + x11-libs/libX11 + || ( + dev-qt/qtgui:5[jpeg,png,X(-)] + dev-qt/qtgui:5[jpeg,png,xcb(-)] + ) + || ( + dev-qt/qtwidgets:5[png,X(-)] + dev-qt/qtwidgets:5[png,xcb(-)] + ) + dbus? ( + dev-qt/qtdbus:5 + dev-libs/libdbusmenu-qt[qt5(+)] + ) + enchant? ( app-text/enchant:= ) + hunspell? ( >=app-text/hunspell-1.7:= ) + pulseaudio? ( media-sound/pulseaudio ) +" + +DEPEND=" + ${PYTHON_DEPS} + ${RDEPEND} +" + +BDEPEND=" + >=dev-util/cmake-3.16 + virtual/pkgconfig +" + +REQUIRED_USE="|| ( alsa pulseaudio ) + spell? ( + ^^ ( enchant hunspell ) + ) +" + +S="${WORKDIR}/${MY_P}" + +PATCHES=( + "${FILESDIR}/2.0.0-fixes.patch" +) + +src_configure() { + local mycxxflags=( + -Wno-deprecated-declarations + -Wno-error=deprecated-declarations + -Wno-switch + ) + + append-cxxflags "${mycxxflags[@]}" + + # TODO: unbundle header-only libs, ofc telegram uses git versions... + # it fals with tl-expected-1.0.0, so we use bundled for now to avoid git rev snapshots + # EXPECTED VARIANT + local mycmakeargs=( + -DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON + -DDESKTOP_APP_USE_GLIBC_WRAPS=OFF + -DDESKTOP_APP_USE_PACKAGED=ON + -DDESKTOP_APP_USE_PACKAGED_EXPECTED=OFF + -DDESKTOP_APP_USE_PACKAGED_RLOTTIE=OFF + -DDESKTOP_APP_USE_PACKAGED_VARIANT=OFF + -DTDESKTOP_LAUNCHER_BASENAME="${PN}" + -DDESKTOP_APP_DISABLE_DBUS_INTEGRATION="$(usex dbus OFF ON)" + -DDESKTOP_APP_DISABLE_SPELLCHECK="$(usex spell OFF ON)" # enables hunspell + -DDESKTOP_APP_USE_ENCHANT="$(usex enchant ON OFF)" # enables enchant and disables hunspell + ) + + 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_desktop_database_update + xdg_icon_cache_update + xdg_mimeinfo_database_update +} + +pkg_postrm() { + xdg_desktop_database_update + xdg_icon_cache_update + xdg_mimeinfo_database_update +} -- cgit v1.2.3-65-gdbad