From 1220ca80afb760ea7ba4e0c73eb0bc6b69b33e96 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Sat, 18 Jan 2020 20:44:02 +1000 Subject: [PATCH] Telegram: bump version --- ...tchset => telegram_desktop-1.9.4.patchset} | 1548 ++++++++++------- ...3.recipe => telegram_desktop-1.9.4.recipe} | 31 +- 2 files changed, 945 insertions(+), 634 deletions(-) rename net-im/telegram-desktop/patches/{telegram_desktop-1.9.3.patchset => telegram_desktop-1.9.4.patchset} (79%) rename net-im/telegram-desktop/{telegram_desktop-1.9.3.recipe => telegram_desktop-1.9.4.recipe} (85%) diff --git a/net-im/telegram-desktop/patches/telegram_desktop-1.9.3.patchset b/net-im/telegram-desktop/patches/telegram_desktop-1.9.4.patchset similarity index 79% rename from net-im/telegram-desktop/patches/telegram_desktop-1.9.3.patchset rename to net-im/telegram-desktop/patches/telegram_desktop-1.9.4.patchset index 201004c25..ef612b0bd 100644 --- a/net-im/telegram-desktop/patches/telegram_desktop-1.9.3.patchset +++ b/net-im/telegram-desktop/patches/telegram_desktop-1.9.4.patchset @@ -1,18 +1,18 @@ -From d547c14ec5ebc0c39d47459d126c10ec5dc40dc2 Mon Sep 17 00:00:00 2001 +From d2757681df66652ba0b7732fdb4010bb1792860c Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Mon, 6 Jan 2020 17:46:10 +1000 +Date: Sat, 18 Jan 2020 18:31:20 +1000 Subject: Add Haiku support diff --git a/CMakeLists.txt b/CMakeLists.txt -index ff9adc6..af7e2c9 100644 +index d427ad0..73ef023 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,16 +10,17 @@ cmake_policy(SET CMP0091 NEW) set_property(GLOBAL PROPERTY USE_FOLDERS ON) --include(cmake/variables.cmake) +-include(cmake/validate_special_target.cmake) -include(cmake/version.cmake) -desktop_app_parse_version(Telegram/build/version) - @@ -23,14 +23,14 @@ index ff9adc6..af7e2c9 100644 HOMEPAGE_URL "https://desktop.telegram.org" ) + -+include(cmake/variables.cmake) ++include(cmake/validate_special_target.cmake) +include(cmake/version.cmake) +desktop_app_parse_version(Telegram/build/version) + set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Telegram) - include(cmake/nice_target_sources.cmake) -@@ -30,7 +31,7 @@ include(cmake/generate_target.cmake) + include(cmake/variables.cmake) +@@ -31,7 +32,7 @@ include(cmake/generate_target.cmake) include(cmake/options.cmake) @@ -40,67 +40,22 @@ index ff9adc6..af7e2c9 100644 add_subdirectory(cmake) add_subdirectory(Telegram) diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt -index d8c623a..8ee842a 100644 +index 5c89cc1..5904898 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt -@@ -697,60 +697,18 @@ PRIVATE - passport/passport_panel_form.h - passport/passport_panel_password.cpp - passport/passport_panel_password.h -- platform/linux/linux_desktop_environment.cpp -- platform/linux/linux_desktop_environment.h -- platform/linux/linux_gdk_helper.cpp -- platform/linux/linux_gdk_helper.h -- platform/linux/linux_libs.cpp -- platform/linux/linux_libs.h -- platform/linux/file_utilities_linux.cpp -- platform/linux/file_utilities_linux.h -- platform/linux/launcher_linux.cpp -- platform/linux/launcher_linux.h -- platform/linux/main_window_linux.cpp -- platform/linux/main_window_linux.h -- platform/linux/notifications_manager_linux.cpp -- platform/linux/notifications_manager_linux.h -- platform/linux/specific_linux.cpp -- platform/linux/specific_linux.h -- platform/mac/file_utilities_mac.mm -- platform/mac/file_utilities_mac.h -- platform/mac/launcher_mac.mm -- platform/mac/launcher_mac.h -- platform/mac/mac_iconv_helper.c -- platform/mac/main_window_mac.mm -- platform/mac/main_window_mac.h -- platform/mac/notifications_manager_mac.mm -- platform/mac/notifications_manager_mac.h -- platform/mac/specific_mac.mm -- platform/mac/specific_mac.h -- platform/mac/specific_mac_p.mm -- platform/mac/specific_mac_p.h -- platform/mac/window_title_mac.mm -- platform/mac/window_title_mac.h -- platform/mac/mac_touchbar.h -- platform/mac/mac_touchbar.mm -- platform/win/audio_win.cpp -- platform/win/audio_win.h -- platform/win/file_utilities_win.cpp -- platform/win/file_utilities_win.h -- platform/win/launcher_win.cpp -- platform/win/launcher_win.h -- platform/win/main_window_win.cpp -- platform/win/main_window_win.h -- platform/win/notifications_manager_win.cpp -- platform/win/notifications_manager_win.h -- platform/win/specific_win.cpp -- platform/win/specific_win.h -- platform/win/window_title_win.cpp -- platform/win/window_title_win.h -- platform/win/windows_app_user_model_id.cpp -- platform/win/windows_app_user_model_id.h -- platform/win/windows_dlls.cpp -- platform/win/windows_dlls.h -- platform/win/windows_event_filter.cpp -- platform/win/windows_event_filter.h -- platform/win/wrapper_wrl_implements_h.h +@@ -94,7 +94,7 @@ PRIVATE + desktop-app::external_zlib + desktop-app::external_qt + desktop-app::external_qr_code_generator +- desktop-app::external_crash_reports ++# desktop-app::external_crash_reports + desktop-app::external_auto_updates + tdesktop::lib_tgvoip + desktop-app::external_openssl +@@ -762,6 +762,18 @@ PRIVATE + platform/win/windows_event_filter.cpp + platform/win/windows_event_filter.h + platform/win/wrapper_wrl_implements_h.h + platform/haiku/file_utilities_haiku.cpp + platform/haiku/file_utilities_haiku.h + platform/haiku/haiku_desktop_environment.cpp @@ -116,78 +71,41 @@ index d8c623a..8ee842a 100644 platform/platform_audio.h platform/platform_file_utilities.h platform/platform_launcher.h -@@ -937,6 +895,7 @@ PRIVATE - observer_peer.cpp - observer_peer.h - qt_static_plugins.cpp -+ qt_functions.cpp - settings.cpp - settings.h - ) -@@ -1097,7 +1056,6 @@ source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/Telegram PREFIX Resources FILES ${ - target_include_directories(Telegram - PRIVATE - ${src_loc} -- ${third_party_loc}/minizip - ) - - target_compile_definitions(Telegram -@@ -1118,7 +1076,7 @@ endif() +@@ -1142,7 +1154,7 @@ endif() set_target_properties(Telegram PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${output_folder}) --if (NOT build_macstore AND NOT build_winstore) -+if (False) +-if ((NOT disable_autoupdate OR NOT LINUX) AND NOT build_macstore AND NOT build_winstore) ++if ((NOT disable_autoupdate OR NOT LINUX OR NOT HAIKU) AND NOT build_macstore AND NOT build_winstore) add_executable(Updater WIN32) init_target(Updater) -@@ -1157,3 +1115,9 @@ if (NOT build_macstore AND NOT build_winstore) - set_target_properties(Packer PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${output_folder}) - endif() - endif() -+ -+set_target_properties(Telegram PROPERTIES -+ OUTPUT_NAME "telegram-desktop" -+) -+ -+install(TARGETS Telegram RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/Telegram/SourceFiles/calls/calls_call.cpp b/Telegram/SourceFiles/calls/calls_call.cpp -index bf57bdc..01f7cc4 100644 +index bf57bdc..ae79d2f 100644 --- a/Telegram/SourceFiles/calls/calls_call.cpp +++ b/Telegram/SourceFiles/calls/calls_call.cpp -@@ -27,6 +27,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +@@ -5,6 +5,7 @@ the official desktop application for the Telegram messaging service. + For license and copyright information please follow this link: + https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + */ ++ + #include "calls/calls_call.h" + + #include "main/main_session.h" +@@ -27,6 +28,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #define NEED_TO_RESTORE_SLOTS #endif // slots -+#ifdef __x86_64__ -+#define int64 XXX -+#define uint64 YYY -+#else -+#define int32 XXX -+#define uint32 YYY ++// Don't include SupportDefs.h ++#ifdef __HAIKU__ ++#define _SUPPORT_DEFS_H ++typedef int32 status_t; ++typedef uint32 type_code; +#endif + #include #include -diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp -index 2547342..a94c354 100644 ---- a/Telegram/SourceFiles/core/launcher.cpp -+++ b/Telegram/SourceFiles/core/launcher.cpp -@@ -278,6 +278,13 @@ int Launcher::exec() { - Platform::start(); - Ui::DisableCustomScaling(); - -+#if defined(Q_OS_HAIKU) -+ QCoreApplication::addLibraryPath("/boot/system/add-ons/Qt5"); -+ QCoreApplication::addLibraryPath("/boot/system/add-ons/x86/Qt5"); -+// setenv("QT_STYLE_OVERRIDE", "qwerty", false); -+// unsetenv("QT_QPA_PLATFORMTHEME"); -+#endif -+ - auto result = executeApplication(); - - DEBUG_LOG(("Telegram finished, result: %1").arg(result)); diff --git a/Telegram/SourceFiles/core/update_checker.cpp b/Telegram/SourceFiles/core/update_checker.cpp index 160571e..842ac9b 100644 --- a/Telegram/SourceFiles/core/update_checker.cpp @@ -1882,108 +1800,6 @@ index 6aea663..a5c46ef 100644 -#endif // Q_OS_MAC || Q_OS_WIN || Q_OS_WINRT || Q_OS_LINUX +#endif // Q_OS_MAC || Q_OS_WIN || Q_OS_WINRT || Q_OS_LINUX || Q_OS_HAIKU -diff --git a/Telegram/SourceFiles/qt_functions.cpp b/Telegram/SourceFiles/qt_functions.cpp -new file mode 100644 -index 0000000..8817342 ---- /dev/null -+++ b/Telegram/SourceFiles/qt_functions.cpp -@@ -0,0 +1,96 @@ -+/**************************************************************************** -+** -+** Copyright (C) 2015 The Qt Company Ltd. -+** Contact: http://www.qt.io/licensing/ -+** -+** This file contains some parts of the Qt Toolkit. -+** -+** $QT_BEGIN_LICENSE:LGPL21$ -+** Commercial License Usage -+** Licensees holding valid commercial Qt licenses may use this file in -+** accordance with the commercial license agreement provided with the -+** Software or, alternatively, in accordance with the terms contained in -+** a written agreement between you and The Qt Company. For licensing terms -+** and conditions see http://www.qt.io/terms-conditions. For further -+** information use the contact form at http://www.qt.io/contact-us. -+** -+** GNU Lesser General Public License Usage -+** Alternatively, this file may be used under the terms of the GNU Lesser -+** General Public License version 2.1 or version 3 as published by the Free -+** Software Foundation and appearing in the file LICENSE.LGPLv21 and -+** LICENSE.LGPLv3 included in the packaging of this file. Please review the -+** following information to ensure the GNU Lesser General Public License -+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -+** -+** As a special exception, The Qt Company gives you certain additional -+** rights. These rights are described in The Qt Company LGPL Exception -+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -+** -+** $QT_END_LICENSE$ -+** -+****************************************************************************/ -+ -+#include -+ -+/* TODO: find a dynamic library with these symbols. */ -+ -+/* Debian maintainer: this function is taken from qfiledialog.cpp */ -+/* -+ Makes a list of filters from ;;-separated text. -+ Used by the mac and windows implementations -+*/ -+QStringList qt_make_filter_list(const QString &filter) -+{ -+ QString f(filter); -+ -+ if (f.isEmpty()) -+ return QStringList(); -+ -+ QString sep(QLatin1String(";;")); -+ int i = f.indexOf(sep, 0); -+ if (i == -1) { -+ if (f.indexOf(QLatin1Char('\n'), 0) != -1) { -+ sep = QLatin1Char('\n'); -+ i = f.indexOf(sep, 0); -+ } -+ } -+ -+ return f.split(sep); -+} -+ -+/* Debian maintainer: this constructor is taken from qtextengine.cpp for TextPainter::drawLine */ -+QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe, const QTextCharFormat &format) -+ : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), charFormat(format), -+ num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe) -+{ -+} -+ -+/* Debian maintainer: this method is also taken from qtextengine.cpp */ -+// Fix up flags and underlineStyle with given info -+void QTextItemInt::initWithScriptItem(const QScriptItem &si) -+{ -+ // explicitly initialize flags so that initFontAttributes can be called -+ // multiple times on the same TextItem -+ flags = 0; -+ if (si.analysis.bidiLevel %2) -+ flags |= QTextItem::RightToLeft; -+ ascent = si.ascent; -+ descent = si.descent; -+ -+ if (charFormat.hasProperty(QTextFormat::TextUnderlineStyle)) { -+ underlineStyle = charFormat.underlineStyle(); -+ } else if (charFormat.boolProperty(QTextFormat::FontUnderline) -+ || f->d->underline) { -+ underlineStyle = QTextCharFormat::SingleUnderline; -+ } -+ -+ // compat -+ if (underlineStyle == QTextCharFormat::SingleUnderline) -+ flags |= QTextItem::Underline; -+ -+ if (f->d->overline || charFormat.fontOverline()) -+ flags |= QTextItem::Overline; -+ if (f->d->strikeOut || charFormat.fontStrikeOut()) -+ flags |= QTextItem::StrikeOut; -+} diff --git a/Telegram/SourceFiles/qt_static_plugins.cpp b/Telegram/SourceFiles/qt_static_plugins.cpp index cc1a767..c1b5859 100644 --- a/Telegram/SourceFiles/qt_static_plugins.cpp @@ -2016,19 +1832,26 @@ index cc1a767..c1b5859 100644 -Q_IMPORT_PLUGIN(NimfInputContextPlugin) #endif // Q_OS_WIN | Q_OS_MAC | Q_OS_LINUX diff --git a/Telegram/SourceFiles/settings/settings_calls.cpp b/Telegram/SourceFiles/settings/settings_calls.cpp -index 31d16e3..9eb64e8 100644 +index 31d16e3..e592a75 100644 --- a/Telegram/SourceFiles/settings/settings_calls.cpp +++ b/Telegram/SourceFiles/settings/settings_calls.cpp -@@ -31,6 +31,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +@@ -5,6 +5,7 @@ the official desktop application for the Telegram messaging service. + For license and copyright information please follow this link: + https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + */ ++ + #include "settings/settings_calls.h" + + #include "settings/settings_common.h" +@@ -31,6 +32,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #define NEED_TO_RESTORE_SLOTS #endif // slots -+#ifdef __x86_64__ -+#define int64 XXX -+#define uint64 YYY -+#else -+#define int32 XXX -+#define uint32 YYY ++// Don't include SupportDefs.h ++#ifdef __HAIKU__ ++#define _SUPPORT_DEFS_H ++typedef int32 status_t; ++typedef uint32 type_code; +#endif + #include @@ -2913,147 +2736,53 @@ index 0bc42eb..c87cde9 100644 typedef pid_t PlatformThreadId; typedef pthread_t PlatformThreadRef; diff --git a/Telegram/cmake/lib_tgvoip.cmake b/Telegram/cmake/lib_tgvoip.cmake -index 38fa632..daf50a7 100644 +index bb76f03..f4cabae 100644 --- a/Telegram/cmake/lib_tgvoip.cmake +++ b/Telegram/cmake/lib_tgvoip.cmake -@@ -68,45 +68,13 @@ PRIVATE - json11.cpp - json11.hpp +@@ -118,6 +118,14 @@ else() + os/linux/AudioPulse.cpp + os/linux/AudioPulse.h -- # Windows -- os/windows/NetworkSocketWinsock.cpp -- os/windows/NetworkSocketWinsock.h -- os/windows/AudioInputWave.cpp -- os/windows/AudioInputWave.h -- os/windows/AudioOutputWave.cpp -- os/windows/AudioOutputWave.h -- os/windows/AudioOutputWASAPI.cpp -- os/windows/AudioOutputWASAPI.h -- os/windows/AudioInputWASAPI.cpp -- os/windows/AudioInputWASAPI.h -- os/windows/WindowsSpecific.cpp -- os/windows/WindowsSpecific.h -- -- # macOS -- os/darwin/AudioInputAudioUnit.cpp -- os/darwin/AudioInputAudioUnit.h -- os/darwin/AudioOutputAudioUnit.cpp -- os/darwin/AudioOutputAudioUnit.h -- os/darwin/AudioInputAudioUnitOSX.cpp -- os/darwin/AudioInputAudioUnitOSX.h -- os/darwin/AudioOutputAudioUnitOSX.cpp -- os/darwin/AudioOutputAudioUnitOSX.h -- os/darwin/AudioUnitIO.cpp -- os/darwin/AudioUnitIO.h -- os/darwin/DarwinSpecific.mm -- os/darwin/DarwinSpecific.h -- -- # Linux -- os/linux/AudioInputALSA.cpp -- os/linux/AudioInputALSA.h -- os/linux/AudioOutputALSA.cpp -- os/linux/AudioOutputALSA.h -- os/linux/AudioOutputPulse.cpp -- os/linux/AudioOutputPulse.h -- os/linux/AudioInputPulse.cpp -- os/linux/AudioInputPulse.h -- os/linux/AudioPulse.cpp -- os/linux/AudioPulse.h -+ # Haiku -+ os/haiku/AudioInputHaiku.cpp -+ os/haiku/AudioInputHaiku.h -+ os/haiku/AudioOutputHaiku.cpp -+ os/haiku/AudioOutputHaiku.h -+ os/haiku/RingBuffer.cpp -+ os/haiku/RingBuffer.h - - # POSIX - os/posix/NetworkSocketPosix.cpp -@@ -176,8 +144,6 @@ PRIVATE - webrtc_dsp/rtc_base/sanitizer.h - webrtc_dsp/rtc_base/scoped_ref_ptr.h - webrtc_dsp/rtc_base/logging.h -- webrtc_dsp/rtc_base/logging_mac.h -- webrtc_dsp/rtc_base/logging_mac.mm - webrtc_dsp/rtc_base/timeutils.h - webrtc_dsp/rtc_base/atomicops.h - webrtc_dsp/rtc_base/stringencode.cc -@@ -212,7 +178,6 @@ PRIVATE - webrtc_dsp/rtc_base/type_traits.h - webrtc_dsp/rtc_base/platform_file.h - webrtc_dsp/rtc_base/refcounter.h -- webrtc_dsp/rtc_base/logging_mac.h - webrtc_dsp/rtc_base/thread_checker.h - webrtc_dsp/rtc_base/race_checker.h - webrtc_dsp/rtc_base/refcountedobject.h -@@ -749,6 +714,20 @@ elseif (APPLE) - TGVOIP_NO_OSX_PRIVATE_API - ) - endif() -+elseif (HAIKU) -+ target_compile_options(lib_tgvoip -+ PRIVATE -+ -Wno-unknown-pragmas -+ -Wno-error=sequence-point -+ -Wno-error=unused-result -+ -mmmx -+ -msse2 -+ ) -+ target_compile_definitions(lib_tgvoip -+ PUBLIC -+ WEBRTC_POSIX -+ WEBRTC_HAIKU -+ ) - else() - target_compile_options(lib_tgvoip - PRIVATE ++ # Haiku ++ os/haiku/AudioInputHaiku.cpp ++ os/haiku/AudioInputHaiku.h ++ os/haiku/AudioOutputHaiku.cpp ++ os/haiku/AudioOutputHaiku.h ++ os/haiku/RingBuffer.cpp ++ os/haiku/RingBuffer.h ++ + # POSIX + os/posix/NetworkSocketPosix.cpp + os/posix/NetworkSocketPosix.h +@@ -759,6 +767,20 @@ else() + TGVOIP_NO_OSX_PRIVATE_API + ) + endif() ++ elseif (HAIKU) ++ target_compile_options(lib_tgvoip ++ PRIVATE ++ -Wno-unknown-pragmas ++ -Wno-error=sequence-point ++ -Wno-error=unused-result ++ -mmmx ++ -msse2 ++ ) ++ target_compile_definitions(lib_tgvoip ++ PUBLIC ++ WEBRTC_POSIX ++ WEBRTC_HAIKU ++ ) + else() + target_compile_options(lib_tgvoip + PRIVATE diff --git a/Telegram/lib_base/CMakeLists.txt b/Telegram/lib_base/CMakeLists.txt -index 68473e8..300d977 100644 +index da416a7..4a7fbe9 100644 --- a/Telegram/lib_base/CMakeLists.txt +++ b/Telegram/lib_base/CMakeLists.txt -@@ -17,45 +17,18 @@ get_filename_component(src_loc . REALPATH) - target_precompile_headers(lib_base PRIVATE ${src_loc}/base/base_pch.h) - nice_target_sources(lib_base ${src_loc} - PRIVATE -- base/platform/linux/base_file_utilities_linux.cpp -- base/platform/linux/base_file_utilities_linux.h -- base/platform/linux/base_info_linux.cpp -- base/platform/linux/base_info_linux.h -- base/platform/linux/base_last_input_linux.cpp -- base/platform/linux/base_last_input_linux.h -- base/platform/linux/base_layout_switch_linux.cpp -- base/platform/linux/base_layout_switch_linux.h -- base/platform/linux/base_process_linux.cpp -- base/platform/linux/base_process_linux.h -- base/platform/linux/base_url_scheme_linux.cpp -- base/platform/linux/base_url_scheme_linux.h -- base/platform/mac/base_file_utilities_mac.h -- base/platform/mac/base_file_utilities_mac.mm -- base/platform/mac/base_info_mac.h -- base/platform/mac/base_info_mac.mm -- base/platform/mac/base_last_input_mac.h -- base/platform/mac/base_last_input_mac.mm -- base/platform/mac/base_layout_switch_mac.h -- base/platform/mac/base_layout_switch_mac.mm -- base/platform/mac/base_process_mac.h -- base/platform/mac/base_process_mac.mm -- base/platform/mac/base_url_scheme_mac.h -- base/platform/mac/base_url_scheme_mac.mm -- base/platform/mac/base_utilities_mac.h -- base/platform/mac/base_utilities_mac.mm -- base/platform/win/base_file_utilities_win.cpp -- base/platform/win/base_file_utilities_win.h -- base/platform/win/base_info_win.cpp -- base/platform/win/base_info_win.h -- base/platform/win/base_last_input_win.cpp -- base/platform/win/base_last_input_win.h -- base/platform/win/base_layout_switch_win.cpp -- base/platform/win/base_layout_switch_win.h -- base/platform/win/base_process_win.cpp -- base/platform/win/base_process_win.h -- base/platform/win/base_url_scheme_win.cpp -- base/platform/win/base_url_scheme_win.h -- base/platform/win/base_windows_h.h +@@ -56,6 +56,18 @@ PRIVATE + base/platform/win/base_url_scheme_win.cpp + base/platform/win/base_url_scheme_win.h + base/platform/win/base_windows_h.h + base/platform/haiku/base_file_utilities_haiku.cpp + base/platform/haiku/base_file_utilities_haiku.h + base/platform/haiku/base_info_haiku.cpp @@ -3069,32 +2798,15 @@ index 68473e8..300d977 100644 base/platform/base_platform_info.h base/platform/base_platform_last_input.h base/platform/base_platform_layout_switch.h -@@ -83,7 +56,6 @@ PRIVATE - base/base_file_utilities.cpp - base/base_file_utilities.h - base/file_lock.h -- base/file_lock_win.cpp - base/file_lock_posix.cpp - base/flat_map.h - base/flat_set.h -@@ -142,17 +114,12 @@ PUBLIC +@@ -142,7 +154,7 @@ PUBLIC desktop-app::lib_crl desktop-app::external_qt desktop-app::external_openssl - desktop-app::external_crash_reports ++# desktop-app::external_crash_reports desktop-app::external_variant desktop-app::external_ranges desktop-app::external_gsl - desktop-app::external_expected - ) - --if (DESKTOP_APP_USE_GLIBC_WRAPS) -- target_link_libraries(lib_base PUBLIC desktop-app::linux_glibc_wraps) --endif() -- - target_precompile_headers(lib_base_crash_report_writer PRIVATE ${src_loc}/base/base_pch.h) - nice_target_sources(lib_base_crash_report_writer ${src_loc} - PRIVATE diff --git a/Telegram/lib_base/base/build_config.h b/Telegram/lib_base/base/build_config.h index a02c9b0..cffaec4 100644 --- a/Telegram/lib_base/base/build_config.h @@ -3799,22 +3511,84 @@ index 0000000..177a2a1 +#pragma once + +#include "base/platform/base_platform_url_scheme.h" +diff --git a/Telegram/lib_crl/CMakeLists.txt b/Telegram/lib_crl/CMakeLists.txt +index d241fb6..4d81e67 100644 +--- a/Telegram/lib_crl/CMakeLists.txt ++++ b/Telegram/lib_crl/CMakeLists.txt +@@ -32,6 +32,7 @@ PRIVATE + crl/dispatch/crl_dispatch_semaphore.h + crl/mac/crl_mac_time.cpp + crl/linux/crl_linux_time.cpp ++ crl/haiku/crl_haiku_time.cpp + crl/qt/crl_qt_async.cpp + crl/qt/crl_qt_async.h + crl/qt/crl_qt_guards.h +diff --git a/Telegram/lib_crl/crl/haiku/crl_haiku_time.cpp b/Telegram/lib_crl/crl/haiku/crl_haiku_time.cpp +new file mode 100644 +index 0000000..f682740 +--- /dev/null ++++ b/Telegram/lib_crl/crl/haiku/crl_haiku_time.cpp +@@ -0,0 +1,44 @@ ++// This file is part of Desktop App Toolkit, ++// a set of libraries for developing nice desktop applications. ++// ++// For license and copyright information please follow this link: ++// https://github.com/desktop-app/legal/blob/master/LEGAL ++// ++#include ++ ++#ifdef CRL_USE_LINUX_TIME ++ ++#include ++ ++namespace crl::details { ++ ++void init() { ++} ++ ++inner_time_type current_value() { ++ timespec ts; ++ clock_gettime(CLOCK_MONOTONIC, &ts); ++ const auto seconds = inner_time_type(ts.tv_sec); ++ const auto milliseconds = inner_time_type(ts.tv_nsec) / 1000000; ++ return seconds * 1000 + milliseconds; ++} ++ ++time convert(inner_time_type value) { ++ return time(value); ++} ++ ++inner_profile_type current_profile_value() { ++ timespec ts; ++ clock_gettime(CLOCK_MONOTONIC, &ts); ++ const auto seconds = inner_profile_type(ts.tv_sec); ++ const auto milliseconds = inner_profile_type(ts.tv_nsec) / 1000; ++ return seconds * 1000000 + milliseconds; ++} ++ ++profile_time convert_profile(inner_profile_type value) { ++ return profile_time(value); ++} ++ ++} // namespace crl::details ++ ++#endif // CRL_USE_LINUX_TIME diff --git a/Telegram/lib_spellcheck/CMakeLists.txt b/Telegram/lib_spellcheck/CMakeLists.txt -index 282e732..c85ee20 100644 +index 282e732..c5a1b7e 100644 --- a/Telegram/lib_spellcheck/CMakeLists.txt +++ b/Telegram/lib_spellcheck/CMakeLists.txt -@@ -18,10 +18,6 @@ PRIVATE - spellcheck/platform/linux/linux_enchant.h - spellcheck/platform/linux/spellcheck_linux.cpp - spellcheck/platform/linux/spellcheck_linux.h -- spellcheck/platform/mac/spellcheck_mac.h -- spellcheck/platform/mac/spellcheck_mac.mm -- spellcheck/platform/win/spellcheck_win.cpp -- spellcheck/platform/win/spellcheck_win.h +@@ -22,6 +22,10 @@ PRIVATE + spellcheck/platform/mac/spellcheck_mac.mm + spellcheck/platform/win/spellcheck_win.cpp + spellcheck/platform/win/spellcheck_win.h ++ spellcheck/platform/haiku/haiku_enchant.cpp ++ spellcheck/platform/haiku/haiku_enchant.h ++ spellcheck/platform/haiku/spellcheck_haiku.cpp ++ spellcheck/platform/haiku/spellcheck_haiku.h spellcheck/spellcheck_utils.cpp spellcheck/spellcheck_utils.h spellcheck/spellcheck_types.h -@@ -39,7 +35,7 @@ PUBLIC +@@ -39,7 +43,7 @@ PUBLIC desktop-app::lib_ui ) @@ -3823,92 +3597,722 @@ index 282e732..c85ee20 100644 find_package(PkgConfig REQUIRED) pkg_search_module(ENCHANT REQUIRED enchant-2 enchant) -diff --git a/Telegram/lib_spellcheck/spellcheck/platform/linux/linux_enchant.cpp b/Telegram/lib_spellcheck/spellcheck/platform/linux/linux_enchant.cpp -index 3074802..88e3333 100644 ---- a/Telegram/lib_spellcheck/spellcheck/platform/linux/linux_enchant.cpp -+++ b/Telegram/lib_spellcheck/spellcheck/platform/linux/linux_enchant.cpp -@@ -32,7 +32,11 @@ - * rigid dependency on the Enchant library at runtime. - */ - -+#ifdef __HAIKU__ +diff --git a/Telegram/lib_spellcheck/spellcheck/platform/haiku/haiku_enchant.cpp b/Telegram/lib_spellcheck/spellcheck/platform/haiku/haiku_enchant.cpp +new file mode 100644 +index 0000000..cc3db6a +--- /dev/null ++++ b/Telegram/lib_spellcheck/spellcheck/platform/haiku/haiku_enchant.cpp +@@ -0,0 +1,229 @@ ++/* enchant ++ * Copyright (C) 2003 Dom Lachowicz ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ */ ++ +#include -+#else - #include -+#endif - #include - #include "spellcheck/platform/linux/linux_enchant.h" - ++#include ++#include "spellcheck/platform/haiku/haiku_enchant.h" ++ ++namespace { ++ ++struct { ++ //decltype (enchant_broker_describe) * broker_describe; ++ //decltype (enchant_broker_dict_exists) * broker_dict_exists; ++ decltype (enchant_broker_free) * broker_free; ++ decltype (enchant_broker_free_dict) * broker_free_dict; ++ decltype (enchant_broker_get_error) * broker_get_error; ++ decltype (enchant_broker_init) * broker_init; ++ decltype (enchant_broker_list_dicts) * broker_list_dicts; ++ decltype (enchant_broker_request_dict) * broker_request_dict; ++ //decltype (enchant_broker_request_pwl_dict) * broker_request_pwl_dict; ++ decltype (enchant_broker_set_ordering) * broker_set_ordering; ++ decltype (enchant_dict_add) * dict_add; ++ decltype (enchant_dict_add_to_session) * dict_add_to_session; ++ decltype (enchant_dict_check) * dict_check; ++ decltype (enchant_dict_describe) * dict_describe; ++ decltype (enchant_dict_free_string_list) * dict_free_string_list; ++ decltype (enchant_dict_get_error) * dict_get_error; ++ decltype (enchant_dict_is_added) * dict_is_added; ++ //decltype (enchant_dict_is_removed) * dict_is_removed; ++ decltype (enchant_dict_remove) * dict_remove; ++ decltype (enchant_dict_remove_from_session) * dict_remove_from_session; ++ //decltype (enchant_dict_store_replacement) * dict_store_replacement; ++ decltype (enchant_dict_suggest) * dict_suggest; ++} f_enchant; ++ ++} // anonymous namespace ++ ++enchant::Exception::Exception (const char * ex) ++ : std::exception (), m_ex ("") { ++ if (ex) ++ m_ex = ex; ++} ++ ++enchant::Exception::~Exception () = default; ++ ++const char * enchant::Exception::what () const noexcept { ++ return m_ex.c_str(); ++} ++ ++enchant::Dict::Dict (EnchantDict * dict, EnchantBroker * broker) ++ : m_dict (dict), m_broker (broker) { ++ f_enchant.dict_describe (m_dict, s_describe_fn, this); ++} ++ ++enchant::Dict::~Dict () { ++ f_enchant.broker_free_dict (m_broker, m_dict); ++} ++ ++bool enchant::Dict::check (const std::string & utf8word) { ++ int val; ++ ++ val = f_enchant.dict_check (m_dict, utf8word.c_str(), utf8word.size()); ++ if (val == 0) ++ return true; ++ else if (val > 0) ++ return false; ++ else { ++ throw enchant::Exception (f_enchant.dict_get_error (m_dict)); ++ } ++ ++ return false; // never reached ++} ++ ++void enchant::Dict::suggest (const std::string & utf8word, ++ std::vector & out_suggestions) { ++ size_t n_suggs; ++ char ** suggs; ++ ++ out_suggestions.clear (); ++ ++ suggs = f_enchant.dict_suggest (m_dict, utf8word.c_str(), ++ utf8word.size(), &n_suggs); ++ ++ if (suggs && n_suggs) { ++ out_suggestions.reserve(n_suggs); ++ ++ for (size_t i = 0; i < n_suggs; i++) { ++ out_suggestions.push_back (suggs[i]); ++ } ++ ++ f_enchant.dict_free_string_list (m_dict, suggs); ++ } ++} ++ ++void enchant::Dict::add (const std::string & utf8word) { ++ f_enchant.dict_add (m_dict, utf8word.c_str(), utf8word.size()); ++} ++ ++void enchant::Dict::add_to_session (const std::string & utf8word) { ++ f_enchant.dict_add_to_session (m_dict, utf8word.c_str(), utf8word.size()); ++} ++ ++bool enchant::Dict::is_added (const std::string & utf8word) { ++ return f_enchant.dict_is_added (m_dict, utf8word.c_str(), ++ utf8word.size()); ++} ++ ++void enchant::Dict::remove (const std::string & utf8word) { ++ f_enchant.dict_remove (m_dict, utf8word.c_str(), utf8word.size()); ++} ++ ++void enchant::Dict::remove_from_session (const std::string & utf8word) { ++ f_enchant.dict_remove_from_session (m_dict, utf8word.c_str(), ++ utf8word.size()); ++} ++ ++//bool enchant::Dict::is_removed (const std::string & utf8word) { ++// return f_enchant.dict_is_removed (m_dict, utf8word.c_str(), ++// utf8word.size()); ++//} ++ ++//void enchant::Dict::store_replacement (const std::string & utf8bad, ++// const std::string & utf8good) { ++// f_enchant.dict_store_replacement (m_dict, ++// utf8bad.c_str(), utf8bad.size(), ++// utf8good.c_str(), utf8good.size()); ++//} ++ ++enchant::Broker::Broker () ++ : m_broker (f_enchant.broker_init ()) ++ { ++ } ++ ++enchant::Broker::~Broker () { ++ f_enchant.broker_free (m_broker); ++} ++ ++enchant::Dict * enchant::Broker::request_dict (const std::string & lang) { ++ EnchantDict * dict = f_enchant.broker_request_dict (m_broker, lang.c_str()); ++ ++ if (!dict) { ++ throw enchant::Exception (f_enchant.broker_get_error (m_broker)); ++ return 0; // never reached ++ } ++ ++ return new Dict (dict, m_broker); ++} ++ ++//enchant::Dict * enchant::Broker::request_pwl_dict (const std::string & pwl) { ++// EnchantDict * dict = f_enchant.broker_request_pwl_dict (m_broker, pwl.c_str()); ++// ++// if (!dict) { ++// throw enchant::Exception (f_enchant.broker_get_error (m_broker)); ++// return 0; // never reached ++// } ++// ++// return new Dict (dict, m_broker); ++//} ++ ++//bool enchant::Broker::dict_exists (const std::string & lang) { ++// if (f_enchant.broker_dict_exists (m_broker, lang.c_str())) ++// return true; ++// return false; ++//} ++ ++void enchant::Broker::set_ordering (const std::string & tag, const std::string & ordering) { ++ f_enchant.broker_set_ordering (m_broker, tag.c_str(), ordering.c_str()); ++} ++ ++//void enchant::Broker::describe (EnchantBrokerDescribeFn fn, void * user_data) { ++// f_enchant.broker_describe (m_broker, fn, user_data); ++//} ++ ++void enchant::Broker::list_dicts (EnchantDictDescribeFn fn, void * user_data) { ++ f_enchant.broker_list_dicts (m_broker, fn, user_data); ++} ++ ++#define GET_SYMBOL_enchant(func_name) do { \ ++ typedef decltype (enchant_ ## func_name) * Fp; \ ++ f_enchant.func_name = reinterpret_cast ( dlsym (handle, "enchant_" # func_name)); \ ++ if (!f_enchant.func_name) { \ ++ return false; \ ++ } \ ++} while(0) ++ ++bool enchant::loader::do_explicit_linking () { ++ static enum { NotLoadedYet, LoadSuccessful, LoadFailed = -1 } load_status; ++ if (load_status == NotLoadedYet) { ++ load_status = LoadFailed; ++ void * handle = dlopen ("libenchant.so.1", RTLD_NOW) ++ ?: dlopen ("libenchant-2.so.2", RTLD_NOW) ++ ?: dlopen ("libenchant.so.2", RTLD_NOW); ++ if (!handle) { ++ // logs ? ++ return false; ++ } ++ //GET_SYMBOL_enchant (broker_describe); ++ //GET_SYMBOL_enchant (broker_dict_exists); ++ GET_SYMBOL_enchant (broker_free); ++ GET_SYMBOL_enchant (broker_free_dict); ++ GET_SYMBOL_enchant (broker_get_error); ++ GET_SYMBOL_enchant (broker_init); ++ GET_SYMBOL_enchant (broker_list_dicts); ++ GET_SYMBOL_enchant (broker_request_dict); ++ //GET_SYMBOL_enchant (broker_request_pwl_dict); ++ GET_SYMBOL_enchant (broker_set_ordering); ++ GET_SYMBOL_enchant (dict_add); ++ GET_SYMBOL_enchant (dict_add_to_session); ++ GET_SYMBOL_enchant (dict_check); ++ GET_SYMBOL_enchant (dict_describe); ++ GET_SYMBOL_enchant (dict_free_string_list); ++ GET_SYMBOL_enchant (dict_get_error); ++ GET_SYMBOL_enchant (dict_is_added); ++ //GET_SYMBOL_enchant (dict_is_removed); ++ GET_SYMBOL_enchant (dict_remove); ++ GET_SYMBOL_enchant (dict_remove_from_session); ++ //GET_SYMBOL_enchant (dict_store_replacement); ++ GET_SYMBOL_enchant (dict_suggest); ++ load_status = LoadSuccessful; ++ } ++ return load_status == LoadSuccessful; ++} ++ ++// vi: ts=8 sw=8 +diff --git a/Telegram/lib_spellcheck/spellcheck/platform/haiku/haiku_enchant.h b/Telegram/lib_spellcheck/spellcheck/platform/haiku/haiku_enchant.h +new file mode 100644 +index 0000000..f73f860 +--- /dev/null ++++ b/Telegram/lib_spellcheck/spellcheck/platform/haiku/haiku_enchant.h +@@ -0,0 +1,151 @@ ++/* enchant ++ * Copyright (C) 2003 Dom Lachowicz ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ */ ++ ++#pragma once ++ ++#include ++#include ++#include ++ ++#ifndef ENCHANT_H ++typedef struct str_enchant_broker EnchantBroker; ++typedef struct str_enchant_dict EnchantDict; ++ ++typedef void (*EnchantBrokerDescribeFn) (const char * const provider_name, ++ const char * const provider_desc, ++ const char * const provider_dll_file, ++ void * user_data); ++ ++typedef void (*EnchantDictDescribeFn) (const char * const lang_tag, ++ const char * const provider_name, ++ const char * const provider_desc, ++ const char * const provider_file, ++ void * user_data); ++#endif // !ENCHANT_H ++ ++namespace enchant ++{ ++ class Broker; ++ ++ class Exception : public std::exception ++ { ++ public: ++ explicit Exception (const char * ex); ++ virtual ~Exception () noexcept; ++ virtual const char * what () const noexcept; ++ ++ private: ++ std::string m_ex; ++ }; ++ ++ class Dict ++ { ++ friend class enchant::Broker; ++ ++ public: ++ ++ ~Dict (); ++ ++ bool check (const std::string & utf8word); ++ void suggest (const std::string & utf8word, ++ std::vector & out_suggestions); ++ ++ std::vector suggest (const std::string & utf8word) { ++ std::vector result; ++ suggest (utf8word, result); ++ return result; ++ } ++ ++ void add (const std::string & utf8word); ++ void add_to_session (const std::string & utf8word); ++ bool is_added (const std::string & utf8word); ++ void remove (const std::string & utf8word); ++ void remove_from_session (const std::string & utf8word); ++ bool is_removed (const std::string & utf8word); ++ void store_replacement (const std::string & utf8bad, ++ const std::string & utf8good); ++ ++ const std::string & get_lang () const { ++ return m_lang; ++ } ++ ++ const std::string & get_provider_name () const { ++ return m_provider_name; ++ } ++ ++ const std::string & get_provider_desc () const { ++ return m_provider_desc; ++ } ++ ++ const std::string & get_provider_file () const { ++ return m_provider_file; ++ } ++ ++ private: ++ ++ void * _private[5]; ++ ++ static void s_describe_fn (const char * const lang, ++ const char * const provider_name, ++ const char * const provider_desc, ++ const char * const provider_file, ++ void * user_data) { ++ enchant::Dict * dict = static_cast (user_data); ++ ++ dict->m_lang = lang; ++ dict->m_provider_name = provider_name; ++ dict->m_provider_desc = provider_desc; ++ dict->m_provider_file = provider_file; ++ } ++ ++ Dict (EnchantDict * dict, EnchantBroker * broker); ++ ++ Dict () = delete; ++ Dict (const Dict & rhs) = delete; ++ Dict& operator=(const Dict & rhs) = delete; ++ ++ EnchantDict * m_dict; ++ EnchantBroker * m_broker; ++ ++ std::string m_lang; ++ std::string m_provider_name; ++ std::string m_provider_desc; ++ std::string m_provider_file; ++ }; ++ ++ class Broker ++ { ++ ++ public: ++ ++ Broker (); ++ ~Broker (); ++ ++ Dict * request_dict (const std::string & lang); ++ Dict * request_pwl_dict (const std::string & pwl); ++ bool dict_exists (const std::string & lang); ++ void set_ordering (const std::string & tag, const std::string & ordering); ++ void describe (EnchantBrokerDescribeFn fn, void * user_data = nullptr); ++ void list_dicts (EnchantDictDescribeFn fn, void * user_data = nullptr); ++ ++ private: ++ ++ void * _private[5]; ++ ++ Broker (const Broker & rhs) = delete; ++ Broker& operator=(const Broker & rhs) = delete; ++ ++ EnchantBroker * m_broker; ++ }; ++ ++ namespace loader { ++ bool do_explicit_linking (); ++ } ++ ++} +diff --git a/Telegram/lib_spellcheck/spellcheck/platform/haiku/spellcheck_haiku.cpp b/Telegram/lib_spellcheck/spellcheck/platform/haiku/spellcheck_haiku.cpp +new file mode 100644 +index 0000000..d73aadc +--- /dev/null ++++ b/Telegram/lib_spellcheck/spellcheck/platform/haiku/spellcheck_haiku.cpp +@@ -0,0 +1,276 @@ ++// This file is part of Desktop App Toolkit, ++// a set of libraries for developing nice desktop applications. ++// ++// Author: Nicholas Guriev , public domain, 2019 ++// License: CC0, https://creativecommons.org/publicdomain/zero/1.0/legalcode ++ ++#include ++#include ++ ++#include "spellcheck/spellcheck_utils.h" ++#include "spellcheck/platform/haiku/haiku_enchant.h" ++ ++#include "spellcheck/platform/haiku/spellcheck_haiku.h" ++#include "base/integration.h" ++ ++namespace Platform::Spellchecker { ++namespace { ++ ++constexpr auto kHspell = "hspell"; ++constexpr auto kMySpell = "myspell"; ++constexpr auto kHunspell = "hunspell"; ++constexpr auto kOrdering = "hspell,aspell,hunspell,myspell"; ++constexpr auto kMaxValidators = 10; ++constexpr auto kMaxMySpellCount = 3; ++constexpr auto kMaxWordLength = 15; ++ ++using DictPtr = std::unique_ptr; ++ ++auto CheckProvider(DictPtr &validator, const std::string &provider) { ++ auto p = validator->get_provider_name(); ++ std::transform(begin(p), end(p), begin(p), ::tolower); ++ return (p.find(provider) == 0); // startsWith. ++} ++ ++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; ++} ++ ++class EnchantSpellChecker { ++public: ++ auto knownLanguages(); ++ bool checkSpelling(const QString &word); ++ auto findSuggestions(const QString &word); ++ void addWord(const QString &wordToAdd); ++ void ignoreWord(const QString &word); ++ void removeWord(const QString &word); ++ bool isWordInDictionary(const QString &word); ++ static EnchantSpellChecker *instance(); ++ ++private: ++ EnchantSpellChecker(); ++ EnchantSpellChecker(const EnchantSpellChecker&) = delete; ++ EnchantSpellChecker& operator =(const EnchantSpellChecker&) = delete; ++ ++ std::unique_ptr _brokerHandle; ++ std::vector _validators; ++ ++ std::vector> _hspells; ++}; ++ ++EnchantSpellChecker::EnchantSpellChecker() { ++ std::set langs; ++ _brokerHandle = std::make_unique(); ++ _brokerHandle->list_dicts([]( ++ const char *language, ++ const char *provider, ++ const char *description, ++ const char *filename, ++ void *our_payload) { ++ static_cast(our_payload)->insert(language); ++ }, &langs); ++ _validators.reserve(langs.size()); ++ try { ++ std::string langTag = QLocale::system().name().toStdString(); ++ _brokerHandle->set_ordering(langTag, kOrdering); ++ _validators.push_back(DictPtr(_brokerHandle->request_dict(langTag))); ++ langs.erase(langTag); ++ } catch (const enchant::Exception &e) { ++ // no first dictionary found ++ } ++ auto mySpellCount = 0; ++ for (const std::string &language : langs) { ++ try { ++ _brokerHandle->set_ordering(language, kOrdering); ++ auto validator = DictPtr(_brokerHandle->request_dict(language)); ++ if (!validator) { ++ continue; ++ } ++ if (CheckProvider(validator, kHspell)) { ++ _hspells.push_back(validator.get()); ++ } ++ if (CheckProvider(validator, kMySpell) ++ || CheckProvider(validator, kHunspell)) { ++ if (mySpellCount > kMaxMySpellCount) { ++ continue; ++ } else { ++ mySpellCount++; ++ } ++ } ++ _validators.push_back(std::move(validator)); ++ if (_validators.size() > kMaxValidators) { ++ break; ++ } ++ } catch (const enchant::Exception &e) { ++ base::Integration::Instance().logMessage(QString("Catch after request_dict: ") + e.what()); ++ } ++ } ++} ++ ++EnchantSpellChecker *EnchantSpellChecker::instance() { ++ static EnchantSpellChecker capsule; ++ return &capsule; ++} ++ ++auto EnchantSpellChecker::knownLanguages() { ++ return _validators | ranges::views::transform([](const auto &validator) { ++ return QString(validator->get_lang().c_str()); ++ }) | ranges::to_vector; ++} ++ ++bool EnchantSpellChecker::checkSpelling(const QString &word) { ++ auto w = word.toStdString(); ++ ++ if (IsHebrew(word) && _hspells.size()) { ++ return ranges::any_of(_hspells, [&](const auto &validator) { ++ return validator->check(w); ++ }); ++ } ++ return ranges::any_of(_validators, [&](const auto &validator) { ++ // Hspell is the spell checker that only checks words in Hebrew. ++ // It returns 'true' for any non-Hebrew word, ++ // so we should skip Hspell if a word is not in Hebrew. ++ if (ranges::find_if(_hspells, [&](auto &v) { ++ return v == validator.get(); ++ }) != _hspells.end()) { ++ return false; ++ } ++ if (validator->get_lang().find("uk") == 0) { ++ return false; ++ } ++ try { ++ return validator->check(w); ++ } catch (const enchant::Exception &e) { ++ base::Integration::Instance().logMessage(QString("Catch after check '") + word + "': " + e.what()); ++ return true; ++ } ++ }) || _validators.empty(); ++} ++ ++auto EnchantSpellChecker::findSuggestions(const QString &word) { ++ const auto wordScript = ::Spellchecker::WordScript(&word); ++ auto w = word.toStdString(); ++ std::vector result; ++ if (!_validators.size()) { ++ return result; ++ } ++ ++ const auto convertSuggestions = [&](auto suggestions) { ++ for (const auto &replacement : suggestions) { ++ if (result.size() >= kMaxSuggestions) { ++ break; ++ } ++ if (!replacement.empty()) { ++ result.push_back(replacement.c_str()); ++ } ++ } ++ }; ++ ++ if (word.size() >= kMaxWordLength) { ++ // The first element is the validator of the system language. ++ auto *v = _validators[0].get(); ++ const auto lang = QString::fromStdString(v->get_lang()); ++ if (wordScript == ::Spellchecker::LocaleToScriptCode(lang)) { ++ convertSuggestions(v->suggest(w)); ++ } ++ return result; ++ } ++ ++ if (IsHebrew(word) && _hspells.size()) { ++ for (const auto &h : _hspells) { ++ convertSuggestions(h->suggest(w)); ++ if (result.size()) { ++ return result; ++ } ++ } ++ } ++ for (const auto &validator : _validators) { ++ const auto lang = QString::fromStdString(validator->get_lang()); ++ if (wordScript != ::Spellchecker::LocaleToScriptCode(lang)) { ++ continue; ++ } ++ convertSuggestions(validator->suggest(w)); ++ if (!result.empty()) { ++ break; ++ } ++ } ++ return result; ++} ++ ++void EnchantSpellChecker::addWord(const QString &wordToAdd) { ++ auto word = wordToAdd.toStdString(); ++ auto &&first = _validators.at(0); ++ first->add(word); ++ first->add_to_session(word); ++} ++ ++void EnchantSpellChecker::ignoreWord(const QString &word) { ++ _validators.at(0)->add_to_session(word.toStdString()); ++} ++ ++void EnchantSpellChecker::removeWord(const QString &word) { ++ auto w = word.toStdString(); ++ for (const auto &validator : _validators) { ++ validator->remove_from_session(w); ++ validator->remove(w); ++ } ++} ++ ++bool EnchantSpellChecker::isWordInDictionary(const QString &word) { ++ auto w = word.toStdString(); ++ return ranges::any_of(_validators, [&w](const auto &validator) { ++ return validator->is_added(w); ++ }); ++} ++ ++} // namespace ++ ++void Init() { ++} ++ ++bool IsAvailable() { ++ static auto Available = enchant::loader::do_explicit_linking(); ++ return Available; ++} ++ ++void KnownLanguages(std::vector *langCodes) { ++ *langCodes = EnchantSpellChecker::instance()->knownLanguages(); ++} ++ ++bool CheckSpelling(const QString &wordToCheck) { ++ return EnchantSpellChecker::instance()->checkSpelling(wordToCheck); ++} ++ ++void FillSuggestionList( ++ const QString &wrongWord, ++ std::vector *variants) { ++ *variants = EnchantSpellChecker::instance()->findSuggestions(wrongWord); ++} ++ ++void AddWord(const QString &word) { ++ EnchantSpellChecker::instance()->addWord(word); ++} ++ ++void RemoveWord(const QString &word) { ++ EnchantSpellChecker::instance()->removeWord(word); ++} ++ ++void IgnoreWord(const QString &word) { ++ EnchantSpellChecker::instance()->ignoreWord(word); ++} ++ ++bool IsWordInDictionary(const QString &wordToCheck) { ++ return EnchantSpellChecker::instance()->isWordInDictionary(wordToCheck); ++} ++ ++void CheckSpellingText( ++ const QString &text, ++ MisspelledWords *misspelledWords) { ++ *misspelledWords = ::Spellchecker::RangesFromText( ++ text, ++ ::Spellchecker::CheckSkipAndSpell); ++} ++ ++} // namespace Platform::Spellchecker +diff --git a/Telegram/lib_spellcheck/spellcheck/platform/haiku/spellcheck_haiku.h b/Telegram/lib_spellcheck/spellcheck/platform/haiku/spellcheck_haiku.h +new file mode 100644 +index 0000000..49d672c +--- /dev/null ++++ b/Telegram/lib_spellcheck/spellcheck/platform/haiku/spellcheck_haiku.h +@@ -0,0 +1,13 @@ ++// This file is part of Desktop App Toolkit, ++// a set of libraries for developing nice desktop applications. ++// ++// For license and copyright information please follow this link: ++// https://github.com/desktop-app/legal/blob/master/LEGAL ++// ++#pragma once ++ ++#include "spellcheck/platform/platform_spellcheck.h" ++ ++namespace Platform::Spellchecker { ++ ++} // namespace Platform::Spellchecker diff --git a/Telegram/lib_spellcheck/spellcheck/platform/platform_spellcheck.h b/Telegram/lib_spellcheck/spellcheck/platform/platform_spellcheck.h -index 6ad7201..89cf176 100644 +index 6ad7201..333d642 100644 --- a/Telegram/lib_spellcheck/spellcheck/platform/platform_spellcheck.h +++ b/Telegram/lib_spellcheck/spellcheck/platform/platform_spellcheck.h -@@ -39,6 +39,6 @@ void CheckSpellingText( +@@ -39,6 +39,8 @@ void CheckSpellingText( #include "spellcheck/platform/mac/spellcheck_mac.h" #elif defined Q_OS_WIN // Q_OS_MAC #include "spellcheck/platform/win/spellcheck_win.h" -#elif defined Q_OS_WINRT || defined Q_OS_LINUX // Q_OS_MAC || Q_OS_WIN -+#elif defined Q_OS_WINRT || defined Q_OS_LINUX || defined Q_OS_HAIKU // Q_OS_MAC || Q_OS_WIN ++#elif defined Q_OS_HAIKU // Q_OS_MAC || Q_OS_WIN ++#include "spellcheck/platform/haiku/spellcheck_haiku.h" ++#elif defined Q_OS_WINRT || defined Q_OS_LINUX // Q_OS_MAC || Q_OS_WIN || Q_OS_HAIKU #include "spellcheck/platform/linux/spellcheck_linux.h" -#endif // Q_OS_MAC || Q_OS_WIN || Q_OS_WINRT || Q_OS_LINUX +#endif // Q_OS_MAC || Q_OS_WIN || Q_OS_WINRT || Q_OS_LINUX || defined Q_OS_HAIKU -diff --git a/Telegram/lib_storage/CMakeLists.txt b/Telegram/lib_storage/CMakeLists.txt -index b5a2576..3c74381 100644 ---- a/Telegram/lib_storage/CMakeLists.txt -+++ b/Telegram/lib_storage/CMakeLists.txt -@@ -15,7 +15,6 @@ nice_target_sources(lib_storage ${src_loc} - PRIVATE - storage/storage_clear_legacy.cpp - storage/storage_clear_legacy_posix.cpp -- storage/storage_clear_legacy_win.cpp - storage/storage_clear_legacy.h - storage/storage_databases.cpp - storage/storage_databases.h -@@ -36,7 +35,6 @@ PRIVATE - storage/cache/storage_cache_types.cpp - storage/cache/storage_cache_types.h - storage/storage_clear_legacy_posix.cpp -- storage/storage_clear_legacy_win.cpp - ) - - target_include_directories(lib_storage diff --git a/Telegram/lib_ui/CMakeLists.txt b/Telegram/lib_ui/CMakeLists.txt -index 687b25f..e18a853 100644 +index 81bf4d1..4b462bd 100644 --- a/Telegram/lib_ui/CMakeLists.txt +++ b/Telegram/lib_ui/CMakeLists.txt -@@ -21,9 +21,7 @@ set(style_files - ) - set(qrc_files - fonts/fonts.qrc -- qt_conf/linux.qrc -- qt_conf/mac.qrc -- qt_conf/win.qrc -+ qt_conf/haiku.qrc - ) - - generate_palette(lib_ui ui/colors.palette) -@@ -70,24 +68,10 @@ PRIVATE - ui/layers/layer_manager.h - ui/layers/layer_widget.cpp - ui/layers/layer_widget.h -- ui/platform/linux/ui_window_linux.cpp -- ui/platform/linux/ui_window_linux.h -- ui/platform/linux/ui_utility_linux.cpp -- ui/platform/linux/ui_utility_linux.h -- ui/platform/mac/ui_window_mac.h -- ui/platform/mac/ui_window_mac.mm -- ui/platform/mac/ui_window_title_mac.h -- ui/platform/mac/ui_window_title_mac.mm -- ui/platform/mac/ui_utility_mac.h -- ui/platform/mac/ui_utility_mac.mm -- ui/platform/win/ui_window_shadow_win.cpp -- ui/platform/win/ui_window_shadow_win.h -- ui/platform/win/ui_window_title_win.cpp -- ui/platform/win/ui_window_title_win.h -- ui/platform/win/ui_window_win.cpp -- ui/platform/win/ui_window_win.h -- ui/platform/win/ui_utility_win.cpp -- ui/platform/win/ui_utility_win.h +@@ -85,6 +85,10 @@ PRIVATE + ui/platform/win/ui_window_win.h + ui/platform/win/ui_utility_win.cpp + ui/platform/win/ui_utility_win.h + ui/platform/haiku/ui_window_haiku.cpp + ui/platform/haiku/ui_window_haiku.h + ui/platform/haiku/ui_utility_haiku.cpp @@ -4070,10 +4474,10 @@ index 0000000..b4f4fe2 + +#include "ui/platform/ui_platform_window.h" diff --git a/Telegram/lib_ui/ui/platform/ui_platform_utility.h b/Telegram/lib_ui/ui/platform/ui_platform_utility.h -index d253c91..2034204 100644 +index dec7e12..f24be72 100644 --- a/Telegram/lib_ui/ui/platform/ui_platform_utility.h +++ b/Telegram/lib_ui/ui/platform/ui_platform_utility.h -@@ -36,8 +36,10 @@ void DrainMainQueue(); // Needed only if UseMainQueueGeneric() is false. +@@ -37,8 +37,10 @@ void DrainMainQueue(); // Needed only if UseMainQueueGeneric() is false. #ifdef Q_OS_MAC #include "ui/platform/mac/ui_utility_mac.h" @@ -4087,24 +4491,6 @@ index d253c91..2034204 100644 #include "ui/platform/win/ui_utility_win.h" -#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN +#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN || Q_OS_HAIKU -diff --git a/Telegram/lib_ui/ui/style/style_core_font.cpp b/Telegram/lib_ui/ui/style/style_core_font.cpp -index cfe2111..fdb8f22 100644 ---- a/Telegram/lib_ui/ui/style/style_core_font.cpp -+++ b/Telegram/lib_ui/ui/style/style_core_font.cpp -@@ -20,9 +20,11 @@ void style_InitFontsResource() { - Q_INIT_RESOURCE(win); - #elif defined Q_OS_MAC // Q_OS_WIN - Q_INIT_RESOURCE(mac); --#else // Q_OS_WIN || Q_OS_MAC -+#elif defined Q_OS_HAIKU // Q_OS_WIN || Q_OS_MAC -+ Q_INIT_RESOURCE(haiku); -+#else // Q_OS_WIN || Q_OS_MAC || Q_OS_HAIKU - Q_INIT_RESOURCE(linux); --#endif // Q_OS_WIN || Q_OS_MAC || Q_OS_LINUX -+#endif // Q_OS_WIN || Q_OS_MAC || Q_OS_LINUX || Q_OS_HAIKU - } - - namespace style { diff --git a/cmake/external.cmake b/cmake/external.cmake new file mode 100644 index 0000000..a6c28f1 @@ -4239,23 +4625,53 @@ index 4187ad3..68e36e3 100644 add_subdirectory(variant) add_subdirectory(xxhash) -add_subdirectory(zlib) -diff --git a/cmake/init_target.cmake b/cmake/init_target.cmake -index c7a1244..fc691a6 100644 ---- a/cmake/init_target.cmake -+++ b/cmake/init_target.cmake -@@ -27,7 +27,6 @@ function(init_target target_name) # init_target(my_target folder_name) - endif() - target_link_libraries(${target_name} PUBLIC desktop-app::common_options) - set_target_properties(${target_name} PROPERTIES -- LINK_SEARCH_START_STATIC 1 - XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_WEAK YES - XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN YES - XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES +diff --git a/cmake/nice_target_sources.cmake b/cmake/nice_target_sources.cmake +index 2ac58d4..6aed2b8 100644 +--- a/cmake/nice_target_sources.cmake ++++ b/cmake/nice_target_sources.cmake +@@ -15,6 +15,7 @@ function(nice_target_sources target_name src_loc) + set(not_win_sources "") + set(not_mac_sources "") + set(not_linux_sources "") ++ set(not_haiku_sources "") + foreach (entry ${list}) + if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") + set(writing_now ${entry}) +@@ -23,12 +24,19 @@ function(nice_target_sources target_name src_loc) + if (${entry} MATCHES "(^|/)win/" OR ${entry} MATCHES "(^|/)winrc/" OR ${entry} MATCHES "(^|/)windows/" OR ${entry} MATCHES "[_\\/]win\\.") + list(APPEND not_mac_sources ${full_name}) + list(APPEND not_linux_sources ${full_name}) ++ list(APPEND not_haiku_sources ${full_name}) + elseif (${entry} MATCHES "(^|/)mac/" OR ${entry} MATCHES "(^|/)darwin/" OR ${entry} MATCHES "(^|/)osx/" OR ${entry} MATCHES "[_\\/]mac\\." OR ${entry} MATCHES "[_\\/]darwin\\." OR ${entry} MATCHES "[_\\/]osx\\.") + list(APPEND not_win_sources ${full_name}) + list(APPEND not_linux_sources ${full_name}) ++ list(APPEND not_haiku_sources ${full_name}) + elseif (${entry} MATCHES "(^|/)linux/" OR ${entry} MATCHES "[_\\/]linux\\.") + list(APPEND not_win_sources ${full_name}) + list(APPEND not_mac_sources ${full_name}) ++ list(APPEND not_haiku_sources ${full_name}) ++ elseif (${entry} MATCHES "(^|/)haiku/" OR ${entry} MATCHES "[_\\/]haiku\\.") ++ list(APPEND not_win_sources ${full_name}) ++ list(APPEND not_mac_sources ${full_name}) ++ list(APPEND not_linux_sources ${full_name}) + elseif (${entry} MATCHES "(^|/)posix/" OR ${entry} MATCHES "[_\\/]posix\\.") + list(APPEND not_win_sources ${full_name}) + endif() +@@ -64,6 +72,9 @@ function(nice_target_sources target_name src_loc) + elseif (APPLE) + set_source_files_properties(${not_mac_sources} PROPERTIES HEADER_FILE_ONLY TRUE) + set_source_files_properties(${not_mac_sources} PROPERTIES SKIP_AUTOGEN TRUE) ++ elseif (HAIKU) ++ set_source_files_properties(${not_haiku_sources} PROPERTIES HEADER_FILE_ONLY TRUE) ++ set_source_files_properties(${not_haiku_sources} PROPERTIES SKIP_AUTOGEN TRUE) + elseif (LINUX) + set_source_files_properties(${not_linux_sources} PROPERTIES HEADER_FILE_ONLY TRUE) + set_source_files_properties(${not_linux_sources} PROPERTIES SKIP_AUTOGEN TRUE) diff --git a/cmake/options.cmake b/cmake/options.cmake -index 56dbe48..59d191a 100644 +index a207f28..f76f093 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake -@@ -23,6 +23,8 @@ if (WIN32) +@@ -30,6 +30,8 @@ if (WIN32) include(cmake/options_win.cmake) elseif (APPLE) include(cmake/options_mac.cmake) @@ -4266,10 +4682,10 @@ index 56dbe48..59d191a 100644 else() diff --git a/cmake/options_haiku.cmake b/cmake/options_haiku.cmake new file mode 100644 -index 0000000..677cb36 +index 0000000..063f1ce --- /dev/null +++ b/cmake/options_haiku.cmake -@@ -0,0 +1,31 @@ +@@ -0,0 +1,30 @@ +# This file is part of Telegram Desktop for Haiku +# For license and copyright information please follow this link: +# https://github.com/desktop-app/legal/blob/master/LEGAL @@ -4277,8 +4693,7 @@ index 0000000..677cb36 + +target_compile_options(common_options +INTERFACE -+ $,,-O3 -fno-strict-aliasing> -+ -pipe ++ $,,-Ofast -fno-strict-aliasing> + -fPIC + -mmmx + -msse2 @@ -4299,13 +4714,13 @@ index 0000000..677cb36 +) +target_link_options(common_options +INTERFACE -+ $,,-O3> ++ $,,-Ofast> +) diff --git a/cmake/variables.cmake b/cmake/variables.cmake -index b3d7ff4..37fd1eb 100644 +index d53ed08..f0ad4ad 100644 --- a/cmake/variables.cmake +++ b/cmake/variables.cmake -@@ -37,6 +37,7 @@ set(build_osx 0) +@@ -34,6 +34,7 @@ set(build_osx 0) set(build_macstore 0) set(build_winstore 0) set(build_linux32 0) @@ -4313,10 +4728,10 @@ index b3d7ff4..37fd1eb 100644 if (WIN32) if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp") -@@ -57,6 +58,12 @@ elseif (APPLE) - report_bad_special_target() +@@ -45,6 +46,12 @@ elseif (APPLE) + elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "mas") + set(build_macstore 1) endif() - set(DESKTOP_APP_USE_GLIBC_WRAPS OFF) +elseif (HAIKU) + set(build_haiku 1) + set(DESKTOP_APP_USE_GLIBC_WRAPS OFF) @@ -4324,17 +4739,15 @@ index b3d7ff4..37fd1eb 100644 + set(CMAKE_RANLIB gcc-ranlib) + set(CMAKE_NM gcc-nm) else() - set(LINUX 1) execute_process(COMMAND uname -m OUTPUT_VARIABLE machine_uname) -@@ -79,8 +86,10 @@ else() - set(CMAKE_NM /usr/bin/gcc-nm) + if (CMAKE_SIZEOF_VOID_P EQUAL 4) +@@ -66,8 +73,8 @@ else() + endif() endif() -if (NOT APPLE OR build_osx) - get_filename_component(libs_loc "../Libraries" REALPATH) -+if (HAIKU) -+ get_filename_component(libs_loc "Telegram/ThirdParty" REALPATH) -+elseif (NOT APPLE OR build_osx) ++if (NOT APPLE OR build_osx OR build_haiku) + get_filename_component(libs_loc "Telegram/ThirdParty" REALPATH) else() get_filename_component(libs_loc "../Libraries/macos" REALPATH) @@ -4342,104 +4755,3 @@ index b3d7ff4..37fd1eb 100644 -- 2.24.1 - -From bcce700284bed71887c9cba091ea51dab14f8c92 Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Mon, 6 Jan 2020 21:41:41 +1000 -Subject: Don't include SupportDefs.h - - -diff --git a/Telegram/SourceFiles/calls/calls_call.cpp b/Telegram/SourceFiles/calls/calls_call.cpp -index 01f7cc4..ae79d2f 100644 ---- a/Telegram/SourceFiles/calls/calls_call.cpp -+++ b/Telegram/SourceFiles/calls/calls_call.cpp -@@ -5,6 +5,7 @@ the official desktop application for the Telegram messaging service. - For license and copyright information please follow this link: - https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL - */ -+ - #include "calls/calls_call.h" - - #include "main/main_session.h" -@@ -27,12 +28,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL - #define NEED_TO_RESTORE_SLOTS - #endif // slots - --#ifdef __x86_64__ --#define int64 XXX --#define uint64 YYY --#else --#define int32 XXX --#define uint32 YYY -+// Don't include SupportDefs.h -+#ifdef __HAIKU__ -+#define _SUPPORT_DEFS_H -+typedef int32 status_t; -+typedef uint32 type_code; - #endif - - #include -diff --git a/Telegram/SourceFiles/settings/settings_calls.cpp b/Telegram/SourceFiles/settings/settings_calls.cpp -index 9eb64e8..e592a75 100644 ---- a/Telegram/SourceFiles/settings/settings_calls.cpp -+++ b/Telegram/SourceFiles/settings/settings_calls.cpp -@@ -5,6 +5,7 @@ the official desktop application for the Telegram messaging service. - For license and copyright information please follow this link: - https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL - */ -+ - #include "settings/settings_calls.h" - - #include "settings/settings_common.h" -@@ -31,12 +32,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL - #define NEED_TO_RESTORE_SLOTS - #endif // slots - --#ifdef __x86_64__ --#define int64 XXX --#define uint64 YYY --#else --#define int32 XXX --#define uint32 YYY -+// Don't include SupportDefs.h -+#ifdef __HAIKU__ -+#define _SUPPORT_DEFS_H -+typedef int32 status_t; -+typedef uint32 type_code; - #endif - - #include --- -2.24.1 - - -From 156d8e7b9b8f6ba585d469595756ff697a6e1d0e Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Tue, 7 Jan 2020 12:57:27 +1000 -Subject: Remove -pipe compiler options and use -Ofast optimisation - - -diff --git a/cmake/options_haiku.cmake b/cmake/options_haiku.cmake -index 677cb36..063f1ce 100644 ---- a/cmake/options_haiku.cmake -+++ b/cmake/options_haiku.cmake -@@ -5,8 +5,7 @@ - - target_compile_options(common_options - INTERFACE -- $,,-O3 -fno-strict-aliasing> -- -pipe -+ $,,-Ofast -fno-strict-aliasing> - -fPIC - -mmmx - -msse2 -@@ -27,5 +26,5 @@ INTERFACE - ) - target_link_options(common_options - INTERFACE -- $,,-O3> -+ $,,-Ofast> - ) --- -2.24.1 - diff --git a/net-im/telegram-desktop/telegram_desktop-1.9.3.recipe b/net-im/telegram-desktop/telegram_desktop-1.9.4.recipe similarity index 85% rename from net-im/telegram-desktop/telegram_desktop-1.9.3.recipe rename to net-im/telegram-desktop/telegram_desktop-1.9.4.recipe index 66f9d86fa..855827b44 100644 --- a/net-im/telegram-desktop/telegram_desktop-1.9.3.recipe +++ b/net-im/telegram-desktop/telegram_desktop-1.9.4.recipe @@ -1,21 +1,17 @@ SUMMARY="Telegram Desktop Messenger" DESCRIPTION="Unofficial build of the original Telegram client for Haiku." HOMEPAGE="https://www.telegram.org/" -COPYRIGHT="2013-2019 Telegram" +COPYRIGHT="2013-2020 Telegram" LICENSE="GNU GPL v3" -REVISION="2" +REVISION="1" SOURCE_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v$portVersion/tdesktop-$portVersion-full.tar.gz" -CHECKSUM_SHA256="ca9c67369140952d5ffe404ca082517193e3832b2c21ba1af791f078e4d9a7bb" +CHECKSUM_SHA256="9ef7ac0e97629dec7ff68aea54f517a40c4a41fa9197f205bd4431d0e37abad1" SOURCE_FILENAME="tdesktop-$portVersion-full.tar.gz" SOURCE_DIR="tdesktop-$portVersion-full" -srcGitRev_2="8a732ee6736af8af024b5b2032580b85a9be8239" -SOURCE_URI_2="https://github.com/ericniebler/range-v3/archive/$srcGitRev_2.tar.gz" -CHECKSUM_SHA256_2="6cd6a412db92bf3c26a408f5807751f976b4a4cb2801c705cb63001e53b47a11" -SOURCE_FILENAME_2="range-$srcGitRev_2.tar.gz" -srcGitRev_3="0663103551379b958b2e79c51d51d163ec484300" -SOURCE_URI_3="https://salsa.debian.org/debian/telegram-desktop/raw/$srcGitRev_3/debian/rules#noarchive" -CHECKSUM_SHA256_3="2b24fb808acee36b5a15824c4ff8bd8b8e83a326a9e4593d2b21922425c5ffb3" +srcGitRev_2="0663103551379b958b2e79c51d51d163ec484300" +SOURCE_URI_2="https://salsa.debian.org/debian/telegram-desktop/raw/$srcGitRev_2/debian/rules#noarchive" +CHECKSUM_SHA256_2="2b24fb808acee36b5a15824c4ff8bd8b8e83a326a9e4593d2b21922425c5ffb3" PATCHES="telegram_desktop-$portVersion.patchset" ADDITIONAL_FILES=" @@ -51,6 +47,7 @@ REQUIRES=" lib:libQt5Widgets$secondaryArchSuffix lib:libswresample$secondaryArchSuffix lib:libswscale$secondaryArchSuffix + lib:libxxhash$secondaryArchSuffix lib:libz$secondaryArchSuffix " @@ -75,12 +72,14 @@ BUILD_REQUIRES=" devel:librapidjson$secondaryArchSuffix devel:libswresample$secondaryArchSuffix devel:libswscale$secondaryArchSuffix + devel:libxxhash$secondaryArchSuffix devel:libz$secondaryArchSuffix + devel:range_v3$secondaryArchSuffix " BUILD_PREREQUIRES=" cmd:cmake cmd:gcc$secondaryArchSuffix - cmd:lrelease$secondaryArchSuffix + cmd:lrelease$secondaryArchSuffix >= 5 cmd:make cmd:pkg_config$secondaryArchSuffix cmd:python @@ -94,11 +93,9 @@ PATCH() BUILD() { - ln -sfn $sourceDir2/range-v3-$srcGitRev_2 Telegram/ThirdParty/range-v3 - # get API_ID and API_HASH from Debian - local TELEGRAM_API_ID=`sed -n 's/TELEGRAM_API_ID = \(.*\)/\1/p' < $sourceDir3/rules` - local TELEGRAM_API_HASH=`sed -n 's/TELEGRAM_API_HASH = \(.*\)/\1/p' < $sourceDir3/rules` + local TELEGRAM_API_ID=`sed -n 's/TELEGRAM_API_ID = \(.*\)/\1/p' < $sourceDir2/rules` + local TELEGRAM_API_HASH=`sed -n 's/TELEGRAM_API_HASH = \(.*\)/\1/p' < $sourceDir2/rules` if [ -z $TELEGRAM_API_ID ] || [ -z $TELEGRAM_API_HASH ]; then TELEGRAM_API_ID="17349" @@ -121,6 +118,8 @@ BUILD() -DTDESKTOP_API_TEST=OFF \ -DTDESKTOP_DISABLE_DESKTOP_FILE_GENERATION=ON \ -DTDESKTOP_DISABLE_GTK_INTEGRATION=ON \ + -DDESKTOP_APP_USE_PACKAGED_RLOTTIE=OFF \ + -DTDESKTOP_USE_PACKAGED_TGVOIP=OFF \ -DTDESKTOP_API_ID=$TELEGRAM_API_ID \ -DTDESKTOP_API_HASH=$TELEGRAM_API_HASH @@ -139,7 +138,7 @@ INSTALL() { mkdir -p $appsDir $prefix/bin cp build/tg-notify-gate $prefix/bin - cp build/bin/telegram-desktop $appsDir/Telegram + cp build/bin/Telegram $appsDir strip $appsDir/Telegram local APP_SIGNATURE="application/x-vnd.telegram"