From 879258db8aaada67116d9a83d5759393a0bd462c Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Tue, 17 Sep 2019 19:09:55 +0200
Subject: Import still relevant part of Haiku patches.


diff --git a/CMakeLists.txt b/CMakeLists.txt
index 360bde5..d1cdd35 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -137,6 +137,13 @@ if (APPLE)
       option(BUILD_ALSA ${MAC_NOT_AVAIL} OFF)
 endif (APPLE)
 
+# Disable components not supported on Haiku
+if (HAIKU)
+	set(HAIKU_NOT_AVAIL "Not available on Haiku")
+	option(BUILD_PULSEAUDIO ${HAIKU_NOT_AVAIL} OFF)
+	option(BUILD_ALSA ${HAIKU_NOT_AVAIL} OFF)
+endif (HAIKU)
+
 # Disable components not supported on Linux/BSD
 if (NOT APPLE AND NOT MINGW AND NOT MSVC)
       set(NIX_NOT_AVAIL "Not available on Linux/BSD")
diff --git a/mscore/CMakeLists.txt b/mscore/CMakeLists.txt
index 6eb2162..ff07f7c 100644
--- a/mscore/CMakeLists.txt
+++ b/mscore/CMakeLists.txt
@@ -436,7 +436,7 @@ else (MINGW)
 
       if (APPLE)
         target_link_libraries(mscoreapp ${OsxFrameworks})
-      else (APPLE)
+      elseif (NOT HAIKU)
           target_link_libraries(mscoreapp rt)
       endif (APPLE)
 
@@ -445,7 +445,9 @@ else (MINGW)
          if(USE_JACK)
             target_link_libraries(mscoreapp ${CMAKE_DL_LIBS})
          endif(USE_JACK)
-         target_link_libraries(mscoreapp rt)
+         if (NOT HAIKU)
+            target_link_libraries(mscoreapp rt)
+         endif (NOT HAIKU)
       endif (NOT APPLE)
 
       if (APPLE)
-- 
2.30.0


From 5e36125644dc5c6b5eecfe1b0d8a4c4935a65bb5 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Tue, 7 Jan 2020 13:31:47 +1000
Subject: Don't set Fusion style for Haiku


diff --git a/mscore/musescore.cpp b/mscore/musescore.cpp
index c08a15e..32444f2 100644
--- a/mscore/musescore.cpp
+++ b/mscore/musescore.cpp
@@ -7391,7 +7391,9 @@ void tryToRequestTelemetryPermission()
 void MuseScore::updateUiStyleAndTheme()
       {
       // set UI Theme
+#ifndef __HAIKU__
       QApplication::setStyle(QStyleFactory::create("Fusion"));
+#endif
 
 #ifdef Q_OS_MAC
       // On Mac, update the color of the window title bars
-- 
2.30.0


From 4988f4c9533e94fe0c70590592426af360612c5c Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Wed, 20 Jan 2021 09:52:46 +0100
Subject: Haiku patch


diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt
index 0cfba78..69645fc 100644
--- a/main/CMakeLists.txt
+++ b/main/CMakeLists.txt
@@ -250,7 +250,7 @@ else (MINGW)
 
       if (APPLE)
         target_link_libraries(mscore ${OsxFrameworks})
-      else (APPLE)
+      elif (NOT HAIKU)
           target_link_libraries(mscore rt)
       endif (APPLE)
 
diff --git a/thirdparty/qt-google-analytics/ganalytics.cpp b/thirdparty/qt-google-analytics/ganalytics.cpp
index 7037eb0..a5bd106 100644
--- a/thirdparty/qt-google-analytics/ganalytics.cpp
+++ b/thirdparty/qt-google-analytics/ganalytics.cpp
@@ -381,7 +381,7 @@ QString GAnalytics::Private::getSystemInfo()
             .arg(QAndroidJniObject::getStaticObjectField<jstring>("android/os/Build", "ID").toString())
             .arg(QAndroidJniObject::getStaticObjectField<jstring>("android/os/Build", "BRAND").toString());
 }
-#elif defined(Q_OS_LINUX)
+#elif defined(Q_OS_LINUX) || defined(Q_OS_HAIKU)
 #include <sys/utsname.h>
 
 /**
-- 
2.30.0

