clang: Patch to fix headers, add static analysis package

* clang was using the wrong include directories, patched
  to use /boot/system/development vs /boot/development
  Upstreamed: llvm.org/show_bug.cgi?id=18595
* Manually copy over the static analysis tools (no automated
  installation) and give them what they need to function.
  (tested working!)
* clang isn't aware of secondary architecture include
  paths at this time.
This commit is contained in:
Alexander von Gluck IV
2014-01-24 04:51:21 +00:00
parent 0c9343db65
commit 176cac1066
3 changed files with 139 additions and 27 deletions

View File

@@ -14,7 +14,7 @@ SRC_URI="http://llvm.org/releases/${portVersion}/llvm-${portVersion}.src.tar.gz"
CHECKSUM_MD5="46ed668a1ce38985120dbf6344cf6116"
SRC_URI_2="http://llvm.org/releases/${portVersion}/clang-${portVersion}.src.tar.gz"
CHECKSUM_MD5_2="b378f1e2c424e03289effc75268d3d2c"
REVISION="1"
REVISION="2"
ARCHITECTURES="x86 x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
@@ -55,7 +55,8 @@ BUILD_PREREQUIRES="
SOURCE_DIR="llvm-${portVersion}"
PATCHES="clang-${portVersion}.patchset"
PATCHES="llvm-${portVersion}.patchset"
PATCHES_2="clang-${portVersion}.patchset"
BUILD()
{
@@ -82,10 +83,21 @@ INSTALL()
mkdir -p $docDir
make install-clang
# devel package
packageEntries devel \
$developDir
# Install static analysis tools
mkdir -p $developDir/tools/clang$secondaryArchSuffix
cp -Ra tools/clang/tools/scan-build $developDir/tools/clang$secondaryArchSuffix/
cp -Ra tools/clang/tools/scan-view $developDir/tools/clang$secondaryArchSuffix/
ln -s $developDir/tools/clang$secondaryArchSuffix/scan-build/scan-build $binDir/scan-build
ln -s $developDir/tools/clang$secondaryArchSuffix/scan-view/scan-view $binDir/scan-view
ln -s $binDir/clang $developDir/tools/clang$secondaryArchSuffix/scan-build/clang
# analysis package
packageEntries analysis \
$binDir/scan-build \
$binDir/scan-view \
$developDir/tools/clang$secondaryArchSuffix
}
TEST()
@@ -94,12 +106,15 @@ TEST()
}
# ----- devel package -------------------------------------------------------
# ----- analysis package -------------------------------------------------------
PROVIDES_devel="
clang${secondaryArchSuffix}_devel = $portVersion
SUMMARY_analysis="Static analysis tools using the clang compiler"
PROVIDES_analysis="
clang${secondaryArchSuffix}_analysis = $portVersion
cmd:scan_build = $portVersion
cmd:scan_view = $portVersion
"
REQUIRES_devel="
REQUIRES_analysis="
clang$secondaryArchSuffix == $portVersion base
"

View File

@@ -1,25 +1,97 @@
From 744634aa845c403f5a39b8257bbacd36dc1dd351 Mon Sep 17 00:00:00 2001
From 33c9dfc71ce4a7cc0a0e5967b9110bcbc3d0a7d7 Mon Sep 17 00:00:00 2001
From: Alexander von Gluck IV <kallisti5@unixzen.com>
Date: Wed, 22 Jan 2014 05:04:31 +0000
Subject: [PATCH] haiku: fix Host.h for endian.h
Date: Fri, 24 Jan 2014 02:22:17 +0000
Subject: [PATCH] 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.
---
include/llvm/Support/Host.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
lib/Frontend/InitHeaderSearch.cpp | 70 +++++++++++++++++++++------------------
1 file changed, 38 insertions(+), 32 deletions(-)
diff --git a/include/llvm/Support/Host.h b/include/llvm/Support/Host.h
index 28c4cc7..ab985a4 100644
--- a/include/llvm/Support/Host.h
+++ b/include/llvm/Support/Host.h
@@ -16,7 +16,7 @@
diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp
index d144cbb..e96e329 100644
--- a/lib/Frontend/InitHeaderSearch.cpp
+++ b/lib/Frontend/InitHeaderSearch.cpp
@@ -272,38 +272,44 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
llvm_unreachable("Include management is handled in the driver.");
#include "llvm/ADT/StringMap.h"
-#if defined(__linux__) || defined(__GNU__)
+#if defined(__linux__) || defined(__GNU__) || defined(__HAIKU__)
#include <endian.h>
#else
#if !defined(BYTE_ORDER) && !defined(LLVM_ON_WIN32)
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

View File

@@ -0,0 +1,25 @@
From 744634aa845c403f5a39b8257bbacd36dc1dd351 Mon Sep 17 00:00:00 2001
From: Alexander von Gluck IV <kallisti5@unixzen.com>
Date: Wed, 22 Jan 2014 05:04:31 +0000
Subject: [PATCH] haiku: fix Host.h for endian.h
---
include/llvm/Support/Host.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/llvm/Support/Host.h b/include/llvm/Support/Host.h
index 28c4cc7..ab985a4 100644
--- a/include/llvm/Support/Host.h
+++ b/include/llvm/Support/Host.h
@@ -16,7 +16,7 @@
#include "llvm/ADT/StringMap.h"
-#if defined(__linux__) || defined(__GNU__)
+#if defined(__linux__) || defined(__GNU__) || defined(__HAIKU__)
#include <endian.h>
#else
#if !defined(BYTE_ORDER) && !defined(LLVM_ON_WIN32)
--
1.8.3.4