termux-packages/packages/swift/swift-utils-swift_build_support-swift_build_support-targets.py.patch

40 lines
2.0 KiB
Diff
Raw Normal View History

2022-02-08 20:48:18 +01:00
diff --git a/swift/utils/swift_build_support/swift_build_support/targets.py b/swift/utils/swift_build_support/swift_build_support/targets.py
index 7ebcdc070c1..5a6ed88182e 100644
--- a/swift/utils/swift_build_support/swift_build_support/targets.py
+++ b/swift/utils/swift_build_support/swift_build_support/targets.py
@@ -166,6 +166,7 @@ class AndroidPlatform(Platform):
flags += '-sdk %s/sysroot ' % (android_toolchain_path)
flags += '-tools-directory %s/bin' % (android_toolchain_path)
+ flags += ' -Xlinker -rpath -Xlinker @TERMUX_PREFIX@/lib'
return flags
def cmake_options(self, args):
@@ -174,8 +175,7 @@ class AndroidPlatform(Platform):
return options
def ndk_toolchain_path(self, args):
- return '%s/toolchains/llvm/prebuilt/%s' % (
- args.android_ndk, StdlibDeploymentTarget.host_target().name)
+ return args.android_ndk
def swiftpm_config(self, args, output_dir, swift_toolchain, resource_path):
config_file = '%s/swiftpm-android-%s.json' % (output_dir, args.android_arch)
@@ -190,7 +190,7 @@ class AndroidPlatform(Platform):
spm_json += ' "version": 1,\n'
spm_json += ' "target": "%s-unknown-linux-android%s",\n' % (
args.android_arch, args.android_api_level)
- spm_json += ' "toolchain-bin-dir": "%s/bin",\n' % swift_toolchain
+ spm_json += ' "toolchain-bin-dir": "%s/bin",\n' % args.android_ndk
spm_json += ' "sdk": "%s/sysroot",\n' % self.ndk_toolchain_path(args)
spm_json += ' "extra-cc-flags": [ "-fPIC", "-I%s/usr/include" ],\n' % (
@@ -203,6 +203,7 @@ class AndroidPlatform(Platform):
spm_json += ' "-tools-directory", "%s/bin",\n' % (
self.ndk_toolchain_path(args))
spm_json += ' "-Xcc", "-I%s/usr/include",\n' % args.cross_compile_deps_path
+ spm_json += ' "-Xlinker", "-rpath", "-Xlinker", "@TERMUX_PREFIX@/lib",\n'
spm_json += ' "-L%s/usr/lib"\n' % args.cross_compile_deps_path
spm_json += ' ],\n'