Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions build-script-helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import json
import sys
import os, platform
import re
import subprocess

def printerr(message):
Expand Down Expand Up @@ -159,7 +158,9 @@ def get_swiftpm_options(action, args):
if args.verbose or action == 'install':
swiftpm_args += ['--verbose']

if platform.system() == 'Darwin':
build_target = get_build_target(args)
build_os = build_target.split('-')[2]
if build_os.startswith('macosx'):
swiftpm_args += [
# Relative library rpath for swift; will only be used when /usr/lib/swift
# is not available.
Expand All @@ -168,13 +169,12 @@ def get_swiftpm_options(action, args):
else:
swiftpm_args += [
# Library rpath for swift, dispatch, Foundation, etc. when installing
'-Xlinker', '-rpath', '-Xlinker', '$ORIGIN/../lib/swift/linux',
'-Xlinker', '-rpath', '-Xlinker', '$ORIGIN/../lib/swift/' + build_os,
]

build_target = get_build_target(args)
cross_compile_hosts = args.cross_compile_hosts
if cross_compile_hosts:
if re.search('-apple-macosx', build_target) and re.match('macosx-', cross_compile_hosts):
if build_os.startswith('macosx') and cross_compile_hosts.startswith('macosx-'):
swiftpm_args += ["--arch", "x86_64", "--arch", "arm64"]
else:
printerr("cannot cross-compile for %s" % cross_compile_hosts)
Expand Down Expand Up @@ -290,7 +290,7 @@ def get_build_target(args):
command = [args.swift_exec, '-print-target-info']
target_info_json = subprocess.check_output(command, stderr=subprocess.PIPE, universal_newlines=True).strip()
args.target_info = json.loads(target_info_json)
if platform.system() == 'Darwin':
if '-apple-macosx' in args.target_info["target"]["unversionedTriple"]:
return args.target_info["target"]["unversionedTriple"]

return args.target_info["target"]["triple"]
Expand Down