Skip to content

Commit 49e5426

Browse files
Rebase release-6.0 with stable 6.0.2 release tags
1 parent 7bbc826 commit 49e5426

6 files changed

+1312
-2
lines changed

schemes/release-6.0/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"update-checkout-scheme": "release/6.0",
3-
"base-tag": "swift-6.0-DEVELOPMENT-SNAPSHOT-2024-10-12-a",
3+
"base-tag": "swift-6.0.2-RELEASE",
44
"build-compiler": false,
55
"icu4c": ["https://github.com/swiftwasm/icu4c-wasi/releases/download/0.8.0/icu4c-wasi.tar.xz"],
66
"libxml2": ["https://github.com/swiftwasm/libxml2-wasm/releases/download/2.0.0/libxml2-wasm32-unknown-wasi.tar.gz"],
77
"wasi-sysroot": "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-21/wasi-sysroot-21.0.tar.gz",
8-
"swift-org-download-channel": "swift-6.0-branch"
8+
"swift-org-download-channel": "swift-6.0.2-release"
99
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
From acdc7e138ff67f02c261bb6372f755c2fdb6bc7b Mon Sep 17 00:00:00 2001
2+
From: Yuta Saito <[email protected]>
3+
Date: Sat, 30 Mar 2024 10:28:40 +0000
4+
Subject: [PATCH] build: Repair the build on WASI platform
5+
6+
Cherry picked from https://github.com/apple/swift-corelibs-foundation/pull/4934
7+
8+
(cherry picked from commit 51ee6906be0556eb63cd35a16ad4167f69f16a63)
9+
---
10+
Package.swift | 20 ++++++++++++++++++--
11+
Sources/CoreFoundation/CFBundle.c | 8 +++++++-
12+
Sources/CoreFoundation/CFString.c | 2 +-
13+
3 files changed, 26 insertions(+), 4 deletions(-)
14+
15+
diff --git a/Package.swift b/Package.swift
16+
index 4ead01c3..8aa40e79 100644
17+
--- a/Package.swift
18+
+++ b/Package.swift
19+
@@ -3,6 +3,16 @@
20+
21+
import PackageDescription
22+
23+
+let platformsWithThreads: [Platform] = [
24+
+ .iOS,
25+
+ .macOS,
26+
+ .tvOS,
27+
+ .watchOS,
28+
+ .macCatalyst,
29+
+ .driverKit,
30+
+ .android,
31+
+ .linux,
32+
+]
33+
var dispatchIncludeFlags: [CSetting]
34+
if let environmentPath = Context.environment["DISPATCH_INCLUDE_PATH"] {
35+
dispatchIncludeFlags = [.unsafeFlags([
36+
@@ -31,8 +41,11 @@ let coreFoundationBuildSettings: [CSetting] = [
37+
.define("DEPLOYMENT_ENABLE_LIBDISPATCH"),
38+
.define("DEPLOYMENT_RUNTIME_SWIFT"),
39+
.define("HAVE_STRUCT_TIMESPEC"),
40+
- .define("SWIFT_CORELIBS_FOUNDATION_HAS_THREADS"),
41+
+ .define("SWIFT_CORELIBS_FOUNDATION_HAS_THREADS", .when(platforms: platformsWithThreads)),
42+
.define("_GNU_SOURCE", .when(platforms: [.linux, .android])),
43+
+ .define("_WASI_EMULATED_SIGNAL", .when(platforms: [.wasi])),
44+
+ .define("HAVE_STRLCPY", .when(platforms: [.wasi])),
45+
+ .define("HAVE_STRLCAT", .when(platforms: [.wasi])),
46+
.unsafeFlags([
47+
"-Wno-shorten-64-to-32",
48+
"-Wno-deprecated-declarations",
49+
@@ -61,8 +74,11 @@ let interfaceBuildSettings: [CSetting] = [
50+
.define("CF_BUILDING_CF"),
51+
.define("DEPLOYMENT_ENABLE_LIBDISPATCH"),
52+
.define("HAVE_STRUCT_TIMESPEC"),
53+
- .define("SWIFT_CORELIBS_FOUNDATION_HAS_THREADS"),
54+
+ .define("SWIFT_CORELIBS_FOUNDATION_HAS_THREADS", .when(platforms: platformsWithThreads)),
55+
.define("_GNU_SOURCE", .when(platforms: [.linux, .android])),
56+
+ .define("_WASI_EMULATED_SIGNAL", .when(platforms: [.wasi])),
57+
+ .define("HAVE_STRLCPY", .when(platforms: [.wasi])),
58+
+ .define("HAVE_STRLCAT", .when(platforms: [.wasi])),
59+
.unsafeFlags([
60+
"-Wno-shorten-64-to-32",
61+
"-Wno-deprecated-declarations",
62+
diff --git a/Sources/CoreFoundation/CFBundle.c b/Sources/CoreFoundation/CFBundle.c
63+
index 8026a262..05afe988 100644
64+
--- a/Sources/CoreFoundation/CFBundle.c
65+
+++ b/Sources/CoreFoundation/CFBundle.c
66+
@@ -596,7 +596,13 @@ static CFBundleRef _CFBundleGetBundleWithIdentifier(CFStringRef bundleID, void *
67+
68+
CFBundleRef CFBundleGetBundleWithIdentifier(CFStringRef bundleID) {
69+
// Use the frame that called this as a hint
70+
- return _CFBundleGetBundleWithIdentifier(bundleID, __builtin_return_address(0));
71+
+ void *hint;
72+
+#if TARGET_OS_WASI
73+
+ hint = NULL;
74+
+#else
75+
+ hint = __builtin_frame_address(0);
76+
+#endif
77+
+ return _CFBundleGetBundleWithIdentifier(bundleID, hint);
78+
}
79+
80+
CFBundleRef _CFBundleGetBundleWithIdentifierWithHint(CFStringRef bundleID, void *pointer) {
81+
diff --git a/Sources/CoreFoundation/CFString.c b/Sources/CoreFoundation/CFString.c
82+
index 1de46dac..94a6c86d 100644
83+
--- a/Sources/CoreFoundation/CFString.c
84+
+++ b/Sources/CoreFoundation/CFString.c
85+
@@ -28,7 +28,7 @@
86+
#include "CFRuntime_Internal.h"
87+
#include <assert.h>
88+
#include <_foundation_unicode/uchar.h>
89+
-#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_BSD
90+
+#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WASI
91+
#include "CFConstantKeys.h"
92+
#include "CFStringLocalizedFormattingInternal.h"
93+
#endif
94+
--
95+
2.46.0
96+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
From 8873088ed6903231235bf8f338358a68157794a8 Mon Sep 17 00:00:00 2001
2+
From: Max Desiatov <[email protected]>
3+
Date: Mon, 5 Aug 2024 20:28:46 +0100
4+
Subject: [PATCH] Reflect `Package.swift` WASI changes in `CMakeLists.txt`
5+
6+
---
7+
CMakeLists.txt | 26 ++++++++++++++++++++++++--
8+
1 file changed, 24 insertions(+), 2 deletions(-)
9+
10+
diff --git a/CMakeLists.txt b/CMakeLists.txt
11+
index 30d960cb..edb6cf06 100644
12+
--- a/CMakeLists.txt
13+
+++ b/CMakeLists.txt
14+
@@ -115,7 +115,6 @@ list(APPEND _Foundation_common_build_flags
15+
"-DCF_BUILDING_CF"
16+
"-DDEPLOYMENT_ENABLE_LIBDISPATCH"
17+
"-DHAVE_STRUCT_TIMESPEC"
18+
- "-DSWIFT_CORELIBS_FOUNDATION_HAS_THREADS"
19+
"-Wno-shorten-64-to-32"
20+
"-Wno-deprecated-declarations"
21+
"-Wno-unreachable-code"
22+
@@ -127,6 +126,18 @@ list(APPEND _Foundation_common_build_flags
23+
"-Wno-switch"
24+
"-fblocks")
25+
26+
+if(CMAKE_SYSTEM_NAME STREQUAL "WASI")
27+
+ list(APPEND _Foundation_common_build_flags
28+
+ "-D_WASI_EMULATED_SIGNAL"
29+
+ "-DHAVE_STRLCPY"
30+
+ "-DHAVE_STRLCAT"
31+
+ )
32+
+else()
33+
+ list(APPEND _Foundation_common_build_flags
34+
+ "-DSWIFT_CORELIBS_FOUNDATION_HAS_THREADS"
35+
+ )
36+
+endif()
37+
+
38+
if(NOT "${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")
39+
list(APPEND _Foundation_common_build_flags
40+
"-fconstant-cfstrings"
41+
@@ -154,10 +165,21 @@ set(_Foundation_swift_build_flags)
42+
list(APPEND _Foundation_swift_build_flags
43+
"-swift-version 6"
44+
"-DDEPLOYMENT_RUNTIME_SWIFT"
45+
- "-DSWIFT_CORELIBS_FOUNDATION_HAS_THREADS"
46+
"-Xfrontend"
47+
"-require-explicit-sendable")
48+
49+
+if(CMAKE_SYSTEM_NAME STREQUAL "WASI")
50+
+ list(APPEND _Foundation_swift_build_flags
51+
+ "-D_WASI_EMULATED_SIGNAL"
52+
+ "-DHAVE_STRLCPY"
53+
+ "-DHAVE_STRLCAT"
54+
+ )
55+
+else()
56+
+ list(APPEND _Foundation_swift_build_flags
57+
+ "-DSWIFT_CORELIBS_FOUNDATION_HAS_THREADS"
58+
+ )
59+
+endif()
60+
+
61+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
62+
list(APPEND _Foundation_common_build_flags
63+
"-D_GNU_SOURCE")
64+
--
65+
2.46.0
66+

0 commit comments

Comments
 (0)