Skip to content
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

[wasm] Port CoreFoundation/PlugIn.subproj #4900

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CoreFoundation/PlugIn.subproj/CFBundle.c
Expand Up @@ -42,7 +42,7 @@
#endif
#endif /* BINARY_SUPPORT_DLFCN */

#if TARGET_OS_MAC
#if TARGET_OS_MAC || TARGET_OS_WASI
#include <fcntl.h>
#elif TARGET_OS_WIN32
#include <fcntl.h>
Expand Down
1 change: 1 addition & 0 deletions CoreFoundation/PlugIn.subproj/CFBundle_BinaryTypes.h
Expand Up @@ -28,6 +28,7 @@ CF_EXTERN_C_BEGIN
#define BINARY_SUPPORT_DLL 1
#elif TARGET_OS_LINUX || TARGET_OS_BSD
#define BINARY_SUPPORT_DLFCN 1
#elif TARGET_OS_WASI
#else
#error Unknown or unspecified DEPLOYMENT_TARGET
#endif
Expand Down
8 changes: 7 additions & 1 deletion CoreFoundation/PlugIn.subproj/CFBundle_InfoPlist.c
Expand Up @@ -15,7 +15,7 @@
#include <CoreFoundation/CFByteOrder.h>
#include <CoreFoundation/CFURLAccess.h>

#if (TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD) && !TARGET_OS_CYGWIN
#if (TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WASI) && !TARGET_OS_CYGWIN
#include <dirent.h>
#if TARGET_OS_MAC || TARGET_OS_BSD
#include <sys/sysctl.h>
Expand Down Expand Up @@ -142,6 +142,8 @@ CF_PRIVATE CFStringRef _CFBundleGetPlatformNameSuffix(void) {
return _CFBundleLinuxPlatformNameSuffix;
#elif TARGET_OS_BSD
return _CFBundleFreeBSDPlatformNameSuffix;
#elif TARGET_OS_WASI
return _CFBundleWASIPlatformNameSuffix;
#else
#error Unknown or unspecified DEPLOYMENT_TARGET
#endif
Expand Down Expand Up @@ -174,6 +176,8 @@ CF_EXPORT CFStringRef _CFGetPlatformName(void) {
#endif
#elif TARGET_OS_BSD
return _CFBundleFreeBSDPlatformName;
#elif TARGET_OS_WASI
return _CFBundleWASIPlatformName;
#else
#error Unknown or unspecified DEPLOYMENT_TARGET
#endif
Expand All @@ -194,6 +198,8 @@ CF_EXPORT CFStringRef _CFGetAlternatePlatformName(void) {
#endif
#elif TARGET_OS_BSD
return CFSTR("FreeBSD");
#elif TARGET_OS_WASI
return CFSTR("WASI");
#else
#error Unknown or unspecified DEPLOYMENT_TARGET
#endif
Expand Down
4 changes: 3 additions & 1 deletion CoreFoundation/PlugIn.subproj/CFBundle_Internal.h
Expand Up @@ -32,7 +32,7 @@ CF_EXTERN_C_BEGIN
// FHS bundles are supported on the Swift and C runtimes, except on Windows.
#if !DEPLOYMENT_RUNTIME_OBJC && !TARGET_OS_WIN32

#if TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_ANDROID
#if TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_ANDROID || TARGET_OS_WASI
#define _CFBundleFHSSharedLibraryFilenamePrefix CFSTR("lib")
#define _CFBundleFHSSharedLibraryFilenameSuffix CFSTR(".so")
#elif TARGET_OS_MAC
Expand Down Expand Up @@ -390,6 +390,7 @@ extern void _CFPlugInWillUnload(CFPlugInRef plugIn);
#define _CFBundleSolarisPlatformName CFSTR("solaris")
#define _CFBundleLinuxPlatformName CFSTR("linux")
#define _CFBundleFreeBSDPlatformName CFSTR("freebsd")
#define _CFBundleWASIPlatformName CFSTR("wasi")
#define _CFBundleMacOSXPlatformNameSuffix CFSTR("-macos")
#define _CFBundleAlternateMacOSXPlatformNameSuffix CFSTR("-macosx")
#define _CFBundleiPhoneOSPlatformNameSuffix CFSTR("-iphoneos")
Expand All @@ -400,6 +401,7 @@ extern void _CFPlugInWillUnload(CFPlugInRef plugIn);
#define _CFBundleSolarisPlatformNameSuffix CFSTR("-solaris")
#define _CFBundleLinuxPlatformNameSuffix CFSTR("-linux")
#define _CFBundleFreeBSDPlatformNameSuffix CFSTR("-freebsd")
#define _CFBundleWASIPlatformNameSuffix CFSTR("-wasi")

STATIC_CONST_STRING_DECL(_CFBundleMacDeviceName, "mac");
STATIC_CONST_STRING_DECL(_CFBundleiPhoneDeviceName, "iphone");
Expand Down
4 changes: 4 additions & 0 deletions CoreFoundation/PlugIn.subproj/CFBundle_Resources.c
Expand Up @@ -507,6 +507,8 @@ CF_EXPORT CFStringRef _CFBundleGetCurrentPlatform(void) {
#endif
#elif TARGET_OS_BSD
return CFSTR("FreeBSD");
#elif TARGET_OS_WASI
return CFSTR("WASI");
#else
#error Unknown or unspecified DEPLOYMENT_TARGET
#endif
Expand All @@ -529,6 +531,8 @@ CF_PRIVATE CFStringRef _CFBundleGetPlatformExecutablesSubdirectoryName(void) {
#endif
#elif TARGET_OS_BSD
return CFSTR("FreeBSD");
#elif TARGET_OS_WASI
return CFSTR("WASI");
#else
#error Unknown or unspecified DEPLOYMENT_TARGET
#endif
Expand Down