From dbc97e44eaeb44908e8e71edd0f6f64f79cfef3e Mon Sep 17 00:00:00 2001
From: Alexander von Gluck IV <kallisti5@unixzen.com>
Date: Fri, 24 Jan 2014 02:22:17 +0000
Subject: haiku: Fix header search paths

* /boot/develop no longer exists
* /boot/common no longer exists
* We still need to figure something out
  for secondary architecture builds.

diff --git a/clang-3.4/lib/Frontend/InitHeaderSearch.cpp b/clang-3.4/lib/Frontend/InitHeaderSearch.cpp
index d144cbb..e96e329 100644
--- a/clang-3.4/lib/Frontend/InitHeaderSearch.cpp
+++ b/clang-3.4/lib/Frontend/InitHeaderSearch.cpp
@@ -272,38 +272,44 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
     llvm_unreachable("Include management is handled in the driver.");
 
   case llvm::Triple::Haiku:
-    AddPath("/boot/common/include", System, false);
-    AddPath("/boot/develop/headers/os", System, false);
-    AddPath("/boot/develop/headers/os/app", System, false);
-    AddPath("/boot/develop/headers/os/arch", System, false);
-    AddPath("/boot/develop/headers/os/device", System, false);
-    AddPath("/boot/develop/headers/os/drivers", System, false);
-    AddPath("/boot/develop/headers/os/game", System, false);
-    AddPath("/boot/develop/headers/os/interface", System, false);
-    AddPath("/boot/develop/headers/os/kernel", System, false);
-    AddPath("/boot/develop/headers/os/locale", System, false);
-    AddPath("/boot/develop/headers/os/mail", System, false);
-    AddPath("/boot/develop/headers/os/media", System, false);
-    AddPath("/boot/develop/headers/os/midi", System, false);
-    AddPath("/boot/develop/headers/os/midi2", System, false);
-    AddPath("/boot/develop/headers/os/net", System, false);
-    AddPath("/boot/develop/headers/os/storage", System, false);
-    AddPath("/boot/develop/headers/os/support", System, false);
-    AddPath("/boot/develop/headers/os/translation", System, false);
-    AddPath("/boot/develop/headers/os/add-ons/graphics", System, false);
-    AddPath("/boot/develop/headers/os/add-ons/input_server", System, false);
-    AddPath("/boot/develop/headers/os/add-ons/screen_saver", System, false);
-    AddPath("/boot/develop/headers/os/add-ons/tracker", System, false);
-    AddPath("/boot/develop/headers/os/be_apps/Deskbar", System, false);
-    AddPath("/boot/develop/headers/os/be_apps/NetPositive", System, false);
-    AddPath("/boot/develop/headers/os/be_apps/Tracker", System, false);
-    AddPath("/boot/develop/headers/cpp", System, false);
-    AddPath("/boot/develop/headers/cpp/i586-pc-haiku", System, false);
-    AddPath("/boot/develop/headers/3rdparty", System, false);
-    AddPath("/boot/develop/headers/bsd", System, false);
-    AddPath("/boot/develop/headers/glibc", System, false);
-    AddPath("/boot/develop/headers/posix", System, false);
-    AddPath("/boot/develop/headers",  System, false);
+  	// TODO: We need to handle hybrid secondary architecture paths
+  	// (see buildtools/tree/gcc/gcc/config/haiku.h)
+    AddPath("/boot/system/non-packaged/develop/headers", System, false);
+    AddPath("/boot/system/develop/headers/os", System, false);
+    AddPath("/boot/system/develop/headers/os/app", System, false);
+    AddPath("/boot/system/develop/headers/os/arch", System, false);
+    AddPath("/boot/system/develop/headers/os/device", System, false);
+    AddPath("/boot/system/develop/headers/os/drivers", System, false);
+    AddPath("/boot/system/develop/headers/os/game", System, false);
+    AddPath("/boot/system/develop/headers/os/interface", System, false);
+    AddPath("/boot/system/develop/headers/os/kernel", System, false);
+    AddPath("/boot/system/develop/headers/os/locale", System, false);
+    AddPath("/boot/system/develop/headers/os/mail", System, false);
+    AddPath("/boot/system/develop/headers/os/media", System, false);
+    AddPath("/boot/system/develop/headers/os/midi", System, false);
+    AddPath("/boot/system/develop/headers/os/midi2", System, false);
+    AddPath("/boot/system/develop/headers/os/net", System, false);
+    AddPath("/boot/system/develop/headers/os/opengl", System, false);
+    AddPath("/boot/system/develop/headers/os/storage", System, false);
+    AddPath("/boot/system/develop/headers/os/support", System, false);
+    AddPath("/boot/system/develop/headers/os/translation", System, false);
+    AddPath("/boot/system/develop/headers/os/add-ons/graphics", System, false);
+    AddPath("/boot/system/develop/headers/os/add-ons/input_server", System, false);
+    AddPath("/boot/system/develop/headers/os/add-ons/mail_daemon", System, false);
+    AddPath("/boot/system/develop/headers/os/add-ons/registrar", System, false);
+    AddPath("/boot/system/develop/headers/os/add-ons/screen_saver", System, false);
+    AddPath("/boot/system/develop/headers/os/add-ons/tracker", System, false);
+    AddPath("/boot/system/develop/headers/os/be_apps/Deskbar", System, false);
+    AddPath("/boot/system/develop/headers/os/be_apps/NetPositive", System, false);
+    AddPath("/boot/system/develop/headers/os/be_apps/Tracker", System, false);
+    AddPath("/boot/system/develop/headers/cpp", System, false);
+    AddPath("/boot/system/develop/headers/cpp/i586-pc-haiku", System, false);
+    AddPath("/boot/system/develop/headers/3rdparty", System, false);
+    AddPath("/boot/system/develop/headers/bsd", System, false);
+    AddPath("/boot/system/develop/headers/glibc", System, false);
+    AddPath("/boot/system/develop/headers/gnu", System, false);
+    AddPath("/boot/system/develop/headers/posix", System, false);
+    AddPath("/boot/system/develop/headers", System, false);
     break;
   case llvm::Triple::RTEMS:
     break;
-- 
1.8.3.4


From 67f6c48d61c2350ec3063c373f5c8ad196c456df Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 18 May 2014 12:41:50 +0200
Subject: libclang: add soname when building on Haiku.


diff --git a/clang-3.4/tools/libclang/Makefile b/clang-3.4/tools/libclang/Makefile
index 43ecbd1..837276d 100644
--- a/clang-3.4/tools/libclang/Makefile
+++ b/clang-3.4/tools/libclang/Makefile
@@ -29,7 +29,7 @@ USEDLIBS = clangIndex.a clangFrontend.a clangDriver.a \
 include $(CLANG_LEVEL)/Makefile
 
 # Add soname to the library.
-ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD GNU GNU/kFreeBSD))
+ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD GNU GNU/kFreeBSD Haiku))
         LLVMLibsOptions += -Wl,-soname,lib$(LIBRARYNAME)$(SHLIBEXT)
 endif
 
-- 
1.8.3.4

