rust-llvm: Make llvm-config cross compile friendly

Import patches from clang layer to ensure that llvm-config
can be provided configs from environment

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj
2018-11-09 22:52:05 -08:00
parent e04d99bf38
commit b15ba05ea8
2 changed files with 73 additions and 15 deletions
+3 -15
View File
@@ -14,6 +14,9 @@ DEPENDS += "ninja-native rust-llvm-native"
ARM_INSTRUCTION_SET_armv5 = "arm"
ARM_INSTRUCTION_SET_armv4t = "arm"
LLVM_RELEASE = "6.0"
LLVM_DIR = "llvm${LLVM_RELEASE}"
EXTRA_OECMAKE = " \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_TARGETS_TO_BUILD='X86;ARM;AArch64;PowerPC;Mips' \
@@ -41,21 +44,6 @@ EXTRA_OECMAKE_append_class-target = "\
# provide almost no value. If you really need them then override this
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
do_compile_prepend_class-target() {
# Fix paths in llvm-config
sed -i "s|sys::path::parent_path(CurrentPath))\.str()|sys::path::parent_path(sys::path::parent_path(CurrentPath))).str()|g" ${S}/tools/llvm-config/llvm-config.cpp
# Fix the hardcoded libdir in llvm-config
sed -i 's:/lib\>:/${baselib}:g' ${S}/tools/llvm-config/llvm-config.cpp
}
do_compile_class-native() {
ninja -v ${PARALLEL_MAKE} llvm-config llvm-tblgen
}
do_install_class-native() {
install -D -m 0755 ${B}/bin/llvm-tblgen ${D}${libdir}/llvm-rust/bin/llvm-tblgen
install -D -m 0755 ${B}/bin/llvm-config ${D}${libdir}/llvm-rust/bin/llvm-config
}
do_install_append_class-target() {
# Disable checks on the native tools, since these should came from the native recipe
sed -i -e 's/\(.*APPEND.*_IMPORT_CHECK_FILES_FOR_.*{_IMPORT_PREFIX}\/bin\/.*\)/#\1/' ${D}/usr/share/llvm/cmake/LLVMExports-noconfig.cmake