diff options
author | Khem Raj <raj.khem@gmail.com> | 2015-05-15 14:52:54 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2015-05-15 14:52:54 -0700 |
commit | c582f59d3915b908f22b3cb9ebaa6fcbbc594bd8 (patch) | |
tree | 4b27fad44e8406c33329610b3b6ef58b4d93715d | |
parent | 8581dc624d1c10b37a5533ac168f6f491cddd86f (diff) | |
download | meta-clang-c582f59d3915b908f22b3cb9ebaa6fcbbc594bd8.tar.gz |
clang: Fix building for target
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | conf/clang.conf | 1 | ||||
-rw-r--r-- | recipes-devtools/clang/clang/0001-Remove-CMAKE_CROSSCOMPILING-so-it-can-cross-compile.patch | 34 | ||||
-rw-r--r-- | recipes-devtools/clang/clang_git.bb | 10 |
3 files changed, 44 insertions, 1 deletions
diff --git a/conf/clang.conf b/conf/clang.conf index 0d13d1d..ed3194e 100644 --- a/conf/clang.conf +++ b/conf/clang.conf | |||
@@ -5,6 +5,7 @@ CXX_toolchain-clang = "${TARGET_PREFIX}clang++ ${HOST_CC_ARCH}${TOOLCHAIN_OPTION | |||
5 | CPP_toolchain-clang = "${TARGET_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} -E" | 5 | CPP_toolchain-clang = "${TARGET_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} -E" |
6 | CCLD_toolchain-clang = "${TARGET_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" | 6 | CCLD_toolchain-clang = "${TARGET_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" |
7 | THUMB_TUNE_CCARGS_remove_toolchain-clang = "-mthumb-interwork" | 7 | THUMB_TUNE_CCARGS_remove_toolchain-clang = "-mthumb-interwork" |
8 | TUNE_CCARGS_append_toolchain-clang = " -D__extern_always_inline=inline" | ||
8 | 9 | ||
9 | TOOLCHAIN_pn-lzo = "clang" | 10 | TOOLCHAIN_pn-lzo = "clang" |
10 | DEPENDS_append_pn-lzo = " clang-cross-${TARGET_ARCH} " | 11 | DEPENDS_append_pn-lzo = " clang-cross-${TARGET_ARCH} " |
diff --git a/recipes-devtools/clang/clang/0001-Remove-CMAKE_CROSSCOMPILING-so-it-can-cross-compile.patch b/recipes-devtools/clang/clang/0001-Remove-CMAKE_CROSSCOMPILING-so-it-can-cross-compile.patch new file mode 100644 index 0000000..8945c66 --- /dev/null +++ b/recipes-devtools/clang/clang/0001-Remove-CMAKE_CROSSCOMPILING-so-it-can-cross-compile.patch | |||
@@ -0,0 +1,34 @@ | |||
1 | From a004191b8e3976ac4a201ddc78c03a777d3193d9 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Fri, 15 May 2015 12:13:17 -0700 | ||
4 | Subject: [PATCH] Remove CMAKE_CROSSCOMPILING so it can cross compile | ||
5 | |||
6 | we already have llvm-config from clang-native | ||
7 | |||
8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
9 | --- | ||
10 | tools/llvm-config/CMakeLists.txt | 4 ++-- | ||
11 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
12 | |||
13 | diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt | ||
14 | index d2ef45a..3d8b7b1 100644 | ||
15 | --- a/tools/llvm-config/CMakeLists.txt | ||
16 | +++ b/tools/llvm-config/CMakeLists.txt | ||
17 | @@ -34,7 +34,7 @@ add_llvm_tool(llvm-config | ||
18 | # Add the dependency on the generation step. | ||
19 | add_file_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/llvm-config.cpp ${BUILDVARIABLES_OBJPATH}) | ||
20 | |||
21 | -if(CMAKE_CROSSCOMPILING) | ||
22 | +if(CMAKE_CROSSCOMPILING1) | ||
23 | set(${project}_LLVM_CONFIG_EXE "${LLVM_NATIVE_BUILD}/bin/llvm-config") | ||
24 | set(${project}_LLVM_CONFIG_EXE ${${project}_LLVM_CONFIG_EXE} PARENT_SCOPE) | ||
25 | |||
26 | @@ -47,4 +47,4 @@ if(CMAKE_CROSSCOMPILING) | ||
27 | add_dependencies(${project}NativeLLVMConfig CONFIGURE_LLVM_NATIVE) | ||
28 | |||
29 | add_dependencies(llvm-config ${project}NativeLLVMConfig) | ||
30 | -endif(CMAKE_CROSSCOMPILING) | ||
31 | +endif(CMAKE_CROSSCOMPILING1) | ||
32 | -- | ||
33 | 2.1.4 | ||
34 | |||
diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb index a1d3cf6..d197908 100644 --- a/recipes-devtools/clang/clang_git.bb +++ b/recipes-devtools/clang/clang_git.bb | |||
@@ -14,6 +14,7 @@ LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=4c0bc17c954e99fd547528d938832bfa; \ | |||
14 | " | 14 | " |
15 | SRC_URI = "git://github.com/llvm-mirror/llvm.git;branch=${BRANCH};name=llvm \ | 15 | SRC_URI = "git://github.com/llvm-mirror/llvm.git;branch=${BRANCH};name=llvm \ |
16 | git://github.com/llvm-mirror/clang.git;branch=${BRANCH};destsuffix=git/tools/clang;name=clang \ | 16 | git://github.com/llvm-mirror/clang.git;branch=${BRANCH};destsuffix=git/tools/clang;name=clang \ |
17 | file://0001-Remove-CMAKE_CROSSCOMPILING-so-it-can-cross-compile.patch \ | ||
17 | " | 18 | " |
18 | 19 | ||
19 | SRCREV_llvm = "08709687efd951d1d6c3ad5f8d518129c068c737" | 20 | SRCREV_llvm = "08709687efd951d1d6c3ad5f8d518129c068c737" |
@@ -44,6 +45,7 @@ def get_clang_target_arch(bb, d): | |||
44 | #TUNE_CCARGS_remove = "-mthumb-interwork" | 45 | #TUNE_CCARGS_remove = "-mthumb-interwork" |
45 | #TUNE_CCARGS_remove = "-march=armv7-a" | 46 | #TUNE_CCARGS_remove = "-march=armv7-a" |
46 | #TUNE_CCARGS_remove = "-marm" | 47 | #TUNE_CCARGS_remove = "-marm" |
48 | TUNE_CCARGS_append_class-target = " -D__extern_always_inline=inline -L${PKG_CONFIG_SYSROOT_DIR}${libdir}/libxml2 -I${PKG_CONFIG_SYSROOT_DIR}${includedir}/libxml2 " | ||
47 | 49 | ||
48 | EXTRA_OECMAKE="-DLLVM_ENABLE_RTTI:BOOL=True \ | 50 | EXTRA_OECMAKE="-DLLVM_ENABLE_RTTI:BOOL=True \ |
49 | -DLLVM_ENABLE_FFI:BOOL=False \ | 51 | -DLLVM_ENABLE_FFI:BOOL=False \ |
@@ -59,6 +61,7 @@ EXTRA_OECMAKE_append_class-nativesdk = "\ | |||
59 | -DLLVM_TARGETS_TO_BUILD:STRING='AArch64;ARM;Mips;PowerPC;X86' \ | 61 | -DLLVM_TARGETS_TO_BUILD:STRING='AArch64;ARM;Mips;PowerPC;X86' \ |
60 | " | 62 | " |
61 | EXTRA_OECMAKE_append_class-target = "\ | 63 | EXTRA_OECMAKE_append_class-target = "\ |
64 | -DLLVM_ENABLE_PIC=False \ | ||
62 | -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \ | 65 | -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \ |
63 | -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \ | 66 | -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \ |
64 | -DLLVM_TARGETS_TO_BUILD:STRING='${@get_clang_target_arch(bb, d)}' \ | 67 | -DLLVM_TARGETS_TO_BUILD:STRING='${@get_clang_target_arch(bb, d)}' \ |
@@ -70,7 +73,7 @@ EXTRA_OECMAKE_append_class-target = "\ | |||
70 | # | 73 | # |
71 | EXTRA_OEMAKE += "REQUIRES_RTTI=1 VERBOSE=1" | 74 | EXTRA_OEMAKE += "REQUIRES_RTTI=1 VERBOSE=1" |
72 | 75 | ||
73 | DEPENDS = "zlib libffi libxml2-native binutils" | 76 | DEPENDS = "zlib libffi libxml2 binutils" |
74 | 77 | ||
75 | do_configure_prepend() { | 78 | do_configure_prepend() { |
76 | # Remove RPATHs | 79 | # Remove RPATHs |
@@ -83,6 +86,11 @@ do_configure_prepend() { | |||
83 | sed -ri "s#/(bin|include|lib)(/?\")#/\1/${LLVM_DIR}\2#g" ${S}/tools/llvm-config/llvm-config.cpp | 86 | sed -ri "s#/(bin|include|lib)(/?\")#/\1/${LLVM_DIR}\2#g" ${S}/tools/llvm-config/llvm-config.cpp |
84 | } | 87 | } |
85 | 88 | ||
89 | do_compile_prepend_class-native () { | ||
90 | oe_runmake LLVM-tablegen-host | ||
91 | oe_runmake CLANG-tablegen-host | ||
92 | } | ||
93 | |||
86 | do_install_append_class-native () { | 94 | do_install_append_class-native () { |
87 | install -Dm 0755 ${B}/NATIVE/bin/clang-tblgen ${D}${bindir}/clang-tblgen | 95 | install -Dm 0755 ${B}/NATIVE/bin/clang-tblgen ${D}${bindir}/clang-tblgen |
88 | for f in `find ${D}${bindir} -executable -type f -not -type l`; do | 96 | for f in `find ${D}${bindir} -executable -type f -not -type l`; do |