summaryrefslogtreecommitdiffstats
path: root/waftools/detections/compiler_swift.py
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2019-05-07 23:30:45 +0200
committerJan Ekström <jeebjp@gmail.com>2019-07-21 18:13:07 +0300
commit916f4146a7f0b0ad7f6c30fff9e8cba06980745e (patch)
tree8c36b5ab1d7e5f9e6f48c57fb02fa90f53775aeb /waftools/detections/compiler_swift.py
parentc540ac8485d132285071aa43a493c3829f4f0d5c (diff)
downloadmpv-916f4146a7f0b0ad7f6c30fff9e8cba06980745e.tar.bz2
mpv-916f4146a7f0b0ad7f6c30fff9e8cba06980745e.tar.xz
build: make macOS SDK path and version configurable via env vars
Diffstat (limited to 'waftools/detections/compiler_swift.py')
-rw-r--r--waftools/detections/compiler_swift.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/waftools/detections/compiler_swift.py b/waftools/detections/compiler_swift.py
index d867a440d4..98d2522c86 100644
--- a/waftools/detections/compiler_swift.py
+++ b/waftools/detections/compiler_swift.py
@@ -116,14 +116,26 @@ def __find_swift_library(ctx):
def __find_macos_sdk(ctx):
ctx.start_msg('Checking for macOS SDK')
- sdk = __run(['xcrun', '--sdk', 'macosx', '--show-sdk-path'])
- sdk_build_version = __run(['xcrun', '--sdk', 'macosx', '--show-sdk-build-version' ])
+ sdk = None
+ sdk_build_version = None
+
+ #look for set macOS SDK paths and version in passed environment variables
+ if 'MACOS_SDK' in ctx.environ:
+ sdk = ctx.environ['MACOS_SDK']
+ if 'MACOS_SDK_VERSION' in ctx.environ:
+ ctx.env.MACOS_SDK_VERSION = ctx.environ['MACOS_SDK_VERSION']
+
+ #find macOS SDK paths and version
+ if not sdk:
+ sdk = __run(['xcrun', '--sdk', 'macosx', '--show-sdk-path'])
+ if not ctx.env.MACOS_SDK_VERSION:
+ sdk_build_version = __run(['xcrun', '--sdk', 'macosx', '--show-sdk-build-version' ])
if sdk:
ctx.end_msg(sdk)
ctx.env.MACOS_SDK = sdk
- if sdk_build_version:
+ if sdk_build_version and not ctx.env.MACOS_SDK_VERSION:
verRe = re.compile("(\d+)(\D+)(\d+)")
version_parts = verRe.search(sdk_build_version)
major = int(version_parts.group(1))-4