1 # IceCream distributed compiling support
3 # We need to create a tar.bz2 of our toolchain and set
4 # ICECC_VERSION, ICECC_CXX and ICEC_CC
9 Create a tar.bz of the current toolchain
12 # Constin native-native compilation no environment needed if
13 # host prefix is empty (let us duplicate the query for ease)
14 prefix = bb.data.expand('${HOST_PREFIX}', d)
22 ice_dir = bb.data.expand('${CROSS_DIR}', d)
23 prefix = bb.data.expand('${HOST_PREFIX}' , d)
24 distro = bb.data.expand('${DISTRO}', d)
25 target_sys = bb.data.expand('${TARGET_SYS}', d)
26 #float = bb.data.getVar('${TARGET_FPU}', d)
28 name = socket.gethostname()
31 os.stat(ice_dir + '/' + target_sys + '/lib/ld-linux.so.2')
32 os.stat(ice_dir + '/' + target_sys + '/bin/g++')
37 cross_name = prefix + distro + target_sys + float +VERSION+ name
38 tar_file = ice_dir + '/ice/' + cross_name + '.tar.bz2'
45 os.makedirs(ice_dir+'/ice')
49 # FIXME find out the version of the compiler
50 tar = tarfile.open(tar_file, 'w:bz2')
51 tar.add(ice_dir + '/' + target_sys + '/lib/ld-linux.so.2',
52 target_sys + 'cross/lib/ld-linux.so.2')
53 tar.add(ice_dir + '/' + target_sys + '/lib/ld-linux.so.2',
54 target_sys + 'cross/lib/ld-2.3.3.so')
55 tar.add(ice_dir + '/' + target_sys + '/lib/libc-2.3.3.so',
56 target_sys + 'cross/lib/libc-2.3.3.so')
57 tar.add(ice_dir + '/' + target_sys + '/lib/libc.so.6',
58 target_sys + 'cross/lib/libc.so.6')
59 tar.add(ice_dir + '/' + target_sys + '/bin/gcc',
60 target_sys + 'cross/usr/bin/gcc')
61 tar.add(ice_dir + '/' + target_sys + '/bin/g++',
62 target_sys + 'cross/usr/bin/g++')
63 tar.add(ice_dir + '/' + target_sys + '/bin/as',
64 target_sys + 'cross/usr/bin/as')
65 tar.add(ice_dir + '/lib/gcc/' + target_sys +'/'+ VERSION + '/specs',
66 target_sys+'cross/usr/lib/gcc/'+target_sys+'/'+VERSION+'/lib/specs')
67 tar.add(ice_dir + '/libexec/gcc/'+target_sys+'/' + VERSION + '/cc1',
68 target_sys + 'cross/usr/lib/gcc/'+target_sys+'/'+VERSION+'/lib/cc1')
69 tar.add(ice_dir + '/libexec/gcc/arm-linux/' + VERSION + '/cc1plus',
70 target_sys+'cross/usr/lib/gcc/'+target_sys+'/'+VERSION+'/lib/cc1plus')
75 def create_path(compilers, type, bb, d):
77 Create Symlinks for the icecc in the staging directory
81 staging = bb.data.expand('${STAGING_DIR}', d) + "/ice/" + type
82 icecc = bb.data.getVar('ICECC_PATH', d)
84 # Create the dir if necessary
91 for compiler in compilers:
92 gcc_path = staging + "/" + compiler
96 os.symlink(icecc, gcc_path)
101 def use_icc_version(bb,d):
102 # Constin native native
103 prefix = bb.data.expand('${HOST_PREFIX}', d)
108 native = bb.data.expand('${PN}', d)
109 blacklist = [ "-cross", "-native" ]
111 for black in blacklist:
117 def icc_path(bb,d,compile):
118 native = bb.data.expand('${PN}', d)
119 blacklist = [ "ulibc", "glibc", "ncurses" ]
120 for black in blacklist:
124 if "-native" in native:
126 if "-cross" in native:
129 prefix = bb.data.expand('${HOST_PREFIX}', d)
130 if compile and len(prefix) != 0:
131 return create_path( [prefix+"gcc", prefix+"g++"], "cross", bb, d )
132 elif not compile or len(prefix) == 0:
133 return create_path( ["gcc", "g++"], "native", bb, d)
136 def icc_version(bb,d):
137 return create_env(bb,d)
141 # set the IceCream environment variables
142 do_configure_prepend() {
143 export PATH=${@icc_path(bb,d,False)}$PATH
144 export ICECC_CC="gcc"
145 export ICECC_CXX="g++"
148 do_compile_prepend() {
149 export PATH=${@icc_path(bb,d,True)}$PATH
150 export ICECC_CC="${HOST_PREFIX}gcc"
151 export ICECC_CXX="${HOST_PREFIX}g++"
153 if [ "${@use_icc_version(bb,d)}" = "yes" ]; then
154 export ICECC_VERSION="${@icc_version(bb,d)}"