mirror of https://github.com/mpv-player/mpv
build: fix swift linking with upcoming xcode 11
in xcode 11 the dynamic swift libraries were moved to a separated versioned swift folder, which can't be used for linking and only for distribution. additional to the std dynamic swift lib folder the system wide folder is needed for linking too.
This commit is contained in:
parent
d00f9b19c7
commit
f64c0115ae
|
@ -89,8 +89,16 @@ def process_libraries(libs_dict, binary, processed = []):
|
||||||
def process_swift_libraries(binary):
|
def process_swift_libraries(binary):
|
||||||
command = ['xcrun', '--find', 'swift-stdlib-tool']
|
command = ['xcrun', '--find', 'swift-stdlib-tool']
|
||||||
swiftStdlibTool = subprocess.check_output(command, universal_newlines=True).strip()
|
swiftStdlibTool = subprocess.check_output(command, universal_newlines=True).strip()
|
||||||
|
# from xcode11 on the dynamic swift libs reside in a separate directory from
|
||||||
|
# the std one, might need versioned paths for future swift versions
|
||||||
|
swiftLibPath = os.path.join(swiftStdlibTool, '../../lib/swift-5.0/macosx')
|
||||||
|
swiftLibPath = os.path.abspath(swiftLibPath)
|
||||||
|
|
||||||
command = [swiftStdlibTool, '--copy', '--platform', 'macosx', '--scan-executable', binary, '--destination', lib_path(binary)]
|
command = [swiftStdlibTool, '--copy', '--platform', 'macosx', '--scan-executable', binary, '--destination', lib_path(binary)]
|
||||||
|
|
||||||
|
if os.path.exists(swiftLibPath):
|
||||||
|
command.extend(['--source-libraries', swiftLibPath])
|
||||||
|
|
||||||
subprocess.check_output(command, universal_newlines=True)
|
subprocess.check_output(command, universal_newlines=True)
|
||||||
|
|
||||||
print(">> setting additional rpath for swift libraries")
|
print(">> setting additional rpath for swift libraries")
|
||||||
|
|
|
@ -44,6 +44,7 @@ def __add_dynamic_swift_library_linking_flags(ctx, swift_library):
|
||||||
if StrictVersion(ctx.env.SWIFT_VERSION) >= StrictVersion("5.0"):
|
if StrictVersion(ctx.env.SWIFT_VERSION) >= StrictVersion("5.0"):
|
||||||
ctx.env.append_value('LINKFLAGS', [
|
ctx.env.append_value('LINKFLAGS', [
|
||||||
'-Xlinker', '-rpath', '-Xlinker', '/usr/lib/swift',
|
'-Xlinker', '-rpath', '-Xlinker', '/usr/lib/swift',
|
||||||
|
'-L/usr/lib/swift',
|
||||||
])
|
])
|
||||||
|
|
||||||
ctx.env.append_value('LINKFLAGS', [
|
ctx.env.append_value('LINKFLAGS', [
|
||||||
|
|
Loading…
Reference in New Issue