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/util.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'morphlib/util.py') diff --git a/morphlib/util.py b/morphlib/util.py index 16063f45..c3a7ac9f 100644 --- a/morphlib/util.py +++ b/morphlib/util.py @@ -42,6 +42,17 @@ def arch(): '''Return the CPU architecture of the current host.''' return os.uname()[4] + +def target(runcmd): # pragma: no cover + '''Returns the machine triplet of the current host''' + try: + target = runcmd(['cc', '-dumpmachine']).strip() + except cliapp.AppException as e: + raise morphlib.Error( + 'Failed to execute host compiler \'cc\': %s' % e) + return target + + def indent(string, spaces=4): '''Return ``string`` indented by ``spaces`` spaces. -- cgit v1.2.1