aboutsummaryrefslogtreecommitdiff
path: root/meta-linaro-toolchain/conf/distro/include
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <marcin.juszkiewicz@linaro.org>2013-03-13 14:40:56 +0100
committerMarcin Juszkiewicz <marcin.juszkiewicz@linaro.org>2013-03-13 14:43:50 +0100
commit12a612e83924ad5f9ddf2f41df41c35eb744a3fc (patch)
tree47f4866ca9725ff853c9efef1dde7bbb985c52b5 /meta-linaro-toolchain/conf/distro/include
parenta9d70669d6a9d2e80a01182c732336be0cd5513b (diff)
downloadmeta-linaro-12a612e83924ad5f9ddf2f41df41c35eb744a3fc.tar.gz
move toolchain components into meta-linaro-toolchain
Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
Diffstat (limited to 'meta-linaro-toolchain/conf/distro/include')
-rw-r--r--meta-linaro-toolchain/conf/distro/include/external-linaro-toolchain-versions.inc108
-rw-r--r--meta-linaro-toolchain/conf/distro/include/tcmode-external-linaro.inc68
2 files changed, 176 insertions, 0 deletions
diff --git a/meta-linaro-toolchain/conf/distro/include/external-linaro-toolchain-versions.inc b/meta-linaro-toolchain/conf/distro/include/external-linaro-toolchain-versions.inc
new file mode 100644
index 00000000..6b5a6fb7
--- /dev/null
+++ b/meta-linaro-toolchain/conf/distro/include/external-linaro-toolchain-versions.inc
@@ -0,0 +1,108 @@
+def elt_run(d, cmd, *args):
+ import bb.process
+ import subprocess
+
+ topdir = d.getVar('TOPDIR', True)
+ toolchain_path = d.getVar('EXTERNAL_TOOLCHAIN', True)
+ if not toolchain_path:
+ return 'UNKNOWN', 'UNKNOWN'
+
+ target_prefix = d.getVar('TARGET_PREFIX', True)
+ path = os.path.join(toolchain_path, 'bin', target_prefix + cmd)
+ args = [path] + list(args)
+
+ return bb.process.run(args, cwd=topdir, stderr=subprocess.PIPE)
+
+def elt_get_version(d):
+ try:
+ stdout, stderr = elt_run(d, 'gcc', '-v')
+ except bb.process.CmdError as exc:
+ bb.error('Failed to obtain external Linaro toolchain version: %s' % exc)
+ return 'UNKNOWN'
+ else:
+ last_line = stderr.splitlines()[-1]
+ return last_line
+
+def elt_get_main_version(d):
+ version = elt_get_version(d)
+ if version != 'UNKNOWN':
+ return version.split()[-1].rstrip(')')
+ else:
+ return version
+
+def elt_get_gcc_version(d):
+ version = elt_get_version(d)
+ if version != 'UNKNOWN':
+ return version.split()[2]
+ else:
+ return version
+
+def elt_get_libc_version(d):
+ import os,bb
+ syspath = bb.data.expand('${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}', d)
+ if not syspath:
+ return 'UNKNOWN'
+
+ libpath = syspath + '/libc/lib/${ELT_TARGET_SYS}/'
+
+ if os.path.exists(libpath):
+ for file in os.listdir(libpath):
+ if file.find('libc-') == 0:
+ return file[5:-3]
+
+ libpath = syspath + '/libc/lib/'
+
+ if os.path.exists(libpath):
+ for file in os.listdir(libpath):
+ if file.find('libc-') == 0:
+ return file[5:-3]
+ return 'UNKNOWN'
+
+def elt_get_kernel_version(d):
+ import os,bb
+ syspath = bb.data.expand('${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}', d)
+ if not syspath:
+ return 'UNKNOWN'
+
+ vf = syspath + '/libc/usr/include/linux/version.h'
+
+ try:
+ f = open(vf, 'r')
+ except (OSError, IOError):
+ return 'UNKNOWN'
+
+ 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 'UNKNOWN'
+
+def elt_get_gdb_version(d):
+ try:
+ stdout, stderr = elt_run(d, 'gdb', '-v')
+ except CmdError:
+ return 'UNKNOWN'
+ else:
+ first_line = stdout.splitlines()[0]
+ return first_line.split()[-1]
+
+python external_linaro_toolchain_version_handler () {
+ if not isinstance(e, bb.event.ConfigParsed):
+ return
+ d = e.data
+ ld = d.createCopy()
+ ld.finalize()
+
+ d.setVar('ELT_VER_MAIN', elt_get_main_version(ld))
+ d.setVar('ELT_VER_GCC', elt_get_gcc_version(ld))
+ d.setVar('ELT_VER_LIBC', elt_get_libc_version(ld))
+ d.setVar('ELT_VER_KERNEL', elt_get_kernel_version(ld))
+ d.setVar('ELT_VER_GDB', elt_get_gdb_version(ld))
+}
+addhandler external_linaro_toolchain_version_handler
diff --git a/meta-linaro-toolchain/conf/distro/include/tcmode-external-linaro.inc b/meta-linaro-toolchain/conf/distro/include/tcmode-external-linaro.inc
new file mode 100644
index 00000000..284fb8bc
--- /dev/null
+++ b/meta-linaro-toolchain/conf/distro/include/tcmode-external-linaro.inc
@@ -0,0 +1,68 @@
+#
+# Configuration to use an external Linaro binary toolchain
+#
+
+EXTERNAL_TOOLCHAIN ?= "/usr/local/linaro-binary-toolchain/${TARGET_ARCH}"
+
+TOOLCHAIN_PATH_ADD = "${EXTERNAL_TOOLCHAIN}/bin:"
+PATH =. "${TOOLCHAIN_PATH_ADD}"
+
+ELT_TARGET_SYS ?= "arm-linux-gnueabihf"
+TARGET_PREFIX = "${ELT_TARGET_SYS}-"
+
+PREFERRED_PROVIDER_linux-libc-headers = "external-linaro-toolchain"
+PREFERRED_PROVIDER_linux-libc-headers-dev = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-initial = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}g++ = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}binutils = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}libc-for-gcc = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}compilerlibs = "external-linaro-toolchain"
+PREFERRED_PROVIDER_libgcc = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/libc = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/libintl = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/libiconv = "external-linaro-toolchain"
+PREFERRED_PROVIDER_glibc-thread-db = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/linux-libc-headers = "external-linaro-toolchain"
+
+TARGET_CPPFLAGS_prepend = " -isystem${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/include "
+TARGET_LDFLAGS_prepend = " -L${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/lib -Wl,-rpath-link,${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/lib "
+
+TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_HOST}"
+
+DISTRO_FEATURES_LIBC = "ipv4 ipv6 libc-backtrace libc-big-macros libc-bsd libc-cxx-tests libc-catgets libc-crypt \
+ libc-crypt-ufc libc-db-aliases libc-envz libc-fcvt libc-fmtmsg libc-fstab libc-ftraverse \
+ libc-getlogin libc-idn libc-inet-anl libc-libm libc-libm-big \
+ libc-memusage libc-nis libc-nsswitch libc-rcmd libc-rtld-debug libc-spawn libc-streams libc-sunrpc \
+ libc-utmp libc-utmpx libc-wordexp libc-posix-clang-wchar libc-posix-regexp libc-posix-regexp-glibc \
+ libc-posix-wchar-io"
+
+ENABLE_BINARY_LOCALE_GENERATION = "0"
+GLIBC_INTERNAL_USE_BINARY_LOCALE = "precompiled"
+
+def populate_toolchain_links(d):
+ import errno
+ import os
+ from glob import glob
+
+ d = d.createCopy()
+ d.finalize()
+
+ pattern = bb.data.expand('${EXTERNAL_TOOLCHAIN}/bin/${TARGET_PREFIX}*', d)
+ files = glob(pattern)
+ if not files:
+ bb.fatal("Unable to populate toolchain binary symlinks")
+
+ bindir = d.getVar('STAGING_BINDIR_TOOLCHAIN', True)
+ bb.mkdirhier(bindir)
+ for f in files:
+ base = os.path.basename(f)
+ newpath = os.path.join(bindir, base)
+ try:
+ os.symlink(f, newpath)
+ except OSError as exc:
+ if exc.errno == errno.EEXIST:
+ break
+ bb.fatal("Unable to populate toolchain binary symlink for %s: %s" % (newpath, exc))
+
+require conf/distro/include/external-linaro-toolchain-versions.inc