summaryrefslogtreecommitdiff
path: root/morphlib/buildenvironment.py
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2013-02-25 11:45:30 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2013-03-13 15:20:02 +0000
commit92d98f57eaa6e0871b70d0d0ab1db879cf3ea47a (patch)
treee8d6629110f8c079c2d94b6f1e3fe8e239b9fd43 /morphlib/buildenvironment.py
parentece7f823de6bd61a0676edf71a9525697848824e (diff)
downloadmorph-92d98f57eaa6e0871b70d0d0ab1db879cf3ea47a.tar.gz
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.
Diffstat (limited to 'morphlib/buildenvironment.py')
-rw-r--r--morphlib/buildenvironment.py22
1 files changed, 19 insertions, 3 deletions
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)