From 2a3ec865e036f6e937651f8d9de58de1a927745b Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 24 Jan 2016 14:37:04 +0100
Subject: Fix search paths for plib and SDL2


diff --git a/cmake/FindPLIB.cmake b/cmake/FindPLIB.cmake
index 63b43da..1681b8c 100644
--- a/cmake/FindPLIB.cmake
+++ b/cmake/FindPLIB.cmake
@@ -16,7 +16,7 @@ IF(NOT APPLE OR OPTION_USE_MACPORTS)
  FIND_PATH(PLIB_PLIBINCLUDE_DIR plib/ssg.h
   HINTS ENV PLIB_DIR
   PATH_SUFFIXES 
-	Headers include/plib include
+	Headers include/plib include develop/headers/plib develop/headers/x86/plib
   PATHS
 #Additional MacOS Paths
    	 ~/Library/Frameworks/plib.framework
@@ -24,6 +24,7 @@ IF(NOT APPLE OR OPTION_USE_MACPORTS)
  	 /System/Library/Frameworks/plib.framework # Tiger
 
 	/usr /usr/local
+	/system
   DOC "Location of plib")
 ENDIF(NOT APPLE OR OPTION_USE_MACPORTS)
 
diff --git a/cmake/FindSDL2.cmake b/cmake/FindSDL2.cmake
index bc72d64..9c05691 100644
--- a/cmake/FindSDL2.cmake
+++ b/cmake/FindSDL2.cmake
@@ -14,6 +14,7 @@ SET(SDL2_SEARCH_PATHS
 /Library/Frameworks
 /usr/local
 /usr
+/system
 /sw # Fink
 /opt/local # DarwinPorts
 /opt/csw # Blastwave
@@ -23,7 +24,7 @@ SET(SDL2_SEARCH_PATHS
 FIND_PATH(SDL2_INCLUDE_DIR SDL.h
 HINTS
 $ENV{SDL2DIR}
-PATH_SUFFIXES include/SDL2 include
+PATH_SUFFIXES include/SDL2 include develop/headers/SDL2 develop/headers/x86/SDL2
 PATHS ${SDL2_SEARCH_PATHS}
 )
 
-- 
2.21.0


From 2989e48a739b6731f328de98a1d8b8b108ed89d1 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 24 Jan 2016 14:37:04 +0100
Subject: Haiku fix


diff --git a/src/libs/tgfclient/CMakeLists.txt b/src/libs/tgfclient/CMakeLists.txt
index 77b7a1d..1cabf1f 100644
--- a/src/libs/tgfclient/CMakeLists.txt
+++ b/src/libs/tgfclient/CMakeLists.txt
@@ -111,12 +111,12 @@ IF(WIN32)
     TARGET_LINK_LIBRARIES(tgfclient winmm)
 ENDIF(WIN32)
 
-IF(UNIX)
+IF(UNIX AND NOT HAIKU)
     ADD_X11_LIBRARY(tgfclient)
     IF(OPTION_XRANDR)
         ADD_XRANDR_LIBRARY(tgfclient)
     ENDIF(OPTION_XRANDR)
-ENDIF(UNIX)
+ENDIF(UNIX AND NOT HAIKU)
 
 IF(UNIX)
     SD_INSTALL_FILES(LIB lib TARGETS tgfclient)
-- 
2.21.0


From 2f821f24ddd2978c3a51376d670b6150b57c5b42 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 24 Jan 2016 16:09:57 +0100
Subject: Disable code unsupported on Haiku.


diff --git a/src/libs/tgf/linuxspec.cpp b/src/libs/tgf/linuxspec.cpp
index 12d663e..420f019 100644
--- a/src/libs/tgf/linuxspec.cpp
+++ b/src/libs/tgf/linuxspec.cpp
@@ -653,7 +653,7 @@ unsigned linuxGetNumberOfCPUs()
 		}
 		
 		// Linux, Solaris, AIX
-#elif defined(linux) || defined(__linux__) || defined(USE_MACPORTS)
+#elif defined(linux) || defined(__linux__) || defined(USE_MACPORTS) || !defined(__HAIKU__)
 		
 		nCPUs = (unsigned)sysconf(_SC_NPROCESSORS_ONLN);
 		
@@ -692,7 +692,7 @@ unsigned linuxGetNumberOfCPUs()
 * Remarks
 *    
 */
-#if !defined(USE_MACPORTS)
+#if !defined(USE_MACPORTS) && !defined(__HAIKU__)
 std::string cpuSet2String(const cpu_set_t* pCPUSet)
 {
 	std::ostringstream ossCPUSet;
@@ -711,7 +711,7 @@ bool
 linuxSetThreadAffinity(int nCPUId)
 {
 	// MacOS X, FreeBSD, OpenBSD, NetBSD, etc ...
-#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || !defined(__HAIKU__)
 	
 	GfLogWarning("Thread affinity not yet implemented on Mac OS X or BSD.\n");
 	// TODO.
-- 
2.21.0


From 3d71280d87ae7dbf3b70ed5969766abaf80c8b07 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 24 Jan 2016 16:20:36 +0100
Subject: Use namespace std


diff --git a/src/modules/simu/simuv2.1/simu.cpp b/src/modules/simu/simuv2.1/simu.cpp
index cac11d7..9c4377f 100644
--- a/src/modules/simu/simuv2.1/simu.cpp
+++ b/src/modules/simu/simuv2.1/simu.cpp
@@ -28,6 +28,7 @@
 
 #include "sim.h"
 
+using namespace std;
 
 tCar *SimCarTable = 0;
 
-- 
2.21.0


From a72f2a177696ec2dbdd4143f93ffef37b043c297 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 24 Jan 2016 16:22:54 +0100
Subject: Do not link against dl


diff --git a/src/tools/nfsperf/CMakeLists.txt b/src/tools/nfsperf/CMakeLists.txt
index 0a2a6b6..d9fc80e 100644
--- a/src/tools/nfsperf/CMakeLists.txt
+++ b/src/tools/nfsperf/CMakeLists.txt
@@ -16,9 +16,9 @@ SD_ADD_EXECUTABLE(${_TARGET_NAME} ${NFSPERF_SOURCES})
 
 ADD_SDLIB_LIBRARY(${_TARGET_NAME} portability tgf txml) # txml ignored if OPTION_3RDPARTY_EXPAT
 
-IF(UNIX)
+IF(UNIX AND NOT HAIKU)
     TARGET_LINK_LIBRARIES(${_TARGET_NAME} dl)
-ENDIF(UNIX)
+ENDIF(UNIX AND NOT HAIKU)
 
 IF(UNIX)
     SD_INSTALL_FILES(MAN man6 PREFIX ${SOURCE_DIR}/doc/man FILES ${_TARGET_NAME}.6)
diff --git a/src/tools/xmlversion/CMakeLists.txt b/src/tools/xmlversion/CMakeLists.txt
index ac20c95..1efcd7a 100644
--- a/src/tools/xmlversion/CMakeLists.txt
+++ b/src/tools/xmlversion/CMakeLists.txt
@@ -23,8 +23,8 @@ ELSE(CMAKE_SKIP_RPATH OR CMAKE_SKIP_BUILD_RPATH)
 	ADD_SDLIB_LIBRARY(xmlversion portability tgf txml)
 ENDIF(CMAKE_SKIP_RPATH OR CMAKE_SKIP_BUILD_RPATH)
 
-IF(UNIX)
+IF(UNIX AND NOT HAIKU)
   TARGET_LINK_LIBRARIES(xmlversion dl)
-ENDIF(UNIX)
+ENDIF(UNIX AND NOT HAIKU)
 
 # Note: we don't install xmlversion, as it's a only a build-time tool.
-- 
2.21.0

