From bee081a9ff1f7279773f7fa00073916408fc5ca1 Mon Sep 17 00:00:00 2001
From: Sergei Reznikov <diver@gelios.net>
Date: Thu, 31 Mar 2016 11:08:17 +0300
Subject: build fixes for boost 1.55.0


diff --git a/core/connections/wim/packets/send_feedback.cpp b/core/connections/wim/packets/send_feedback.cpp
index 230da06..44afd32 100644
--- a/core/connections/wim/packets/send_feedback.cpp
+++ b/core/connections/wim/packets/send_feedback.cpp
@@ -37,7 +37,7 @@ int32_t send_feedback::init_request(std::shared_ptr<core::http_request_simple> _
     auto fromCurr = boost::filesystem::wpath(g_core->get_network_log().file_names_history().second);
     if (boost::filesystem::exists(fromCurr))
     {
-        auto tempCurr = fromCurr.parent_path().append(L"feedback_log_current.tmp");
+        auto tempCurr = fromCurr.parent_path().append(L"feedback_log_current.tmp", boost::filesystem::path::codecvt());
         boost::filesystem::copy_file(fromCurr, tempCurr, boost::filesystem::copy_option::overwrite_if_exists);
         const long sizeCurr = boost::filesystem::file_size(tempCurr);
         {
@@ -61,7 +61,7 @@ int32_t send_feedback::init_request(std::shared_ptr<core::http_request_simple> _
         auto fromPrev = boost::filesystem::wpath(g_core->get_network_log().file_names_history().first);
         if (boost::filesystem::exists(fromPrev))
         {
-            auto tempPrev = fromPrev.parent_path().append(L"feedback_log_previous.tmp");
+            auto tempPrev = fromPrev.parent_path().append(L"feedback_log_previous.tmp", boost::filesystem::path::codecvt());
             boost::filesystem::copy_file(fromPrev, tempPrev, boost::filesystem::copy_option::overwrite_if_exists);
             const long sizePrev = boost::filesystem::file_size(tempPrev);
             {
@@ -79,7 +79,7 @@ int32_t send_feedback::init_request(std::shared_ptr<core::http_request_simple> _
         }
     }
 
-    log_ = fromCurr.parent_path().append("feedbacklog.txt").wstring();
+    log_ = fromCurr.parent_path().append("feedbacklog.txt", boost::filesystem::path::codecvt()).wstring();
 
     auto to = boost::filesystem::wpath(log_);
     if (boost::filesystem::exists(to))
diff --git a/core/log/log.cpp b/core/log/log.cpp
index 59a9bf3..9b233ce 100644
--- a/core/log/log.cpp
+++ b/core/log/log.cpp
@@ -410,7 +410,7 @@ namespace
 		area_filename % log_file_index_ % w_area % log_files_ext_;
 
 		fs::wpath path = logs_dir_;
-		path.append(area_filename.str());
+		path.append(area_filename.str(), boost::filesystem::path::codecvt());
 
 		return path;
 	}
@@ -613,4 +613,4 @@ namespace core
 
 	}
 
-}
\ No newline at end of file
+}
diff --git a/core/network_log.cpp b/core/network_log.cpp
index c644a51..7f3c4a0 100644
--- a/core/network_log.cpp
+++ b/core/network_log.cpp
@@ -69,7 +69,7 @@ namespace core
         area_filename % _index % L"net" % L"txt";
 
         boost::filesystem::wpath path = _logs_directory;
-        path.append(area_filename.str());
+        path.append(area_filename.str(), boost::filesystem::path::codecvt());
 
         return path;
     }
@@ -112,7 +112,7 @@ namespace core
         for (auto iter = files.rbegin(); iter != files.rend(); ++iter)
         {
             boost::filesystem::wpath file_path = _logs_directory;
-            file_path.append(tools::from_utf8(iter->second));
+            file_path.append(tools::from_utf8(iter->second), boost::filesystem::path::codecvt());
 
             if (boost::filesystem::exists(file_path))
             {
diff --git a/core/stdafx.h b/core/stdafx.h
index fe8eb2a..70a547e 100644
--- a/core/stdafx.h
+++ b/core/stdafx.h
@@ -46,6 +46,7 @@
 #include <assert.h>
 
 #include <boost/algorithm/string.hpp>
+#define BOOST_NO_CXX11_SCOPED_ENUMS
 #include <boost/filesystem.hpp>
 #include <boost/format.hpp>
 #include <boost/lexical_cast.hpp>
diff --git a/core/utils.cpp b/core/utils.cpp
index e146ff1..1382be7 100644
--- a/core/utils.cpp
+++ b/core/utils.cpp
@@ -84,7 +84,7 @@ namespace core
         {
             boost::filesystem::wpath logs_dir(get_product_data_path());
 
-            logs_dir.append(L"logs");
+            logs_dir.append(L"logs", boost::filesystem::path::codecvt());
 
             return logs_dir;
         }
-- 
2.12.2


From 41737fd51f33a60735dc6142830e2a633066a264 Mon Sep 17 00:00:00 2001
From: Sergei Reznikov <diver@gelios.net>
Date: Thu, 31 Mar 2016 11:09:34 +0300
Subject: initial Haiku support


diff --git a/core/tools/strings.cpp b/core/tools/strings.cpp
index 000a4b7..c04048d 100644
--- a/core/tools/strings.cpp
+++ b/core/tools/strings.cpp
@@ -146,13 +146,13 @@ namespace core
         
         const std::string wstring_to_string(const std::wstring& _wstr)
         {
-#if defined(__linux__)
+#if defined(__linux__) || defined(__HAIKU__)
             return std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t>().to_bytes(_wstr);
 #elif defined(__APPLE__)
             return std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t>().to_bytes(_wstr);
 #else
             return from_utf16(short_path_for(_wstr));
-#endif //__linux__
+#endif
         }
 
         std::string adler32(const std::string& _input)
diff --git a/core/tools/system_common.cpp b/core/tools/system_common.cpp
index 494f46d..1c51a36 100644
--- a/core/tools/system_common.cpp
+++ b/core/tools/system_common.cpp
@@ -4,7 +4,7 @@
 #if defined(_WIN32)
 #include <Windows.h>
 
-#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__))
+#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__)) || defined(__HAIKU__)
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/param.h>
@@ -41,7 +41,7 @@ size_t get_memory_size_mb()
 	GlobalMemoryStatusEx( &status );
 	return (size_t) (status.ullTotalPhys / mb);
 
-#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__))
+#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__)) || defined(__HAIKU__)
 	/* UNIX variants. ------------------------------------------- */
 	/* Prefer sysctl() over sysconf() except sysctl() HW_REALMEM and HW_PHYSMEM */
 
@@ -94,4 +94,4 @@ size_t get_memory_size_mb()
 #endif
 }
 
-}}}
\ No newline at end of file
+}}}
diff --git a/core/utils.cpp b/core/utils.cpp
index 1382be7..da55cb0 100644
--- a/core/utils.cpp
+++ b/core/utils.cpp
@@ -12,9 +12,12 @@ namespace core
 		{
 #ifdef __linux__
 			return (core::tools::system::get_user_profile() + L"/.config/" + L"ICQ");
+#ifdef __HAIKU__
+			return (core::tools::system::get_user_profile() + L"/config/settings/" + L"ICQ");
 #else
 			return (core::tools::system::get_user_profile() + L"/" + L"ICQ");
-#endif //__linux__
+#endif // haiku
+#endif // linux
 		}
 
 		std::string get_product_name()
@@ -32,6 +35,10 @@ namespace core
 			{
 				return "Mail.ru Mac OS X ICQ";
 			}
+			else if (platform::is_haiku())
+			{
+				return "Mail.ru Haiku ICQ";
+			}
 			else if (platform::is_linux())
 			{
 				return "Mail.ru Linux ICQ";
@@ -58,6 +65,10 @@ namespace core
 			{
 				return "Apple";
 			}
+			else if (platform::is_haiku())
+			{
+				return "Haiku";
+			}
 			else
 			{
 				assert(false);
diff --git a/corelib/common.h b/corelib/common.h
index b62986c..d72ac44 100644
--- a/corelib/common.h
+++ b/corelib/common.h
@@ -131,6 +131,15 @@ namespace platform
 		#endif
 	}
 
+	inline bool is_haiku()
+	{
+		#if defined(__HAIKU__)
+			return true;
+		#else
+			return false;
+		#endif
+	}
+
 	inline bool is_linux()
 	{
 		#if defined(__linux__)
diff --git a/gui/core_dispatcher.cpp b/gui/core_dispatcher.cpp
index 33b9a8c..e29071b 100644
--- a/gui/core_dispatcher.cpp
+++ b/gui/core_dispatcher.cpp
@@ -197,7 +197,7 @@ qint64 core_dispatcher::delete_message(const int64_t _message_id)
 
 bool core_dispatcher::init()
 {
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__HAIKU__)
     QLibrary libcore(CORELIBRARY);
 	if (!libcore.load())
     {
@@ -224,7 +224,7 @@ bool core_dispatcher::init()
         return false;
     }
     core_face_ = core_face;
-#endif //__linux__
+#endif
 	core_connector_ = core_face_->get_core_connector();
 	if (!core_connector_)
 		return false;
diff --git a/gui/gui.pro b/gui/gui.pro
index fb211cb..ad54b08 100644
--- a/gui/gui.pro
+++ b/gui/gui.pro
@@ -15,7 +15,7 @@ CONFIG += 64
 
 CONFIG += res_internal
 
-CORELIB_PATH = ../corelib
+CORELIB_PATH = ../corelib/corelib
 
 PRECOMPILED_HEADER = stdafx.h
 
@@ -320,17 +320,17 @@ HEADERS  += \
 
 DEFINES += STRIP_VOIP
 QMAKE_CXXFLAGS += -std=c++0x
-QMAKE_LIBS += -lopenal -lavformat -lavcodec -lswresample -lavfilter -lavutil -lcorelib -lboost_system -lcurl_static -lssl_static -lcrypto_static -lboost_filesystem -lidn -lrtmp -lgcrypt -lgnutls -lgpg-error -ltasn1 -lz -lstdc++ -lrt -lxcb-util
+QMAKE_LIBS += -lopenal -lavformat -lavcodec -lswresample -lavfilter -lavutil -lcorelib -lboost_system -lcurl -lssl -lcrypto -lboost_filesystem -lidn -lrtmp -lgcrypt -lgnutls -lgpg-error -ltasn1 -lz -lstdc++
 CONFIG(32, 64|32) {
     QMAKE_LIBS += -lp11-kit
 }
 
-QMAKE_LIBS_THREAD = -lxcb-util -lffi -lpcre -lexpat -lXext -lXau -lXdmcp -lz -Wl,-Bdynamic -ldl -lpthread -lX11
+QMAKE_LIBS_THREAD = -lffi -lpcre -lexpat -lz -Wl,-Bstatic
 
-QMAKE_LFLAGS += -Wl,-Bstatic -static-libgcc -static-libstdc++ -L$$CORELIB_PATH
+QMAKE_LFLAGS += -Wl,-Bdynamic -static-libgcc -static-libstdc++ -L$$CORELIB_PATH
 
 CONFIG(64, 64|32) {
-    QMAKE_LFLAGS += -L$${PWD}/../external/linux/x64 -L$${PWD}/../external/OpenAl/lib/linux/x64 -L$${PWD}/../external/ffmpeg/lib/linux/x64 -L/x64
+    QMAKE_LFLAGS += #-L$${PWD}/../external/linux/x64 -L$${PWD}/../external/OpenAl/lib/linux/x64 -L$${PWD}/../external/ffmpeg/lib/linux/x64 -L/x64
 } else {
     QMAKE_LFLAGS += -L$${PWD}/../external/linux -L$${PWD}/../external/OpenAl/lib/linux -L$${PWD}/../external/ffmpeg/lib/linux -L/x32
 }
diff --git a/gui/main_window/settings/ContactUs.cpp b/gui/main_window/settings/ContactUs.cpp
index dee90e8..ad358e4 100644
--- a/gui/main_window/settings/ContactUs.cpp
+++ b/gui/main_window/settings/ContactUs.cpp
@@ -507,6 +507,8 @@ void GeneralSettingsWidget::Creator::initContactUs(QWidget* parent, std::map<std
                                     col.set_value_as_string("fb.question.178", build::is_debug() ? "beta" : "live");
                                     if (platform::is_apple())
                                         col.set_value_as_string("fb.question.3005", "OSx");
+                                    if (platform::is_haiku())
+                                        col.set_value_as_string("fb.question.3005", "Haiku");
                                     else if (platform::is_windows())
                                         col.set_value_as_string("fb.question.3005", "Windows");
                                     else if (platform::is_linux())
@@ -664,4 +666,4 @@ void GeneralSettingsWidget::Creator::initContactUs(QWidget* parent, std::map<std
         successPage->setVisible(false);
         scroll_area_content_layout->addWidget(successPage);
     }
-}
\ No newline at end of file
+}
diff --git a/gui/main_window/sounds/MpegLoader.h b/gui/main_window/sounds/MpegLoader.h
index b7cbacb..ed253eb 100644
--- a/gui/main_window/sounds/MpegLoader.h
+++ b/gui/main_window/sounds/MpegLoader.h
@@ -1,5 +1,9 @@
 #pragma once
 
+#ifndef UINT64_C
+#define UINT64_C(c) (c ## ULL)
+#endif
+
 extern "C"
 {
 #include <libavformat/avformat.h>
@@ -62,4 +66,4 @@ namespace Ui
         AVFrame* Frame_;
         SwrContext* SwrContext_;
     };
-}
\ No newline at end of file
+}
diff --git a/gui/stdafx.h b/gui/stdafx.h
index 5c6fa22..91ecb85 100644
--- a/gui/stdafx.h
+++ b/gui/stdafx.h
@@ -388,10 +388,10 @@
 #import <QtWidgets/qmenu.h>
 #import <QtWidgets/qmenubar.h>
 #import <QtGui/qclipboard.h>
-#import <QtCore/QObjectCleanupHandler.h>
+#import <QtCore/qobjectcleanuphandler.h>
 #import <QtGui/qmovie.h>
 #import <QtWidgets/qgesture.h>
-#import <QtCore/QUuid.h>
+#import <QtCore/QUuid>
 /*
 #import <QtNetwork/qnetworkrequest.h>
 #import <QtNetwork/qnetworkreply.h>
@@ -402,7 +402,7 @@
 
 #define assert(e) { if (!(e)) puts("ASSERT: " #e); }
 
-#include "macconfig.h"
+//#include "macconfig.h"
 
 //#include <QGraphicsDropShadowEffect>
 //#include <QProxyStyle>
diff --git a/gui/voip/DetachedVideoWnd.cpp b/gui/voip/DetachedVideoWnd.cpp
index 84d6cf6..1d71309 100644
--- a/gui/voip/DetachedVideoWnd.cpp
+++ b/gui/voip/DetachedVideoWnd.cpp
@@ -345,7 +345,7 @@ Ui::DetachedVideoWindow::DetachedVideoWindow(QWidget* parent)
 #endif
 
         video_panel_header_effect_ = new UIEffects(*video_panel_header_.get());
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__HAIKU__)
         std::vector<QWidget*> panels;
         panels.push_back(video_panel_header_.get());
         _rootWidget = platform_specific::GraphicsPanel::create(this, panels);
@@ -354,7 +354,7 @@ Ui::DetachedVideoWindow::DetachedVideoWindow(QWidget* parent)
         _rootWidget->setAttribute(Qt::WA_UpdatesDisabled);
         _rootWidget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
         layout()->addWidget(_rootWidget);
-#endif //__linux__
+#endif
         std::vector<QWidget*> topPanels;
         topPanels.push_back(video_panel_header_.get());
         std::vector<QWidget*> bottomPanels;
diff --git a/gui/voip/VideoWindow.cpp b/gui/voip/VideoWindow.cpp
index 4562567..35151d2 100644
--- a/gui/voip/VideoWindow.cpp
+++ b/gui/voip/VideoWindow.cpp
@@ -190,14 +190,14 @@ Ui::VideoWindow::VideoWindow()
     panels.push_back(video_panel_.get());
     panels.push_back(video_panel_header_.get());
     panels.push_back(video_panel_header_with_avatars_.get());
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__HAIKU__)
     _rootWidget = platform_specific::GraphicsPanel::create(this, panels);
     _rootWidget->setContentsMargins(0, 0, 0, 0);
     //_rootWidget->setProperty("WidgetWithBG", true);
     _rootWidget->setAttribute(Qt::WA_UpdatesDisabled);
     _rootWidget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
     layout()->addWidget(_rootWidget);
-#endif //__linux__
+#endif
     QIcon icon(":/resources/main_window/appicon.ico");
     setWindowIcon(icon);
 
-- 
2.12.2


From 5a7ce418f5eb30631a96f4fb85bc949c4359424d Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sun, 14 May 2017 23:38:17 +0200
Subject: needs cmath, fix with newer boost.


diff --git a/corelib/corelib/corelib.pro b/corelib/corelib/corelib.pro
index d7a26d1..83c27b3 100644
--- a/corelib/corelib/corelib.pro
+++ b/corelib/corelib/corelib.pro
@@ -298,7 +298,7 @@ HEADERS += \
 
 DEFINES += STRIP_VOIP
 
-QMAKE_CXXFLAGS += -std=c++0x
+QMAKE_CXXFLAGS += -std=c++0x -DBOOST_NO_CXX11_CONSTEXPR
 
 QMAKE_LFLAGS += -static-libgcc -static-libstdc++
 
diff --git a/gui/gui.pro b/gui/gui.pro
index ad54b08..85f8b4b 100644
--- a/gui/gui.pro
+++ b/gui/gui.pro
@@ -319,7 +319,7 @@ HEADERS  += \
     main_window/settings/themes/ThemeWidget.h
 
 DEFINES += STRIP_VOIP
-QMAKE_CXXFLAGS += -std=c++0x
+QMAKE_CXXFLAGS += -std=c++0x -DBOOST_NO_CXX11_CONSTEXPR
 QMAKE_LIBS += -lopenal -lavformat -lavcodec -lswresample -lavfilter -lavutil -lcorelib -lboost_system -lcurl -lssl -lcrypto -lboost_filesystem -lidn -lrtmp -lgcrypt -lgnutls -lgpg-error -ltasn1 -lz -lstdc++
 CONFIG(32, 64|32) {
     QMAKE_LIBS += -lp11-kit
diff --git a/gui/stdafx.h b/gui/stdafx.h
index 91ecb85..07cdf32 100644
--- a/gui/stdafx.h
+++ b/gui/stdafx.h
@@ -290,6 +290,7 @@
 #include <codecvt>
 #include <assert.h>
 #include <limits>
+#include <cmath>
 
 #include <stdint.h>
 
diff --git a/installer/installer.pro b/installer/installer.pro
index 7a1f7ee..d5fb315 100644
--- a/installer/installer.pro
+++ b/installer/installer.pro
@@ -14,7 +14,7 @@ SOURCES += main.cpp
 CONFIG += 64
 
 QMAKE_LFLAGS += -Wl,-Bstatic -static-libgcc -static-libstdc++
-QMAKE_CXXFLAGS += -std=c++0x
+QMAKE_CXXFLAGS += -std=c++0x -DBOOST_NO_CXX11_CONSTEXPR
 
 CONFIG(64, 64|32) {
     QMAKE_LFLAGS += -L/x64
-- 
2.12.2

