From 5ea8e209324e9b5a31295982ce0413126eaace4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adri=C3=A1n=20Arroyo=20Calle?=
 <adrian.arroyocalle@gmail.com>
Date: Wed, 24 Dec 2014 14:55:21 +0000
Subject: Add __HAIKU__ when needed


diff --git a/src/osgDB/FileUtils.cpp b/src/osgDB/FileUtils.cpp
index c0c8cec..f723123 100644
--- a/src/osgDB/FileUtils.cpp
+++ b/src/osgDB/FileUtils.cpp
@@ -80,8 +80,8 @@ typedef char TCHAR;
     #if (MAC_OS_X_VERSION_MAX_ALLOWED <= 1040)
         #define stat64 stat
     #endif
-#elif defined(__CYGWIN__) || defined(__FreeBSD__) || defined(__DragonFly__) || \
-      (defined(__hpux) && !defined(_LARGEFILE64_SOURCE))
+#elif defined(__CYGWIN__) || defined(__HAIKU__) || defined(__FreeBSD__) || \
+      defined(__DragonFly__) || (defined(__hpux) && !defined(_LARGEFILE64_SOURCE))
     #define stat64 stat
 #endif
 
diff --git a/src/osgPlugins/osc/osc/OscHostEndianness.h b/src/osgPlugins/osc/osc/OscHostEndianness.h
index fe135f4..680fcfe 100644
--- a/src/osgPlugins/osc/osc/OscHostEndianness.h
+++ b/src/osgPlugins/osc/osc/OscHostEndianness.h
@@ -51,7 +51,7 @@
 
 #else
 
-    #if defined(__GLIBC__) || defined(__ANDROID__) || defined(__CYGWIN__)
+    #if defined(__GLIBC__) || defined(__ANDROID__) || defined(__CYGWIN__) || defined(__HAIKU__)
         #include <endian.h>
         #if (__BYTE_ORDER == __LITTLE_ENDIAN)
             #ifndef __LITTLE_ENDIAN__
-- 
2.30.0


From f63eb838383d774ba3237c3e9d0c42541e98c84c Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 8 Oct 2018 00:19:11 +1000
Subject: Find plugins in system lib and addons directory


diff --git a/src/osgDB/FileUtils.cpp b/src/osgDB/FileUtils.cpp
index f723123..fd87ddb 100644
--- a/src/osgDB/FileUtils.cpp
+++ b/src/osgDB/FileUtils.cpp
@@ -763,6 +763,26 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths)
         convertStringPathIntoFilePathList("/usr/bin/:/usr/local/bin/",filepath);
     }
 
+#elif defined(__HAIKU__)
+
+    void osgDB::appendPlatformSpecificLibraryFilePaths(FilePathList& filepath)
+    {
+
+       char* ptr;
+       if( (ptr = getenv( "LD_LIBRARY_PATH" )) )
+        {
+            convertStringPathIntoFilePathList(ptr,filepath);
+        }
+
+        appendInstallationLibraryFilePaths(filepath);
+
+#if defined(__ia64__) || defined(__x86_64__)
+        convertStringPathIntoFilePathList("/system/lib/:/system/add-ons/",filepath);
+#else
+        convertStringPathIntoFilePathList("/system/lib/x86/:/system/add-ons/x86/",filepath);
+#endif
+    }
+
 #elif defined(WIN32)
 
     void osgDB::appendPlatformSpecificLibraryFilePaths(FilePathList& filepath)
-- 
2.30.0

