llvm: switch to cmake build.

This commit is contained in:
Jerome Duval
2016-01-31 16:46:04 +00:00
parent 999240401d
commit 3997f345e9
2 changed files with 305 additions and 27 deletions

View File

@@ -31,7 +31,7 @@ other than the ones listed above.
HOMEPAGE="http://www.llvm.org/"
COPYRIGHT="2003-2014 University of Illinois at Urbana-Champaign"
LICENSE="UIUC"
REVISION="1"
REVISION="2"
SOURCE_URI="http://llvm.org/pre-releases/${portVersion/~*}/${portVersion/*~}/llvm-${portVersion/\~}.src.tar.xz"
SOURCE_URI_2="http://llvm.org/pre-releases/${portVersion/~*}/${portVersion/*~}/cfe-${portVersion/\~}.src.tar.xz"
SOURCE_URI_3="http://llvm.org/pre-releases/${portVersion/~*}/${portVersion/*~}/clang-tools-extra-${portVersion/\~}.src.tar.xz"
@@ -56,6 +56,7 @@ PROVIDES="
cmd:llvm_ar
cmd:llvm_as
cmd:llvm_bcanalyzer
cmd:llvm_c_test
cmd:llvm_config
cmd:llvm_cov
cmd:llvm_cxxdump
@@ -65,6 +66,7 @@ PROVIDES="
cmd:llvm_dwarfdump
cmd:llvm_dwp
cmd:llvm_extract
cmd:llvm_lib
cmd:llvm_link
cmd:llvm_lto
cmd:llvm_mc
@@ -212,6 +214,7 @@ PROVIDES="
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
PROVIDES_clang="
llvm${secondaryArchSuffix}_clang = $portVersion
@@ -226,7 +229,8 @@ PROVIDES_clang="
cmd:clang_tblgen = $portVersion
cmd:clang_tidy = $portVersion
cmd:c_index_test = $portVersion
cmd:pp_trace = $portVersion
cmd:git_clang_format = $portVersion
cmd:modularize = $portVersion
lib:libclang$secondaryArchSuffix = $portVersion
devel:libclang$secondaryArchSuffix = $portVersion
devel:libclangarcmigrate$secondaryArchSuffix = $portVersion
@@ -269,9 +273,12 @@ PROVIDES_clang="
"
REQUIRES_clang="
haiku$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
PROVIDES_clang_analysis="
llvm${secondaryArchSuffix}_clang_analysis = $portVersion
cmd:c++_analyzer$secondaryArchSuffix = $portVersion
cmd:ccc_analyzer$secondaryArchSuffix = $portVersion
cmd:scan_build$secondaryArchSuffix = $portVersion
cmd:scan_view$secondaryArchSuffix = $portVersion
"
@@ -281,16 +288,14 @@ REQUIRES_clang_analysis="
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:aclocal
cmd:autoconf
cmd:automake
cmd:cmake
cmd:find
cmd:gcc$secondaryArchSuffix
cmd:groff
cmd:ld$secondaryArchSuffix
cmd:libtoolize
cmd:make
cmd:python
cmd:sed
@@ -310,8 +315,10 @@ BUILD()
mkdir -p build; cd build
# Haiku C++ requires rtti in a lot of central system components
# such as Mesa
export REQUIRES_RTTI=1
runConfigure ../configure --enable-optimized
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$prefix \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_ENABLE_THREADS=NO \
..
make $jobArgs PROJ_datadir=$dataDir PROJ_docsdir=$docDir \
PROJ_mandir=$manDir PROJ_includedir=$includeDir PROJ_libdir=$libDir
}
@@ -319,9 +326,7 @@ BUILD()
INSTALL()
{
cd build
mkdir -p $developDir
mkdir -p $docDir
mkdir -p $binDir
mkdir -p $binDir $developDir $dataDir $docDir $includeDir $manDir
make install PROJ_datadir=$dataDir PROJ_docsdir=$docDir \
PROJ_mandir=$manDir PROJ_includedir=$includeDir PROJ_libdir=$libDir
@@ -336,25 +341,27 @@ INSTALL()
make -C tools/clang install PROJ_datadir=$dataDir PROJ_docsdir=$docDir \
PROJ_mandir=$manDir PROJ_includedir=$includeDir PROJ_libdir=$libDir
# 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*
mv $prefix/include/* $includeDir/
rmdir $prefix/include
mv $prefix/libexec/* $binDir/
mv $prefix/share/man/* $manDir/
mv $prefix/share/clang $dataDir/
mv $prefix/share/llvm $dataDir/
mv $prefix/share/scan-build $dataDir/
mv $prefix/share/scan-view $dataDir/
rmdir $prefix/include $prefix/libexec $prefix/share/man
# analysis package
sed -i 's|/libexec/|/bin/|' $binDir/scan-build
sed -i 's|/share/|/data/|' $binDir/scan-build $binDir/scan-view
# clang package
packageEntries clang \
$binDir/c-index-test \
$binDir/clang* \
$binDir/pp-trace \
$binDir/git-clang-format \
$binDir/modularize \
$dataDir/clang \
$includeDir/clang* \
$libDir/libclang* \
$libDir/clang \
@@ -364,7 +371,11 @@ INSTALL()
packageEntries clang_analysis \
$binDir/scan-build \
$binDir/scan-view \
$developDir/tools/clang$secondaryArchSuffix
$binDir/c++-analyzer \
$binDir/ccc-analyzer \
$dataDir/scan-build \
$dataDir/scan-view \
$manDir/man1/scan-build.1
}
TEST()

View File

@@ -1,4 +1,4 @@
From 04d1b341b12990a70fdf4b04f5c1cfb5795e19c6 Mon Sep 17 00:00:00 2001
From 6b8f3f7b0e6b369968bcf9308cff89eed89065a2 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: haiku: fix Host.h for endian.h
@@ -21,7 +21,7 @@ index 8f4bf3c..8114f9b 100644
2.2.2
From 30a29ae7267107d93109d709d1ec00ff9965fa45 Mon Sep 17 00:00:00 2001
From eaacb667d69e2cb0595041283bbfd95952028fde Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 18 May 2014 12:41:16 +0200
Subject: libLTO: add soname when building on Haiku.
@@ -46,7 +46,7 @@ index 530c05a..ffa76d2 100644
2.2.2
From 6284c7f4baaa5989af78b8b54ff011fb483dbb98 Mon Sep 17 00:00:00 2001
From 7947f9897c36c3980262fb21e4e69e73e9d8dd8f Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Wed, 20 Jan 2016 21:13:28 +0000
Subject: llvm-config: use /develop/headers instead of /include
@@ -93,3 +93,270 @@ index 80f6279..8275aac 100644
--
2.2.2
From 20d0593975bcacf8f9cf20fb299bf3d946e68077 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sun, 31 Jan 2016 10:23:24 +0000
Subject: patch cmake build for Haiku.
diff --git a/autoconf/config.guess b/autoconf/config.guess
index b209a1a..776ef5c 100755
--- a/autoconf/config.guess
+++ b/autoconf/config.guess
@@ -2,13 +2,13 @@
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-# 2011 Free Software Foundation, Inc.
+# 2011, 2012, 2013 Free Software Foundation, Inc.
-timestamp='2011-08-20'
+timestamp='2012-12-29'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
@@ -17,26 +17,22 @@ timestamp='2011-08-20'
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner. Please send patches (context
-# diff format) to <config-patches@gnu.org> and include a ChangeLog
-# entry.
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
#
-# This script attempts to guess a canonical system name similar to
-# config.sub. If it succeeds, it prints the system name on stdout, and
-# exits with 0. Otherwise, it exits with 1.
+# Originally written by Per Bothner.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+#
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+
me=`echo "$0" | sed -e 's,.*/,,'`
@@ -57,8 +53,8 @@ GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
-Software Foundation, Inc.
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
+2012, 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -145,7 +141,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
- # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
@@ -202,14 +198,14 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit ;;
- *:OpenBSD:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
- exit ;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
exit ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;;
@@ -308,7 +304,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
- arm:riscos:*:*|arm:RISCOS:*:*)
+ arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -807,10 +803,13 @@ EOF
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
+ *:MINGW64*:*)
+ echo ${UNAME_MACHINE}-pc-mingw64
+ exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
- *:MSYS*:*)
+ i*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*)
@@ -867,8 +866,12 @@ EOF
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
- aarch64*:Linux:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ aarch64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ aarch64_be:Linux:*:*)
+ UNAME_MACHINE=aarch64_be
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
@@ -904,13 +907,16 @@ EOF
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
cris:Linux:*:*)
- echo cris-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;;
crisv32:Linux:*:*)
- echo crisv32-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;;
frv:Linux:*:*)
- echo frv-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ hexagon:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
LIBC=gnu
@@ -952,7 +958,7 @@ EOF
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
or32:Linux:*:*)
- echo or32-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-gnu
@@ -971,9 +977,6 @@ EOF
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
exit ;;
- ppc64le:Linux:*:*)
- echo powerpc64le-unknown-linux-gnu
- exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;;
@@ -996,7 +999,7 @@ EOF
echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;;
x86_64:Linux:*:*)
- echo x86_64-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -1203,6 +1206,9 @@ EOF
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
+ x86_64:Haiku:*:*)
+ echo x86_64-unknown-haiku
+ exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
@@ -1258,7 +1264,7 @@ EOF
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
- NSE-?:NONSTOP_KERNEL:*:*)
+ NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
@@ -1327,11 +1333,11 @@ EOF
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
+ x86_64:VMkernel:*:*)
+ echo ${UNAME_MACHINE}-unknown-esx
+ exit ;;
esac
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index f699211..c5be442 100755
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -13,7 +13,7 @@ include(TestBigEndian)
include(HandleLLVMStdlib)
-if( UNIX AND NOT BEOS )
+if( UNIX AND NOT (BEOS OR HAIKU) )
# Used by check_symbol_exists:
set(CMAKE_REQUIRED_LIBRARIES m)
endif()
diff --git a/cmake/modules/CheckAtomic.cmake b/cmake/modules/CheckAtomic.cmake
index 551de6a..d43fd7b 100644
--- a/cmake/modules/CheckAtomic.cmake
+++ b/cmake/modules/CheckAtomic.cmake
@@ -32,8 +32,6 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
if (NOT HAVE_CXX_ATOMICS_WITH_LIB)
message(FATAL_ERROR "Host compiler must support std::atomic!")
endif()
- else()
- message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.")
endif()
endif()
endif()
diff --git a/lib/Support/CMakeLists.txt b/lib/Support/CMakeLists.txt
index 75b3e89..db5c555 100644
--- a/lib/Support/CMakeLists.txt
+++ b/lib/Support/CMakeLists.txt
@@ -24,7 +24,9 @@ if( NOT MSVC )
if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ )
set(system_libs ${system_libs} z)
endif()
- set(system_libs ${system_libs} m)
+ if( UNIX AND NOT (BEOS OR HAIKU) )
+ set(system_libs ${system_libs} m)
+ endif()
endif( MINGW )
endif( NOT MSVC )
--
2.2.2