Skip to content

Commit 087a706

Browse files
Merge pull request #4900 from kateinoigakukun/pr-f0914c36fb2222012adde113c50ca508e22f743e
[wasm] Port CoreFoundation/PlugIn.subproj
2 parents 131ec0d + 660ccc8 commit 087a706

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

CoreFoundation/PlugIn.subproj/CFBundle.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#endif
4343
#endif /* BINARY_SUPPORT_DLFCN */
4444

45-
#if TARGET_OS_MAC
45+
#if TARGET_OS_MAC || TARGET_OS_WASI
4646
#include <fcntl.h>
4747
#elif TARGET_OS_WIN32
4848
#include <fcntl.h>

CoreFoundation/PlugIn.subproj/CFBundle_BinaryTypes.h

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ CF_EXTERN_C_BEGIN
2828
#define BINARY_SUPPORT_DLL 1
2929
#elif TARGET_OS_LINUX || TARGET_OS_BSD
3030
#define BINARY_SUPPORT_DLFCN 1
31+
#elif TARGET_OS_WASI
3132
#else
3233
#error Unknown or unspecified DEPLOYMENT_TARGET
3334
#endif

CoreFoundation/PlugIn.subproj/CFBundle_InfoPlist.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <CoreFoundation/CFByteOrder.h>
1616
#include <CoreFoundation/CFURLAccess.h>
1717

18-
#if (TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD) && !TARGET_OS_CYGWIN
18+
#if (TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WASI) && !TARGET_OS_CYGWIN
1919
#include <dirent.h>
2020
#if TARGET_OS_MAC || TARGET_OS_BSD
2121
#include <sys/sysctl.h>
@@ -142,6 +142,8 @@ CF_PRIVATE CFStringRef _CFBundleGetPlatformNameSuffix(void) {
142142
return _CFBundleLinuxPlatformNameSuffix;
143143
#elif TARGET_OS_BSD
144144
return _CFBundleFreeBSDPlatformNameSuffix;
145+
#elif TARGET_OS_WASI
146+
return _CFBundleWASIPlatformNameSuffix;
145147
#else
146148
#error Unknown or unspecified DEPLOYMENT_TARGET
147149
#endif
@@ -174,6 +176,8 @@ CF_EXPORT CFStringRef _CFGetPlatformName(void) {
174176
#endif
175177
#elif TARGET_OS_BSD
176178
return _CFBundleFreeBSDPlatformName;
179+
#elif TARGET_OS_WASI
180+
return _CFBundleWASIPlatformName;
177181
#else
178182
#error Unknown or unspecified DEPLOYMENT_TARGET
179183
#endif
@@ -194,6 +198,8 @@ CF_EXPORT CFStringRef _CFGetAlternatePlatformName(void) {
194198
#endif
195199
#elif TARGET_OS_BSD
196200
return CFSTR("FreeBSD");
201+
#elif TARGET_OS_WASI
202+
return CFSTR("WASI");
197203
#else
198204
#error Unknown or unspecified DEPLOYMENT_TARGET
199205
#endif

CoreFoundation/PlugIn.subproj/CFBundle_Internal.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ CF_EXTERN_C_BEGIN
3232
// FHS bundles are supported on the Swift and C runtimes, except on Windows.
3333
#if !DEPLOYMENT_RUNTIME_OBJC && !TARGET_OS_WIN32
3434

35-
#if TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_ANDROID
35+
#if TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_ANDROID || TARGET_OS_WASI
3636
#define _CFBundleFHSSharedLibraryFilenamePrefix CFSTR("lib")
3737
#define _CFBundleFHSSharedLibraryFilenameSuffix CFSTR(".so")
3838
#elif TARGET_OS_MAC
@@ -390,6 +390,7 @@ extern void _CFPlugInWillUnload(CFPlugInRef plugIn);
390390
#define _CFBundleSolarisPlatformName CFSTR("solaris")
391391
#define _CFBundleLinuxPlatformName CFSTR("linux")
392392
#define _CFBundleFreeBSDPlatformName CFSTR("freebsd")
393+
#define _CFBundleWASIPlatformName CFSTR("wasi")
393394
#define _CFBundleMacOSXPlatformNameSuffix CFSTR("-macos")
394395
#define _CFBundleAlternateMacOSXPlatformNameSuffix CFSTR("-macosx")
395396
#define _CFBundleiPhoneOSPlatformNameSuffix CFSTR("-iphoneos")
@@ -400,6 +401,7 @@ extern void _CFPlugInWillUnload(CFPlugInRef plugIn);
400401
#define _CFBundleSolarisPlatformNameSuffix CFSTR("-solaris")
401402
#define _CFBundleLinuxPlatformNameSuffix CFSTR("-linux")
402403
#define _CFBundleFreeBSDPlatformNameSuffix CFSTR("-freebsd")
404+
#define _CFBundleWASIPlatformNameSuffix CFSTR("-wasi")
403405

404406
STATIC_CONST_STRING_DECL(_CFBundleMacDeviceName, "mac");
405407
STATIC_CONST_STRING_DECL(_CFBundleiPhoneDeviceName, "iphone");

CoreFoundation/PlugIn.subproj/CFBundle_Resources.c

+4
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,8 @@ CF_EXPORT CFStringRef _CFBundleGetCurrentPlatform(void) {
507507
#endif
508508
#elif TARGET_OS_BSD
509509
return CFSTR("FreeBSD");
510+
#elif TARGET_OS_WASI
511+
return CFSTR("WASI");
510512
#else
511513
#error Unknown or unspecified DEPLOYMENT_TARGET
512514
#endif
@@ -529,6 +531,8 @@ CF_PRIVATE CFStringRef _CFBundleGetPlatformExecutablesSubdirectoryName(void) {
529531
#endif
530532
#elif TARGET_OS_BSD
531533
return CFSTR("FreeBSD");
534+
#elif TARGET_OS_WASI
535+
return CFSTR("WASI");
532536
#else
533537
#error Unknown or unspecified DEPLOYMENT_TARGET
534538
#endif

0 commit comments

Comments
 (0)