Skip to content

Commit f501e19

Browse files
committedFeb 8, 2024
Work towards macOS build
1 parent bfdf5f2 commit f501e19

24 files changed

+91
-183
lines changed
 

‎Package.swift

+8-11
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ let buildSettings: [CSetting] = [
1010
.define("DEPLOYMENT_RUNTIME_SWIFT"),
1111
.define("DEPLOYMENT_ENABLE_LIBDISPATCH"),
1212
.define("HAVE_STRUCT_TIMESPEC"),
13-
.define("__CONSTANT_CFSTRINGS__"),
1413
.define("_GNU_SOURCE", .when(platforms: [.linux, .android])),
1514
.define("CF_CHARACTERSET_UNICODE_DATA_L", to: "\"Sources/CoreFoundation/CFUnicodeData-L.mapping\""),
1615
.define("CF_CHARACTERSET_UNICODE_DATA_B", to: "\"Sources/CoreFoundation/CFUnicodeData-B.mapping\""),
@@ -25,7 +24,7 @@ let buildSettings: [CSetting] = [
2524
"-Wno-int-conversion",
2625
"-Wno-unused-function",
2726
"-Wno-microsoft-enum-forward-reference",
28-
"-fconstant-cfstrings",
27+
"-fconstant-cfstrings",
2928
"-fexceptions", // TODO: not on OpenBSD
3029
"-fdollars-in-identifiers",
3130
"-fno-common",
@@ -44,7 +43,6 @@ let interfaceBuildSettings: [CSetting] = [
4443
.define("DEPLOYMENT_RUNTIME_SWIFT"),
4544
.define("DEPLOYMENT_ENABLE_LIBDISPATCH"),
4645
.define("HAVE_STRUCT_TIMESPEC"),
47-
.define("__CONSTANT_CFSTRINGS__"),
4846
.define("_GNU_SOURCE", .when(platforms: [.linux, .android])),
4947
.unsafeFlags([
5048
"-Wno-shorten-64-to-32",
@@ -55,7 +53,7 @@ let interfaceBuildSettings: [CSetting] = [
5553
"-Wno-int-conversion",
5654
"-Wno-unused-function",
5755
"-Wno-microsoft-enum-forward-reference",
58-
"-fconstant-cfstrings",
56+
"-fconstant-cfstrings",
5957
"-fexceptions", // TODO: not on OpenBSD
6058
"-fdollars-in-identifiers",
6159
"-fno-common",
@@ -89,7 +87,7 @@ let package = Package(
8987
dependencies: [
9088
.product(name: "FoundationEssentials", package: "swift-foundation"),
9189
.product(name: "FoundationInternationalization", package: "swift-foundation"),
92-
"CoreFoundationPackage"
90+
"_CoreFoundation"
9391
],
9492
path: "Sources/Foundation",
9593
swiftSettings: [.define("DEPLOYMENT_RUNTIME_SWIFT")]
@@ -99,7 +97,7 @@ let package = Package(
9997
dependencies: [
10098
.product(name: "FoundationEssentials", package: "swift-foundation"),
10199
"Foundation",
102-
"CoreFoundationPackage",
100+
"_CoreFoundation",
103101
"_CFXMLInterface"
104102
],
105103
path: "Sources/FoundationXML",
@@ -110,25 +108,24 @@ let package = Package(
110108
dependencies: [
111109
.product(name: "FoundationEssentials", package: "swift-foundation"),
112110
"Foundation",
113-
"CoreFoundationPackage",
111+
"_CoreFoundation",
114112
"_CFURLSessionInterface"
115113
],
116114
path: "Sources/FoundationNetworking",
117115
swiftSettings: [.define("DEPLOYMENT_RUNTIME_SWIFT")]
118116
),
119117
.target(
120-
name: "CoreFoundationPackage",
118+
name: "_CoreFoundation",
121119
dependencies: [
122120
.product(name: "FoundationICU", package: "swift-foundation-icu"),
123-
"Clibcurl"
124121
],
125122
path: "Sources/CoreFoundation",
126123
cSettings: buildSettings
127124
),
128125
.target(
129126
name: "_CFXMLInterface",
130127
dependencies: [
131-
"CoreFoundationPackage",
128+
"_CoreFoundation",
132129
"Clibxml2",
133130
],
134131
path: "Sources/_CFXMLInterface",
@@ -137,7 +134,7 @@ let package = Package(
137134
.target(
138135
name: "_CFURLSessionInterface",
139136
dependencies: [
140-
"CoreFoundationPackage",
137+
"_CoreFoundation",
141138
"Clibcurl",
142139
],
143140
path: "Sources/_CFURLSessionInterface",

‎Sources/CoreFoundation/CFCalendar.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99

1010
#include "CFCalendar.h"
11+
#include "CFCalendarPriv.h"
1112
#include "CFRuntime.h"
1213
#include "CFInternal.h"
1314
#include "CFRuntime_Internal.h"
@@ -722,7 +723,7 @@ CFCalendarRef CFCalendarCreateWithIdentifier(CFAllocatorRef allocator, CFStringR
722723
return _CFCalendarCreate(allocator, identifier, NULL, NULL, kCFNotFound, kCFNotFound, NULL);
723724
}
724725

725-
CF_CROSS_PLATFORM_EXPORT Boolean _CFCalendarInitWithIdentifier(CFCalendarRef calendar, CFStringRef identifier) {
726+
CF_EXPORT Boolean _CFCalendarInitWithIdentifier(CFCalendarRef calendar, CFStringRef identifier) {
726727
return _CFCalendarInitialize(calendar, kCFAllocatorSystemDefault, identifier, NULL, NULL, kCFNotFound, kCFNotFound, NULL) ? true : false;
727728
}
728729

‎Sources/CoreFoundation/CFDateIntervalFormatter.c

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "CFRuntime_Internal.h"
1414

1515
#include "CFCalendar.h"
16+
#include "CFCalendar_Internal.h"
1617
#include "CFDate.h"
1718
#include "CFDateFormatter.h"
1819
#include "CFDateInterval.h"

‎Sources/CoreFoundation/CFLocaleKeys.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
88
*/
99

10-
#include "TargetConditionals.h"
10+
#include "CFTargetConditionals.h"
1111
#include "CFInternal.h"
1212

1313
CONST_STRING_DECL(kCFLocaleAlternateQuotationBeginDelimiterKey, "kCFLocaleAlternateQuotationBeginDelimiterKey");

‎Sources/CoreFoundation/include/CFAvailability.h

+1-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@
1010
#if !defined(__COREFOUNDATION_CFAVAILABILITY__)
1111
#define __COREFOUNDATION_CFAVAILABILITY__ 1
1212

13-
#if __has_include(<CoreFoundation/TargetConditionals.h>)
14-
#include "TargetConditionals.h"
15-
#else
16-
#include <TargetConditionals.h>
17-
#endif
13+
#include "CFTargetConditionals.h"
1814

1915
#if __has_include(<Availability.h>) && __has_include(<os/availability.h>) && __has_include(<AvailabilityMacros.h>)
2016
#include <Availability.h>

‎Sources/CoreFoundation/include/CFBase.h

+1-6
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@
1212
#if !defined(__COREFOUNDATION_CFBASE__)
1313
#define __COREFOUNDATION_CFBASE__ 1
1414

15-
#if __has_include(<CoreFoundation/TargetConditionals.h>)
16-
#include "TargetConditionals.h"
17-
#else
18-
#include <TargetConditionals.h>
19-
#endif
20-
15+
#include "CFTargetConditionals.h"
2116
#include "CFAvailability.h"
2217

2318
#if (defined(__CYGWIN32__) || defined(_WIN32)) && !defined(__WIN32__)

‎Sources/CoreFoundation/include/CFCalendar.h

-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ Boolean CFCalendarAddComponents(CFCalendarRef calendar, /* inout */ CFAbsoluteTi
109109
CF_EXPORT
110110
Boolean CFCalendarGetComponentDifference(CFCalendarRef calendar, CFAbsoluteTime startingAT, CFAbsoluteTime resultAT, CFOptionFlags options, const char *componentDesc, ...);
111111

112-
113112
CF_EXTERN_C_END
114113
CF_IMPLICIT_BRIDGING_DISABLED
115114

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/* CFCalendarPriv.h
2+
Copyright (c) 2004-2019, Apple Inc. and the Swift project authors
3+
4+
Portions Copyright (c) 2014-2019, Apple Inc. and the Swift project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
See http://swift.org/LICENSE.txt for license information
7+
See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
8+
*/
9+
10+
#if !defined(__COREFOUNDATION_CFCALENDAR_PRIV__)
11+
#define __COREFOUNDATION_CFCALENDAR_PRIV__ 1
12+
13+
#include "CFBase.h"
14+
#include "CFLocale.h"
15+
#include "CFDate.h"
16+
#include "CFTimeZone.h"
17+
#include "CFDateComponents.h"
18+
#include "CFCalendar.h"
19+
20+
CF_IMPLICIT_BRIDGING_ENABLED
21+
CF_EXTERN_C_BEGIN
22+
CF_ASSUME_NONNULL_BEGIN
23+
24+
// swift-corelibs-foundation only
25+
26+
typedef struct {
27+
CFTimeInterval onsetTime;
28+
CFTimeInterval ceaseTime;
29+
CFIndex start;
30+
CFIndex end;
31+
} _CFCalendarWeekendRange;
32+
33+
CF_EXPORT Boolean _CFCalendarInitWithIdentifier(CFCalendarRef calendar, CFStringRef identifier);
34+
CF_EXPORT Boolean _CFCalendarComposeAbsoluteTimeV(CFCalendarRef calendar, /* out */ CFAbsoluteTime *atp, const char *componentDesc, int32_t *vector, int32_t count);
35+
CF_EXPORT Boolean _CFCalendarDecomposeAbsoluteTimeV(CFCalendarRef calendar, CFAbsoluteTime at, const char *componentDesc, int32_t *_Nonnull * _Nonnull vector, int32_t count);
36+
CF_EXPORT Boolean _CFCalendarAddComponentsV(CFCalendarRef calendar, /* inout */ CFAbsoluteTime *atp, CFOptionFlags options, const char *componentDesc, int32_t *vector, int32_t count);
37+
CF_EXPORT Boolean _CFCalendarGetComponentDifferenceV(CFCalendarRef calendar, CFAbsoluteTime startingAT, CFAbsoluteTime resultAT, CFOptionFlags options, const char *componentDesc, int32_t *_Nonnull * _Nonnull vector, int32_t count);
38+
CF_EXPORT void _CFCalendarEnumerateDates(CFCalendarRef calendar, CFDateRef start, CFDateComponentsRef matchingComponents, CFOptionFlags opts, void (^block)(CFDateRef _Nullable, Boolean, Boolean*));
39+
40+
CF_ASSUME_NONNULL_END
41+
CF_EXTERN_C_END
42+
CF_IMPLICIT_BRIDGING_DISABLED
43+
44+
#endif /* ! __COREFOUNDATION_CFCALENDAR_PRIV__ */
45+

‎Sources/CoreFoundation/include/CFLocking.h

+1-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@
1414
#if !defined(__COREFOUNDATION_CFLOCKING_H__)
1515
#define __COREFOUNDATION_CFLOCKING_H__ 1
1616

17-
#if __has_include(<CoreFoundation/TargetConditionals.h>)
18-
#include "TargetConditionals.h"
19-
#else
20-
#include <TargetConditionals.h>
21-
#endif
17+
#include "CFTargetConditionals.h"
2218

2319
#if TARGET_OS_MAC
2420

‎Sources/CoreFoundation/include/TargetConditionals.h ‎Sources/CoreFoundation/include/CFTargetConditionals.h

+7
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
1919
*/
2020

21+
#if __has_include(<TargetConditionals.h>)
22+
#include <TargetConditionals.h>
23+
#else
24+
2125
#ifndef __TARGETCONDITIONALS__
2226
#define __TARGETCONDITIONALS__
2327
/****************************************************************************************************
@@ -275,3 +279,6 @@
275279
#endif
276280

277281
#endif /* __TARGETCONDITIONALS__ */
282+
283+
#endif // __has_include
284+

‎Sources/CoreFoundation/include/CoreFoundation-SwiftRuntime.h

-106
This file was deleted.

‎Sources/CoreFoundation/include/CoreFoundation.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@
7272
#include "CFUUID.h"
7373
#include "CFUtilities.h"
7474
#include "CFBundle.h"
75-
#include "CFLocaleInternal.h"
75+
76+
#include "ForSwiftFoundationOnly.h"
7677

7778
#if TARGET_OS_OSX || TARGET_OS_IPHONE || TARGET_OS_WIN32
7879
#include "CFMessagePort.h"

‎Sources/CoreFoundation/include/CoreFoundation_Prefix.h

+1-7
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,7 @@
1010
#ifndef __COREFOUNDATION_PREFIX_H__
1111
#define __COREFOUNDATION_PREFIX_H__ 1
1212

13-
#if __has_include(<CoreFoundation/TargetConditionals.h>)
14-
#include "TargetConditionals.h"
15-
#define __TARGETCONDITIONALS__ // Prevent loading the macOS TargetConditionals.h at all.
16-
#else
17-
#include <TargetConditionals.h>
18-
#endif
19-
13+
#include "CFTargetConditionals.h"
2014
#include "CFAvailability.h"
2115

2216
#if TARGET_OS_WASI

‎Sources/CoreFoundation/internalInclude/ForSwiftFoundationOnly.h ‎Sources/CoreFoundation/include/ForSwiftFoundationOnly.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include "CFBase.h"
1919
#include "CFNumber.h"
2020
#include "CFLocking.h"
21-
#include "CFLocaleInternal.h"
2221
#include "CFCalendar.h"
22+
#include "CFCalendarPriv.h"
2323
#include "CFPriv.h"
2424
#include "CFRegularExpression.h"
2525
#include "CFLogUtilities.h"
@@ -49,8 +49,6 @@
4949
#include <dirent.h>
5050
#endif
5151

52-
#include "CFCalendar_Internal.h"
53-
5452
#if __has_include(<execinfo.h>)
5553
#include <execinfo.h>
5654
#endif

‎Sources/CoreFoundation/internalInclude/Block.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
88
//
99

10-
#include "TargetConditionals.h"
10+
#include "CFTargetConditionals.h"
1111

1212
#ifndef _Block_H_
1313
#define _Block_H_

0 commit comments

Comments
 (0)