diff options
author | Henning Heinold <heinold@inf.fu-berlin.de> | 2011-11-12 20:58:34 +0100 |
---|---|---|
committer | Henning Heinold <heinold@inf.fu-berlin.de> | 2011-11-26 23:41:44 +0100 |
commit | 57e069cde6617f00ca8834a82c6f360af43d5067 (patch) | |
tree | 48cbe15e96d217c45acfa64b0c13aad8c6424980 /recipes-core/llvm/llvm.inc | |
download | meta-java-57e069cde6617f00ca8834a82c6f360af43d5067.tar.gz |
meta-java: initial commit
* taken over mostly stuff from oe classic
* cleaned up recipes
* added license checksums
* bump icedtea6-native to 1.8.11
* use jamvm from git as native
Diffstat (limited to 'recipes-core/llvm/llvm.inc')
-rw-r--r-- | recipes-core/llvm/llvm.inc | 218 |
1 files changed, 218 insertions, 0 deletions
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 | |||