summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/darwin.config34
1 files changed, 19 insertions, 15 deletions
diff --git a/config/darwin.config b/config/darwin.config
index 9e8f6354..3ffb8a38 100644
--- a/config/darwin.config
+++ b/config/darwin.config
@@ -5,6 +5,8 @@
import os
from cerbero.config import Architecture, DistroVersion
+from cerbero.utils import shell
+from cerbero.errors import FatalError
# We don't want anything from macports detected in configure and
# used later. System libs are passed through the -isysroot option
@@ -20,21 +22,23 @@ elif target_arch == Architecture.X86:
elif target_arch == Architecture.UNIVERSAL:
build='universal-apple-darwin12'
-SDK_VERSION = {
- DistroVersion.OS_X_MOUNTAIN_LION: '10.8',
- DistroVersion.OS_X_MAVERICKS: '10.9',
- DistroVersion.OS_X_YOSEMITE: '10.10',
- DistroVersion.OS_X_EL_CAPITAN: '10.11',
-}
-
-# The SDK target can be overriden in configure with 'osx_target_sdk_version' for instance
-# to target the 10.6 SDK
-sdk_version = osx_target_sdk_version or SDK_VERSION[distro_version]
-
-# For Xcode >= 4.3, the SDK is installed in a completely different path
-sdk_root = '/Developer/SDKs/MacOSX%s.sdk' % sdk_version
-if not os.path.exists(sdk_root):
- sdk_root = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX%s.sdk' % sdk_version
+# By default we ask for the 'latest' SDK. This can be overriden by
+# configure using 'osx_target_sdk_version' (e.g. set to '10.10')
+sdk_requested_version = '' # Empty == latest
+if osx_target_sdk_version is not None:
+ sdk_requested_version = osx_target_sdk_version
+
+sdk_root = None
+ret = shell.check_call('xcodebuild -sdk macosx%s -version' % sdk_requested_version).split('\n')
+sdk_path_prefix = 'Path: '
+sdk_path_line = [x for x in ret if x.startswith(sdk_path_prefix)]
+if sdk_path_line:
+ sdk_root = str(sdk_path_line[0][len(sdk_path_prefix):])
+
+if sdk_root is None:
+ raise FatalError("Could not determine SDK path with requested version %s" % sdk_requested_version)
+elif not os.path.exists(sdk_root):
+ raise FatalError("Determined SDK path %s does not exist. Is your Xcode installatio broken?" % sdk_root);
min_osx_sdk_version = min_osx_sdk_version or '10.8'
sdk='-mmacosx-version-min=%s -isysroot %s' % (min_osx_sdk_version, sdk_root)