summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-core/llvm
diff options
context:
space:
mode:
authorTudor Florea <tudor.florea@enea.com>2015-10-08 22:51:41 +0200
committerTudor Florea <tudor.florea@enea.com>2015-10-08 22:51:41 +0200
commit1219bf8a90a7bf8cd3a5363551ef635d51e8fc8e (patch)
treea21a5fc103bb3bd65ecd85ed22be5228fc54e447 /meta-oe/recipes-core/llvm
downloadmeta-openembedded-1219bf8a90a7bf8cd3a5363551ef635d51e8fc8e.tar.gz
initial commit for Enea Linux 5.0 arm
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta-oe/recipes-core/llvm')
-rw-r--r--meta-oe/recipes-core/llvm/llvm-common.bb22
-rw-r--r--meta-oe/recipes-core/llvm/llvm-common/llvm-config10
-rw-r--r--meta-oe/recipes-core/llvm/llvm.inc145
-rw-r--r--meta-oe/recipes-core/llvm/llvm3.3/arm_fenv_uclibc.patch14
-rw-r--r--meta-oe/recipes-core/llvm/llvm3.3_3.3.bb11
5 files changed, 202 insertions, 0 deletions
diff --git a/meta-oe/recipes-core/llvm/llvm-common.bb b/meta-oe/recipes-core/llvm/llvm-common.bb
new file mode 100644
index 000000000..618cc1e9d
--- /dev/null
+++ b/meta-oe/recipes-core/llvm/llvm-common.bb
@@ -0,0 +1,22 @@
1SUMMARY = "Helper script for OE's llvm support"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
4 file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420 \
5"
6
7SRC_URI = "file://llvm-config"
8
9ALLOW_EMPTY_${PN} = "1"
10SYSROOT_PREPROCESS_FUNCS_append_class-target = " llvm_common_sysroot_preprocess"
11
12llvm_common_sysroot_preprocess() {
13 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
14 install -m 0755 ${WORKDIR}/llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/
15}
16
17do_install_class-native() {
18 install -d ${D}${bindir}
19 install -m 0755 ${WORKDIR}/llvm-config ${D}${bindir}
20}
21
22BBCLASSEXTEND = "native"
diff --git a/meta-oe/recipes-core/llvm/llvm-common/llvm-config b/meta-oe/recipes-core/llvm/llvm-common/llvm-config
new file mode 100644
index 000000000..a9a416d93
--- /dev/null
+++ b/meta-oe/recipes-core/llvm/llvm-common/llvm-config
@@ -0,0 +1,10 @@
1#!/bin/sh
2# Wrapper script for real llvm-config. Simply calls
3
4if [ $WANT_LLVM_RELEASE ]; then
5 exec `dirname $0`/${TARGET_PREFIX}llvm-config$WANT_LLVM_RELEASE ${@}
6else
7 echo "The variable WANT_LLVM_RELEASE is not defined and exported"
8 echo "by your build recipe. Go figure."
9 exit 1
10fi
diff --git a/meta-oe/recipes-core/llvm/llvm.inc b/meta-oe/recipes-core/llvm/llvm.inc
new file mode 100644
index 000000000..26bac3310
--- /dev/null
+++ b/meta-oe/recipes-core/llvm/llvm.inc
@@ -0,0 +1,145 @@
1# LLVM does not provide ABI stability between different versions. For this
2# reason OE makes it possible to build and install different llvm versions
3# at the same time.
4#
5# This is true for the normal recipes as well as the native ones.
6#
7# All regular installation directories are prefixed with 'llvm${LLVM_RELEASE}'
8# e.g. "${STAGING_BINDIR}/llvm2.5" or "${STAGING_INCDIR}/llvm2.5"
9#
10# For your program or library that makes use of llvm you do should not need to
11# modify anything as long as it uses the results of various llvm-config
12# invocations. If you need customizations something is wrong and it needs to be
13# fixed (report bug).
14#
15# However the *recipe* for your program/library *must* declare
16# export WANT_LLVM_RELEASE = "<valid version number>"
17# The version number is picked up by a generic wrapper script which just calls
18# the variant of the specified version.
19
20DESCRIPTION = "The Low Level Virtual Machine"
21HOMEPAGE = "http://llvm.org"
22
23# 3-clause BSD-like
24# University of Illinois/NCSA Open Source License
25LICENSE = "NCSA"
26LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=d0a3ef0d3e0e8f5cf59e5ffc273ab1f8"
27
28DEPENDS = "libffi libxml2-native llvm-common"
29
30inherit perlnative pythonnative autotools
31
32LLVM_RELEASE = "${PV}"
33LLVM_DIR = "llvm${LLVM_RELEASE}"
34
35SRC_URI = "http://llvm.org/releases/${PV}/llvm-${PV}.src.tar.gz"
36S = "${WORKDIR}/llvm-${PV}.src"
37
38LLVM_BUILD_DIR = "${WORKDIR}/llvm-${PV}.build"
39LLVM_INSTALL_DIR = "${WORKDIR}/llvm-install"
40
41EXTRA_OECONF += "--disable-assertions \
42 --enable-debug-runtime \
43 --disable-expensive-checks \
44 --enable-bindings=none \
45 --enable-keep-symbols \
46 --enable-libffi \
47 --enable-optimized \
48 --enable-shared \
49 --enable-targets=host-only"
50EXTRA_OEMAKE += "REQUIRES_RTTI=1 VERBOSE=1"
51
52do_configure_prepend() {
53 # Remove RPATHs
54 sed -i 's:$(RPATH) -Wl,$(\(ToolDir\|LibDir\|ExmplDir\))::g' ${S}/Makefile.rules
55
56 # Drop "svn" suffix from version string
57 sed -i 's/${PV}svn/${PV}/g' ${S}/configure
58
59 # Fix paths in llvm-config
60 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
61 sed -ri "s#/(bin|include|lib)(/?\")#/\1/${LLVM_DIR}\2#g" ${S}/tools/llvm-config/llvm-config.cpp
62
63 # Fails to build unless using separate directory from source
64 mkdir -p ${LLVM_BUILD_DIR}
65 cd ${LLVM_BUILD_DIR}
66}
67
68do_compile() {
69 cd ${LLVM_BUILD_DIR}
70 oe_runmake \
71 AR="${BUILD_AR}" \
72 CC="${BUILD_CC}" \
73 CFLAGS="${BUILD_CFLAGS}" \
74 CXX="${BUILD_CXX}" \
75 CXXFLAGS="${BUILD_CXXFLAGS}" \
76 CPP="${BUILD_CPP}" \
77 CPPFLAGS="${BUILD_CPPFLAGS}" \
78 NM="${BUILD_NM}" \
79 RANLIB="${BUILD_RANLIB}" \
80 PATH="${STAGING_BINDIR_NATIVE}:$PATH" \
81 cross-compile-build-tools
82 oe_runmake
83}
84
85do_install() {
86 cd ${LLVM_BUILD_DIR}
87 oe_runmake DESTDIR=${LLVM_INSTALL_DIR} install
88
89 mv ${LLVM_INSTALL_DIR}${bindir}/${HOST_SYS}-llvm-config-host ${LLVM_INSTALL_DIR}/llvm-config-host
90
91 install -d ${D}${bindir}/${LLVM_DIR}
92 mv ${LLVM_INSTALL_DIR}${bindir}/* ${D}${bindir}/${LLVM_DIR}/
93
94 install -d ${D}${includedir}/${LLVM_DIR}
95 mv ${LLVM_INSTALL_DIR}${includedir}/* ${D}${includedir}/${LLVM_DIR}/
96
97 install -d ${D}${libdir}/${LLVM_DIR}
98 mv ${LLVM_INSTALL_DIR}${libdir}/* ${D}${libdir}/${LLVM_DIR}/
99 ln -s ${LLVM_DIR}/libLLVM-${PV}.so ${D}${libdir}/libLLVM-${PV}.so
100
101 install -d ${D}${docdir}/${LLVM_DIR}
102 mv ${LLVM_INSTALL_DIR}${prefix}/docs/llvm/* ${D}${docdir}/${LLVM_DIR}
103}
104
105SYSROOT_PREPROCESS_FUNCS += "llvm_sysroot_preprocess"
106
107llvm_sysroot_preprocess() {
108 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}
109 mv ${LLVM_INSTALL_DIR}/llvm-config-host ${SYSROOT_DESTDIR}${bindir_crossscripts}/llvm-config${PV}
110}
111
112ALLOW_EMPTY_${PN} = "1"
113ALLOW_EMPTY_${PN}-staticdev = "1"
114FILES_${PN} = ""
115FILES_${PN}-staticdev = ""
116DOTDEBUG-dbg = " ${bindir}/${LLVM_DIR}/.debug \
117 ${libdir}/${LLVM_DIR}/.debug/BugpointPasses.so \
118 ${libdir}/${LLVM_DIR}/.debug/LLVMHello.so \
119 /usr/src/debug \
120"
121
122FILES_${PN}-dev = "${bindir}/${LLVM_DIR} \
123 ${includedir}/${LLVM_DIR} \
124 ${libdir}/${LLVM_DIR}/BugpointPasses.so \
125 ${libdir}/${LLVM_DIR}/LLVMHello.so \
126"
127
128PACKAGES_DYNAMIC = "^libllvm-.*$"
129
130INSANE_SKIP_libllvm${LLVM_RELEASE}-llvm-${LLVM_RELEASE} += "dev-so"
131
132python llvm_populate_packages() {
133 libdir = bb.data.expand('${libdir}', d)
134 libllvm_libdir = bb.data.expand('${libdir}/${LLVM_DIR}', d)
135 split_dbg_packages = do_split_packages(d, libllvm_libdir+'/.debug', '^lib(.*)\.so$', 'libllvm${LLVM_RELEASE}-%s-dbg', 'Split debug package for %s', allow_dirs=True)
136 split_packages = do_split_packages(d, libdir, '^lib(.*)\.so$', 'libllvm${LLVM_RELEASE}-%s', 'Split package for %s', allow_dirs=True, allow_links=True, recursive=True)
137 split_staticdev_packages = do_split_packages(d, libllvm_libdir, '^lib(.*)\.a$', 'libllvm${LLVM_RELEASE}-%s-staticdev', 'Split staticdev package for %s', allow_dirs=True)
138 if split_packages:
139 pn = d.getVar('PN', True)
140 d.appendVar('RDEPENDS_' + pn, ' '+' '.join(split_packages))
141 d.appendVar('RDEPENDS_' + pn + '-dbg', ' '+' '.join(split_dbg_packages))
142 d.appendVar('RDEPENDS_' + pn + '-staticdev', ' '+' '.join(split_staticdev_packages))
143}
144
145PACKAGESPLITFUNCS_prepend = "llvm_populate_packages "
diff --git a/meta-oe/recipes-core/llvm/llvm3.3/arm_fenv_uclibc.patch b/meta-oe/recipes-core/llvm/llvm3.3/arm_fenv_uclibc.patch
new file mode 100644
index 000000000..c3ae49464
--- /dev/null
+++ b/meta-oe/recipes-core/llvm/llvm3.3/arm_fenv_uclibc.patch
@@ -0,0 +1,14 @@
1Index: llvm-2.9/include/llvm/Support/FEnv.h
2===================================================================
3--- llvm-2.9.orig/include/llvm/Support/FEnv.h 2010-11-29 20:44:50.000000000 +0100
4+++ llvm-2.9/include/llvm/Support/FEnv.h 2011-11-18 18:42:22.580161297 +0100
5@@ -17,6 +17,9 @@
6
7 #include "llvm/Config/config.h"
8 #include <cerrno>
9+
10+#undef HAVE_FENV_H
11+
12 #ifdef HAVE_FENV_H
13 #include <fenv.h>
14 #endif
diff --git a/meta-oe/recipes-core/llvm/llvm3.3_3.3.bb b/meta-oe/recipes-core/llvm/llvm3.3_3.3.bb
new file mode 100644
index 000000000..4617efa8b
--- /dev/null
+++ b/meta-oe/recipes-core/llvm/llvm3.3_3.3.bb
@@ -0,0 +1,11 @@
1require llvm.inc
2
3DEPENDS += "zlib"
4EXTRA_OECONF += "--enable-zlib"
5
6SRC_URI_append_libc-uclibc = " file://arm_fenv_uclibc.patch "
7SRC_URI[md5sum] = "40564e1dc390f9844f1711c08b08e391"
8SRC_URI[sha256sum] = "68766b1e70d05a25e2f502e997a3cb3937187a3296595cf6e0977d5cd6727578"
9
10PACKAGECONFIG ??= ""
11PACKAGECONFIG[r600] = "--enable-experimental-targets=R600,,,"