From 404cbe3dccba9475ca6aaca9ad318bfe6b2682d9 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Thu, 3 Nov 2016 10:29:50 -0500 Subject: [PATCH] rust-llvm: cmake build bits from openswitch Grabbed this chunk from http://git.openswitch.net/cgit/openswitch/ops-build/tree/yocto/openswitch/meta-foss-openswitch/recipes-core/llvm/llvm.inc The cmake.bbclass that poky ships with does not generate the proper values for native builds so this is necessary to fix that up. --- recipes-devtools/rust/rust-llvm.inc | 74 +++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/recipes-devtools/rust/rust-llvm.inc b/recipes-devtools/rust/rust-llvm.inc index 880e3ec..c8800b6 100644 --- a/recipes-devtools/rust/rust-llvm.inc +++ b/recipes-devtools/rust/rust-llvm.inc @@ -31,6 +31,80 @@ EXTRA_OECMAKE = " \ # provide almost no value. If you really need them then override this INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +EXTRA_OECMAKE_append_class-target = "\ + -DCROSS_TOOLCHAIN_FLAGS_NATIVE='-DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/native_toolchain.cmake' \ +" + +do_generate_native_toolchain_file() { + cat > ${WORKDIR}/native_toolchain.cmake <:/${baselib}:g' ${S}/tools/llvm-config/llvm-config.cpp +} + +do_compile() { + oe_runmake +} + +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 +} + +SYSROOT_PREPROCESS_FUNCS_append_class-target = " llvm_sysroot_preprocess" +SYSROOT_PREPROCESS_FUNCS_append_class-native = " llvm_native_sysroot_preprocess" + +llvm_sysroot_preprocess() { + install -d ${SYSROOT_DESTDIR}${bindir} + cp ${B}/NATIVE/bin/llvm-config ${SYSROOT_DESTDIR}/${bindir} || bbfatal "missing llvm-config" + cp ${B}/NATIVE/bin/llvm-tblgen ${SYSROOT_DESTDIR}/${bindir} || bbfatal "missing llvm-tblgen" +} + +llvm_native_sysroot_preprocess() { + sysroot_stage_dir ${D}${STAGING_DIR_NATIVE}/usr/libexec ${SYSROOT_DESTDIR}${bindir} +} + PACKAGES += "${PN}-data" # Add the extra locations to avoid the complaints about unpackaged files