[oe-commits] Robert Schuster : llvm: Reworked to allow multiple installation of same version.

GIT User account git at amethyst.openembedded.net
Tue Apr 28 12:02:50 UTC 2009


Module: openembedded.git
Branch: stable/2009
Commit: 05f14c79375cc8ebf3ba4ccbf48395d78d1033b0
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=05f14c79375cc8ebf3ba4ccbf48395d78d1033b0

Author: Robert Schuster <thebohemian at gmx.net>
Date:   Tue Mar 31 11:51:10 2009 +0200

llvm: Reworked to allow multiple installation of same version.
  - 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                 |   12 ++++
 recipes/llvm/llvm-common.bb                        |   14 ++++
 recipes/llvm/llvm-common/llvm-config               |   10 +++
 recipes/llvm/llvm-native.inc                       |   26 ++++++++
 recipes/llvm/llvm2.5-native_2.5.bb                 |    4 +
 recipes/llvm/{llvm-2.5 => llvm2.5}/fix-build.patch |    0 
 recipes/llvm/llvm2.5_2.5.bb                        |    4 +
 recipes/llvm/llvm_2.5.bb                           |   67 --------------------
 8 files changed, 70 insertions(+), 67 deletions(-)

diff --git a/recipes/llvm/llvm-common-native.bb b/recipes/llvm/llvm-common-native.bb
new file mode 100644
index 0000000..c2b79bd
--- /dev/null
+++ b/recipes/llvm/llvm-common-native.bb
@@ -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
index 0000000..b7f2bfc
--- /dev/null
+++ b/recipes/llvm/llvm-common.bb
@@ -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
index 0000000..5256b8c
--- /dev/null
+++ b/recipes/llvm/llvm-common/llvm-config
@@ -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
index 0000000..a7d7fa3
--- /dev/null
+++ b/recipes/llvm/llvm-native.inc
@@ -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
index 0000000..13b5a44
--- /dev/null
+++ b/recipes/llvm/llvm2.5-native_2.5.bb
@@ -0,0 +1,4 @@
+require llvm-native.inc
+
+SRC_URI += "file://fix-build.patch;patch=1"
+
diff --git a/recipes/llvm/llvm-2.5/fix-build.patch b/recipes/llvm/llvm2.5/fix-build.patch
similarity index 100%
rename from recipes/llvm/llvm-2.5/fix-build.patch
rename to recipes/llvm/llvm2.5/fix-build.patch
diff --git a/recipes/llvm/llvm2.5_2.5.bb b/recipes/llvm/llvm2.5_2.5.bb
new file mode 100644
index 0000000..355634e
--- /dev/null
+++ b/recipes/llvm/llvm2.5_2.5.bb
@@ -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
index ece6442..0000000
--- a/recipes/llvm/llvm_2.5.bb
+++ /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
-





More information about the Openembedded-commits mailing list