spacepaste

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
From db7b141e33d5774a5e505321d305ec1fe5063af7 Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa@gmail.com>
Date: Wed, 4 Dec 2013 23:09:59 +0100
Subject: [PATCH] icecc.bbclass: Fix allarch and native recipes having
 different signatures

* for different MACHINES
* is there more elegant way to have "overridable" function so that
  signature handler properly uses only the branch without
  STAGING_BINDIR_TOOLCHAIN?

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta/classes/allarch.bbclass |  3 +++
 meta/classes/icecc.bbclass   | 27 ++++++++++++++++++++-------
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/meta/classes/allarch.bbclass b/meta/classes/allarch.bbclass
index 4a65f77..5064b2f 100644
--- a/meta/classes/allarch.bbclass
+++ b/meta/classes/allarch.bbclass
@@ -23,6 +23,9 @@ python () {
         d.setVar("TARGET_CC_ARCH", "none")
         d.setVar("TARGET_LD_ARCH", "none")
         d.setVar("TARGET_AS_ARCH", "none")
+        # icecc.bbclass is using TARGET_FPU to construct icecc archive name, but because icecc is disabled for allarch
+        # recipes it was polluting allarch signatures without good reason
+        d.setVar("TARGET_FPU", "")
         d.setVar("PACKAGE_EXTRA_ARCHS", "")
         d.setVar("TARGET_PREFIX", "")
 
diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass
index 054e25c..7affe25 100644
--- a/meta/classes/icecc.bbclass
+++ b/meta/classes/icecc.bbclass
@@ -183,9 +183,7 @@ def icc_get_external_tool(bb, d, tool):
     return os.path.join(external_toolchain_bindir, '%s%s' % (target_prefix, tool))
 
 def icc_get_tool(bb, d, tool):
-    if icc_is_native(bb, d):
-        return bb.utils.which(os.getenv("PATH"), tool)
-    elif icc_is_kernel(bb, d):
+    if icc_is_kernel(bb, d):
         return bb.utils.which(os.getenv("PATH"), get_cross_kernel_cc(bb, d))
     else:
         ice_dir = d.expand('${STAGING_BINDIR_TOOLCHAIN}')
@@ -200,17 +198,24 @@ def icc_get_tool(bb, d, tool):
             else:
                 return ""
 
-def icc_get_and_check_tool(bb, d, tool):
+def check_tool(t):
     # Check that g++ or gcc is not a symbolic link to icecc binary in
     # PATH or icecc-create-env script will silently create an invalid
     # compiler environment package.
-    t = icc_get_tool(bb, d, tool)
     if t and os.popen("readlink -f %s" % t).read()[:-1] == get_icecc(d):
         bb.error("%s is a symlink to %s in PATH and this prevents icecc from working" % (t, get_icecc(d)))
         return ""
     else:
         return t
 
+def icc_get_and_check_tool(bb, d, tool):
+    t = icc_get_tool(bb, d, tool)
+    return check_tool(t)
+
+def icc_get_and_check_tool_native(bb, d, tool):
+    t = bb.utils.which(os.getenv("PATH"), tool)
+    return check_tool(t)
+
 wait_for_file() {
     local TIME_ELAPSED=0
     local FILE_TO_TEST=$1
@@ -230,6 +235,15 @@ def set_icecc_env():
     # dummy python version of set_icecc_env
     return
 
+get_tools() {
+    ICECC_CC="${@icc_get_and_check_tool(bb, d, "gcc")}"
+    ICECC_CXX="${@icc_get_and_check_tool(bb, d, "g++")}"
+}
+get_tools_class-native() {
+    ICECC_CC="${@icc_get_and_check_tool_native(bb, d, "gcc")}"
+    ICECC_CXX="${@icc_get_and_check_tool_native(bb, d, "g++")}"
+}
+
 set_icecc_env() {
     if [ "x${ICECC_DISABLED}" != "x" ]
     then
@@ -249,8 +263,7 @@ set_icecc_env() {
         return
     fi
 
-    ICECC_CC="${@icc_get_and_check_tool(bb, d, "gcc")}"
-    ICECC_CXX="${@icc_get_and_check_tool(bb, d, "g++")}"
+    . get_tools
     # cannot use icc_get_and_check_tool here because it assumes as without target_sys prefix
     ICECC_WHICH_AS="${@bb.utils.which(os.getenv('PATH'), 'as')}"
     if [ ! -x "${ICECC_CC}" -o ! -x "${ICECC_CXX}" ]
-- 
1.8.4.3