From 92d98f57eaa6e0871b70d0d0ab1db879cf3ea47a Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Mon, 25 Feb 2013 11:45:30 +0000 Subject: Set environment variables defining target for build-essential In the future we will allow this to be modified to provide a cross-bootstrap mode, but for now we use the same target as the host compiler. --- morphlib/buildenvironment.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'morphlib/buildenvironment.py') diff --git a/morphlib/buildenvironment.py b/morphlib/buildenvironment.py index fce98da4..29561220 100644 --- a/morphlib/buildenvironment.py +++ b/morphlib/buildenvironment.py @@ -13,6 +13,7 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +import cliapp import os import morphlib @@ -20,9 +21,11 @@ import morphlib class BuildEnvironment(): - def __init__(self, settings, arch=None): - self.extra_path = [] + def __init__(self, settings, target, arch=None): + '''Create a new BuildEnvironment object''' + self.extra_path = [] + self.target = target self.arch = morphlib.util.arch() if arch is None else arch self.env = self._clean_env(settings) @@ -34,6 +37,15 @@ class BuildEnvironment(): _override_term = 'dumb' _override_username = 'tomjon' + def get_bootstrap_target(self, target): + '''Set 'vendor' field of the given machine triplet as 'bootstrap' ''' + + parts = target.split('-') + if len(parts) < 2: + raise morphlib.Error('Failed to parse machine triplet returned by ' + 'host compiler: %s' % target) + return '-'.join([parts[0], 'bootstrap'] + parts[2:]) + def _clean_env(self, settings): '''Create a fresh set of environment variables for a clean build. @@ -69,7 +81,11 @@ class BuildEnvironment(): env['HOME'] = self._override_home env['PREFIX'] = settings['prefix'] - env['BOOTSTRAP'] = 'false' + env['BUILD'] = self.target + env['TARGET'] = self.target + env['TARGET_STAGE1'] = self.get_bootstrap_target(self.target) + env['TARGET_GCC_CONFIG'] = '' + if not settings['no-ccache']: self.extra_path.append(self._ccache_path) -- cgit v1.2.1