diff options
author | Richard Purdie <richard@openedhand.com> | 2006-08-27 16:01:33 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2006-08-27 16:01:33 +0000 |
commit | 93a8d0662ed361c76defe75a5cd84f203fdb1af1 (patch) | |
tree | 3481256915c4474980290e53c086af8f8389a10e /meta/classes/icecc.bbclass | |
parent | 37d03b1b00610716b27259a42c8718c8628b2ad3 (diff) | |
download | poky-93a8d0662ed361c76defe75a5cd84f203fdb1af1.tar.gz |
classes: Sync with OE
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@651 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/classes/icecc.bbclass')
-rw-r--r-- | meta/classes/icecc.bbclass | 120 |
1 files changed, 71 insertions, 49 deletions
diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass index 7dfcfc29a4..66a5bf79e3 100644 --- a/meta/classes/icecc.bbclass +++ b/meta/classes/icecc.bbclass | |||
@@ -1,9 +1,17 @@ | |||
1 | # IceCream distributed compiling support | 1 | # IceCream distributed compiling support |
2 | # | 2 | # |
3 | # We need to create a tar.bz2 of our toolchain and set | 3 | # We need to create a tar.bz2 of our toolchain and set |
4 | # ICECC_VERSION, ICECC_CXX and ICEC_CC | 4 | # ICECC_VERSION, ICECC_CXX and ICEC_CC |
5 | # | 5 | # |
6 | 6 | ||
7 | def icc_determine_gcc_version(gcc): | ||
8 | """ | ||
9 | Hack to determine the version of GCC | ||
10 | |||
11 | 'i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5363)' | ||
12 | """ | ||
13 | return os.popen("%s --version" % gcc ).readline()[2] | ||
14 | |||
7 | def create_env(bb,d): | 15 | def create_env(bb,d): |
8 | """ | 16 | """ |
9 | Create a tar.bz of the current toolchain | 17 | Create a tar.bz of the current toolchain |
@@ -13,7 +21,7 @@ def create_env(bb,d): | |||
13 | # host prefix is empty (let us duplicate the query for ease) | 21 | # host prefix is empty (let us duplicate the query for ease) |
14 | prefix = bb.data.expand('${HOST_PREFIX}', d) | 22 | prefix = bb.data.expand('${HOST_PREFIX}', d) |
15 | if len(prefix) == 0: | 23 | if len(prefix) == 0: |
16 | return "" | 24 | return "" |
17 | 25 | ||
18 | import tarfile | 26 | import tarfile |
19 | import socket | 27 | import socket |
@@ -23,51 +31,66 @@ def create_env(bb,d): | |||
23 | prefix = bb.data.expand('${HOST_PREFIX}' , d) | 31 | prefix = bb.data.expand('${HOST_PREFIX}' , d) |
24 | distro = bb.data.expand('${DISTRO}', d) | 32 | distro = bb.data.expand('${DISTRO}', d) |
25 | target_sys = bb.data.expand('${TARGET_SYS}', d) | 33 | target_sys = bb.data.expand('${TARGET_SYS}', d) |
26 | #float = bb.data.getVar('${TARGET_FPU}', d) | 34 | float = bb.data.getVar('${TARGET_FPU}', d) or "hard" |
27 | float = "anyfloat" | ||
28 | name = socket.gethostname() | 35 | name = socket.gethostname() |
29 | 36 | ||
37 | # Stupid check to determine if we have built a libc and a cross | ||
38 | # compiler. | ||
30 | try: | 39 | try: |
31 | os.stat(ice_dir + '/' + target_sys + '/lib/ld-linux.so.2') | 40 | os.stat(os.path.join(ice_dir, target_sys, 'lib', 'ld-linux.so.2')) |
32 | os.stat(ice_dir + '/' + target_sys + '/bin/g++') | 41 | os.stat(os.path.join(ice_dir, target_sys, 'bin', 'g++')) |
33 | except: | 42 | except: |
34 | return "" | 43 | return "" |
35 | 44 | ||
36 | VERSION = '3.4.3' | 45 | VERSION = icc_determine_gcc_version( os.path.join(ice_dir,target_sys,"bin","g++") ) |
37 | cross_name = prefix + distro + target_sys + float +VERSION+ name | 46 | cross_name = prefix + distro + target_sys + float +VERSION+ name |
38 | tar_file = ice_dir + '/ice/' + cross_name + '.tar.bz2' | 47 | tar_file = os.path.join(ice_dir, 'ice', cross_name + '.tar.bz2') |
39 | 48 | ||
40 | try: | 49 | try: |
41 | os.stat(tar_file) | 50 | os.stat(tar_file) |
42 | return tar_file | 51 | return tar_file |
43 | except: | 52 | except: |
44 | try: | 53 | try: |
45 | os.makedirs(ice_dir+'/ice') | 54 | os.makedirs(os.path.join(ice_dir,'ice')) |
46 | except: | 55 | except: |
47 | pass | 56 | pass |
48 | 57 | ||
49 | # FIXME find out the version of the compiler | 58 | # FIXME find out the version of the compiler |
59 | # Consider using -print-prog-name={cc1,cc1plus} | ||
60 | # and -print-file-name=specs | ||
61 | |||
62 | # We will use the GCC to tell us which tools to use | ||
63 | # What we need is: | ||
64 | # -gcc | ||
65 | # -g++ | ||
66 | # -as | ||
67 | # -cc1 | ||
68 | # -cc1plus | ||
69 | # and we add them to /usr/bin | ||
70 | |||
50 | tar = tarfile.open(tar_file, 'w:bz2') | 71 | tar = tarfile.open(tar_file, 'w:bz2') |
51 | tar.add(ice_dir + '/' + target_sys + '/lib/ld-linux.so.2', | 72 | |
52 | target_sys + 'cross/lib/ld-linux.so.2') | 73 | # Now add the required files |
53 | tar.add(ice_dir + '/' + target_sys + '/lib/ld-linux.so.2', | 74 | tar.add(os.path.join(ice_dir,target_sys,'bin','gcc'), |
54 | target_sys + 'cross/lib/ld-2.3.3.so') | 75 | os.path.join("usr","bin","gcc") ) |
55 | tar.add(ice_dir + '/' + target_sys + '/lib/libc-2.3.3.so', | 76 | tar.add(os.path.join(ice_dir,target_sys,'bin','g++'), |
56 | target_sys + 'cross/lib/libc-2.3.3.so') | 77 | os.path.join("usr","bin","g++") ) |
57 | tar.add(ice_dir + '/' + target_sys + '/lib/libc.so.6', | 78 | tar.add(os.path.join(ice_dir,target_sys,'bin','as'), |
58 | target_sys + 'cross/lib/libc.so.6') | 79 | os.path.join("usr","bin","as") ) |
59 | tar.add(ice_dir + '/' + target_sys + '/bin/gcc', | 80 | |
60 | target_sys + 'cross/usr/bin/gcc') | 81 | # Now let us find cc1 and cc1plus |
61 | tar.add(ice_dir + '/' + target_sys + '/bin/g++', | 82 | cc1 = os.popen("%s -print-prog-name=cc1" % data.getVar('CC', d, True)).read()[:-1] |
62 | target_sys + 'cross/usr/bin/g++') | 83 | cc1plus = os.popen("%s -print-prog-name=cc1plus" % data.getVar('CC', d, True)).read()[:-1] |
63 | tar.add(ice_dir + '/' + target_sys + '/bin/as', | 84 | spec = os.popen("%s -print-file-name=specs" % data.getVar('CC', d, True)).read()[:-1] |
64 | target_sys + 'cross/usr/bin/as') | 85 | |
65 | tar.add(ice_dir + '/lib/gcc/' + target_sys +'/'+ VERSION + '/specs', | 86 | # CC1 and CC1PLUS should be there... |
66 | target_sys+'cross/usr/lib/gcc/'+target_sys+'/'+VERSION+'/lib/specs') | 87 | tar.add(cc1, os.path.join('usr', 'bin', 'cc1')) |
67 | tar.add(ice_dir + '/libexec/gcc/'+target_sys+'/' + VERSION + '/cc1', | 88 | tar.add(cc1plus, os.path.join('usr', 'bin', 'cc1plus')) |
68 | target_sys + 'cross/usr/lib/gcc/'+target_sys+'/'+VERSION+'/lib/cc1') | 89 | |
69 | tar.add(ice_dir + '/libexec/gcc/arm-linux/' + VERSION + '/cc1plus', | 90 | # spec - if it exists |
70 | target_sys+'cross/usr/lib/gcc/'+target_sys+'/'+VERSION+'/lib/cc1plus') | 91 | if os.path.exists(spec): |
92 | tar.add(spec) | ||
93 | |||
71 | tar.close() | 94 | tar.close() |
72 | return tar_file | 95 | return tar_file |
73 | 96 | ||
@@ -78,7 +101,7 @@ def create_path(compilers, type, bb, d): | |||
78 | """ | 101 | """ |
79 | import os | 102 | import os |
80 | 103 | ||
81 | staging = bb.data.expand('${STAGING_DIR}', d) + "/ice/" + type | 104 | staging = os.path.join(bb.data.expand('${STAGING_DIR}', d), "ice", type) |
82 | icecc = bb.data.getVar('ICECC_PATH', d) | 105 | icecc = bb.data.getVar('ICECC_PATH', d) |
83 | 106 | ||
84 | # Create the dir if necessary | 107 | # Create the dir if necessary |
@@ -89,7 +112,7 @@ def create_path(compilers, type, bb, d): | |||
89 | 112 | ||
90 | 113 | ||
91 | for compiler in compilers: | 114 | for compiler in compilers: |
92 | gcc_path = staging + "/" + compiler | 115 | gcc_path = os.path.join(staging, compiler) |
93 | try: | 116 | try: |
94 | os.stat(gcc_path) | 117 | os.stat(gcc_path) |
95 | except: | 118 | except: |
@@ -102,15 +125,14 @@ def use_icc_version(bb,d): | |||
102 | # Constin native native | 125 | # Constin native native |
103 | prefix = bb.data.expand('${HOST_PREFIX}', d) | 126 | prefix = bb.data.expand('${HOST_PREFIX}', d) |
104 | if len(prefix) == 0: | 127 | if len(prefix) == 0: |
105 | return "no" | 128 | return "no" |
106 | 129 | ||
107 | 130 | ||
108 | native = bb.data.expand('${PN}', d) | 131 | blacklist = [ "cross", "native" ] |
109 | blacklist = [ "-cross", "-native" ] | ||
110 | 132 | ||
111 | for black in blacklist: | 133 | for black in blacklist: |
112 | if black in native: | 134 | if bb.data.inherits_class(black, d): |
113 | return "no" | 135 | return "no" |
114 | 136 | ||
115 | return "yes" | 137 | return "yes" |
116 | 138 | ||
@@ -118,13 +140,13 @@ def icc_path(bb,d,compile): | |||
118 | native = bb.data.expand('${PN}', d) | 140 | native = bb.data.expand('${PN}', d) |
119 | blacklist = [ "ulibc", "glibc", "ncurses" ] | 141 | blacklist = [ "ulibc", "glibc", "ncurses" ] |
120 | for black in blacklist: | 142 | for black in blacklist: |
121 | if black in native: | 143 | if black in native: |
122 | return "" | 144 | return "" |
123 | 145 | ||
124 | if "-native" in native: | 146 | blacklist = [ "cross", "native" ] |
125 | compile = False | 147 | for black in blacklist: |
126 | if "-cross" in native: | 148 | if bb.data.inherits_class(black, d): |
127 | compile = False | 149 | compile = False |
128 | 150 | ||
129 | prefix = bb.data.expand('${HOST_PREFIX}', d) | 151 | prefix = bb.data.expand('${HOST_PREFIX}', d) |
130 | if compile and len(prefix) != 0: | 152 | if compile and len(prefix) != 0: |
@@ -151,6 +173,6 @@ do_compile_prepend() { | |||
151 | export ICECC_CXX="${HOST_PREFIX}g++" | 173 | export ICECC_CXX="${HOST_PREFIX}g++" |
152 | 174 | ||
153 | if [ "${@use_icc_version(bb,d)}" = "yes" ]; then | 175 | if [ "${@use_icc_version(bb,d)}" = "yes" ]; then |
154 | export ICECC_VERSION="${@icc_version(bb,d)}" | 176 | export ICECC_VERSION="${@icc_version(bb,d)}" |
155 | fi | 177 | fi |
156 | } | 178 | } |