From 4c9ca61e0e88b0e2b3f51397c1e3a38d461805b5 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Mon, 24 Sep 2018 00:24:23 +1000 Subject: [PATCH] Telegram: fix build --- .../patches/telegram_desktop-1.3.16.patchset | 771 +++++++++++++++++- .../telegram_desktop-1.3.16.recipe | 3 - 2 files changed, 769 insertions(+), 5 deletions(-) diff --git a/net-im/telegram-desktop/patches/telegram_desktop-1.3.16.patchset b/net-im/telegram-desktop/patches/telegram_desktop-1.3.16.patchset index f2b7bfb70..e2b1bc6b5 100644 --- a/net-im/telegram-desktop/patches/telegram_desktop-1.3.16.patchset +++ b/net-im/telegram-desktop/patches/telegram_desktop-1.3.16.patchset @@ -1,6 +1,6 @@ -From 930c73c90b840248cf1fd3a75bb3b672a47a5a0b Mon Sep 17 00:00:00 2001 +From 9ead81be3d11cff9ae7a7e5e818d3d4706b4444d Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Sun, 23 Sep 2018 23:33:52 +1000 +Date: Mon, 24 Sep 2018 00:18:28 +1000 Subject: Add Haiku support @@ -12,6 +12,18 @@ index 0000000..6d80862 @@ -0,0 +1,2 @@ +[Paths] +Libraries=:/gui/art +diff --git a/Telegram/Resources/qrc/telegram_emoji.qrc b/Telegram/Resources/qrc/telegram_emoji.qrc +index bb9ce0a..47a0c05 100644 +--- a/Telegram/Resources/qrc/telegram_emoji.qrc ++++ b/Telegram/Resources/qrc/telegram_emoji.qrc +@@ -2,7 +2,5 @@ + + ../art/emoji.webp + ../art/emoji_125x.webp +- ../art/emoji_150x.webp +- ../art/emoji_200x.webp + + diff --git a/Telegram/Resources/qrc/telegram_emoji2.qrc b/Telegram/Resources/qrc/telegram_emoji2.qrc new file mode 100644 index 0000000..e1ddb8d @@ -35,6 +47,300 @@ index 0000000..33115f9 + ../etc/qt_haiku.conf + + +diff --git a/Telegram/SourceFiles/base/algorithm_tests.cpp b/Telegram/SourceFiles/base/algorithm_tests.cpp +index 9e3df82..3092663 100644 +--- a/Telegram/SourceFiles/base/algorithm_tests.cpp ++++ b/Telegram/SourceFiles/base/algorithm_tests.cpp +@@ -5,7 +5,11 @@ 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 + */ ++#if !defined(Q_OS_HAIKU) + #include "catch.hpp" ++#else ++#include "../ThirdParty/variant/test/include/catch.hpp" ++#endif + + #include "base/index_based_iterator.h" + +@@ -47,4 +51,4 @@ TEST_CASE("index_based_iterator tests", "[base::algorithm]") { + auto expected = std::vector { 5 }; + REQUIRE(v == expected); + } +-} +\ No newline at end of file ++} +diff --git a/Telegram/SourceFiles/base/build_config.h b/Telegram/SourceFiles/base/build_config.h +index 3bcb595..b97d66a 100644 +--- a/Telegram/SourceFiles/base/build_config.h ++++ b/Telegram/SourceFiles/base/build_config.h +@@ -17,13 +17,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + #define OS_LINUX 1 + #elif defined(_WIN32) // __APPLE__ || __linux__ + #define OS_WIN 1 ++#elif defined(__HAIKU__) ++#define OS_HAIKU 1 + #else // __APPLE__ || __linux__ || _WIN32 + #error Please add support for your platform in base/build_config.h + #endif // else for __APPLE__ || __linux__ || _WIN32 + + // For access to standard POSIXish features, use OS_POSIX instead of a + // more specific macro. +-#if defined(OS_MAC) || defined(OS_LINUX) ++#if defined(OS_MAC) || defined(OS_LINUX) || defined(OS_HAIKU) + #define OS_POSIX 1 + #endif // OS_MAC || OS_LINUX + +diff --git a/Telegram/SourceFiles/base/flags_tests.cpp b/Telegram/SourceFiles/base/flags_tests.cpp +index 786dc49..b1ed887 100644 +--- a/Telegram/SourceFiles/base/flags_tests.cpp ++++ b/Telegram/SourceFiles/base/flags_tests.cpp +@@ -5,7 +5,11 @@ 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 + */ ++#if !defined(Q_OS_HAIKU) + #include "catch.hpp" ++#else ++#include "../ThirdParty/variant/test/include/catch.hpp" ++#endif + + #include "base/flags.h" + +diff --git a/Telegram/SourceFiles/base/flat_map_tests.cpp b/Telegram/SourceFiles/base/flat_map_tests.cpp +index b2fc899..429a2c3 100644 +--- a/Telegram/SourceFiles/base/flat_map_tests.cpp ++++ b/Telegram/SourceFiles/base/flat_map_tests.cpp +@@ -5,7 +5,11 @@ 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 + */ ++#if !defined(Q_OS_HAIKU) + #include "catch.hpp" ++#else ++#include "../ThirdParty/variant/test/include/catch.hpp" ++#endif + + #include "base/flat_map.h" + #include +diff --git a/Telegram/SourceFiles/base/flat_set_tests.cpp b/Telegram/SourceFiles/base/flat_set_tests.cpp +index a73f1d2..77d98a6 100644 +--- a/Telegram/SourceFiles/base/flat_set_tests.cpp ++++ b/Telegram/SourceFiles/base/flat_set_tests.cpp +@@ -5,7 +5,11 @@ 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 + */ ++#if !defined(Q_OS_HAIKU) + #include "catch.hpp" ++#else ++#include "../ThirdParty/variant/test/include/catch.hpp" ++#endif + + #include "base/flat_set.h" + +diff --git a/Telegram/SourceFiles/base/tests_main.cpp b/Telegram/SourceFiles/base/tests_main.cpp +index fbdcb56..0eb0e4f 100644 +--- a/Telegram/SourceFiles/base/tests_main.cpp ++++ b/Telegram/SourceFiles/base/tests_main.cpp +@@ -6,8 +6,12 @@ For license and copyright information please follow this link: + https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + */ + #define CATCH_CONFIG_RUNNER ++#if !defined(Q_OS_HAIKU) + #include "catch.hpp" + #include "reporters/catch_reporter_compact.hpp" ++#else ++#include "../ThirdParty/variant/test/include/catch.hpp" ++#endif + #include + + int (*TestForkedMethod)()/* = nullptr*/; +diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp +index 8a420c7..0ba85bd 100644 +--- a/Telegram/SourceFiles/core/launcher.cpp ++++ b/Telegram/SourceFiles/core/launcher.cpp +@@ -62,6 +62,10 @@ int Launcher::exec() { + + // I don't know why path is not in QT_PLUGIN_PATH by default + QCoreApplication::addLibraryPath("/usr/lib/qt/plugins"); ++#if defined(Q_OS_HAIKU) ++ QCoreApplication::addLibraryPath("/boot/system/add-ons/Qt5"); ++ QCoreApplication::addLibraryPath("/boot/system/add-ons/x86/Qt5"); ++#endif + // without this Telegram doesn't start on Ubuntu 17.04 due GTK errors + setenv("QT_STYLE_OVERRIDE", "qwerty", false); + // Telegram doesn't start when extraordinary theme is set, see launchpad.net/bugs/1680943 +@@ -142,6 +146,9 @@ void Launcher::prepareSettings() { + case dbipMacOld: + gPlatformString = qsl("MacOSold"); + break; ++ case dbipHaiku: ++ gPlatformString = qsl("HaikuDepot"); ++ break; + case dbipLinux64: + gPlatformString = qsl("Linux64bit"); + break; +diff --git a/Telegram/SourceFiles/core/update_checker.cpp b/Telegram/SourceFiles/core/update_checker.cpp +index 92fc35d..cf29c3a 100644 +--- a/Telegram/SourceFiles/core/update_checker.cpp ++++ b/Telegram/SourceFiles/core/update_checker.cpp +@@ -633,6 +633,7 @@ bool ParseCommonMap( + case dbipWindows: return "win"; + case dbipMac: return "mac"; + case dbipMacOld: return "mac32"; ++ case dbipHaiku: return "haiku"; + case dbipLinux64: return "linux"; + case dbipLinux32: return "linux32"; + } +@@ -2068,6 +2069,9 @@ bool checkReadyUpdate() { + #elif defined Q_OS_LINUX // Q_OS_MAC + QString curUpdater = (cExeDir() + qsl("Updater")); + QFileInfo updater(cWorkingDir() + qsl("tupdates/temp/Updater")); ++#elif defined Q_OS_HAIKU // Q_OS_LINUX ++ QString curUpdater = (cExeDir() + qsl("Updater")); ++ QFileInfo updater(cWorkingDir() + qsl("tupdates/temp/Updater")); + #endif // Q_OS_LINUX + if (!updater.exists()) { + QFileInfo current(curUpdater); +diff --git a/Telegram/SourceFiles/core/utils.h b/Telegram/SourceFiles/core/utils.h +index 0cd4059..1047a5f 100644 +--- a/Telegram/SourceFiles/core/utils.h ++++ b/Telegram/SourceFiles/core/utils.h +@@ -411,6 +411,7 @@ enum DBIPlatform { + dbipLinux64 = 2, + dbipLinux32 = 3, + dbipMacOld = 4, ++ dbipHaiku = 5, + }; + + enum DBIPeerReportSpamStatus { +diff --git a/Telegram/SourceFiles/export/data/export_data_types.cpp b/Telegram/SourceFiles/export/data/export_data_types.cpp +index 5f2e3aa..a3cf2c6 100644 +--- a/Telegram/SourceFiles/export/data/export_data_types.cpp ++++ b/Telegram/SourceFiles/export/data/export_data_types.cpp +@@ -212,6 +212,8 @@ Image ParseMaxImage( + const MTPVector &data, + const QString &suggestedPath) { + auto result = Image(); ++// GCC7 Segmentation violation for Haiku ++#ifndef __HAIKU__ + result.file.suggestedPath = suggestedPath; + + auto maxArea = int64(0); +@@ -234,6 +236,7 @@ Image ParseMaxImage( + } + }); + } ++#endif + return result; + } + +@@ -388,6 +391,7 @@ Document ParseDocument( + const MTPDocument &data, + const QString &suggestedFolder) { + auto result = Document(); ++#ifndef __HAIKU__ + data.match([&](const MTPDdocument &data) { + result.id = data.vid.v; + result.date = data.vdate.v; +@@ -424,6 +428,7 @@ Document ParseDocument( + }, [&](const MTPDdocumentEmpty &data) { + result.id = data.vid.v; + }); ++#endif + return result; + } + +@@ -1017,6 +1022,7 @@ Message ParseMessage( + const MTPMessage &data, + const QString &mediaFolder) { + auto result = Message(); ++#ifndef __HAIKU__ + data.match([&](const auto &data) { + result.id = data.vid.v; + if constexpr (!MTPDmessageEmpty::Is()) { +@@ -1103,6 +1109,7 @@ Message ParseMessage( + }, [&](const MTPDmessageEmpty &data) { + result.id = data.vid.v; + }); ++#endif + return result; + } + +diff --git a/Telegram/SourceFiles/export/export_api_wrap.cpp b/Telegram/SourceFiles/export/export_api_wrap.cpp +index c882ba8..a1ebad4 100644 +--- a/Telegram/SourceFiles/export/export_api_wrap.cpp ++++ b/Telegram/SourceFiles/export/export_api_wrap.cpp +@@ -719,6 +719,8 @@ void ApiWrap::requestUserpics( + void ApiWrap::handleUserpicsSlice(const MTPphotos_Photos &result) { + Expects(_userpicsProcess != nullptr); + ++// GCC7 Segmentation violation for Haiku ++#ifndef __HAIKU__ + result.match([&](const auto &data) { + if constexpr (MTPDphotos_photos::Is()) { + _userpicsProcess->lastSlice = true; +@@ -727,6 +729,7 @@ void ApiWrap::handleUserpicsSlice(const MTPphotos_Photos &result) { + data.vphotos, + _userpicsProcess->processed)); + }); ++#endif + } + + void ApiWrap::loadUserpicsFiles(Data::UserpicsSlice &&slice) { +@@ -1199,7 +1202,8 @@ void ApiWrap::appendChatsSlice( + + void ApiWrap::requestMessagesSlice() { + Expects(_chatProcess != nullptr); +- ++// GCC7 Segmentation violation for Haiku ++#ifndef __HAIKU__ + requestChatMessages( + _chatProcess->info.splits[_chatProcess->localSplitIndex], + _chatProcess->largestIdPlusOne, +@@ -1222,6 +1226,7 @@ void ApiWrap::requestMessagesSlice() { + _chatProcess->info.relativePath)); + }); + }); ++#endif + } + + void ApiWrap::requestChatMessages( +diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp +index 74edb3e..bcf4875 100644 +--- a/Telegram/SourceFiles/logs.cpp ++++ b/Telegram/SourceFiles/logs.cpp +@@ -333,7 +333,7 @@ void start(not_null launcher) { + if (cBetaVersion()) { + SetDebugEnabled(true); + workingDirChosen = true; +-#if defined Q_OS_MAC || defined Q_OS_LINUX ++#if defined Q_OS_MAC || defined Q_OS_LINUX || defined Q_OS_HAIKU + } else { + #ifdef _DEBUG + cForceWorkingDir(cExeDir()); +diff --git a/Telegram/SourceFiles/media/media_audio.cpp b/Telegram/SourceFiles/media/media_audio.cpp +index fb46a00..752e7ef 100644 +--- a/Telegram/SourceFiles/media/media_audio.cpp ++++ b/Telegram/SourceFiles/media/media_audio.cpp +@@ -86,6 +86,7 @@ void EnumeratePlaybackDevices() { + void EnumerateCaptureDevices() { + auto deviceNames = QStringList(); + auto devices = alcGetString(nullptr, ALC_CAPTURE_DEVICE_SPECIFIER); ++#ifndef __HAIKU__ + Assert(devices != nullptr); + while (*devices != 0) { + auto deviceName8Bit = QByteArray(devices); +@@ -94,7 +95,7 @@ void EnumerateCaptureDevices() { + devices += deviceName8Bit.size() + 1; + } + LOG(("Audio Capture Devices: %1").arg(deviceNames.join(';'))); +- ++#endif + if (auto device = alcGetString(nullptr, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER)) { + LOG(("Audio Capture Default Device: %1").arg(QString::fromLocal8Bit(device))); + } else { diff --git a/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp new file mode 100644 index 0000000..58bc1c3 @@ -1650,6 +1956,173 @@ index 0000000..99d13d5 +bool linuxMoveFile(const char *from, const char *to); + +bool psLaunchMaps(const LocationCoords &coords); +diff --git a/Telegram/SourceFiles/platform/platform_audio.h b/Telegram/SourceFiles/platform/platform_audio.h +index 7705b2e..cfc1fc9 100644 +--- a/Telegram/SourceFiles/platform/platform_audio.h ++++ b/Telegram/SourceFiles/platform/platform_audio.h +@@ -19,7 +19,7 @@ void DeInit(); + + // Platform dependent implementations. + +-#if defined Q_OS_MAC || defined Q_OS_LINUX ++#if defined Q_OS_MAC || defined Q_OS_LINUX || defined(Q_OS_HAIKU) + namespace Platform { + namespace Audio { + +diff --git a/Telegram/SourceFiles/platform/platform_file_utilities.h b/Telegram/SourceFiles/platform/platform_file_utilities.h +index 68b1058..2839790 100644 +--- a/Telegram/SourceFiles/platform/platform_file_utilities.h ++++ b/Telegram/SourceFiles/platform/platform_file_utilities.h +@@ -47,6 +47,8 @@ bool Get( + #include "platform/mac/file_utilities_mac.h" + #elif defined Q_OS_LINUX // Q_OS_MAC + #include "platform/linux/file_utilities_linux.h" ++#elif defined Q_OS_HAIKU // Q_OS_LINUX ++#include "platform/haiku/file_utilities_haiku.h" + #elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX + #include "platform/win/file_utilities_win.h" + #endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN +diff --git a/Telegram/SourceFiles/platform/platform_launcher.h b/Telegram/SourceFiles/platform/platform_launcher.h +index 27180d0..953b47f 100644 +--- a/Telegram/SourceFiles/platform/platform_launcher.h ++++ b/Telegram/SourceFiles/platform/platform_launcher.h +@@ -25,6 +25,8 @@ namespace Platform { + #include "platform/mac/launcher_mac.h" + #elif defined Q_OS_LINUX // Q_OS_MAC + #include "platform/linux/launcher_linux.h" ++#elif defined Q_OS_HAIKU ++#include "platform/haiku/launcher_haiku.h" + #elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX + #include "platform/win/launcher_win.h" + #endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN +diff --git a/Telegram/SourceFiles/platform/platform_main_window.h b/Telegram/SourceFiles/platform/platform_main_window.h +index 33277c9..4e28b24 100644 +--- a/Telegram/SourceFiles/platform/platform_main_window.h ++++ b/Telegram/SourceFiles/platform/platform_main_window.h +@@ -21,6 +21,8 @@ class MainWindow; + #include "platform/mac/main_window_mac.h" + #elif defined Q_OS_LINUX // Q_OS_MAC + #include "platform/linux/main_window_linux.h" +-#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX ++#elif defined Q_OS_HAIKU // Q_OS_MAC || Q_OS_LINUX ++#include "platform/haiku/main_window_haiku.h" ++#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX || Q_OS_HAIKU + #include "platform/win/main_window_win.h" + #endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN +diff --git a/Telegram/SourceFiles/platform/platform_notifications_manager.h b/Telegram/SourceFiles/platform/platform_notifications_manager.h +index 692f4b4..a40f830 100644 +--- a/Telegram/SourceFiles/platform/platform_notifications_manager.h ++++ b/Telegram/SourceFiles/platform/platform_notifications_manager.h +@@ -28,6 +28,8 @@ void FlashBounce(); + #include "platform/mac/notifications_manager_mac.h" + #elif defined Q_OS_LINUX // Q_OS_MAC + #include "platform/linux/notifications_manager_linux.h" ++#elif defined Q_OS_HAIKU // Q_OS_LINUX ++#include "platform/haiku/notifications_manager_haiku.h" + #elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX + #include "platform/win/notifications_manager_win.h" + #endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN +diff --git a/Telegram/SourceFiles/platform/platform_specific.h b/Telegram/SourceFiles/platform/platform_specific.h +index 92485c7..ebe4a4f 100644 +--- a/Telegram/SourceFiles/platform/platform_specific.h ++++ b/Telegram/SourceFiles/platform/platform_specific.h +@@ -36,6 +36,8 @@ void finish(); + #include "platform/mac/specific_mac.h" + #elif defined Q_OS_LINUX // Q_OS_MAC + #include "platform/linux/specific_linux.h" +-#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX ++#elif defined Q_OS_HAIKU // Q_OS_MAC || Q_OS_LINUX ++#include "platform/haiku/specific_haiku.h" ++#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX || Q_OS_HAIKU + #include "platform/win/specific_win.h" + #endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN +diff --git a/Telegram/SourceFiles/platform/platform_window_title.h b/Telegram/SourceFiles/platform/platform_window_title.h +index 7aed20b..dc0212c 100644 +--- a/Telegram/SourceFiles/platform/platform_window_title.h ++++ b/Telegram/SourceFiles/platform/platform_window_title.h +@@ -25,7 +25,7 @@ void PreviewWindowFramePaint(QImage &preview, const style::palette &palette, QRe + #include "platform/mac/window_title_mac.h" + #elif defined Q_OS_WIN // Q_OS_MAC + #include "platform/win/window_title_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 + + namespace Platform { + +diff --git a/Telegram/SourceFiles/rpl/operators_tests.cpp b/Telegram/SourceFiles/rpl/operators_tests.cpp +index 548057f..feee15e 100644 +--- a/Telegram/SourceFiles/rpl/operators_tests.cpp ++++ b/Telegram/SourceFiles/rpl/operators_tests.cpp +@@ -5,7 +5,11 @@ 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 + */ ++#if !defined(Q_OS_HAIKU) + #include "catch.hpp" ++#else ++#include "../ThirdParty/variant/test/include/catch.hpp" ++#endif + + #include + #include +diff --git a/Telegram/SourceFiles/rpl/producer_tests.cpp b/Telegram/SourceFiles/rpl/producer_tests.cpp +index 0267f92..0e783b0 100644 +--- a/Telegram/SourceFiles/rpl/producer_tests.cpp ++++ b/Telegram/SourceFiles/rpl/producer_tests.cpp +@@ -5,7 +5,11 @@ 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 + */ ++#if !defined(Q_OS_HAIKU) + #include "catch.hpp" ++#else ++#include "../ThirdParty/variant/test/include/catch.hpp" ++#endif + + #include + #include +diff --git a/Telegram/SourceFiles/rpl/variable_tests.cpp b/Telegram/SourceFiles/rpl/variable_tests.cpp +index 9c697fc..36ddf56 100644 +--- a/Telegram/SourceFiles/rpl/variable_tests.cpp ++++ b/Telegram/SourceFiles/rpl/variable_tests.cpp +@@ -5,7 +5,11 @@ 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 + */ ++#if !defined(Q_OS_HAIKU) + #include "catch.hpp" ++#else ++#include "../ThirdParty/variant/test/include/catch.hpp" ++#endif + + #include + #include +diff --git a/Telegram/SourceFiles/settings.cpp b/Telegram/SourceFiles/settings.cpp +index 680f347..cb0d5a3 100644 +--- a/Telegram/SourceFiles/settings.cpp ++++ b/Telegram/SourceFiles/settings.cpp +@@ -77,6 +77,8 @@ DBIPlatform gPlatform = dbipWindows; + DBIPlatform gPlatform = dbipMacOld; + #elif defined Q_OS_MAC + DBIPlatform gPlatform = dbipMac; ++#elif defined Q_OS_HAIKU ++DBIPlatform gPlatform = dbipHaiku; + #elif defined Q_OS_LINUX64 + DBIPlatform gPlatform = dbipLinux64; + #elif defined Q_OS_LINUX32 +diff --git a/Telegram/SourceFiles/settings/settings_notifications_widget.cpp b/Telegram/SourceFiles/settings/settings_notifications_widget.cpp +index 62bbe64..f0c06f9 100644 +--- a/Telegram/SourceFiles/settings/settings_notifications_widget.cpp ++++ b/Telegram/SourceFiles/settings/settings_notifications_widget.cpp +@@ -69,7 +69,7 @@ void NotificationsWidget::createNotificationsControls() { + if (Platform::Notifications::Supported()) { + #ifdef Q_OS_WIN + nativeNotificationsLabel = lang(lng_settings_use_windows); +-#elif defined Q_OS_LINUX64 || defined Q_OS_LINUX32 // Q_OS_WIN ++#elif defined Q_OS_LINUX64 || defined Q_OS_LINUX32 || defined Q_OS_HAIKU // Q_OS_WIN + nativeNotificationsLabel = lang(lng_settings_use_native_notifications); + #endif // Q_OS_WIN || Q_OS_LINUX64 || Q_OS_LINUX32 + } diff --git a/Telegram/SourceFiles/storage/storage_encrypted_file_tests.cpp b/Telegram/SourceFiles/storage/storage_encrypted_file_tests.cpp index 4d522a9..1ca7dd0 100644 --- a/Telegram/SourceFiles/storage/storage_encrypted_file_tests.cpp @@ -1670,6 +2143,86 @@ index 4d522a9..1ca7dd0 100644 return "tests_storage"; #endif // Q_OS_WIN }(); +diff --git a/Telegram/ThirdParty/minizip/ioapi.c b/Telegram/ThirdParty/minizip/ioapi.c +index 7f5c191..649255c 100644 +--- a/Telegram/ThirdParty/minizip/ioapi.c ++++ b/Telegram/ThirdParty/minizip/ioapi.c +@@ -14,7 +14,7 @@ + #define _CRT_SECURE_NO_WARNINGS + #endif + +-#if defined(__APPLE__) || defined(IOAPI_NO_64) ++#if defined(__APPLE__) || defined(IOAPI_NO_64) || defined(__HAIKU__) + // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions + #define FOPEN_FUNC(filename, mode) fopen(filename, mode) + #define FTELLO_FUNC(stream) ftello(stream) +diff --git a/Telegram/gyp/Telegram.gyp b/Telegram/gyp/Telegram.gyp +index 2c6ef58..73da5e1 100644 +--- a/Telegram/gyp/Telegram.gyp ++++ b/Telegram/gyp/Telegram.gyp +@@ -61,6 +61,7 @@ + 'telegram_win.gypi', + 'telegram_mac.gypi', + 'telegram_linux.gypi', ++ 'telegram_haiku.gypi', + 'openssl.gypi', + 'qt.gypi', + 'qt_moc.gypi', +@@ -98,7 +99,7 @@ + '<(libs_loc)/ffmpeg', + '<(libs_loc)/openal-soft/include', + '<(libs_loc)/opus/include', +- '<(libs_loc)/range-v3/include', ++ '<(submodules_loc)/range/include', + '<(minizip_loc)', + '<(sp_media_key_tap_loc)', + '<(emoji_suggestions_loc)', +diff --git a/Telegram/gyp/common.gypi b/Telegram/gyp/common.gypi +index eb90fe2..b12c1d6 100644 +--- a/Telegram/gyp/common.gypi ++++ b/Telegram/gyp/common.gypi +@@ -8,6 +8,7 @@ + 'includes': [ + 'settings_win.gypi', + 'settings_mac.gypi', ++ 'settings_haiku.gypi', + 'settings_linux.gypi', + ], + 'variables': { +@@ -29,6 +30,11 @@ + }, { + 'build_mac': 0, + }], ++ [ 'build_os == "haiku"', { ++ 'build_haiku': 1, ++ }, { ++ 'build_haiku': 0, ++ }], + [ 'build_os == "linux"', { + 'build_linux': 1, + }, { +@@ -40,11 +46,13 @@ + 'build_win%': '<(build_win)', + 'build_mac%': '<(build_mac)', + 'build_linux%': '<(build_linux)', ++ 'build_haiku%': '<(build_haiku)', + }, + 'build_os%': '<(build_os)', + 'build_win%': '<(build_win)', + 'build_mac%': '<(build_mac)', + 'build_linux%': '<(build_linux)', ++ 'build_haiku%': '<(build_haiku)', + + 'official_build_target%': '', + }, +@@ -52,6 +60,7 @@ + 'build_win%': '<(build_win)', + 'build_mac%': '<(build_mac)', + 'build_linux%': '<(build_linux)', ++ 'build_haiku%': '<(build_haiku)', + 'official_build_target%': '<(official_build_target)', + + # GYP does not support per-configuration libraries :( diff --git a/Telegram/gyp/lib_base.gyp b/Telegram/gyp/lib_base.gyp index 1f3e9c3..d96dedd 100644 --- a/Telegram/gyp/lib_base.gyp @@ -1679,6 +2232,19 @@ index 1f3e9c3..d96dedd 100644 '<(src_loc)', '<(SHARED_INTERMEDIATE_DIR)', - '<(libs_loc)/range-v3/include', ++ '<(submodules_loc)/range/include', + '<(submodules_loc)/GSL/include', + '<(submodules_loc)/variant/include', + '<(submodules_loc)/crl/src', +diff --git a/Telegram/gyp/lib_export.gyp b/Telegram/gyp/lib_export.gyp +index 2d1ac6c..d26d7c4 100644 +--- a/Telegram/gyp/lib_export.gyp ++++ b/Telegram/gyp/lib_export.gyp +@@ -48,7 +48,7 @@ + 'include_dirs': [ + '<(src_loc)', + '<(SHARED_INTERMEDIATE_DIR)', +- '<(libs_loc)/range-v3/include', + '<(submodules_loc)/range/include', '<(submodules_loc)/GSL/include', '<(submodules_loc)/variant/include', @@ -1696,6 +2262,140 @@ index 5277135..63996cf 100644 '<(submodules_loc)/GSL/include', '<(submodules_loc)/variant/include', '<(submodules_loc)/crl/src', +diff --git a/Telegram/gyp/list_sources.py b/Telegram/gyp/list_sources.py +index 9efee62..d978ed6 100644 +--- a/Telegram/gyp/list_sources.py ++++ b/Telegram/gyp/list_sources.py +@@ -113,6 +113,8 @@ if input_path != '': + platform_rules[file_path] = [ 'mac' ] + elif '/platform/linux/' in file_path: + platform_rules[file_path] = [ 'linux' ] ++ elif '/platform/haiku/' in file_path: ++ platform_rules[file_path] = [ 'haiku' ] + + for replace in replaces: + replace_parts = replace.split('=', 1) +diff --git a/Telegram/gyp/qt.gypi b/Telegram/gyp/qt.gypi +index 3f91776..8f3e531 100644 +--- a/Telegram/gyp/qt.gypi ++++ b/Telegram/gyp/qt.gypi +@@ -14,7 +14,7 @@ + [ 'build_macold', { + 'qt_version%': '5.3.2', + }, { +- 'qt_version%': '