summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorHeinrich Fink <hfink@toolsonair.com>2015-10-30 11:22:29 +0100
committerSebastian Dröge <sebastian@centricular.com>2015-10-30 17:32:06 +0200
commitc5020a56a003891922c0c70d467981768b0fcd16 (patch)
treef165ce4bed4e9669e4a7fca49d79e1995e32c3de /config
parent54266064743fcc4ea785eae59c9bb8e4aa2400e2 (diff)
Use xcodebuild to get 'latest' SDK path on OSX
By default, we are now always using the 'latest' SDK, as returned by the xcodebuild command line tool, i.e. no hard-coded SDK paths are used by cerbero anymore. It is still possible to ask for a specific SDK version, by setting 'osx_target_sdk_version' in config (e.g. setting it to '10.10' to force compilation against the 10.10 SDK). Requesting an SDK version via osx_target_sdk_version that doesn't exist on the system will error out. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=757357
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)