summaryrefslogtreecommitdiffstats
path: root/waftools
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2019-04-14 11:39:12 +0200
committerJan Ekström <jeebjp@gmail.com>2019-07-21 18:13:07 +0300
commit770fc5221528e18c17e7b3664ad300a96cdace3a (patch)
treedc4dfb573cd32a0e5f88602b3f7a075c2f2d3a48 /waftools
parent76858ba91ce242ac8fb40f2787934e1e3e1fa51b (diff)
downloadmpv-770fc5221528e18c17e7b3664ad300a96cdace3a.tar.bz2
mpv-770fc5221528e18c17e7b3664ad300a96cdace3a.tar.xz
build: make Swift lib and compiler paths configurable via env vars
Diffstat (limited to 'waftools')
-rw-r--r--waftools/detections/compiler_swift.py28
1 files changed, 22 insertions, 6 deletions
diff --git a/waftools/detections/compiler_swift.py b/waftools/detections/compiler_swift.py
index bdac0baf83..3dffcdedd2 100644
--- a/waftools/detections/compiler_swift.py
+++ b/waftools/detections/compiler_swift.py
@@ -38,17 +38,24 @@ def __add_swift_library_linking_flags(ctx, swift_library):
def __find_swift_library(ctx):
swift_libraries = {}
- #first search for swift libs relative to the swift compiler executable
+ #look for set lib paths in passed environment variables
+ if 'SWIFT_LIB_DYNAMIC' in ctx.environ:
+ swift_libraries['SWIFT_LIB_DYNAMIC'] = ctx.environ['SWIFT_LIB_DYNAMIC']
+ if 'SWIFT_LIB_STATIC' in ctx.environ:
+ swift_libraries['SWIFT_LIB_STATIC'] = ctx.environ['SWIFT_LIB_STATIC']
+
+ #search for swift libs relative to the swift compiler executable
swift_library_relative_paths = {
'SWIFT_LIB_DYNAMIC': '../../lib/swift/macosx',
'SWIFT_LIB_STATIC': '../../lib/swift_static/macosx'
}
for lib_type, path in swift_library_relative_paths.items():
- lib_path = os.path.join(ctx.env.SWIFT, path)
- swift_library = ctx.root.find_dir(lib_path)
- if swift_library is not None:
- swift_libraries[lib_type] = swift_library.abspath()
+ if lib_type not in swift_libraries:
+ lib_path = os.path.join(ctx.env.SWIFT, path)
+ swift_library = ctx.root.find_dir(lib_path)
+ if swift_library is not None:
+ swift_libraries[lib_type] = swift_library.abspath()
#fall back to xcode-select path
swift_library_paths = {
@@ -98,7 +105,16 @@ def __find_macos_sdk(ctx):
def __find_swift_compiler(ctx):
ctx.start_msg('Checking for swift (Swift compiler)')
- swift = __run(['xcrun', '-find', 'swift'])
+ swift = ''
+
+ #look for set swift paths in passed environment variables
+ if 'SWIFT' in ctx.environ:
+ swift = ctx.environ['SWIFT']
+
+ #find swift executable
+ if not swift:
+ swift = __run(['xcrun', '-find', 'swift'])
+
if swift:
ctx.end_msg(swift)
ctx.env.SWIFT = swift