summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/llvm')
-rw-r--r--meta/recipes-devtools/llvm/llvm/0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch31
-rw-r--r--meta/recipes-devtools/llvm/llvm/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch91
-rw-r--r--meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch114
-rw-r--r--meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patch37
-rw-r--r--meta/recipes-devtools/llvm/llvm/llvm-config51
-rw-r--r--meta/recipes-devtools/llvm/llvm_18.1.5.bb177
-rw-r--r--meta/recipes-devtools/llvm/llvm_git.bb179
7 files changed, 296 insertions, 384 deletions
diff --git a/meta/recipes-devtools/llvm/llvm/0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch b/meta/recipes-devtools/llvm/llvm/0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch
new file mode 100644
index 0000000000..a5c53b6657
--- /dev/null
+++ b/meta/recipes-devtools/llvm/llvm/0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch
@@ -0,0 +1,31 @@
+From 3b30a9bda88374e8f03bf96e972aee5bd214b98b Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Fri, 27 Nov 2020 10:11:08 +0000
+Subject: [PATCH] AsmMatcherEmitter: sort ClassInfo lists by name as well
+
+Otherwise, there are instances which are identical in
+every other field and therefore sort non-reproducibly
+(which breaks binary and source reproducibiliy).
+
+Upstream-Status: Submitted [https://reviews.llvm.org/D97477]
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+---
+ llvm/utils/TableGen/AsmMatcherEmitter.cpp | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
+index 73724e662f9e..1ca9c73415db 100644
+--- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp
++++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
+@@ -361,7 +361,10 @@ public:
+ // name of a class shouldn't be significant. However, some of the backends
+ // accidentally rely on this behaviour, so it will have to stay like this
+ // until they are fixed.
+- return ValueName < RHS.ValueName;
++ if (ValueName != RHS.ValueName)
++ return ValueName < RHS.ValueName;
++ // All else being equal, we should sort by name, for source and binary reproducibility
++ return Name < RHS.Name;
+ }
+ };
+
diff --git a/meta/recipes-devtools/llvm/llvm/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch b/meta/recipes-devtools/llvm/llvm/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
deleted file mode 100644
index 6dbbced7eb..0000000000
--- a/meta/recipes-devtools/llvm/llvm/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
+++ /dev/null
@@ -1,91 +0,0 @@
-From 905cac8934fb17e20416a4df712a566e757471a3 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 21 May 2016 00:33:20 +0000
-Subject: [PATCH 1/2] llvm: TargetLibraryInfo: Undefine libc functions if they are macros
-
-musl defines some functions as macros and not inline functions
-if this is the case then make sure to undefine them
-
-Upstream-Status: Pending
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- include/llvm/Analysis/TargetLibraryInfo.def | 21 +++++++++++++++++++++
- 1 file changed, 21 insertions(+)
-
-diff --git a/include/llvm/Analysis/TargetLibraryInfo.def b/include/llvm/Analysis/TargetLibraryInfo.def
-index 518a85ee1a0..6b4ead4efc6 100644
---- a/include/llvm/Analysis/TargetLibraryInfo.def
-+++ b/include/llvm/Analysis/TargetLibraryInfo.def
-@@ -731,6 +731,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl")
- TLI_DEFINE_ENUM_INTERNAL(fopen)
- TLI_DEFINE_STRING_INTERNAL("fopen")
- /// FILE *fopen64(const char *filename, const char *opentype)
-+#ifdef fopen64
-+#undef fopen64
-+#endif
- TLI_DEFINE_ENUM_INTERNAL(fopen64)
- TLI_DEFINE_STRING_INTERNAL("fopen64")
- /// int fork();
-@@ -778,6 +781,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek")
- /// int fseeko(FILE *stream, off_t offset, int whence);
- TLI_DEFINE_ENUM_INTERNAL(fseeko)
- TLI_DEFINE_STRING_INTERNAL("fseeko")
-+#ifdef fseeko64
-+#undef fseeko64
-+#endif
- /// int fseeko64(FILE *stream, off64_t offset, int whence)
- TLI_DEFINE_ENUM_INTERNAL(fseeko64)
- TLI_DEFINE_STRING_INTERNAL("fseeko64")
-@@ -788,6 +794,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos")
- TLI_DEFINE_ENUM_INTERNAL(fstat)
- TLI_DEFINE_STRING_INTERNAL("fstat")
- /// int fstat64(int filedes, struct stat64 *buf)
-+#ifdef fstat64
-+#undef fstat64
-+#endif
- TLI_DEFINE_ENUM_INTERNAL(fstat64)
- TLI_DEFINE_STRING_INTERNAL("fstat64")
- /// int fstatvfs(int fildes, struct statvfs *buf);
-@@ -803,6 +812,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell")
- TLI_DEFINE_ENUM_INTERNAL(ftello)
- TLI_DEFINE_STRING_INTERNAL("ftello")
- /// off64_t ftello64(FILE *stream)
-+#ifdef ftello64
-+#undef ftello64
-+#endif
- TLI_DEFINE_ENUM_INTERNAL(ftello64)
- TLI_DEFINE_STRING_INTERNAL("ftello64")
- /// int ftrylockfile(FILE *file);
-@@ -929,6 +941,9 @@ TLI_DEFINE_STRING_INTERNAL("logl")
- TLI_DEFINE_ENUM_INTERNAL(lstat)
- TLI_DEFINE_STRING_INTERNAL("lstat")
- /// int lstat64(const char *path, struct stat64 *buf);
-+#ifdef lstat64
-+#undef lstat64
-+#endif
- TLI_DEFINE_ENUM_INTERNAL(lstat64)
- TLI_DEFINE_STRING_INTERNAL("lstat64")
- /// void *malloc(size_t size);
-@@ -1154,6 +1169,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf")
- TLI_DEFINE_ENUM_INTERNAL(stat)
- TLI_DEFINE_STRING_INTERNAL("stat")
- /// int stat64(const char *path, struct stat64 *buf);
-+#ifdef stat64
-+#undef stat64
-+#endif
- TLI_DEFINE_ENUM_INTERNAL(stat64)
- TLI_DEFINE_STRING_INTERNAL("stat64")
- /// int statvfs(const char *path, struct statvfs *buf);
-@@ -1283,6 +1301,9 @@ TLI_DEFINE_STRING_INTERNAL("times")
- TLI_DEFINE_ENUM_INTERNAL(tmpfile)
- TLI_DEFINE_STRING_INTERNAL("tmpfile")
- /// FILE *tmpfile64(void)
-+#ifdef tmpfile64
-+#undef tmpfile64
-+#endif
- TLI_DEFINE_ENUM_INTERNAL(tmpfile64)
- TLI_DEFINE_STRING_INTERNAL("tmpfile64")
- /// int toascii(int c);
---
-2.20.1
-
diff --git a/meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch b/meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch
deleted file mode 100644
index 2970b0827b..0000000000
--- a/meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 0570fe02c07244a8724c1e6c0437f893c8aa8e93 Mon Sep 17 00:00:00 2001
-From: Martin Kelly <mkelly@xevo.com>
-Date: Fri, 19 May 2017 00:22:57 -0700
-Subject: [PATCH 2/2] llvm: allow env override of exe path
-
-When using a native llvm-config from inside a sysroot, we need llvm-config to
-return the libraries, include directories, etc. from inside the sysroot rather
-than from the native sysroot. Thus provide an env override for calling
-llvm-config from a target sysroot.
-
-To let it work in multilib environment, we need to provide a knob to supply
-multilib dirname as well
-
-Upstream-Status: Inappropriate [OE-Specific]
-
-Signed-off-by: Martin Kelly <mkelly@xevo.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- tools/llvm-config/llvm-config.cpp | 35 ++++++++++++++++++++++---------
- 1 file changed, 25 insertions(+), 10 deletions(-)
-
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index bec89fef98c..91b4d6e4c43 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -226,6 +226,13 @@ Typical components:\n\
-
- /// Compute the path to the main executable.
- std::string GetExecutablePath(const char *Argv0) {
-+ // Hack for Yocto: we need to override the root path when we are using
-+ // llvm-config from within a target sysroot.
-+ const char *Sysroot = std::getenv("YOCTO_ALTERNATE_EXE_PATH");
-+ if (Sysroot != nullptr) {
-+ return Sysroot;
-+ }
-+
- // This just needs to be some symbol in the binary; C++ doesn't
- // allow taking the address of ::main however.
- void *P = (void *)(intptr_t)GetExecutablePath;
-@@ -284,7 +291,7 @@ int main(int argc, char **argv) {
- // bin dir).
- sys::fs::make_absolute(CurrentPath);
- CurrentExecPrefix =
-- sys::path::parent_path(sys::path::parent_path(CurrentPath)).str();
-+ sys::path::parent_path(sys::path::parent_path(sys::path::parent_path(CurrentPath))).str();
-
- // Check to see if we are inside a development tree by comparing to possible
- // locations (prefix style or CMake style).
-@@ -293,7 +300,7 @@ int main(int argc, char **argv) {
- DevelopmentTreeLayout = CMakeStyle;
- ActiveObjRoot = LLVM_OBJ_ROOT;
- } else if (sys::fs::equivalent(CurrentExecPrefix,
-- Twine(LLVM_OBJ_ROOT) + "/bin")) {
-+ Twine(LLVM_OBJ_ROOT) + "/bin/llvm8.0")) {
- IsInDevelopmentTree = true;
- DevelopmentTreeLayout = CMakeBuildModeStyle;
- ActiveObjRoot = LLVM_OBJ_ROOT;
-@@ -307,37 +314,45 @@ int main(int argc, char **argv) {
- std::string ActivePrefix, ActiveBinDir, ActiveIncludeDir, ActiveLibDir,
- ActiveCMakeDir;
- std::string ActiveIncludeOption;
-+ // Hack for Yocto: we need to override the multilib path when we are using
-+ // llvm-config from within a target sysroot.
-+ std::string Multilibdir = std::getenv("YOCTO_ALTERNATE_MULTILIB_NAME");
-+ if (Multilibdir.empty()) {
-+ Multilibdir = "/lib/llvm8.0" LLVM_LIBDIR_SUFFIX;
-+ }
-+
- if (IsInDevelopmentTree) {
-- ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/include";
-+ ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/include/llvm8.0";
- ActivePrefix = CurrentExecPrefix;
-
- // CMake organizes the products differently than a normal prefix style
- // layout.
-+
- switch (DevelopmentTreeLayout) {
- case CMakeStyle:
-- ActiveBinDir = ActiveObjRoot + "/bin";
-- ActiveLibDir = ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX;
-+ ActiveBinDir = ActiveObjRoot + "/bin/llvm8.0";
-+ ActiveLibDir = ActiveObjRoot + "/lib/llvm8.0" + LLVM_LIBDIR_SUFFIX;
- ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
- break;
- case CMakeBuildModeStyle:
- ActivePrefix = ActiveObjRoot;
-- ActiveBinDir = ActiveObjRoot + "/bin/" + build_mode;
-+ ActiveBinDir = ActiveObjRoot + "/bin/llvm8.0/" + build_mode;
- ActiveLibDir =
-- ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX + "/" + build_mode;
-+ ActiveObjRoot + "/lib/llvm8.0" + LLVM_LIBDIR_SUFFIX + "/" + build_mode;
- ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
- break;
- }
-
- // We need to include files from both the source and object trees.
- ActiveIncludeOption =
-- ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include");
-+ ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include/llvm8.0");
- } else {
- ActivePrefix = CurrentExecPrefix;
-- ActiveIncludeDir = ActivePrefix + "/include";
-+ ActiveIncludeDir = ActivePrefix + "/include/llvm8.0";
- SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR));
- sys::fs::make_absolute(ActivePrefix, path);
- ActiveBinDir = path.str();
-- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
-+ ActiveLibDir = ActivePrefix + Multilibdir;
- ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
- ActiveIncludeOption = "-I" + ActiveIncludeDir;
- }
---
-2.20.1
-
diff --git a/meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patch b/meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patch
new file mode 100644
index 0000000000..add38b3bb4
--- /dev/null
+++ b/meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patch
@@ -0,0 +1,37 @@
+From 588a8694c6540e31140c7e242bfb5e279d6ca08c Mon Sep 17 00:00:00 2001
+From: Martin Kelly <mkelly@xevo.com>
+Date: Fri, 19 May 2017 00:22:57 -0700
+Subject: [PATCH] llvm: allow env override of exe and libdir path
+
+When using a native llvm-config from inside a sysroot, we need llvm-config to
+return the libraries, include directories, etc. from inside the sysroot rather
+than from the native sysroot. Thus provide an env override for calling
+llvm-config from a target sysroot.
+
+Upstream-Status: Inappropriate [OE-specific]
+
+Signed-off-by: Martin Kelly <mkelly@xevo.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ llvm/tools/llvm-config/llvm-config.cpp | 25 +++++++++++++++++++------
+ 1 file changed, 19 insertions(+), 6 deletions(-)
+
+diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp
+index e86eb2b44b10..7b2abf318dbe 100644
+--- a/llvm/tools/llvm-config/llvm-config.cpp
++++ b/llvm/tools/llvm-config/llvm-config.cpp
+@@ -246,6 +246,13 @@ Typical components:\n\
+
+ /// Compute the path to the main executable.
+ std::string GetExecutablePath(const char *Argv0) {
++ // Hack for Yocto: we need to override the root path when we are using
++ // llvm-config from within a target sysroot.
++ const char *Sysroot = std::getenv("YOCTO_ALTERNATE_EXE_PATH");
++ if (Sysroot != nullptr) {
++ return Sysroot;
++ }
++
+ // This just needs to be some symbol in the binary; C++ doesn't
+ // allow taking the address of ::main however.
+ void *P = (void *)(intptr_t)GetExecutablePath;
+
diff --git a/meta/recipes-devtools/llvm/llvm/llvm-config b/meta/recipes-devtools/llvm/llvm/llvm-config
new file mode 100644
index 0000000000..5e4ded2da5
--- /dev/null
+++ b/meta/recipes-devtools/llvm/llvm/llvm-config
@@ -0,0 +1,51 @@
+#!/bin/bash
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+# Wrap llvm-config since the native llvm-config will remap some values correctly
+# if placed in the target sysroot but for flags, it would provide the native ones.
+# Provide ours from the environment instead.
+
+NEXT_LLVM_CONFIG="$(which -a llvm-config | sed -n 2p)"
+if [[ $# == 0 ]]; then
+ exec "$NEXT_LLVM_CONFIG"
+fi
+
+remain=""
+output=""
+for arg in "$@"; do
+ case "$arg" in
+ --cppflags)
+ output="${output} ${CPPFLAGS}"
+ ;;
+ --cflags)
+ output="${output} ${CFLAGS}"
+ ;;
+ --cxxflags)
+ output="${output} ${CXXFLAGS}"
+ ;;
+ --ldflags)
+ output="${output} ${LDFLAGS}"
+ ;;
+ --shared-mode)
+ output="${output} shared"
+ ;;
+ --libs)
+ output="${output} -lLLVM"
+ ;;
+ --link-shared)
+ break
+ ;;
+ *)
+ remain="${remain} ${arg}"
+ ;;
+ esac
+done
+
+if [ "${remain}" != "" ]; then
+ output="${output} "$("$NEXT_LLVM_CONFIG" ${remain})
+fi
+
+echo "${output}"
diff --git a/meta/recipes-devtools/llvm/llvm_18.1.5.bb b/meta/recipes-devtools/llvm/llvm_18.1.5.bb
new file mode 100644
index 0000000000..9c80b46b60
--- /dev/null
+++ b/meta/recipes-devtools/llvm/llvm_18.1.5.bb
@@ -0,0 +1,177 @@
+# Copyright (C) 2017 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+SUMMARY = "The LLVM Compiler Infrastructure"
+HOMEPAGE = "http://llvm.org"
+LICENSE = "Apache-2.0-with-LLVM-exception"
+SECTION = "devel"
+
+LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=8a15a0759ef07f2682d2ba4b893c9afe"
+
+DEPENDS = "libffi libxml2 zlib zstd libedit ninja-native llvm-native"
+
+RDEPENDS:${PN}:append:class-target = " ncurses-terminfo"
+
+inherit cmake pkgconfig
+# could be 'rcX' or 'git' or empty ( for release )
+VER_SUFFIX = ""
+
+PV .= "${VER_SUFFIX}"
+
+MAJOR_VERSION = "${@oe.utils.trim_version("${PV}", 1)}"
+
+LLVM_RELEASE = "${PV}"
+
+SRC_URI = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${PV}/llvm-project-${PV}.src.tar.xz \
+ file://0007-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \
+ file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \
+ file://llvm-config \
+ "
+SRC_URI[sha256sum] = "3591a52761a7d390ede51af01ea73abfecc4b1d16445f9d019b67a57edd7de56"
+
+UPSTREAM_CHECK_URI = "https://github.com/llvm/llvm-project"
+UPSTREAM_CHECK_REGEX = "llvmorg-(?P<pver>\d+(\.\d+)+)"
+
+S = "${WORKDIR}/llvm-project-${PV}.src/llvm"
+
+LLVM_INSTALL_DIR = "${WORKDIR}/llvm-install"
+
+def get_llvm_arch(bb, d, arch_var):
+ import re
+ a = d.getVar(arch_var)
+ if re.match(r'(i.86|athlon|x86.64)$', a): return 'X86'
+ elif re.match(r'arm$', a): return 'ARM'
+ elif re.match(r'armeb$', a): return 'ARM'
+ elif re.match(r'aarch64$', a): return 'AArch64'
+ elif re.match(r'aarch64_be$', a): return 'AArch64'
+ elif re.match(r'mips(isa|)(32|64|)(r6|)(el|)$', a): return 'Mips'
+ elif re.match(r'riscv(32|64)(eb|)$', a): return 'RISCV'
+ elif re.match(r'p(pc|owerpc)(|64)', a): return 'PowerPC'
+ else:
+ raise bb.parse.SkipRecipe("Cannot map '%s' to a supported LLVM architecture" % a)
+
+def get_llvm_host_arch(bb, d):
+ return get_llvm_arch(bb, d, 'HOST_ARCH')
+
+PACKAGECONFIG ??= "libllvm"
+PACKAGECONFIG:class-native = "${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'libllvm', '', d)}"
+# if optviewer OFF, force the modules to be not found or the ones on the host would be found
+PACKAGECONFIG[optviewer] = ",-DPY_PYGMENTS_FOUND=OFF -DPY_PYGMENTS_LEXERS_C_CPP_FOUND=OFF -DPY_YAML_FOUND=OFF,python3-pygments python3-pyyaml,python3-pygments python3-pyyaml"
+PACKAGECONFIG[libllvm] = ""
+
+#
+# Default to build all OE-Core supported target arches (user overridable).
+#
+LLVM_TARGETS ?= "AMDGPU;${@get_llvm_host_arch(bb, d)}"
+
+ARM_INSTRUCTION_SET:armv5 = "arm"
+ARM_INSTRUCTION_SET:armv4t = "arm"
+
+EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \
+ -DLLVM_ENABLE_EXPENSIVE_CHECKS=OFF \
+ -DLLVM_ENABLE_PIC=ON \
+ -DLLVM_BINDINGS_LIST='' \
+ -DLLVM_LINK_LLVM_DYLIB=ON \
+ -DLLVM_ENABLE_FFI=ON \
+ -DLLVM_ENABLE_RTTI=ON \
+ -DFFI_INCLUDE_DIR=$(pkg-config --variable=includedir libffi) \
+ -DLLVM_OPTIMIZED_TABLEGEN=ON \
+ -DLLVM_TARGETS_TO_BUILD='${LLVM_TARGETS}' \
+ -DLLVM_VERSION_SUFFIX='${VER_SUFFIX}' \
+ -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \
+ -DCMAKE_BUILD_TYPE=Release \
+ "
+
+EXTRA_OECMAKE:append:class-target = "\
+ -DCMAKE_CROSSCOMPILING:BOOL=ON \
+ -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen${PV} \
+ -DLLVM_CONFIG_PATH=${STAGING_BINDIR_NATIVE}/llvm-config${PV} \
+ "
+
+EXTRA_OECMAKE:append:class-nativesdk = "\
+ -DCMAKE_CROSSCOMPILING:BOOL=ON \
+ -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen${PV} \
+ -DLLVM_CONFIG_PATH=${STAGING_BINDIR_NATIVE}/llvm-config${PV} \
+ "
+
+# patch out build host paths for reproducibility
+do_compile:prepend:class-target() {
+ sed -i -e "s,${WORKDIR},,g" ${B}/tools/llvm-config/BuildVariables.inc
+}
+
+do_compile() {
+ if ${@bb.utils.contains('PACKAGECONFIG', 'libllvm', 'true', 'false', d)}; then
+ ninja -v ${PARALLEL_MAKE}
+ else
+ ninja -v ${PARALLEL_MAKE} llvm-config llvm-tblgen
+ fi
+}
+
+do_install() {
+ if ${@bb.utils.contains('PACKAGECONFIG', 'libllvm', 'true', 'false', d)}; then
+ DESTDIR=${D} ninja -v install
+
+ # llvm harcodes usr/lib as install path, so this corrects it to actual libdir
+ mv -T -n ${D}/${prefix}/lib ${D}/${libdir} || true
+
+ # Remove opt-viewer: https://llvm.org/docs/Remarks.html
+ rm -rf ${D}${datadir}/opt-viewer
+ rmdir ${D}${datadir}
+
+ # reproducibility
+ sed -i -e 's,${WORKDIR},,g' ${D}/${libdir}/cmake/llvm/LLVMConfig.cmake
+ fi
+}
+
+do_install:append:class-native() {
+ install -D -m 0755 ${B}/bin/llvm-tblgen ${D}${bindir}/llvm-tblgen${PV}
+ install -D -m 0755 ${B}/bin/llvm-config ${D}${bindir}/llvm-config${PV}
+ ln -sf llvm-config${PV} ${D}${bindir}/llvm-config
+}
+
+SYSROOT_PREPROCESS_FUNCS:append:class-target = " llvm_sysroot_preprocess"
+
+llvm_sysroot_preprocess() {
+ install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
+ install -m 0755 ${UNPACKDIR}/llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/
+ ln -sf llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/llvm-config${PV}
+}
+
+PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-libllvm ${PN}-liboptremarks ${PN}-liblto"
+
+RRECOMMENDS:${PN}-dev += "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liboptremarks"
+
+FILES:${PN}-bugpointpasses = "\
+ ${libdir}/BugpointPasses.so \
+"
+
+FILES:${PN}-libllvm = "\
+ ${libdir}/libLLVM-${MAJOR_VERSION}.so \
+ ${libdir}/libLLVM.so.${MAJOR_VER}.${MINOR_VER} \
+"
+
+FILES:${PN}-liblto += "\
+ ${libdir}/libLTO.so.* \
+"
+
+FILES:${PN}-liboptremarks += "\
+ ${libdir}/libRemarks.so.* \
+"
+
+FILES:${PN}-llvmhello = "\
+ ${libdir}/LLVMHello.so \
+"
+
+FILES:${PN}-dev += " \
+ ${libdir}/llvm-config \
+ ${libdir}/libRemarks.so \
+ ${libdir}/libLLVM-${PV}.so \
+"
+
+FILES:${PN}-staticdev += "\
+ ${libdir}/*.a \
+"
+
+INSANE_SKIP:${PN}-libllvm += "dev-so"
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-devtools/llvm/llvm_git.bb b/meta/recipes-devtools/llvm/llvm_git.bb
deleted file mode 100644
index c68512cc63..0000000000
--- a/meta/recipes-devtools/llvm/llvm_git.bb
+++ /dev/null
@@ -1,179 +0,0 @@
-# Copyright (C) 2017 Khem Raj <raj.khem@gmail.com>
-# Released under the MIT license (see COPYING.MIT for the terms)
-
-DESCRIPTION = "The LLVM Compiler Infrastructure"
-HOMEPAGE = "http://llvm.org"
-LICENSE = "NCSA"
-SECTION = "devel"
-
-LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=c6b766a4e85dd28301eeed54a6684648"
-
-DEPENDS = "libffi libxml2 zlib ninja-native llvm-native"
-
-RDEPENDS_${PN}_append_class-target = " ncurses-terminfo"
-
-inherit perlnative pythonnative cmake pkgconfig
-
-PROVIDES += "llvm${PV}"
-
-LLVM_RELEASE = "${PV}"
-LLVM_DIR = "llvm${LLVM_RELEASE}"
-
-# SRCREV is set to the revision of 8.0.0-rc2 tag, while latest release
-# tag is 7.0.1 as of Feb 18 2019, hence the need for UPSTREAM_CHECK_UNKNOWN
-# Remove the UPSTREAM_VERSION_UNKNOWN line once 8.0.0 final is tagged
-UPSTREAM_VERSION_UNKNOWN = "1"
-SRCREV = "98ebe7460199b9cd79eb562b5e8705ad28f5513f"
-
-BRANCH = "release/${MAJOR_VERSION}.x"
-MAJOR_VERSION = "8"
-MINOR_VERSION = "0"
-PATCH_VERSION = "0"
-SOLIBVER = "1"
-PV = "${MAJOR_VERSION}.${MINOR_VERSION}"
-SRC_URI = "git://github.com/llvm/llvm-project.git;branch=${BRANCH} \
- file://0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \
- file://0002-llvm-allow-env-override-of-exe-path.patch \
- "
-
-S = "${WORKDIR}/git/llvm"
-
-LLVM_INSTALL_DIR = "${WORKDIR}/llvm-install"
-
-def get_llvm_arch(bb, d, arch_var):
- import re
- a = d.getVar(arch_var)
- if re.match(r'(i.86|athlon|x86.64)$', a): return 'X86'
- elif re.match(r'arm$', a): return 'ARM'
- elif re.match(r'armeb$', a): return 'ARM'
- elif re.match(r'aarch64$', a): return 'AArch64'
- elif re.match(r'aarch64_be$', a): return 'AArch64'
- elif re.match(r'mips(isa|)(32|64|)(r6|)(el|)$', a): return 'Mips'
- elif re.match(r'p(pc|owerpc)(|64)', a): return 'PowerPC'
- else:
- raise bb.parse.SkipRecipe("Cannot map '%s' to a supported LLVM architecture" % a)
-
-def get_llvm_host_arch(bb, d):
- return get_llvm_arch(bb, d, 'HOST_ARCH')
-
-#
-# Default to build all OE-Core supported target arches (user overridable).
-#
-LLVM_TARGETS ?= "AMDGPU;${@get_llvm_host_arch(bb, d)}"
-
-ARM_INSTRUCTION_SET_armv5 = "arm"
-ARM_INSTRUCTION_SET_armv4t = "arm"
-
-EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \
- -DLLVM_ENABLE_EXPENSIVE_CHECKS=OFF \
- -DLLVM_ENABLE_PIC=ON \
- -DLLVM_BINDINGS_LIST='' \
- -DLLVM_LINK_LLVM_DYLIB=ON \
- -DLLVM_ENABLE_FFI=ON \
- -DFFI_INCLUDE_DIR=$(pkg-config --variable=includedir libffi) \
- -DLLVM_OPTIMIZED_TABLEGEN=ON \
- -DLLVM_TARGETS_TO_BUILD='${LLVM_TARGETS}' \
- -G Ninja"
-
-EXTRA_OECMAKE_append_class-target = "\
- -DCMAKE_CROSSCOMPILING:BOOL=ON \
- -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen${PV} \
- -DLLVM_CONFIG_PATH=${STAGING_BINDIR_NATIVE}/llvm-config${PV} \
- "
-
-EXTRA_OECMAKE_append_class-nativesdk = "\
- -DCMAKE_CROSSCOMPILING:BOOL=ON \
- -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen${PV} \
- -DLLVM_CONFIG_PATH=${STAGING_BINDIR_NATIVE}/llvm-config${PV} \
- "
-
-do_configure_prepend() {
-# 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
- sed -ri "s#/(bin|include|lib)(/?\")#/\1/${LLVM_DIR}\2#g" ${S}/tools/llvm-config/llvm-config.cpp
- sed -ri "s#lib/${LLVM_DIR}#${baselib}/${LLVM_DIR}#g" ${S}/tools/llvm-config/llvm-config.cpp
-}
-
-do_compile() {
- ninja -v ${PARALLEL_MAKE}
-}
-
-do_compile_class-native() {
- ninja -v ${PARALLEL_MAKE} llvm-config llvm-tblgen
-}
-
-do_install() {
- DESTDIR=${LLVM_INSTALL_DIR} ninja -v install
- install -D -m 0755 ${B}/bin/llvm-config ${D}${libdir}/${LLVM_DIR}/llvm-config
-
- install -d ${D}${bindir}/${LLVM_DIR}
- cp -r ${LLVM_INSTALL_DIR}${bindir}/* ${D}${bindir}/${LLVM_DIR}/
-
- install -d ${D}${includedir}/${LLVM_DIR}
- cp -r ${LLVM_INSTALL_DIR}${includedir}/* ${D}${includedir}/${LLVM_DIR}/
-
- install -d ${D}${libdir}/${LLVM_DIR}
-
- # The LLVM sources have "/lib" embedded and so we cannot completely rely on the ${libdir} variable
- if [ -d ${LLVM_INSTALL_DIR}${libdir}/ ]; then
- cp -r ${LLVM_INSTALL_DIR}${libdir}/* ${D}${libdir}/${LLVM_DIR}/
- elif [ -d ${LLVM_INSTALL_DIR}${prefix}/lib ]; then
- cp -r ${LLVM_INSTALL_DIR}${prefix}/lib/* ${D}${libdir}/${LLVM_DIR}/
- elif [ -d ${LLVM_INSTALL_DIR}${prefix}/lib64 ]; then
- cp -r ${LLVM_INSTALL_DIR}${prefix}/lib64/* ${D}${libdir}/${LLVM_DIR}/
- fi
-
- # Remove unnecessary cmake files
- rm -rf ${D}${libdir}/${LLVM_DIR}/cmake
-
- ln -s ${LLVM_DIR}/libLLVM-${MAJOR_VERSION}${SOLIBSDEV} ${D}${libdir}/libLLVM-${MAJOR_VERSION}${SOLIBSDEV}
-
- # We'll have to delete the libLLVM.so due to multiple reasons...
- rm -rf ${D}${libdir}/${LLVM_DIR}/libLLVM.so
- rm -rf ${D}${libdir}/${LLVM_DIR}/libLTO.so
-}
-
-do_install_class-native() {
- install -D -m 0755 ${B}/bin/llvm-tblgen ${D}${bindir}/llvm-tblgen${PV}
- install -D -m 0755 ${B}/bin/llvm-config ${D}${bindir}/llvm-config${PV}
- install -D -m 0755 ${B}/lib/libLLVM-${MAJOR_VERSION}.so ${D}${libdir}/libLLVM-${MAJOR_VERSION}.so
-}
-
-PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-libllvm ${PN}-liboptremarks ${PN}-liblto"
-
-RRECOMMENDS_${PN}-dev += "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liboptremarks"
-
-FILES_${PN}-bugpointpasses = "\
- ${libdir}/${LLVM_DIR}/BugpointPasses.so \
-"
-
-FILES_${PN}-libllvm = "\
- ${libdir}/${LLVM_DIR}/libLLVM-${MAJOR_VERSION}.so \
- ${libdir}/libLLVM-${MAJOR_VERSION}.so \
-"
-
-FILES_${PN}-liblto += "\
- ${libdir}/${LLVM_DIR}/libLTO.so.* \
-"
-
-FILES_${PN}-liboptremarks += "\
- ${libdir}/${LLVM_DIR}/libOptRemarks.so.* \
-"
-
-FILES_${PN}-llvmhello = "\
- ${libdir}/${LLVM_DIR}/LLVMHello.so \
-"
-
-FILES_${PN}-dev += " \
- ${libdir}/${LLVM_DIR}/llvm-config \
- ${libdir}/${LLVM_DIR}/libOptRemarks.so \
- ${libdir}/${LLVM_DIR}/libLLVM-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}.so \
-"
-
-FILES_${PN}-staticdev += "\
- ${libdir}/${LLVM_DIR}/*.a \
-"
-
-INSANE_SKIP_${PN}-libllvm += "dev-so"
-
-BBCLASSEXTEND = "native nativesdk"