Make binaries' rpath comply conventions on iOS and macOS
This simplifies linking embedded frameworks. See #2555
This commit is contained in:
committed by
SvyatoslavScherbina
parent
50376a0975
commit
cfcfecf19e
@@ -158,9 +158,19 @@ open class MacOSBasedLinker(targetProperties: AppleConfigurables)
|
|||||||
if (compilerRtLibrary != null) +compilerRtLibrary!!
|
if (compilerRtLibrary != null) +compilerRtLibrary!!
|
||||||
+libraries
|
+libraries
|
||||||
+linkerArgs
|
+linkerArgs
|
||||||
|
+rpath(dynamic)
|
||||||
}) + if (debug) listOf(dsymUtilCommand(executable, outputDsymBundle)) else emptyList()
|
}) + if (debug) listOf(dsymUtilCommand(executable, outputDsymBundle)) else emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun rpath(dynamic: Boolean): List<String> = listOfNotNull(
|
||||||
|
when (target.family) {
|
||||||
|
Family.OSX -> "@executable_path/../Frameworks"
|
||||||
|
Family.IOS -> "@executable_path/Frameworks"
|
||||||
|
else -> error(target)
|
||||||
|
},
|
||||||
|
"@loader_path/Frameworks".takeIf { dynamic }
|
||||||
|
).flatMap { listOf("-rpath", it) }
|
||||||
|
|
||||||
fun dsymUtilCommand(executable: ExecutableFile, outputDsymBundle: String) =
|
fun dsymUtilCommand(executable: ExecutableFile, outputDsymBundle: String) =
|
||||||
object : Command(dsymutilCommand(executable, outputDsymBundle)) {
|
object : Command(dsymutilCommand(executable, outputDsymBundle)) {
|
||||||
override fun runProcess(): Int =
|
override fun runProcess(): Int =
|
||||||
|
|||||||
Reference in New Issue
Block a user