termux-packages/packages/swift/swiftpm-rpath.patch

97 lines
4.2 KiB
Diff
Raw Normal View History

diff --git a/swiftpm/Sources/PackageDescription/CMakeLists.txt b/swiftpm/Sources/PackageDescription/CMakeLists.txt
index b6d925e1..3e546554 100644
--- a/swiftpm/Sources/PackageDescription/CMakeLists.txt
+++ b/swiftpm/Sources/PackageDescription/CMakeLists.txt
@@ -32,11 +32,13 @@ foreach(PACKAGE_DESCRIPTION_VERSION 4 4_2)
target_link_options(PD${PACKAGE_DESCRIPTION_VERSION} PRIVATE
"SHELL:-Xlinker -install_name -Xlinker @rpath/libPackageDescription.dylib")
endif()
-
+ target_link_options(PD${PACKAGE_DESCRIPTION_VERSION} PRIVATE "SHELL:-no-toolchain-stdlib-rpath")
set_target_properties(PD${PACKAGE_DESCRIPTION_VERSION} PROPERTIES
Swift_MODULE_NAME PackageDescription
Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/pm/${PACKAGE_DESCRIPTION_VERSION}
+ BUILD_WITH_INSTALL_RPATH TRUE
INSTALL_NAME_DIR \\@rpath
+ INSTALL_RPATH "$ORIGIN/../../android"
OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/pm/${PACKAGE_DESCRIPTION_VERSION}
OUTPUT_NAME PackageDescription
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/pm/${PACKAGE_DESCRIPTION_VERSION}
diff --git a/swiftpm/TSC/Sources/TSCBasic/CMakeLists.txt b/swiftpm/TSC/Sources/TSCBasic/CMakeLists.txt
index 50e1ba60..e47b87e7 100644
--- a/swiftpm/TSC/Sources/TSCBasic/CMakeLists.txt
+++ b/swiftpm/TSC/Sources/TSCBasic/CMakeLists.txt
@@ -53,7 +53,7 @@ target_link_libraries(TSCBasic PUBLIC
TSCLibc)
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
target_link_libraries(TSCBasic PUBLIC
- Foundation)
+ Foundation android-spawn)
endif()
# NOTE(compnerd) workaround for CMake not setting up include flags yet
set_target_properties(TSCBasic PROPERTIES
diff --git a/swiftpm/Sources/swift-build/CMakeLists.txt b/swiftpm/Sources/swift-build/CMakeLists.txt
index 6f8a8747..b52c1295 100644
--- a/swiftpm/Sources/swift-build/CMakeLists.txt
+++ b/swiftpm/Sources/swift-build/CMakeLists.txt
@@ -10,6 +10,11 @@ add_executable(swift-build
main.swift)
target_link_libraries(swift-build PRIVATE
Commands)
+if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
+set_target_properties(swift-build PROPERTIES
+ INSTALL_RPATH "$ORIGIN/../lib/swift/android:$ORIGIN/../lib/swift/pm:$ORIGIN/../lib/swift/pm/llbuild"
+ BUILD_WITH_INSTALL_RPATH TRUE)
+endif()
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
install(TARGETS swift-build
diff --git a/swiftpm/Sources/swift-package/CMakeLists.txt b/swiftpm/Sources/swift-package/CMakeLists.txt
index 1ebf9a3a..700594dd 100644
--- a/swiftpm/Sources/swift-package/CMakeLists.txt
+++ b/swiftpm/Sources/swift-package/CMakeLists.txt
@@ -10,6 +10,11 @@ add_executable(swift-package
main.swift)
target_link_libraries(swift-package PRIVATE
Commands)
+if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
+set_target_properties(swift-package PROPERTIES
+ INSTALL_RPATH "$ORIGIN/../lib/swift/android:$ORIGIN/../lib/swift/pm:$ORIGIN/../lib/swift/pm/llbuild"
+ BUILD_WITH_INSTALL_RPATH TRUE)
+endif()
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
install(TARGETS swift-package
diff --git a/swiftpm/Sources/swift-run/CMakeLists.txt b/swiftpm/Sources/swift-run/CMakeLists.txt
index d879e3c9..307edb47 100644
--- a/swiftpm/Sources/swift-run/CMakeLists.txt
+++ b/swiftpm/Sources/swift-run/CMakeLists.txt
@@ -10,6 +10,11 @@ add_executable(swift-run
main.swift)
target_link_libraries(swift-run PRIVATE
Commands)
+if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
+set_target_properties(swift-run PROPERTIES
+ INSTALL_RPATH "$ORIGIN/../lib/swift/android:$ORIGIN/../lib/swift/pm:$ORIGIN/../lib/swift/pm/llbuild"
+ BUILD_WITH_INSTALL_RPATH TRUE)
+endif()
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
install(TARGETS swift-run
diff --git a/swiftpm/Sources/swift-test/CMakeLists.txt b/swiftpm/Sources/swift-test/CMakeLists.txt
index fc4912ef..04a585da 100644
--- a/swiftpm/Sources/swift-test/CMakeLists.txt
+++ b/swiftpm/Sources/swift-test/CMakeLists.txt
@@ -10,6 +10,11 @@ add_executable(swift-test
main.swift)
target_link_libraries(swift-test PRIVATE
Commands)
+if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
+set_target_properties(swift-test PROPERTIES
+ INSTALL_RPATH "$ORIGIN/../lib/swift/android:$ORIGIN/../lib/swift/pm:$ORIGIN/../lib/swift/pm/llbuild"
+ BUILD_WITH_INSTALL_RPATH TRUE)
+endif()
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
install(TARGETS swift-test