summaryrefslogtreecommitdiffstats
path: root/meta/classes/icecc.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/icecc.bbclass')
-rw-r--r--meta/classes/icecc.bbclass62
1 files changed, 25 insertions, 37 deletions
diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass
index 2171e11db0..49597175ca 100644
--- a/meta/classes/icecc.bbclass
+++ b/meta/classes/icecc.bbclass
@@ -38,6 +38,8 @@ BB_HASHBASE_WHITELIST += "ICECC_PARALLEL_MAKE ICECC_DISABLED ICECC_USER_PACKAGE_
38 38
39ICECC_ENV_EXEC ?= "${STAGING_BINDIR_NATIVE}/icecc-create-env" 39ICECC_ENV_EXEC ?= "${STAGING_BINDIR_NATIVE}/icecc-create-env"
40 40
41HOSTTOOLS_NONFATAL += "icecc"
42
41# This version can be incremented when changes are made to the environment that 43# This version can be incremented when changes are made to the environment that
42# invalidate the version on the compile nodes. Changing it will cause a new 44# invalidate the version on the compile nodes. Changing it will cause a new
43# environment to be created. 45# environment to be created.
@@ -98,9 +100,11 @@ DEPENDS_prepend += "${@icecc_dep_prepend(d)} "
98 100
99get_cross_kernel_cc[vardepsexclude] += "KERNEL_CC" 101get_cross_kernel_cc[vardepsexclude] += "KERNEL_CC"
100def get_cross_kernel_cc(bb,d): 102def get_cross_kernel_cc(bb,d):
101 kernel_cc = d.getVar('KERNEL_CC') 103 if not icecc_is_kernel(bb, d):
104 return None
102 105
103 # evaluate the expression by the shell if necessary 106 # evaluate the expression by the shell if necessary
107 kernel_cc = d.getVar('KERNEL_CC')
104 if '`' in kernel_cc or '$(' in kernel_cc: 108 if '`' in kernel_cc or '$(' in kernel_cc:
105 import subprocess 109 import subprocess
106 kernel_cc = subprocess.check_output("echo %s" % kernel_cc, shell=True).decode("utf-8")[:-1] 110 kernel_cc = subprocess.check_output("echo %s" % kernel_cc, shell=True).decode("utf-8")[:-1]
@@ -113,38 +117,6 @@ def get_cross_kernel_cc(bb,d):
113def get_icecc(d): 117def get_icecc(d):
114 return d.getVar('ICECC_PATH') or bb.utils.which(os.getenv("PATH"), "icecc") 118 return d.getVar('ICECC_PATH') or bb.utils.which(os.getenv("PATH"), "icecc")
115 119
116def create_path(compilers, bb, d):
117 """
118 Create Symlinks for the icecc in the staging directory
119 """
120 staging = os.path.join(d.expand('${STAGING_BINDIR}'), "ice")
121 if icecc_is_kernel(bb, d):
122 staging += "-kernel"
123
124 #check if the icecc path is set by the user
125 icecc = get_icecc(d)
126
127 # Create the dir if necessary
128 try:
129 os.stat(staging)
130 except:
131 try:
132 os.makedirs(staging)
133 except:
134 pass
135
136 for compiler in compilers:
137 gcc_path = os.path.join(staging, compiler)
138 try:
139 os.stat(gcc_path)
140 except:
141 try:
142 os.symlink(icecc, gcc_path)
143 except:
144 pass
145
146 return staging
147
148def use_icecc(bb,d): 120def use_icecc(bb,d):
149 if d.getVar('ICECC_DISABLED') == "1": 121 if d.getVar('ICECC_DISABLED') == "1":
150 # don't even try it, when explicitly disabled 122 # don't even try it, when explicitly disabled
@@ -248,12 +220,11 @@ def icecc_path(bb,d):
248 # don't create unnecessary directories when icecc is disabled 220 # don't create unnecessary directories when icecc is disabled
249 return 221 return
250 222
223 staging = os.path.join(d.expand('${STAGING_BINDIR}'), "ice")
251 if icecc_is_kernel(bb, d): 224 if icecc_is_kernel(bb, d):
252 return create_path( [get_cross_kernel_cc(bb,d), ], bb, d) 225 staging += "-kernel"
253 226
254 else: 227 return staging
255 prefix = d.expand('${HOST_PREFIX}')
256 return create_path( [prefix+"gcc", prefix+"g++"], bb, d)
257 228
258def icecc_get_external_tool(bb, d, tool): 229def icecc_get_external_tool(bb, d, tool):
259 external_toolchain_bindir = d.expand('${EXTERNAL_TOOLCHAIN}${bindir_cross}') 230 external_toolchain_bindir = d.expand('${EXTERNAL_TOOLCHAIN}${bindir_cross}')
@@ -350,6 +321,23 @@ set_icecc_env() {
350 return 321 return
351 fi 322 fi
352 323
324 ICECC_BIN="${@get_icecc(d)}"
325 if [ -z "${ICECC_BIN}" ]; then
326 bbwarn "Cannot use icecc: icecc binary not found"
327 return
328 fi
329
330 # Create symlinks to icecc in the recipe-sysroot directory
331 mkdir -p ${ICE_PATH}
332 if [ -n "${KERNEL_CC}" ]; then
333 compilers="${@get_cross_kernel_cc(bb,d)}"
334 else
335 compilers="${HOST_PREFIX}gcc ${HOST_PREFIX}g++"
336 fi
337 for compiler in $compilers; do
338 ln -sf ${ICECC_BIN} ${ICE_PATH}/$compiler
339 done
340
353 ICECC_CC="${@icecc_get_and_check_tool(bb, d, "gcc")}" 341 ICECC_CC="${@icecc_get_and_check_tool(bb, d, "gcc")}"
354 ICECC_CXX="${@icecc_get_and_check_tool(bb, d, "g++")}" 342 ICECC_CXX="${@icecc_get_and_check_tool(bb, d, "g++")}"
355 # cannot use icecc_get_and_check_tool here because it assumes as without target_sys prefix 343 # cannot use icecc_get_and_check_tool here because it assumes as without target_sys prefix