Skip to content

Rebase release-6.0 with stable 6.0.2 release tags #447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions schemes/release-6.0/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"update-checkout-scheme": "release/6.0",
"base-tag": "swift-6.0-DEVELOPMENT-SNAPSHOT-2024-10-12-a",
"base-tag": "swift-6.0.2-RELEASE",
"build-compiler": false,
"icu4c": ["https://github.com/swiftwasm/icu4c-wasi/releases/download/0.8.0/icu4c-wasi.tar.xz"],
"libxml2": ["https://github.com/swiftwasm/libxml2-wasm/releases/download/2.0.0/libxml2-wasm32-unknown-wasi.tar.gz"],
"wasi-sysroot": "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-21/wasi-sysroot-21.0.tar.gz",
"swift-org-download-channel": "swift-6.0-branch"
"swift-org-download-channel": "swift-6.0.2-release"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
From acdc7e138ff67f02c261bb6372f755c2fdb6bc7b Mon Sep 17 00:00:00 2001
From: Yuta Saito <[email protected]>
Date: Sat, 30 Mar 2024 10:28:40 +0000
Subject: [PATCH] build: Repair the build on WASI platform

Cherry picked from https://github.com/apple/swift-corelibs-foundation/pull/4934

(cherry picked from commit 51ee6906be0556eb63cd35a16ad4167f69f16a63)
---
Package.swift | 20 ++++++++++++++++++--
Sources/CoreFoundation/CFBundle.c | 8 +++++++-
Sources/CoreFoundation/CFString.c | 2 +-
3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/Package.swift b/Package.swift
index 4ead01c3..8aa40e79 100644
--- a/Package.swift
+++ b/Package.swift
@@ -3,6 +3,16 @@

import PackageDescription

+let platformsWithThreads: [Platform] = [
+ .iOS,
+ .macOS,
+ .tvOS,
+ .watchOS,
+ .macCatalyst,
+ .driverKit,
+ .android,
+ .linux,
+]
var dispatchIncludeFlags: [CSetting]
if let environmentPath = Context.environment["DISPATCH_INCLUDE_PATH"] {
dispatchIncludeFlags = [.unsafeFlags([
@@ -31,8 +41,11 @@ let coreFoundationBuildSettings: [CSetting] = [
.define("DEPLOYMENT_ENABLE_LIBDISPATCH"),
.define("DEPLOYMENT_RUNTIME_SWIFT"),
.define("HAVE_STRUCT_TIMESPEC"),
- .define("SWIFT_CORELIBS_FOUNDATION_HAS_THREADS"),
+ .define("SWIFT_CORELIBS_FOUNDATION_HAS_THREADS", .when(platforms: platformsWithThreads)),
.define("_GNU_SOURCE", .when(platforms: [.linux, .android])),
+ .define("_WASI_EMULATED_SIGNAL", .when(platforms: [.wasi])),
+ .define("HAVE_STRLCPY", .when(platforms: [.wasi])),
+ .define("HAVE_STRLCAT", .when(platforms: [.wasi])),
.unsafeFlags([
"-Wno-shorten-64-to-32",
"-Wno-deprecated-declarations",
@@ -61,8 +74,11 @@ let interfaceBuildSettings: [CSetting] = [
.define("CF_BUILDING_CF"),
.define("DEPLOYMENT_ENABLE_LIBDISPATCH"),
.define("HAVE_STRUCT_TIMESPEC"),
- .define("SWIFT_CORELIBS_FOUNDATION_HAS_THREADS"),
+ .define("SWIFT_CORELIBS_FOUNDATION_HAS_THREADS", .when(platforms: platformsWithThreads)),
.define("_GNU_SOURCE", .when(platforms: [.linux, .android])),
+ .define("_WASI_EMULATED_SIGNAL", .when(platforms: [.wasi])),
+ .define("HAVE_STRLCPY", .when(platforms: [.wasi])),
+ .define("HAVE_STRLCAT", .when(platforms: [.wasi])),
.unsafeFlags([
"-Wno-shorten-64-to-32",
"-Wno-deprecated-declarations",
diff --git a/Sources/CoreFoundation/CFBundle.c b/Sources/CoreFoundation/CFBundle.c
index 8026a262..05afe988 100644
--- a/Sources/CoreFoundation/CFBundle.c
+++ b/Sources/CoreFoundation/CFBundle.c
@@ -596,7 +596,13 @@ static CFBundleRef _CFBundleGetBundleWithIdentifier(CFStringRef bundleID, void *

CFBundleRef CFBundleGetBundleWithIdentifier(CFStringRef bundleID) {
// Use the frame that called this as a hint
- return _CFBundleGetBundleWithIdentifier(bundleID, __builtin_return_address(0));
+ void *hint;
+#if TARGET_OS_WASI
+ hint = NULL;
+#else
+ hint = __builtin_frame_address(0);
+#endif
+ return _CFBundleGetBundleWithIdentifier(bundleID, hint);
}

CFBundleRef _CFBundleGetBundleWithIdentifierWithHint(CFStringRef bundleID, void *pointer) {
diff --git a/Sources/CoreFoundation/CFString.c b/Sources/CoreFoundation/CFString.c
index 1de46dac..94a6c86d 100644
--- a/Sources/CoreFoundation/CFString.c
+++ b/Sources/CoreFoundation/CFString.c
@@ -28,7 +28,7 @@
#include "CFRuntime_Internal.h"
#include <assert.h>
#include <_foundation_unicode/uchar.h>
-#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_BSD
+#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WASI
#include "CFConstantKeys.h"
#include "CFStringLocalizedFormattingInternal.h"
#endif
--
2.46.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
From 8873088ed6903231235bf8f338358a68157794a8 Mon Sep 17 00:00:00 2001
From: Max Desiatov <[email protected]>
Date: Mon, 5 Aug 2024 20:28:46 +0100
Subject: [PATCH] Reflect `Package.swift` WASI changes in `CMakeLists.txt`

---
CMakeLists.txt | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 30d960cb..edb6cf06 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -115,7 +115,6 @@ list(APPEND _Foundation_common_build_flags
"-DCF_BUILDING_CF"
"-DDEPLOYMENT_ENABLE_LIBDISPATCH"
"-DHAVE_STRUCT_TIMESPEC"
- "-DSWIFT_CORELIBS_FOUNDATION_HAS_THREADS"
"-Wno-shorten-64-to-32"
"-Wno-deprecated-declarations"
"-Wno-unreachable-code"
@@ -127,6 +126,18 @@ list(APPEND _Foundation_common_build_flags
"-Wno-switch"
"-fblocks")

+if(CMAKE_SYSTEM_NAME STREQUAL "WASI")
+ list(APPEND _Foundation_common_build_flags
+ "-D_WASI_EMULATED_SIGNAL"
+ "-DHAVE_STRLCPY"
+ "-DHAVE_STRLCAT"
+ )
+else()
+ list(APPEND _Foundation_common_build_flags
+ "-DSWIFT_CORELIBS_FOUNDATION_HAS_THREADS"
+ )
+endif()
+
if(NOT "${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")
list(APPEND _Foundation_common_build_flags
"-fconstant-cfstrings"
@@ -154,10 +165,21 @@ set(_Foundation_swift_build_flags)
list(APPEND _Foundation_swift_build_flags
"-swift-version 6"
"-DDEPLOYMENT_RUNTIME_SWIFT"
- "-DSWIFT_CORELIBS_FOUNDATION_HAS_THREADS"
"-Xfrontend"
"-require-explicit-sendable")

+if(CMAKE_SYSTEM_NAME STREQUAL "WASI")
+ list(APPEND _Foundation_swift_build_flags
+ "-D_WASI_EMULATED_SIGNAL"
+ "-DHAVE_STRLCPY"
+ "-DHAVE_STRLCAT"
+ )
+else()
+ list(APPEND _Foundation_swift_build_flags
+ "-DSWIFT_CORELIBS_FOUNDATION_HAS_THREADS"
+ )
+endif()
+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
list(APPEND _Foundation_common_build_flags
"-D_GNU_SOURCE")
--
2.46.0

Loading
Loading