summaryrefslogtreecommitdiff
path: root/recipes/llvm
diff options
context:
space:
mode:
authorRobert Schuster <rschus@entw2.(none)>2009-03-20 14:54:41 +0100
committerRobert Schuster <rschus@entw2.(none)>2009-03-20 14:54:41 +0100
commit968aa56f6f96489598aff9f9fe95d0cec0692e73 (patch)
treea013451abfcc8b8a1e74ed2a0eff76759f65d328 /recipes/llvm
parentf68981e2391d6081d9f1584d7d54ed6cc7dccaf2 (diff)
llvm 2.5: New recipe.
Diffstat (limited to 'recipes/llvm')
-rw-r--r--recipes/llvm/llvm-2.5/fix-build.patch24
-rw-r--r--recipes/llvm/llvm_2.5.bb65
2 files changed, 89 insertions, 0 deletions
diff --git a/recipes/llvm/llvm-2.5/fix-build.patch b/recipes/llvm/llvm-2.5/fix-build.patch
new file mode 100644
index 0000000000..000fd4aca5
--- /dev/null
+++ b/recipes/llvm/llvm-2.5/fix-build.patch
@@ -0,0 +1,24 @@
+Index: llvm-2.5/tools/llvm-config/CMakeLists.txt
+===================================================================
+--- llvm-2.5.orig/tools/llvm-config/CMakeLists.txt 2009-01-07 20:24:44.000000000 +0100
++++ llvm-2.5/tools/llvm-config/CMakeLists.txt 2009-03-20 14:18:37.637615308 +0100
+@@ -83,13 +83,13 @@
+ COMMENT "Checking for cyclic dependencies between LLVM libraries.")
+
+ add_custom_command(OUTPUT ${LLVM_CONFIG}
+- COMMAND echo 's,@LLVM_CPPFLAGS@,${CMAKE_CPP_FLAGS},' > temp.sed
+- COMMAND echo 's,@LLVM_CFLAGS@,${CMAKE_C_FLAGS},' >> temp.sed
+- COMMAND echo 's,@LLVM_CXXFLAGS@,${CMAKE_CXX_FLAGS},' >> temp.sed
++ COMMAND echo 's!@LLVM_CPPFLAGS@!${CMAKE_CPP_FLAGS}!' > temp.sed
++ COMMAND echo 's!@LLVM_CFLAGS@!${CMAKE_C_FLAGS}!' >> temp.sed
++ COMMAND echo 's!@LLVM_CXXFLAGS@!${CMAKE_CXX_FLAGS}!' >> temp.sed
+ # TODO: Use general flags for linking, not just for shared libs:
+- COMMAND echo 's,@LLVM_LDFLAGS@,${CMAKE_SHARED_LINKER_FLAGS},' >> temp.sed
+- COMMAND echo 's,@LIBS@,,' >> temp.sed # TODO: System libs
+- COMMAND echo 's,@LLVM_BUILDMODE@,${CMAKE_BUILD_TYPE},' >> temp.sed
++ COMMAND echo 's!@LLVM_LDFLAGS@!${CMAKE_SHARED_LINKER_FLAGS}!' >> temp.sed
++ COMMAND echo 's!@LIBS@!!' >> temp.sed # TODO: System libs
++ COMMAND echo 's!@LLVM_BUILDMODE@!${CMAKE_BUILD_TYPE}!' >> temp.sed
+ COMMAND sed -f temp.sed < ${LLVM_CONFIG_IN} > ${LLVM_CONFIG}
+ COMMAND ${CMAKE_COMMAND} -E remove -f temp.sed
+ COMMAND cat ${FINAL_LIBDEPS} >> ${LLVM_CONFIG}
diff --git a/recipes/llvm/llvm_2.5.bb b/recipes/llvm/llvm_2.5.bb
new file mode 100644
index 0000000000..c0ce3345b8
--- /dev/null
+++ b/recipes/llvm/llvm_2.5.bb
@@ -0,0 +1,65 @@
+# TODO:
+# - packages examples
+# - fix staging (and probably llvm-config script)
+
+DESCRIPTION = "The Low Level Virtual Machine"
+HOMEPAGE = "http://llvm.org"
+LICENSE = "various"
+
+SRC_URI = "\
+ http://llvm.org/releases/${PV}/llvm-${PV}.tar.gz \
+ file://fix-build.patch;patch=1 \
+"
+
+DEPENDS = "llvm-native"
+
+inherit cmake
+
+OECMAKE_SOURCEPATH = ".."
+OECMAKE_BUILDPATH = "build"
+EXTRA_OEMAKE = "-C build"
+EXTRA_OECMAKE = "\
+ -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/tblgen \
+ -DLLVM_TARGETS_TO_BUILD=${@get_llvm_arch(d)} \
+ -DCMAKE_LINKER:FILEPATH=${LD} \
+ -DCMAKE_AR:FILEPATH=${AR} \
+ -DCMAKE_OBJCOPY:FILEPATH=${OBJCOPY} \
+ -DCMAKE_OBJDUMP:FILEPATH=${OBJDUMP} \
+ -DCMAKE_RANLIB:FILEPATH=${RANLIB} \
+ -DCMAKE_STRIP:FILEPATH=${STRIP} \
+"
+
+do_stage() {
+ oe_runmake DESTDIR="${STAGE_TEMP}" install
+
+ install -d ${STAGING_BINDIR_CROSS}
+
+ # Fix some paths in the script to make it work correctly
+ sed -e's^my.*ABS_RUN_DIR =.*^my $ABS_RUN_DIR = "${STAGING_DIR_TARGET}";^' \
+ -e's^my.*INCLUDEDIR =.*^my $INCLUDEDIR = "${STAGING_INCDIR}";^' \
+ -e's^my.*LIBDIR.*^my $LIBDIR = "${STAGING_LIBDIR}";^' \
+ -e's^my.*BINDIR.*^my $BINDIR = "${STAGING_BINDIR}";^' \
+ build/bin/llvm-config > ${STAGING_BINDIR_CROSS}/llvm-config
+
+ chmod +x ${STAGING_BINDIR_CROSS}/llvm-config
+}
+
+# Retrieve the target in a way that is compatible to the arch
+# value in llvm (>= 2.5)
+def get_llvm_arch(d):
+ import bb;
+
+ arch = bb.data.getVar('TARGET_ARCH', d, 1)
+ if arch == "x86_64" or arch == "i486" or arch == "i586" or arch == "i686":
+ arch = "X86"
+ elif arch == "arm":
+ arch = "ARM"
+ elif arch == "mipsel":
+ arch = "Mips"
+ elif arch == "powerpc":
+ arch = "PowerPC"
+ else:
+ oefatal("Your target architecture is not supported by this recipe");
+
+ return arch
+