toolchain.py (f210b58734b750fcab3d4fef6477a6eaf39b5d51) toolchain.py (bb1501f2c22c979961b735db775605cccedd98f6)
1# Copyright (c) 2012 The Chromium OS Authors.
2#
3# SPDX-License-Identifier: GPL-2.0+
4#
5
6import re
7import glob
8import os

--- 27 unchanged lines hidden (view full) ---

36 basename = os.path.basename(fname)
37 pos = basename.rfind('-')
38 self.cross = basename[:pos + 1] if pos != -1 else ''
39
40 # The architecture is the first part of the name
41 pos = self.cross.find('-')
42 self.arch = self.cross[:pos] if pos != -1 else 'sandbox'
43
1# Copyright (c) 2012 The Chromium OS Authors.
2#
3# SPDX-License-Identifier: GPL-2.0+
4#
5
6import re
7import glob
8import os

--- 27 unchanged lines hidden (view full) ---

36 basename = os.path.basename(fname)
37 pos = basename.rfind('-')
38 self.cross = basename[:pos + 1] if pos != -1 else ''
39
40 # The architecture is the first part of the name
41 pos = self.cross.find('-')
42 self.arch = self.cross[:pos] if pos != -1 else 'sandbox'
43
44 env = self.MakeEnvironment()
44 env = self.MakeEnvironment(False)
45
46 # As a basic sanity check, run the C compiler with --version
47 cmd = [fname, '--version']
48 if test:
49 result = command.RunPipe([cmd], capture=True, env=env,
50 raise_on_error=False)
51 self.ok = result.return_code == 0
52 if verbose:

--- 23 unchanged lines hidden (view full) ---

76 priority_list = ['-elf', '-unknown-linux-gnu', '-linux',
77 '-none-linux-gnueabi', '-uclinux', '-none-eabi',
78 '-gentoo-linux-gnu', '-linux-gnueabi', '-le-linux', '-uclinux']
79 for prio in range(len(priority_list)):
80 if priority_list[prio] in fname:
81 return prio
82 return prio
83
45
46 # As a basic sanity check, run the C compiler with --version
47 cmd = [fname, '--version']
48 if test:
49 result = command.RunPipe([cmd], capture=True, env=env,
50 raise_on_error=False)
51 self.ok = result.return_code == 0
52 if verbose:

--- 23 unchanged lines hidden (view full) ---

76 priority_list = ['-elf', '-unknown-linux-gnu', '-linux',
77 '-none-linux-gnueabi', '-uclinux', '-none-eabi',
78 '-gentoo-linux-gnu', '-linux-gnueabi', '-le-linux', '-uclinux']
79 for prio in range(len(priority_list)):
80 if priority_list[prio] in fname:
81 return prio
82 return prio
83
84 def MakeEnvironment(self):
84 def MakeEnvironment(self, full_path):
85 """Returns an environment for using the toolchain.
86
85 """Returns an environment for using the toolchain.
86
87 Thie takes the current environment, adds CROSS_COMPILE and
88 augments PATH so that the toolchain will operate correctly.
87 Thie takes the current environment and adds CROSS_COMPILE so that
88 the tool chain will operate correctly.
89
90 Args:
91 full_path: Return the full path in CROSS_COMPILE and don't set
92 PATH
89 """
90 env = dict(os.environ)
93 """
94 env = dict(os.environ)
91 env['CROSS_COMPILE'] = self.cross
92 env['PATH'] = self.path + ':' + env['PATH']
95 if full_path:
96 env['CROSS_COMPILE'] = os.path.join(self.path, self.cross)
97 else:
98 env['CROSS_COMPILE'] = self.cross
99 env['PATH'] = self.path + ':' + env['PATH']
100
93 return env
94
95
96class Toolchains:
97 """Manage a list of toolchains for building U-Boot
98
99 We select one toolchain for each architecture type
100

--- 156 unchanged lines hidden ---
101 return env
102
103
104class Toolchains:
105 """Manage a list of toolchains for building U-Boot
106
107 We select one toolchain for each architecture type
108

--- 156 unchanged lines hidden ---