[oe-commits] Denys Dmytriyenko : angstrom: framework to select internal/ external toolchain and brand (csl/generic for now)

git version control git at git.openembedded.org
Wed Oct 14 14:03:08 UTC 2009


Module: openembedded.git
Branch: org.openembedded.dev
Commit: 8be279f5a48418db0b4c9142c0c9bd4ae0764e37
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=8be279f5a48418db0b4c9142c0c9bd4ae0764e37

Author: Denys Dmytriyenko <denis at denix.org>
Date:   Wed Oct 14 15:27:07 2009 +0200

angstrom: framework to select internal/external toolchain and brand (csl/generic for now)

---

 conf/bitbake.conf                          |    2 +
 conf/distro/angstrom-2008.1.conf           |   12 +++---
 conf/distro/include/angstrom-glibc.inc     |    2 +-
 recipes/meta/external-toolchain-csl.bb     |   44 +++++++++++++-----------
 recipes/meta/external-toolchain-generic.bb |   50 ++++++++++++++++++++++++++++
 5 files changed, 83 insertions(+), 27 deletions(-)

diff --git a/conf/bitbake.conf b/conf/bitbake.conf
index c2f7666..7426095 100644
--- a/conf/bitbake.conf
+++ b/conf/bitbake.conf
@@ -392,6 +392,8 @@ export PATH
 
 CCACHE = "${@bb.which(bb.data.getVar('PATH', d, 1), 'ccache') and 'ccache '}"
 TOOLCHAIN_OPTIONS = ""
+TOOLCHAIN_PATH ?= ""
+TOOLCHAIN_SYSPATH ?= ""
 
 export CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
 export CXX = "${CCACHE}${HOST_PREFIX}g++ ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
diff --git a/conf/distro/angstrom-2008.1.conf b/conf/distro/angstrom-2008.1.conf
index 76815d8..07c62a0 100644
--- a/conf/distro/angstrom-2008.1.conf
+++ b/conf/distro/angstrom-2008.1.conf
@@ -36,6 +36,10 @@ require conf/distro/include/preferred-opie-versions-1.2.4.inc
 DISTRO_TYPE ?= "debug"
 #DISTRO_TYPE = "release"
 
+# Set the toolchain type (internal, external) and brand (generic, csl etc.)
+TOOLCHAIN_TYPE ?= "internal"
+TOOLCHAIN_BRAND ?= ""
+
 # Ship just basic locale by default. Locales are big (~1Mb uncompr.), so
 # shipping some adhoc subset will be still useless and size burden for
 # users of all other languages/countries. Instead, worth to make it easy
@@ -128,12 +132,8 @@ PREFERRED_VERSION_binutils_avr32 = "2.17"
 PREFERRED_VERSION_binutils-cross_avr32 = "2.17"
 PREFERRED_VERSION_binutils-cross-sdk_avr32 = "2.17"
 
-# Virtuals:
-PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}binutils = "binutils-cross"
-PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-initial = "gcc-cross-initial"
-PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-intermediate = "gcc-cross-intermediate"
-PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc = "gcc-cross"
-PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}g++ = "gcc-cross"
+# Toolchain virtuals:
+require conf/distro/include/toolchain-${TOOLCHAIN_TYPE}.inc
 
 # hostap stuff, we prefer the in-kernel modules, but those don't work for all machines
 PREFERRED_PROVIDER_hostap-conf                      ?= "hostap-conf"
diff --git a/conf/distro/include/angstrom-glibc.inc b/conf/distro/include/angstrom-glibc.inc
index dae149f..fe78f48 100644
--- a/conf/distro/include/angstrom-glibc.inc
+++ b/conf/distro/include/angstrom-glibc.inc
@@ -1,7 +1,7 @@
 # glibc:
 require conf/distro/include/glibc.inc
 
-PREFERRED_PROVIDER_linux-libc-headers ?= "linux-libc-headers"
+require conf/distro/include/glibc-${TOOLCHAIN_TYPE}.inc
 
 TARGET_OS = "linux"
 TARGET_OS .= "${@['','-gnueabi'][bb.data.getVar('TARGET_ARCH',d,1) in ['arm', 'armeb'] and bb.data.getVar('MACHINE',d) not in ['collie','h3600', 'h3800', 'simpad', 'htcwallaby']]}"
diff --git a/conf/distro/include/glibc-external.inc b/conf/distro/include/glibc-external.inc
new file mode 100644
index 0000000..e69de29
diff --git a/conf/distro/include/glibc-internal.inc b/conf/distro/include/glibc-internal.inc
new file mode 100644
index 0000000..e69de29
diff --git a/conf/distro/include/toolchain-external.inc b/conf/distro/include/toolchain-external.inc
new file mode 100644
index 0000000..e69de29
diff --git a/conf/distro/include/toolchain-internal.inc b/conf/distro/include/toolchain-internal.inc
new file mode 100644
index 0000000..e69de29
diff --git a/recipes/meta/external-toolchain-csl.bb b/recipes/meta/external-toolchain-csl.bb
index 051b832..f17cae7 100644
--- a/recipes/meta/external-toolchain-csl.bb
+++ b/recipes/meta/external-toolchain-csl.bb
@@ -126,34 +126,38 @@ DESCRIPTION_sln = "glibc: create symbolic links between files"
 DESCRIPTION_localedef = "glibc: compile locale definition files"
 
 def csl_get_main_version(d):
-	import subprocess,bb
-	return subprocess.Popen([bb.data.getVar('TOOLCHAIN_PATH', d, 1)+'/bin/'+bb.data.getVar('TARGET_PREFIX', d, 1)+'gcc', '-v'], stderr=subprocess.PIPE).communicate()[1].splitlines()[-1].split()[-1].rstrip(')')
+	import subprocess,os,bb
+	if os.path.exists(bb.data.getVar('TOOLCHAIN_PATH', d, 1)+'/bin/'+bb.data.getVar('TARGET_PREFIX', d, 1)+'gcc'):
+		return subprocess.Popen([bb.data.getVar('TOOLCHAIN_PATH', d, 1)+'/bin/'+bb.data.getVar('TARGET_PREFIX', d, 1)+'gcc', '-v'], stderr=subprocess.PIPE).communicate()[1].splitlines()[-1].split()[-1].rstrip(')')
 
 def csl_get_gcc_version(d):
-	import subprocess,bb
-	return subprocess.Popen([bb.data.getVar('TOOLCHAIN_PATH', d, 1)+'/bin/'+bb.data.getVar('TARGET_PREFIX', d, 1)+'gcc', '-v'], stderr=subprocess.PIPE).communicate()[1].splitlines()[-1].split()[2]
+	import subprocess,os,bb
+	if os.path.exists(bb.data.getVar('TOOLCHAIN_PATH', d, 1)+'/bin/'+bb.data.getVar('TARGET_PREFIX', d, 1)+'gcc'):
+		return subprocess.Popen([bb.data.getVar('TOOLCHAIN_PATH', d, 1)+'/bin/'+bb.data.getVar('TARGET_PREFIX', d, 1)+'gcc', '-v'], stderr=subprocess.PIPE).communicate()[1].splitlines()[-1].split()[2]
 
 def csl_get_libc_version(d):
 	import os,bb
-	for file in os.listdir(bb.data.getVar('TOOLCHAIN_SYSPATH', d, 1)+'/libc/lib/'):
-		if file.find('libc-') == 0:
-			return file[5:-3]
-	return None
+	if os.path.exists(bb.data.getVar('TOOLCHAIN_SYSPATH', d, 1)+'/libc/lib/'):
+		for file in os.listdir(bb.data.getVar('TOOLCHAIN_SYSPATH', d, 1)+'/libc/lib/'):
+			if file.find('libc-') == 0:
+				return file[5:-3]
+		return None
 
 def csl_get_kernel_version(d):
 	import os,bb
-	f = open(bb.data.getVar('TOOLCHAIN_SYSPATH', d, 1)+'/libc/usr/include/linux/version.h', 'r')
-	l = f.readlines();
-	f.close();
-	for s in l:
-		if s.find('LINUX_VERSION_CODE') > 0:
-			ver = int(s.split()[2])
-			maj = ver / 65536
-			ver = ver % 65536
-			min = ver / 256
-			ver = ver % 256
-			return str(maj)+'.'+str(min)+'.'+str(ver)
-	return None
+	if os.path.exists(bb.data.getVar('TOOLCHAIN_SYSPATH', d, 1)+'/libc/'):
+		f = open(bb.data.getVar('TOOLCHAIN_SYSPATH', d, 1)+'/libc/usr/include/linux/version.h', 'r')
+		l = f.readlines();
+		f.close();
+		for s in l:
+			if s.find('LINUX_VERSION_CODE') > 0:
+				ver = int(s.split()[2])
+				maj = ver / 65536
+				ver = ver % 65536
+				min = ver / 256
+				ver = ver % 256
+				return str(maj)+'.'+str(min)+'.'+str(ver)
+		return None
 
 CSL_VER_MAIN := "${@csl_get_main_version(d)}"
 CSL_VER_GCC := "${@csl_get_gcc_version(d)}"
diff --git a/recipes/meta/external-toolchain-generic.bb b/recipes/meta/external-toolchain-generic.bb
new file mode 100644
index 0000000..6e87e88
--- /dev/null
+++ b/recipes/meta/external-toolchain-generic.bb
@@ -0,0 +1,50 @@
+DESCRIPTION = "This package allows OE to work with an external toolchain generated \
+               by meta-toolchain instead of building its own. It expects that toolchain \
+               to be located in SDK_PATH/prefix."
+
+PROVIDES = "\
+    linux-libc-headers \
+    virtual/${TARGET_PREFIX}gcc \
+    virtual/${TARGET_PREFIX}gcc-initial \
+    virtual/${TARGET_PREFIX}gcc-intermediate \
+    virtual/${TARGET_PREFIX}binutils \
+    virtual/${TARGET_PREFIX}libc-for-gcc \
+    virtual/${TARGET_PREFIX}libc-initial \
+    virtual/libc \
+    virtual/libintl \
+    virtual/libiconv \
+    "
+
+RPROVIDES = "glibc glibc-utils libsegfault glibc-thread-db libgcc-dev libgcc libstdc++-dev libstdc++ ldd"
+PACKAGES_DYNAMIC = "glibc-gconv-*"
+PR = "r2"
+
+inherit sdk
+
+do_stage() {
+	if [ ! -e  ${prefix}/package-status ]; then
+		echo "The external toolchain could not be found in ${prefix}!"
+		exit 1
+	fi
+	
+	install -d ${STAGING_DIR}/pkgdata/
+	install -d ${STAGING_DIR_TARGET}/shlibs/
+
+	cp -pPRr ${prefix}/pkgdata/* ${STAGING_DIR}/pkgdata/
+	cp -pPRr ${prefix}/${TARGET_SYS}/shlibs/* ${STAGING_DIR_TARGET}/shlibs/
+
+	if [ -d ${prefix}/ipk ]; then
+		install -d ${DEPLOY_DIR_IPK}/
+		cp -pPRr ${prefix}/ipk/* ${DEPLOY_DIR_IPK}/
+	fi
+
+	if [ -d ${prefix}/deb ]; then
+		install -d ${DEPLOY_DIR_DEB}/
+		cp -pPRr ${prefix}/deb/* ${DEPLOY_DIR_DEB}/
+	fi
+
+#	if [ -d ${prefix}/pstage -a "x${DEPLOY_DIR_PSTAGE}" != "x" ]; then
+#		install -d ${DEPLOY_DIR_PSTAGE}/
+#		cp -pPRr ${prefix}/pstage/* ${DEPLOY_DIR_PSTAGE}/
+#	fi
+}





More information about the Openembedded-commits mailing list