llvm: Reworked to allow multiple installation of same version.
authorRobert Schuster <thebohemian@gmx.net>
Tue, 31 Mar 2009 09:51:10 +0000 (11:51 +0200)
committerRobert Schuster <thebohemian@gmx.net>
Tue, 31 Mar 2009 09:55:05 +0000 (11:55 +0200)
  - introduced common include file
  - provided implementation for llvm 2.5
  - added wrapper script and its build recipe
  - the same for native side
llvm2.5 2.5: New recipe
llvm2.5-native 2.5: New recipe.
llvm-common: New recipe.
llvm-common-native: New recipe.

recipes/llvm/llvm-common-native.bb [new file with mode: 0644]
recipes/llvm/llvm-common.bb [new file with mode: 0644]
recipes/llvm/llvm-common/llvm-config [new file with mode: 0644]
recipes/llvm/llvm-native.inc [new file with mode: 0644]
recipes/llvm/llvm2.5-native_2.5.bb [new file with mode: 0644]
recipes/llvm/llvm2.5/fix-build.patch [moved from recipes/llvm/llvm-2.5/fix-build.patch with 100% similarity]
recipes/llvm/llvm2.5_2.5.bb [new file with mode: 0644]
recipes/llvm/llvm_2.5.bb [deleted file]

diff --git a/recipes/llvm/llvm-common-native.bb b/recipes/llvm/llvm-common-native.bb
new file mode 100644 (file)
index 0000000..c2b79bd
--- /dev/null
@@ -0,0 +1,12 @@
+require llvm-common.bb
+
+inherit native
+
+do_install() {
+       :
+}
+
+do_stage() {
+       install -d ${STAGING_BINDIR}
+  install -m 0755 ${WORKDIR}/llvm-config ${STAGING_BINDIR}
+}
diff --git a/recipes/llvm/llvm-common.bb b/recipes/llvm/llvm-common.bb
new file mode 100644 (file)
index 0000000..b7f2bfc
--- /dev/null
@@ -0,0 +1,14 @@
+DESCRIPTION = "Helper script for OE's llvm support"
+
+SRC_URI = "file://llvm-config"
+
+PACKAGES = ""
+
+do_install() {
+       :
+}
+
+do_stage() {
+       install -d ${STAGING_BINDIR_CROSS}
+  install -m 0755 ${WORKDIR}/llvm-config ${STAGING_BINDIR_CROSS}
+}
diff --git a/recipes/llvm/llvm-common/llvm-config b/recipes/llvm/llvm-common/llvm-config
new file mode 100644 (file)
index 0000000..5256b8c
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+# Wrapper script for real llvm-config. Simply calls
+
+if [ $WANT_LLVM_RELEASE ]; then
+       exec `dirname $0`/llvm-config$WANT_LLVM_RELEASE ${@}
+else
+  echo "The variable WANT_LLVM_RELEASE is not defined and exported"
+       echo "by your build recipe. Go figure."
+  exit 1
+fi
diff --git a/recipes/llvm/llvm-native.inc b/recipes/llvm/llvm-native.inc
new file mode 100644 (file)
index 0000000..a7d7fa3
--- /dev/null
@@ -0,0 +1,26 @@
+require llvm.inc
+
+DEPENDS = "llvm-common-native"
+
+inherit native
+
+# the difference to the non-native build is that we do not need
+# to declare the location of the tblgen executable.
+EXTRA_OECMAKE = "\
+  -DLLVM_TARGETS_TO_BUILD=${LLVM_ARCH} \
+  -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() {
+  llvm_stage
+
+  install -d ${STAGING_BINDIR}
+       install -m 0755 build/bin/llvm-config${LLVM_RELEASE} ${STAGING_BINDIR}
+}
+
+
diff --git a/recipes/llvm/llvm2.5-native_2.5.bb b/recipes/llvm/llvm2.5-native_2.5.bb
new file mode 100644 (file)
index 0000000..13b5a44
--- /dev/null
@@ -0,0 +1,4 @@
+require llvm-native.inc
+
+SRC_URI += "file://fix-build.patch;patch=1"
+
diff --git a/recipes/llvm/llvm2.5_2.5.bb b/recipes/llvm/llvm2.5_2.5.bb
new file mode 100644 (file)
index 0000000..355634e
--- /dev/null
@@ -0,0 +1,4 @@
+require llvm.inc
+
+SRC_URI += "file://fix-build.patch;patch=1"
+
diff --git a/recipes/llvm/llvm_2.5.bb b/recipes/llvm/llvm_2.5.bb
deleted file mode 100644 (file)
index ece6442..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-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 \
-"
-
-PR = "r2"
-
-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="${STAGING_DIR_HOST}" install
-
-  install -d ${STAGING_INCDIR}/llvm
-       find include/llvm -name "*.h" -maxdepth 1 -exec \
-    install {} ${STAGING_INCDIR}/llvm \;
-
-  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
-