From 151d64fc74c17700d695ebb01359f2d8d8352986 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 1 Feb 2015 18:22:36 +0000 Subject: [PATCH] clang: Add 3.5.1 recipe * Tested working on x86_64 * additional packaging might be needed for clang-tools-extra/ clang_extra --- sys-devel/clang/clang-3.5.1.recipe | 135 +++++++++++++++++++ sys-devel/clang/patches/clang-3.5.1.patchset | 117 ++++++++++++++++ sys-devel/clang/patches/llvm-3.5.1.patchset | 47 +++++++ 3 files changed, 299 insertions(+) create mode 100644 sys-devel/clang/clang-3.5.1.recipe create mode 100644 sys-devel/clang/patches/clang-3.5.1.patchset create mode 100644 sys-devel/clang/patches/llvm-3.5.1.patchset diff --git a/sys-devel/clang/clang-3.5.1.recipe b/sys-devel/clang/clang-3.5.1.recipe new file mode 100644 index 000000000..e07232269 --- /dev/null +++ b/sys-devel/clang/clang-3.5.1.recipe @@ -0,0 +1,135 @@ +SUMMARY="A llvm front end compiler for C and C++" +DESCRIPTION=" +Clang is an 'LLVM native' C/C++/Objective-C compiler, which aims to deliver \ +amazingly fast compiles (e.g. about 3x faster than GCC when compiling \ +Objective-C code in a debug configuration), extremely useful error and warning \ +messages and to provide a platform for building great source level tools. +" + +HOMEPAGE="http://www.llvm.org/" +LICENSE="UIUC" +COPYRIGHT="2003-2012 University of Illinois at Urbana-Champaign" + +SRC_URI="http://llvm.org/releases/${portVersion}/llvm-${portVersion}.src.tar.xz" +CHECKSUM_SHA256="bf3275d2d7890015c8d8f5e6f4f882f8cf3bf51967297ebe74111d6d8b53be15" + +SRC_URI_2="http://llvm.org/releases/${portVersion}/cfe-${portVersion}.src.tar.xz" +CHECKSUM_SHA256_2="6773f3f9cf815631cc7e779ec134ddd228dc8e9a250e1ea3a910610c59eb8f5c" + +SRC_URI_3="http://llvm.org/releases/${portVersion}/clang-tools-extra-${portVersion}.src.tar.xz" +CHECKSUM_SHA256_3="e8d011250389cfc36eb51557ca25ae66ab08173e8d53536a0747356105d72906" + +REVISION="1" + +ARCHITECTURES="x86 x86_64" +if [ $effectiveTargetArchitecture != x86_gcc2 ]; then + ARCHITECTURES="$ARCHITECTURES x86_gcc2" +fi +SECONDARY_ARCHITECTURES="x86" + +PROVIDES=" + clang$secondaryArchSuffix = $portVersion + cmd:clang = $portVersion + cmd:clang++ = $portVersion + cmd:c_index_test = $portVersion + lib:libLTO$secondaryArchSuffix = $portVersion + lib:libclang$secondaryArchSuffix = $portVersion + devel:libLTO$secondaryArchSuffix = $portVersion + devel:libclang$secondaryArchSuffix = $portVersion + " + +REQUIRES=" + haiku$secondaryArchSuffix + lib:libstdc++$secondaryArchSuffix + " + +BUILD_REQUIRES=" + " + +BUILD_PREREQUIRES=" + haiku${secondaryArchSuffix}_devel + cmd:aclocal + cmd:autoconf + cmd:automake + cmd:gcc$secondaryArchSuffix + cmd:groff + cmd:ld$secondaryArchSuffix + cmd:libtoolize + cmd:make + cmd:python + cmd:sed + " + +SOURCE_DIR="llvm-$portVersion.src" + +PATCHES="llvm-${portVersion}.patchset" +PATCHES_2="clang-${portVersion}.patchset" + +BUILD() +{ + # Add clang tools + mkdir -p tools/clang + cp -rd $sourceDir2/cfe-${portVersion}.src/* tools/clang/ + + # Add clang tools's tool's (really llvm?) + mkdir -p tools/clang/tools/extra + cp -rd $sourceDir3/clang-tools-extra-${portVersion}.src/* tools/clang/tools/extra + + # Haiku C++ requires rtti in a lot of central system components + # such as Mesa + export REQUIRES_RTTI=1 + + # TODO: clang's build system seems to ignore doc / man / shared dirs? + runConfigure ./configure --enable-optimized + make $jobArgs PROJ_datadir=$dataDir PROJ_docsdir=$docDir \ + PROJ_mandir=$manDir PROJ_includedir=$includeDir PROJ_libdir=$libDir +} + +INSTALL() +{ + mkdir -p $developDir + mkdir -p $docDir + mkdir -p $binDir + + make install-clang PROJ_datadir=$dataDir PROJ_docsdir=$docDir \ + PROJ_mandir=$manDir PROJ_includedir=$includeDir PROJ_libdir=$libDir + + # Remove empty dir that shouldn't be created + rmdir $prefix/include + + # 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 + + prepareInstalledDevelLibs libclang libLTO + + # analysis package + packageEntries analysis \ + $binDir/scan-build \ + $binDir/scan-view \ + $developDir/tools/clang$secondaryArchSuffix +} + +TEST() +{ + make check +} + + +# ----- analysis package ------------------------------------------------------- + +SUMMARY_analysis="Static analysis tools using the clang compiler" +PROVIDES_analysis=" + clang${secondaryArchSuffix}_analysis = $portVersion + cmd:scan_build$secondaryArchSuffix = $portVersion + cmd:scan_view$secondaryArchSuffix = $portVersion + " + +REQUIRES_analysis=" + clang$secondaryArchSuffix == $portVersion base + " diff --git a/sys-devel/clang/patches/clang-3.5.1.patchset b/sys-devel/clang/patches/clang-3.5.1.patchset new file mode 100644 index 000000000..d0ee3ab5d --- /dev/null +++ b/sys-devel/clang/patches/clang-3.5.1.patchset @@ -0,0 +1,117 @@ +From 3a2476543f16aa2afe5030875bd6c82f3eedfc73 Mon Sep 17 00:00:00 2001 +From: Alexander von Gluck IV +Date: Sun, 1 Feb 2015 15:13:57 +0000 +Subject: [PATCH 1/2] haiku: fix header search paths + +* /boot/develop no longer exists +* /boot/common no longer exists +--- + lib/Frontend/InitHeaderSearch.cpp | 67 ++++++++++++++++++++------------------- + 1 file changed, 35 insertions(+), 32 deletions(-) + +diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp +index d2edc94..f91346b 100644 +--- a/lib/Frontend/InitHeaderSearch.cpp ++++ b/lib/Frontend/InitHeaderSearch.cpp +@@ -271,38 +271,41 @@ 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); ++ 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/posix", System, false); ++ AddPath("/boot/system/develop/headers", System, false); + break; + case llvm::Triple::RTEMS: + break; +-- +1.8.3.4 + +From 83b0b512f8a6c879338b988da585ba903ff2c504 Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Sun, 1 Feb 2015 15:15:45 +0000 +Subject: [PATCH 2/2] libclang: add soname when building on Haiku. + +--- + tools/libclang/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/libclang/Makefile b/tools/libclang/Makefile +index db3d4f8..149f245 100644 +--- a/tools/libclang/Makefile ++++ b/tools/libclang/Makefile +@@ -33,7 +33,7 @@ USEDLIBS = clangIndex.a clangARCMigrate.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 + diff --git a/sys-devel/clang/patches/llvm-3.5.1.patchset b/sys-devel/clang/patches/llvm-3.5.1.patchset new file mode 100644 index 000000000..0f9980987 --- /dev/null +++ b/sys-devel/clang/patches/llvm-3.5.1.patchset @@ -0,0 +1,47 @@ +From 9cc674f2aa0f54b900d1e773a6ffd201c23e4c05 Mon Sep 17 00:00:00 2001 +From: Alexander von Gluck IV +Date: Wed, 22 Jan 2014 05:04:31 +0000 +Subject: haiku: fix Host.h for endian.h + + +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 + #else + #if !defined(BYTE_ORDER) && !defined(LLVM_ON_WIN32) +-- +1.8.3.4 + + +From 577d261e8e74bc442fe75515e043f268db923ed3 Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Sun, 18 May 2014 12:41:16 +0200 +Subject: libLTO: add soname when building on Haiku. + + +diff --git a/tools/lto/Makefile b/tools/lto/Makefile +index cedbee1..5ce530d 100644 +--- a/tools/lto/Makefile ++++ b/tools/lto/Makefile +@@ -22,6 +22,10 @@ ifdef LLVM_VERSION_INFO + CXX.Flags += -DLLVM_VERSION_INFO='"$(LLVM_VERSION_INFO)"' + endif + ++ifeq ($(HOST_OS),Haiku) ++ LLVMLibsOptions := $(LLVMLibsOptions) -Wl,-soname=$(SharedPrefix)LTO$(SHLIBEXT) ++endif ++ + ifeq ($(HOST_OS),Darwin) + # Special hack to allow libLTO to have an offset version number. + ifdef LLVM_LTO_VERSION_OFFSET +-- +1.8.3.4 +