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