From 3acf13a651b48c38872e9dced5482e5eb3df2840 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 20 Apr 2020 20:53:54 +1000
Subject: Fix for Haiku


diff --git a/CMakeLists.txt b/CMakeLists.txt
index 437f58f..77346ad 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,7 +50,7 @@ find_package(KF5 REQUIRED COMPONENTS
 #    include(MacroPushRequiredVars) -> include(CMakePushCheckState)
 #    macro_push_required_vars() -> cmake_push_check_state()
 #    macro_pop_required_vars() -> cmake_pop_check_state()
-find_package(GPSim REQUIRED)
+find_package(GPSim)
 
 add_definitions(-Wno-deprecated-declarations) # TODO too much spam for now
 add_definitions(-fPIC)
@@ -60,7 +60,7 @@ add_definitions(-fPIC)
 if (KTECHLAB_DEVELOPER_BUILD)
 # for debugging with GCC 5
     add_definitions( -fno-omit-frame-pointer )
-    set(SANITIZE_FLAGS " -fsanitize=address -fno-omit-frame-pointer -fPIC") # address
+    #set(SANITIZE_FLAGS " -fsanitize=address -fno-omit-frame-pointer -fPIC") # address
     #set(SANITIZE_FLAGS " -fsanitize=undefined -fno-omit-frame-pointer ") # undefined
     #set(SANITIZE_FLAGS "") # disabled
 
@@ -124,7 +124,7 @@ add_subdirectory( src )
 add_subdirectory( examples )
 add_subdirectory( icons )
 add_subdirectory( icons-kde3 )
-add_subdirectory( doc )
+#add_subdirectory( doc )
 
 if(BUILD_TESTING)
     add_subdirectory(tests)
diff --git a/microbe/CMakeLists.txt b/microbe/CMakeLists.txt
index eadfe5c..b8ab80d 100644
--- a/microbe/CMakeLists.txt
+++ b/microbe/CMakeLists.txt
@@ -18,8 +18,6 @@ target_link_libraries(microbe
     KF5::CoreAddons
     KF5::I18n
 
-    Qt5::Core
-
-    pthread)
+    Qt5::Core)
 
 install(TARGETS microbe ${INSTALL_TARGETS_DEFAULT_ARGS})
diff --git a/src/electronics/port.cpp b/src/electronics/port.cpp
index 6d93938..a2a6463 100644
--- a/src/electronics/port.cpp
+++ b/src/electronics/port.cpp
@@ -22,7 +22,7 @@
 #include <sys/ioctl.h>
 #include <unistd.h>
 
-#if !defined(DARWIN) && !defined(__FreeBSD__)
+#if !defined(DARWIN) && !defined(__FreeBSD__) && !defined(__HAIKU__)
 #include <linux/ppdev.h>
 #endif
 
@@ -39,7 +39,7 @@ Port::~Port()
 
 QStringList Port::ports( unsigned probeResult )
 {
-#if !defined(DARWIN) && !defined(__FreeBSD__)
+#if !defined(DARWIN) && !defined(__FreeBSD__) && !defined(__HAIKU__)
 	return SerialPort::ports(probeResult) + ParallelPort::ports(probeResult);
 #else
 	return SerialPort::ports(probeResult);
@@ -120,7 +120,11 @@ bool SerialPort::pinState( Pin pin )
 			break;
 			
 		case RD:
+#ifdef __HAIKU__
+			mask = TIOCM_DSR;
+#else
 			mask = TIOCM_SR;
+#endif
 			break;
 			
 		case CTS:
@@ -264,7 +268,7 @@ const int INPUT_MODE_BIT = 1 << 21; // Controls if the data pins are input or ou
 
 // No code using these values will be reached on Darwin, this is just to
 // keep the preprocessor happy.
-#if defined(DARWIN) || defined(__FreeBSD__)
+#if defined(DARWIN) || defined(__FreeBSD__) || defined(__HAIKU__)
 	#define PPRDATA		0xFACADE
 	#define PPRCONTROL	0xC001D00D
 	#define PPWDATA		0xC0EDBABE
-- 
2.26.0

