summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2020-03-10 13:30:02 -0700
committerDan Albert <danalbert@google.com>2020-03-10 13:30:02 -0700
commit349907d5fd3e525e6805d7f0c542b80e7cdeb0e2 (patch)
tree0f9d4e2f3c0ece14720cb9c4f09880216c060755
parent34892c10939ea42a3cff8d712003669822805908 (diff)
downloadbinutils-349907d5fd3e525e6805d7f0c542b80e7cdeb0e2.tar.gz
Configure macOS targets depending on OS.
I've added separate builds for our 10.8 and 10.10 machines while we work out our 10.10 build issues. Unfortunately the 10.10 machines can't build for 10.8 and the 10.8 machines can't build for 10.9, so we need to handle them differently. Test: None Bug: None Change-Id: I6df3d8a663ccb214e3b829cd158e1d10ddb6a037
-rwxr-xr-xdo_build.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/do_build.py b/do_build.py
index d4780af3..b6dbb744 100755
--- a/do_build.py
+++ b/do_build.py
@@ -71,6 +71,24 @@ def check_call(cmd, *args, **kwargs):
subprocess.check_call(cmd, *args, **kwargs)
+def check_output(cmd, *args, **kwargs):
+ """subprocess.check_call with logging."""
+ logger().info('check_output %s', subprocess.list2cmdline(cmd))
+ return subprocess.check_output(cmd, *args, **kwargs)
+
+
+def get_osx_deployment_target():
+ """Determines which macOS deployment target should be used."""
+ major, minor, _ = check_output(['sw_vers', '-productVersion']).split('.')
+ assert major == '10'
+ if minor == '8':
+ return '10.8'
+ elif minor == '10':
+ return '10.9'
+ else:
+ raise RuntimeError(f'Unconfigured macOS version: {major}.{minor}')
+
+
def configure(arch, host: Host, install_dir, src_dir):
"""Configures binutils."""
configure_host = {
@@ -106,7 +124,7 @@ def configure(arch, host: Host, install_dir, src_dir):
toolchain = ndk.paths.android_path(
'prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1')
toolchain_prefix = 'i686-apple-darwin10'
- env['MACOSX_DEPLOYMENT_TARGET'] = '10.8'
+ env['MACOSX_DEPLOYMENT_TARGET'] = get_osx_deployment_target()
elif host == Host.Linux:
toolchain = ndk.paths.android_path(
'prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8')