diff options
Diffstat (limited to 'recipes-core/llvm')
-rw-r--r-- | recipes-core/llvm/llvm-common.bb | 19 | ||||
-rw-r--r-- | recipes-core/llvm/llvm-common/llvm-config | 10 | ||||
-rw-r--r-- | recipes-core/llvm/llvm.inc | 218 | ||||
-rw-r--r-- | recipes-core/llvm/llvm2.9/arm_fenv_uclibc.patch | 14 | ||||
-rw-r--r-- | recipes-core/llvm/llvm2.9_2.9.bb | 25 |
5 files changed, 286 insertions, 0 deletions
diff --git a/recipes-core/llvm/llvm-common.bb b/recipes-core/llvm/llvm-common.bb new file mode 100644 index 0000000..38ca1ee --- /dev/null +++ b/recipes-core/llvm/llvm-common.bb | |||
@@ -0,0 +1,19 @@ | |||
1 | DESCRIPTION = "Helper script for OE's llvm support" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \ | ||
4 | file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420 \ | ||
5 | " | ||
6 | |||
7 | SRC_URI = "file://llvm-config" | ||
8 | |||
9 | do_install() { | ||
10 | install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/ | ||
11 | install -m 0755 ${WORKDIR}/llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/ | ||
12 | } | ||
13 | |||
14 | do_install_virtclass-native() { | ||
15 | install -d ${D}${bindir} | ||
16 | install -m 0755 ${WORKDIR}/llvm-config ${D}${bindir} | ||
17 | } | ||
18 | |||
19 | BBCLASSEXTEND = "native" | ||
diff --git a/recipes-core/llvm/llvm-common/llvm-config b/recipes-core/llvm/llvm-common/llvm-config new file mode 100644 index 0000000..a9a416d --- /dev/null +++ b/recipes-core/llvm/llvm-common/llvm-config | |||
@@ -0,0 +1,10 @@ | |||
1 | #!/bin/sh | ||
2 | # Wrapper script for real llvm-config. Simply calls | ||
3 | |||
4 | if [ $WANT_LLVM_RELEASE ]; then | ||
5 | exec `dirname $0`/${TARGET_PREFIX}llvm-config$WANT_LLVM_RELEASE ${@} | ||
6 | else | ||
7 | echo "The variable WANT_LLVM_RELEASE is not defined and exported" | ||
8 | echo "by your build recipe. Go figure." | ||
9 | exit 1 | ||
10 | fi | ||
diff --git a/recipes-core/llvm/llvm.inc b/recipes-core/llvm/llvm.inc new file mode 100644 index 0000000..a37c790 --- /dev/null +++ b/recipes-core/llvm/llvm.inc | |||
@@ -0,0 +1,218 @@ | |||
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 | |||
20 | DESCRIPTION = "The Low Level Virtual Machine" | ||
21 | HOMEPAGE = "http://llvm.org" | ||
22 | # 3-clause BSD-like | ||
23 | LICENSE = "University of Illinois/NCSA Open Source License" | ||
24 | LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=0ac5f799a2d89477c75b0a378b221855" | ||
25 | |||
26 | DEPENDS = "llvm${LLVM_RELEASE}-native llvm-common" | ||
27 | DEPENDS_virtclass-native = "llvm-common-native cmake-native perl-native" | ||
28 | |||
29 | |||
30 | SRC_URI = "http://llvm.org/releases/${PV}/llvm-${PV}.tgz" | ||
31 | |||
32 | SRC_URI_append_libc-uclibc = " file://arm_fenv_uclibc.patch " | ||
33 | |||
34 | S = "${WORKDIR}/llvm-${PV}" | ||
35 | |||
36 | inherit cmake perlnative | ||
37 | |||
38 | # Defines the LLVM supported arches. By now we always build either for ${BUILD} | ||
39 | # (native) or ${TARGET}. In the future it may make sense to enable all backends | ||
40 | # for the non-native build. The decision which backends are used is made by | ||
41 | # the 3rd party program or library that uses llvm anyway. | ||
42 | LLVM_ARCH = "${@get_llvm_arch(d)}" | ||
43 | |||
44 | # This is used for generating the install directory for the llvm libraries, | ||
45 | # binaries and headers. It makes side by side installation of those possible. | ||
46 | LLVM_RELEASE = "${PV}" | ||
47 | |||
48 | # llvm *must* be built out of tree | ||
49 | OECMAKE_SOURCEPATH = ".." | ||
50 | OECMAKE_BUILDPATH = "build" | ||
51 | EXTRA_OECMAKE = "\ | ||
52 | -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm${LLVM_RELEASE}/tblgen \ | ||
53 | -DLLVM_TARGETS_TO_BUILD=${LLVM_ARCH} \ | ||
54 | -DCMAKE_LINKER:FILEPATH=${LD} \ | ||
55 | -DCMAKE_AR:FILEPATH=${AR} \ | ||
56 | -DCMAKE_OBJCOPY:FILEPATH=${OBJCOPY} \ | ||
57 | -DCMAKE_OBJDUMP:FILEPATH=${OBJDUMP} \ | ||
58 | -DCMAKE_RANLIB:FILEPATH=${RANLIB} \ | ||
59 | -DCMAKE_STRIP:FILEPATH=${STRIP} \ | ||
60 | -DNM_PATH:FILEPATH=${NM} \ | ||
61 | -DLLVM_ENABLE_PIC:BOOL=ON \ | ||
62 | -DLLVM_TARGET_ARCH:STRING=${LLVM_ARCH} \ | ||
63 | -DLLVM_ENABLE_ASSERTIONS:BOOL=ON \ | ||
64 | -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \ | ||
65 | -DBUILD_SHARED_LIBS:BOOL=ON \ | ||
66 | " | ||
67 | # We need to reset this to avoid breakage as we build out of tree | ||
68 | TOOLCHAIN_OPTIONS = "" | ||
69 | |||
70 | PACKAGES = "${PN}-dbg ${PN}-doc ${PN}-dev ${PN}" | ||
71 | |||
72 | PACKAGES_DYNAMIC = "llvm-*" | ||
73 | |||
74 | # the difference to the non-native build is that we do not need | ||
75 | # to declare the location of the tblgen executable. | ||
76 | EXTRA_OECMAKE_virtclass-native = "\ | ||
77 | -DLLVM_TARGETS_TO_BUILD=${LLVM_ARCH} \ | ||
78 | -DCMAKE_LINKER:FILEPATH=${LD} \ | ||
79 | -DCMAKE_AR:FILEPATH=${AR} \ | ||
80 | -DCMAKE_OBJCOPY:FILEPATH=${OBJCOPY} \ | ||
81 | -DCMAKE_OBJDUMP:FILEPATH=${OBJDUMP} \ | ||
82 | -DCMAKE_RANLIB:FILEPATH=${RANLIB} \ | ||
83 | -DCMAKE_STRIP:FILEPATH=${STRIP} \ | ||
84 | -DNM_PATH:FILEPATH=${NM} \ | ||
85 | " | ||
86 | |||
87 | PACKAGES_virtclass-native = "" | ||
88 | |||
89 | PACKAGES_DYNAMIC_virtclass-native = "" | ||
90 | |||
91 | python populate_packages_prepend () { | ||
92 | libllvm_libdir = bb.data.expand('${libdir}/llvm${LLVM_RELEASE}', d) | ||
93 | |||
94 | do_split_packages(d, libllvm_libdir, '^lib(.*)\.so$', 'libllvm-%s', 'Split package for %s', allow_dirs=True) | ||
95 | } | ||
96 | |||
97 | FILES_${PN} = "" | ||
98 | ALLOW_EMPTY_${PN} = "1" | ||
99 | |||
100 | FILES_${PN}-dbg += "${libdir}/llvm${LLVM_RELEASE}/.debug ${bindir}/llvm${LLVM_RELEASE}/.debug" | ||
101 | |||
102 | FILES_${PN}-dev = " \ | ||
103 | ${includedir} \ | ||
104 | ${bindir}/* \ | ||
105 | ${libdir}/llvm${LLVM_RELEASE}/LLVMHello.so \ | ||
106 | ${libdir}/llvm${LLVM_RELEASE}/BugpointPasses.so \ | ||
107 | " | ||
108 | |||
109 | do_install() { | ||
110 | # Install into a private directory to be able to reorganize the files. | ||
111 | |||
112 | cd ${OECMAKE_BUILDPATH} | ||
113 | |||
114 | oe_runmake DESTDIR=${WORKDIR}/llvm-install install | ||
115 | |||
116 | # Create our custom target directories | ||
117 | install -d ${D}${bindir}/llvm${LLVM_RELEASE} | ||
118 | install -d ${D}${includedir}/llvm${LLVM_RELEASE} | ||
119 | install -d ${D}${libdir}/llvm${LLVM_RELEASE} | ||
120 | |||
121 | # Move headers into their own directory | ||
122 | cp -R ${WORKDIR}/llvm-install/${prefix}/include/llvm \ | ||
123 | ${D}${includedir}/llvm${LLVM_RELEASE}/ | ||
124 | cp -R ${WORKDIR}/llvm-install/${prefix}/include/llvm-c \ | ||
125 | ${D}${includedir}/llvm${LLVM_RELEASE}/ | ||
126 | |||
127 | find ${WORKDIR}/llvm-install/${prefix}/lib -name "*" -maxdepth 1 -exec \ | ||
128 | install {} ${D}${libdir}/llvm${LLVM_RELEASE} \; | ||
129 | |||
130 | # I dont know another way out. Binaries are installed into a special subdir | ||
131 | find ${WORKDIR}/llvm-install/${prefix}/bin -name "*" -maxdepth 1 -exec \ | ||
132 | install {} ${D}${bindir}/llvm${LLVM_RELEASE} \; | ||
133 | |||
134 | # LLVM does not install this by default. | ||
135 | install bin/tblgen ${D}${bindir}/llvm${LLVM_RELEASE} | ||
136 | |||
137 | # we install it here unmodified for native and none native and overwrite it | ||
138 | # later for native case | ||
139 | install -d ${D}${bindir} | ||
140 | install -m 0755 bin/llvm-config ${D}${bindir} | ||
141 | |||
142 | # Fix the paths in the config script to make it find the binaries and | ||
143 | # library files. Doing so allows 3rd party configure scripts working | ||
144 | # unmodified. | ||
145 | sed -e's!my.*ABS_RUN_DIR =.*!my $ABS_RUN_DIR = "${STAGING_DIR_TARGET}";!' \ | ||
146 | -e's!my.*INCLUDEDIR =.*!my $INCLUDEDIR = "${STAGING_INCDIR}/llvm${LLVM_RELEASE}";!' \ | ||
147 | -e's!my.*LIBDIR.*!my $LIBDIR = "${STAGING_LIBDIR}/llvm${LLVM_RELEASE}";!' \ | ||
148 | -e's!my.*BINDIR.*!my $BINDIR = "${STAGING_BINDIR}/llvm${LLVM_RELEASE}";!' \ | ||
149 | bin/llvm-config > bin/llvm-config${LLVM_RELEASE} | ||
150 | |||
151 | install -d ${SYSROOT_DESTDIR}${bindir_crossscripts} | ||
152 | install -m 0755 bin/llvm-config${LLVM_RELEASE} ${SYSROOT_DESTDIR}${bindir_crossscripts} | ||
153 | } | ||
154 | |||
155 | do_install_virtclass-native() { | ||
156 | # Install into a private directory to be able to reorganize the files. | ||
157 | |||
158 | cd ${OECMAKE_BUILDPATH} | ||
159 | |||
160 | oe_runmake DESTDIR=${WORKDIR}/llvm-install install | ||
161 | |||
162 | # Create our custom target directories | ||
163 | install -d ${D}${bindir}/llvm${LLVM_RELEASE} | ||
164 | install -d ${D}${includedir}/llvm${LLVM_RELEASE} | ||
165 | install -d ${D}${libdir}/llvm${LLVM_RELEASE} | ||
166 | |||
167 | # Move headers into their own directory | ||
168 | cp -R ${WORKDIR}/llvm-install/${prefix}/include/llvm \ | ||
169 | ${D}${includedir}/llvm${LLVM_RELEASE}/ | ||
170 | cp -R ${WORKDIR}/llvm-install/${prefix}/include/llvm-c \ | ||
171 | ${D}${includedir}/llvm${LLVM_RELEASE}/ | ||
172 | |||
173 | find ${WORKDIR}/llvm-install/${prefix}/lib -name "*" -maxdepth 1 -exec \ | ||
174 | install {} ${D}${libdir}/llvm${LLVM_RELEASE} \; | ||
175 | |||
176 | # I dont know another way out. Binaries are installed into a special subdir | ||
177 | find ${WORKDIR}/llvm-install/${prefix}/bin -name "*" -maxdepth 1 -exec \ | ||
178 | install {} ${D}${bindir}/llvm${LLVM_RELEASE} \; | ||
179 | |||
180 | # LLVM does not install this by default. | ||
181 | install bin/tblgen ${D}${bindir}/llvm${LLVM_RELEASE} | ||
182 | |||
183 | # Fix the paths in the config script to make it find the binaries and | ||
184 | # library files. Doing so allows 3rd party configure scripts working | ||
185 | # unmodified. | ||
186 | sed -e's!my.*ABS_RUN_DIR =.*!my $ABS_RUN_DIR = "${STAGING_DIR_TARGET}";!' \ | ||
187 | -e's!my.*INCLUDEDIR =.*!my $INCLUDEDIR = "${STAGING_INCDIR}/llvm${LLVM_RELEASE}";!' \ | ||
188 | -e's!my.*LIBDIR.*!my $LIBDIR = "${STAGING_LIBDIR}/llvm${LLVM_RELEASE}";!' \ | ||
189 | -e's!my.*BINDIR.*!my $BINDIR = "${STAGING_BINDIR}/llvm${LLVM_RELEASE}";!' \ | ||
190 | bin/llvm-config > bin/llvm-config${LLVM_RELEASE} | ||
191 | |||
192 | install -d ${D}${bindir} | ||
193 | install -m 0755 bin/llvm-config${LLVM_RELEASE} ${D}${bindir} | ||
194 | } | ||
195 | |||
196 | |||
197 | # Retrieve the target in a way that is compatible to the arch | ||
198 | # value in llvm (>= 2.5) | ||
199 | def get_llvm_arch(d): | ||
200 | import bb; | ||
201 | |||
202 | arch = bb.data.getVar('TARGET_ARCH', d, 1) | ||
203 | if arch == "x86_64" or arch == "i486" or arch == "i586" or arch == "i686": | ||
204 | arch = "X86" | ||
205 | elif arch == "arm": | ||
206 | arch = "ARM" | ||
207 | elif arch == "mipsel": | ||
208 | arch = "Mips" | ||
209 | elif arch == "powerpc": | ||
210 | arch = "PowerPC" | ||
211 | else: | ||
212 | oefatal("Your target architecture is not supported by this recipe"); | ||
213 | |||
214 | return arch | ||
215 | |||
216 | |||
217 | BBCLASSEXTEND = "native" | ||
218 | |||
diff --git a/recipes-core/llvm/llvm2.9/arm_fenv_uclibc.patch b/recipes-core/llvm/llvm2.9/arm_fenv_uclibc.patch new file mode 100644 index 0000000..c3ae494 --- /dev/null +++ b/recipes-core/llvm/llvm2.9/arm_fenv_uclibc.patch | |||
@@ -0,0 +1,14 @@ | |||
1 | Index: 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/recipes-core/llvm/llvm2.9_2.9.bb b/recipes-core/llvm/llvm2.9_2.9.bb new file mode 100644 index 0000000..5e5ca29 --- /dev/null +++ b/recipes-core/llvm/llvm2.9_2.9.bb | |||
@@ -0,0 +1,25 @@ | |||
1 | require llvm.inc | ||
2 | |||
3 | PARALLEL_MAKE_virtclass-native = "" | ||
4 | |||
5 | EXTRA_OECMAKE = "\ | ||
6 | -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm${LLVM_RELEASE}/tblgen \ | ||
7 | -DLLVM_TARGETS_TO_BUILD="X86;${LLVM_ARCH}" \ | ||
8 | -DCMAKE_LINKER:FILEPATH=${LD} \ | ||
9 | -DCMAKE_AR:FILEPATH=${AR} \ | ||
10 | -DCMAKE_OBJCOPY:FILEPATH=${OBJCOPY} \ | ||
11 | -DCMAKE_OBJDUMP:FILEPATH=${OBJDUMP} \ | ||
12 | -DCMAKE_RANLIB:FILEPATH=${RANLIB} \ | ||
13 | -DCMAKE_STRIP:FILEPATH=${STRIP} \ | ||
14 | -DNM_PATH:FILEPATH=${NM} \ | ||
15 | -DLLVM_ENABLE_PIC:BOOL=ON \ | ||
16 | -DLLVM_TARGET_ARCH:STRING=${LLVM_ARCH} \ | ||
17 | -DLLVM_ENABLE_ASSERTIONS:BOOL=ON \ | ||
18 | -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \ | ||
19 | -DBUILD_SHARED_LIBS:BOOL=ON \ | ||
20 | " | ||
21 | |||
22 | LLVM_RELEASE = "2.9" | ||
23 | |||
24 | SRC_URI[md5sum] = "793138412d2af2c7c7f54615f8943771" | ||
25 | SRC_URI[sha256sum] = "661236cfa17428b48cfa9cbb9909f7569c64b8ecd219fd91dbc00e3b557b3779" | ||