Skip to content

Commit

Permalink
Merge pull request #5143 from al45tair/static-linux-autolink-6.0
Browse files Browse the repository at this point in the history
[Musl] Add back missing autolink arguments, fix CFPosixSpawnFileActionsChdir.
  • Loading branch information
al45tair authored Dec 6, 2024
2 parents bac9047 + 674441c commit 26a599c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)

option(BUILD_SHARED_LIBS "build shared libraries" ON)
option(BUILD_FULLY_STATIC "build fully static" NO)

# Optionally build tools (on by default) but only when building shared libraries
if(BUILD_SHARED_LIBS)
Expand Down
2 changes: 1 addition & 1 deletion Sources/CoreFoundation/CFPlatform.c
Original file line number Diff line number Diff line change
Expand Up @@ -2283,7 +2283,7 @@ CF_EXPORT int _CFPosixSpawnFileActionsChdir(_CFPosixSpawnFileActionsRef file_act
// Glibc versions prior to 2.29 don't support posix_spawn_file_actions_addchdir_np, impacting:
// - Amazon Linux 2 (EoL mid-2025)
return ENOSYS;
#elif defined(__GLIBC__) || TARGET_OS_DARWIN || defined(__FreeBSD__) || defined(__ANDROID__)
#elif defined(__GLIBC__) || TARGET_OS_DARWIN || defined(__FreeBSD__) || defined(__ANDROID__) || defined(__musl__)
// Pre-standard posix_spawn_file_actions_addchdir_np version available in:
// - Solaris 11.3 (October 2015)
// - Glibc 2.29 (February 2019)
Expand Down
11 changes: 10 additions & 1 deletion Sources/FoundationNetworking/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,16 @@ if(NOT BUILD_SHARED_LIBS)
target_compile_options(FoundationNetworking PRIVATE
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend curl>")
target_compile_options(FoundationNetworking PRIVATE
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend swiftSynchronization>")
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend swiftSynchronization>")

if(BUILD_FULLY_STATIC)
target_compile_options(FoundationNetworking
PRIVATE
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend crypto>"
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend ssl>"
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend z>")
endif()

endif()

set_target_properties(FoundationNetworking PROPERTIES
Expand Down
7 changes: 7 additions & 0 deletions Sources/FoundationXML/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ if(NOT BUILD_SHARED_LIBS)
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend xml2>")
target_compile_options(FoundationXML PRIVATE
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend swiftSynchronization>")

if(BUILD_FULLY_STATIC)
target_compile_options(FoundationXML
PRIVATE
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend z>")
endif()

endif()

set_target_properties(FoundationXML PROPERTIES
Expand Down

0 comments on commit 26a599c

Please sign in to comment.