Skip to content

Commit 26a599c

Browse files
authored
Merge pull request #5143 from al45tair/static-linux-autolink-6.0
[Musl] Add back missing autolink arguments, fix CFPosixSpawnFileActionsChdir.
2 parents bac9047 + 674441c commit 26a599c

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
5757
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
5858

5959
option(BUILD_SHARED_LIBS "build shared libraries" ON)
60+
option(BUILD_FULLY_STATIC "build fully static" NO)
6061

6162
# Optionally build tools (on by default) but only when building shared libraries
6263
if(BUILD_SHARED_LIBS)

Sources/CoreFoundation/CFPlatform.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2283,7 +2283,7 @@ CF_EXPORT int _CFPosixSpawnFileActionsChdir(_CFPosixSpawnFileActionsRef file_act
22832283
// Glibc versions prior to 2.29 don't support posix_spawn_file_actions_addchdir_np, impacting:
22842284
// - Amazon Linux 2 (EoL mid-2025)
22852285
return ENOSYS;
2286-
#elif defined(__GLIBC__) || TARGET_OS_DARWIN || defined(__FreeBSD__) || defined(__ANDROID__)
2286+
#elif defined(__GLIBC__) || TARGET_OS_DARWIN || defined(__FreeBSD__) || defined(__ANDROID__) || defined(__musl__)
22872287
// Pre-standard posix_spawn_file_actions_addchdir_np version available in:
22882288
// - Solaris 11.3 (October 2015)
22892289
// - Glibc 2.29 (February 2019)

Sources/FoundationNetworking/CMakeLists.txt

+10-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,16 @@ if(NOT BUILD_SHARED_LIBS)
6161
target_compile_options(FoundationNetworking PRIVATE
6262
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend curl>")
6363
target_compile_options(FoundationNetworking PRIVATE
64-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend swiftSynchronization>")
64+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend swiftSynchronization>")
65+
66+
if(BUILD_FULLY_STATIC)
67+
target_compile_options(FoundationNetworking
68+
PRIVATE
69+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend crypto>"
70+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend ssl>"
71+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend z>")
72+
endif()
73+
6574
endif()
6675

6776
set_target_properties(FoundationNetworking PROPERTIES

Sources/FoundationXML/CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ if(NOT BUILD_SHARED_LIBS)
3737
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend xml2>")
3838
target_compile_options(FoundationXML PRIVATE
3939
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend swiftSynchronization>")
40+
41+
if(BUILD_FULLY_STATIC)
42+
target_compile_options(FoundationXML
43+
PRIVATE
44+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend z>")
45+
endif()
46+
4047
endif()
4148

4249
set_target_properties(FoundationXML PROPERTIES

0 commit comments

Comments
 (0)