Build ANGLE as a dynamic library
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Dec 2019 17:34:10 +0000 (17:34 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Dec 2019 17:34:10 +0000 (17:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=204708
Source/ThirdParty/ANGLE:

rdar://57349384

Reviewed by Tim Horton.

Take 2 at attempting this. The first time was rolled out
due to failures in Apple's upstream build system.

Modify ANGLE to build as a dynamic library. My (not thorough) testing suggests
this will reduce the in-flight binary size on Apple's build systems by at least
a factor of 10 (it was over 1G). Building release for x86_64-only:
    - Previously: libANGLE.a -- 306 MB
    - Now: libANGLE-shared.dylib -- 6.7 MB

In order to do this, some symbols needed to be exported from the
"sh" namespace (which are used in ANGLEWebKitBridge, but not when
ANGLE's rendering backend is active).

While here, I turned on some more build options, like ARC.

Lastly, I added a build phase that creates a fake libANGLE.a
because Apple's build system thinks that WebCore still needs it.

* ANGLE.xcodeproj/project.pbxproj: Link with IOKit and IOSurface frameworks, and
product a dylib product.
* Configurations/ANGLE.xcconfig: Update the configuration for a dynamic library.
* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:
* include/GLSLANG/ShaderLang.h: Add ANGLE_EXPORT to some functions to make
sure they will be visible in the exported library.
* include/GLSLANG/ShaderVars.h:
* src/libANGLE/renderer/gl/cgl/DisplayCGL.mm: Change reinterpret_cast to a normal
C cast so it can be annotated with __bridge.
(rx::DisplayCGL::isValidNativeWindow const):
* src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm: Ditto.
(rx::WindowSurfaceCGL::WindowSurfaceCGL):
(rx::WindowSurfaceCGL::~WindowSurfaceCGL):
* src/libANGLE/renderer/gl/eagl/DisplayEAGL.mm: Ditto.
* src/libANGLE/renderer/gl/eagl/WindowSurfaceEAGL.mm: Ditto.

Source/WebCore:

Reviewed by Tim Horton.

Weak link against libANGLE-shared.dylib rather than strong link to libANGLE.a.

* Configurations/WebCore.xcconfig:
* Configurations/WebCoreTestSupport.xcconfig:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/ANGLEWebKitBridge.cpp:
(WebCore::ANGLEWebKitBridge::ANGLEWebKitBridge):
(WebCore::ANGLEWebKitBridge::cleanupCompilers):
(WebCore::ANGLEWebKitBridge::compileShaderSource):
(WebCore::ANGLEWebKitBridge::angleAvailable):
* platform/graphics/ANGLEWebKitBridge.h:
* platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
(WebCore::GraphicsContext3D::GraphicsContext3D):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253824 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 files changed:
Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj
Source/ThirdParty/ANGLE/ChangeLog
Source/ThirdParty/ANGLE/Configurations/ANGLE.xcconfig
Source/ThirdParty/ANGLE/Configurations/Base.xcconfig
Source/ThirdParty/ANGLE/Configurations/DebugRelease.xcconfig
Source/ThirdParty/ANGLE/include/CMakeLists.txt
Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h
Source/ThirdParty/ANGLE/include/GLSLANG/ShaderVars.h
Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/DisplayCGL.mm
Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm
Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/eagl/DisplayEAGL.mm
Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/eagl/WindowSurfaceEAGL.mm
Source/WebCore/ChangeLog
Source/WebCore/Configurations/WebCore.xcconfig
Source/WebCore/Configurations/WebCoreTestSupport.xcconfig
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp
Source/WebCore/platform/graphics/ANGLEWebKitBridge.h
Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm

index dbec866..fe54861 100644 (file)
                5CB301461DE39F1A00D2C405 /* VertexArrayGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB301131DE39F1A00D2C405 /* VertexArrayGL.h */; };
                5CB3014F1DE39F4700D2C405 /* DisplayCGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB301491DE39F4700D2C405 /* DisplayCGL.h */; };
                5CB301511DE39F4700D2C405 /* PbufferSurfaceCGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB3014B1DE39F4700D2C405 /* PbufferSurfaceCGL.h */; };
-               5CB304921DE4156200D2C405 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CB3048D1DE4144400D2C405 /* OpenGL.framework */; };
                5CB304931DE4156B00D2C405 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CB3048F1DE4145500D2C405 /* QuartzCore.framework */; };
                5CB304941DE4157200D2C405 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CB3048B1DE4143500D2C405 /* CoreGraphics.framework */; };
                5CB304961DE4157B00D2C405 /* entry_points_egl_ext.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB300BC1DE39E7500D2C405 /* entry_points_egl_ext.h */; settings = {ATTRIBUTES = (Public, ); }; };
                313BCE532361133900FC39E5 /* DisplayEAGL.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DisplayEAGL.mm; sourceTree = "<group>"; };
                3153ACFE239071D900D51DD8 /* WebKitTargetConditionals.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = WebKitTargetConditionals.xcconfig; sourceTree = "<group>"; };
                3153ACFF239071D900D51DD8 /* Version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; };
+               3153AD002390C2EA00D51DD8 /* IOSurface.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOSurface.framework; path = System/Library/Frameworks/IOSurface.framework; sourceTree = SDKROOT; };
+               3153AD022390C32100D51DD8 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
                315EBD3E1FCE43BD00AC7A89 /* uniform_type_info_autogen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = uniform_type_info_autogen.cpp; sourceTree = "<group>"; };
                315EBD401FCE442600AC7A89 /* TranslatorVulkan.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TranslatorVulkan.cpp; sourceTree = "<group>"; };
                315EBD431FCE442700AC7A89 /* UtilsHLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UtilsHLSL.cpp; sourceTree = "<group>"; };
                A3694FC423202C5100A83D8F /* BuiltinsWorkaroundGLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BuiltinsWorkaroundGLSL.cpp; sourceTree = "<group>"; };
                A3694FC523202C5200A83D8F /* BuiltinsWorkaroundGLSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BuiltinsWorkaroundGLSL.h; sourceTree = "<group>"; };
                A3E827A8230CAE2C00E76682 /* commit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = commit.h; sourceTree = "<group>"; };
-               FB39D0D11200F0E300088E69 /* libANGLE.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libANGLE.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               FB39D0D11200F0E300088E69 /* libANGLE-shared.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libANGLE-shared.dylib"; sourceTree = BUILT_PRODUCTS_DIR; };
                FB39D2BF1200F3E600088E69 /* ShaderLang.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = ShaderLang.h; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
                        buildActionMask = 2147483647;
                        files = (
                                5CB304941DE4157200D2C405 /* CoreGraphics.framework in Frameworks */,
-                               5CB304921DE4156200D2C405 /* OpenGL.framework in Frameworks */,
                                5CB304931DE4156B00D2C405 /* QuartzCore.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        isa = PBXGroup;
                        children = (
                                5CB3048B1DE4143500D2C405 /* CoreGraphics.framework */,
+                               3153AD022390C32100D51DD8 /* IOKit.framework */,
+                               3153AD002390C2EA00D51DD8 /* IOSurface.framework */,
                                5CB3048D1DE4144400D2C405 /* OpenGL.framework */,
                                5CB3048F1DE4145500D2C405 /* QuartzCore.framework */,
                        );
                FB39D0CC1200EF9B00088E69 /* Products */ = {
                        isa = PBXGroup;
                        children = (
-                               FB39D0D11200F0E300088E69 /* libANGLE.a */,
+                               FB39D0D11200F0E300088E69 /* libANGLE-shared.dylib */,
                        );
                        name = Products;
                        sourceTree = "<group>";
                                312BDB0B15FECAB00097EBC7 /* CopyFiles */,
                                312BDB0D15FECACE0097EBC7 /* CopyFiles */,
                                6E28B8742294DD8000717E69 /* ShellScript */,
+                               313DE867239FFF91008FC47B /* Attempt to fool Apple Test Platform */,
                        );
                        buildRules = (
                                53E934DB230609D800DE060C /* PBXBuildRule */,
                        );
                        name = ANGLE;
                        productName = angle;
-                       productReference = FB39D0D11200F0E300088E69 /* libANGLE.a */;
-                       productType = "com.apple.product-type.library.static";
+                       productReference = FB39D0D11200F0E300088E69 /* libANGLE-shared.dylib */;
+                       productType = "com.apple.product-type.library.dynamic";
                };
 /* End PBXNativeTarget section */
 
 /* End PBXProject section */
 
 /* Begin PBXShellScriptBuildPhase section */
+               313DE867239FFF91008FC47B /* Attempt to fool Apple Test Platform */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputFileListPaths = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Attempt to fool Apple Test Platform";
+                       outputFileListPaths = (
+                       );
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "if [ \"$DEPLOYMENT_LOCATION\" == \"YES\" ] ; then\n    # Apple-internal build.\n    output_dir=${DSTROOT}${WK_ALTERNATE_FRAMEWORKS_DIR}/usr/local/lib\nelse\n    # External build.\n    output_dir=${BUILT_PRODUCTS_DIR}/usr/local/lib\nfi\n\nmkdir -p $output_dir\necho \"Fake file to fool Apple's test system\" > $output_dir/libANGLE.a\n";
+               };
                6E28B8742294DD8000717E69 /* ShellScript */ = {
                        isa = PBXShellScriptBuildPhase;
                        buildActionMask = 2147483647;
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 5D7C59C51208C68B001C873E /* ANGLE.xcconfig */;
                        buildSettings = {
-                               GCC_PREPROCESSOR_DEFINITIONS = (
-                                       ANGLE_ENABLE_OPENGL,
-                                       ANGLE_ENABLE_GLSL,
-                                       ANGLE_ENABLE_ESSL,
-                                       GL_SILENCE_DEPRECATION,
-                               );
-                               HEADER_SEARCH_PATHS = (
-                                       include,
-                                       src,
-                                       third_party/base,
-                                       src/common/third_party/base,
-                               );
-                               OTHER_CPLUSPLUSFLAGS = "$(ASAN_OTHER_CPLUSPLUSFLAGS)";
                        };
                        name = Production;
                };
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 5D7C59C51208C68B001C873E /* ANGLE.xcconfig */;
                        buildSettings = {
-                               GCC_PREPROCESSOR_DEFINITIONS = (
-                                       ANGLE_ENABLE_OPENGL,
-                                       ANGLE_ENABLE_GLSL,
-                                       ANGLE_ENABLE_ESSL,
-                                       GL_SILENCE_DEPRECATION,
-                               );
-                               HEADER_SEARCH_PATHS = (
-                                       include,
-                                       src,
-                                       third_party/base,
-                                       src/common/third_party/base,
-                               );
-                               OTHER_CPLUSPLUSFLAGS = "$(ASAN_OTHER_CPLUSPLUSFLAGS)";
                        };
                        name = Debug;
                };
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 5D7C59C51208C68B001C873E /* ANGLE.xcconfig */;
                        buildSettings = {
-                               GCC_PREPROCESSOR_DEFINITIONS = (
-                                       ANGLE_ENABLE_OPENGL,
-                                       ANGLE_ENABLE_GLSL,
-                                       ANGLE_ENABLE_ESSL,
-                                       GL_SILENCE_DEPRECATION,
-                               );
-                               HEADER_SEARCH_PATHS = (
-                                       include,
-                                       src,
-                                       third_party/base,
-                                       src/common/third_party/base,
-                               );
-                               OTHER_CPLUSPLUSFLAGS = "$(ASAN_OTHER_CPLUSPLUSFLAGS)";
                        };
                        name = Release;
                };
index 7f8593e..b9f0be4 100644 (file)
@@ -1,3 +1,46 @@
+2019-12-19  Dean Jackson  <dino@apple.com>
+
+        Build ANGLE as a dynamic library
+        https://bugs.webkit.org/show_bug.cgi?id=204708
+        rdar://57349384
+
+        Reviewed by Tim Horton.
+
+        Take 2 at attempting this. The first time was rolled out
+        due to failures in Apple's upstream build system.
+
+        Modify ANGLE to build as a dynamic library. My (not thorough) testing suggests
+        this will reduce the in-flight binary size on Apple's build systems by at least
+        a factor of 10 (it was over 1G). Building release for x86_64-only:
+            - Previously: libANGLE.a -- 306 MB
+            - Now: libANGLE-shared.dylib -- 6.7 MB
+
+        In order to do this, some symbols needed to be exported from the
+        "sh" namespace (which are used in ANGLEWebKitBridge, but not when
+        ANGLE's rendering backend is active).
+
+        While here, I turned on some more build options, like ARC.
+
+        Lastly, I added a build phase that creates a fake libANGLE.a
+        because Apple's build system thinks that WebCore still needs it.
+
+        * ANGLE.xcodeproj/project.pbxproj: Link with IOKit and IOSurface frameworks, and
+        product a dylib product.
+        * Configurations/ANGLE.xcconfig: Update the configuration for a dynamic library.
+        * Configurations/Base.xcconfig:
+        * Configurations/DebugRelease.xcconfig:
+        * include/GLSLANG/ShaderLang.h: Add ANGLE_EXPORT to some functions to make
+        sure they will be visible in the exported library.
+        * include/GLSLANG/ShaderVars.h:
+        * src/libANGLE/renderer/gl/cgl/DisplayCGL.mm: Change reinterpret_cast to a normal
+        C cast so it can be annotated with __bridge.
+        (rx::DisplayCGL::isValidNativeWindow const):
+        * src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm: Ditto.
+        (rx::WindowSurfaceCGL::WindowSurfaceCGL):
+        (rx::WindowSurfaceCGL::~WindowSurfaceCGL):
+        * src/libANGLE/renderer/gl/eagl/DisplayEAGL.mm: Ditto.
+        * src/libANGLE/renderer/gl/eagl/WindowSurfaceEAGL.mm: Ditto.
+
 2019-12-19  ChangSeok Oh  <changseok@webkit.org>
 
         [GTK] Build fix for ANGLE_WEBGL after r253650
index 52cd271..92475dc 100644 (file)
@@ -1,14 +1,44 @@
 #include "Version.xcconfig"
 #include "WebKitTargetConditionals.xcconfig"
 
-PRODUCT_NAME = ANGLE;
+PRODUCT_NAME = ANGLE-shared;
+
+EXECUTABLE_PREFIX = lib;
+
+ANGLE_OTHER_LDFLAGS = -allowable_client WebCore -allowable_client WebCoreTestSupport $(ANGLE_OTHER_LDFLAGS_$(WK_PLATFORM_NAME));
+ANGLE_OTHER_LDFLAGS_iphoneos = -framework IOSurface -framework OpenGLES;
+ANGLE_OTHER_LDFLAGS_iphonesimulator = $(ANGLE_OTHER_LDFLAGS_iphoneos);
+ANGLE_OTHER_LDFLAGS_watchos = $(ANGLE_OTHER_LDFLAGS_iphoneos);
+ANGLE_OTHER_LDFLAGS_watchsimulator = $(ANGLE_OTHER_LDFLAGS_iphonesimulator);
+ANGLE_OTHER_LDFLAGS_appletvos = $(ANGLE_OTHER_LDFLAGS_iphoneos);
+ANGLE_OTHER_LDFLAGS_appletvsimulator = $(ANGLE_OTHER_LDFLAGS_iphonesimulator);
+ANGLE_OTHER_LDFLAGS_maccatalyst = -framework IOKit -framework IOSurface -framework OpenGL;
+ANGLE_OTHER_LDFLAGS_macosx = -framework IOKit -framework IOSurface -framework OpenGL;
+
+INSTALL_PATH = $(NORMAL_WEBCORE_FRAMEWORKS_DIR)/WebCore.framework/Frameworks;
+INSTALL_PATH[sdk=macosx*] = $(INSTALL_PATH_USE_OVERRIDE_FRAMEWORKS_DIR_$(WK_USE_OVERRIDE_FRAMEWORKS_DIR));
+INSTALL_PATH_USE_OVERRIDE_FRAMEWORKS_DIR_NO = $(NORMAL_WEBCORE_FRAMEWORKS_DIR)/WebCore.framework/Versions/A/Frameworks;
+INSTALL_PATH_USE_OVERRIDE_FRAMEWORKS_DIR_YES = $(WK_OVERRIDE_FRAMEWORKS_DIR);
+
+DYLIB_INSTALL_NAME_BASE[sdk=macosx*] = $(DYLIB_INSTALL_NAME_BASE_USE_OVERRIDE_FRAMEWORKS_DIR_$(WK_USE_OVERRIDE_FRAMEWORKS_DIR));
+DYLIB_INSTALL_NAME_BASE_USE_OVERRIDE_FRAMEWORKS_DIR_NO = $(DYLIB_INSTALL_NAME_BASE_WK_RELOCATABLE_FRAMEWORKS_$(WK_RELOCATABLE_FRAMEWORKS));
+DYLIB_INSTALL_NAME_BASE_USE_OVERRIDE_FRAMEWORKS_DIR_YES = @loader_path/../../../;
+DYLIB_INSTALL_NAME_BASE_WK_RELOCATABLE_FRAMEWORKS_ = $(DYLIB_INSTALL_NAME_BASE);
+DYLIB_INSTALL_NAME_BASE_WK_RELOCATABLE_FRAMEWORKS_YES = @loader_path/../../../;
+
+HEADER_SEARCH_PATHS = include src src/common/third_party/numerics third_party/base src/common/third_party/base;
+
+ANGLE_HEADERS_FOLDER_PATH = /usr/local/include/ANGLE;
+
+PUBLIC_HEADERS_FOLDER_PATH = $(ANGLE_HEADERS_FOLDER_PATH);
+PUBLIC_HEADERS_FOLDER_PATH[sdk=macosx*] = $(PUBLIC_HEADERS_FOLDER_PATH_$(WK_PLATFORM_NAME));
+PUBLIC_HEADERS_FOLDER_PATH_macosx = $(ANGLE_HEADERS_FOLDER_PATH);
+PUBLIC_HEADERS_FOLDER_PATH_maccatalyst = $(WK_ALTERNATE_FRAMEWORKS_DIR)/$(ANGLE_HEADERS_FOLDER_PATH);
+
+USE_HEADERMAP = NO;
+
+GCC_PREPROCESSOR_DEFINITIONS = LIBGLESV2_IMPLEMENTATION LIBANGLE_IMPLEMENTATION ANGLE_ENABLE_OPENGL ANGLE_ENABLE_GLSL ANGLE_ENABLE_ESSL GL_SILENCE_DEPRECATION;
+
+INSTALLHDRS_SCRIPT_PHASE = YES;
 
 APPLY_RULES_IN_COPY_HEADERS = $(USE_NEW_BUILD_SYSTEM);
-CLANG_WARN_BOOL_CONVERSION = YES;
-CLANG_WARN_ENUM_CONVERSION = YES;
-CLANG_WARN_INT_CONVERSION = YES;
-COMBINE_HIDPI_IMAGES = NO;
-ENABLE_STRICT_OBJC_MSGSEND = YES;
-HEADER_SEARCH_PATHS = include src src/common/third_party/numerics;
-INSTALL_PATH = $(ANGLE_INSTALL_PATH_PREFIX)/usr/local/lib;
-PUBLIC_HEADERS_FOLDER_PATH = $(ANGLE_INSTALL_PATH_PREFIX)/usr/local/include/ANGLE;
index 0ae54e3..a24e002 100644 (file)
@@ -1,8 +1,12 @@
 #include? "../../../../../Internal/Configurations/HaveInternalSDK.xcconfig"
+#include? "<DEVELOPER_DIR>/AppleInternal/XcodeConfig/PlatformSupport.xcconfig"
 #include "SDKVariant.xcconfig"
+#include "WebKitTargetConditionals.xcconfig"
 
 CODE_SIGN_IDENTITY = -;
 
+SDKROOT = macosx.internal;
+
 USE_INTERNAL_SDK = $(USE_INTERNAL_SDK_$(CONFIGURATION));
 USE_INTERNAL_SDK_Production = YES;
 USE_INTERNAL_SDK_Debug = $(HAVE_INTERNAL_SDK);
@@ -10,33 +14,33 @@ USE_INTERNAL_SDK_Release = $(HAVE_INTERNAL_SDK);
 
 ALWAYS_SEARCH_USER_PATHS = NO;
 
+CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
 CLANG_CXX_LANGUAGE_STANDARD = gnu++1z;
 CLANG_CXX_LIBRARY = libc++;
+CLANG_ENABLE_OBJC_ARC = YES;
 CLANG_ENABLE_OBJC_WEAK = YES;
 CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
 CLANG_WARN_BOOL_CONVERSION = YES;
 CLANG_WARN_COMMA = YES;
 CLANG_WARN_CONSTANT_CONVERSION = YES;
+CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
 CLANG_WARN_EMPTY_BODY = YES;
 CLANG_WARN_ENUM_CONVERSION = YES;
 CLANG_WARN_INFINITE_RECURSION = YES;
 CLANG_WARN_INT_CONVERSION = YES;
 CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
-CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
 CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
 CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
-CLANG_WARN_SUSPICIOUS_MOVE = YES;
 CLANG_WARN_STRICT_PROTOTYPES = YES;
+CLANG_WARN_SUSPICIOUS_MOVE = YES;
 CLANG_WARN_UNREACHABLE_CODE = YES;
-CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
-DEAD_CODE_STRIPPING = YES;
-DEBUG_INFORMATION_FORMAT = dwarf-with-dsym;
+
 GCC_C_LANGUAGE_STANDARD = gnu99;
 GCC_DEBUGGING_SYMBOLS = default;
 GCC_ENABLE_CPP_EXCEPTIONS = NO;
 GCC_ENABLE_CPP_RTTI = NO;
 GCC_ENABLE_OBJC_EXCEPTIONS = YES;
-ENABLE_STRICT_OBJC_MSGSEND = YES;
 GCC_ENABLE_SYMBOL_SEPARATION = NO;
 GCC_FAST_OBJC_DISPATCH = YES;
 GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
@@ -45,22 +49,26 @@ GCC_OBJC_CALL_CXX_CDTORS = YES;
 GCC_OPTIMIZATION_LEVEL = s;
 GCC_PRECOMPILE_PREFIX_HEADER = NO;
 GCC_SYMBOLS_PRIVATE_EXTERN = YES;
+GCC_SYMBOLS_PRIVATE_EXTERN = YES;
 GCC_THREADSAFE_STATICS = NO;
 GCC_TREAT_WARNINGS_AS_ERRORS = YES;
 GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
-GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
+GCC_WARN_ABOUT_MISSING_NEWLINE = NO;
 GCC_WARN_ABOUT_RETURN_TYPE = YES;
 GCC_WARN_UNDECLARED_SELECTOR = YES;
-CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
-CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
 GCC_WARN_UNINITIALIZED_AUTOS = YES;
 GCC_WARN_UNUSED_FUNCTION = YES;
 GCC_WARN_UNUSED_VARIABLE = YES;
+
+DEAD_CODE_STRIPPING = YES;
+DEBUG_INFORMATION_FORMAT = dwarf-with-dsym;
+ENABLE_STRICT_OBJC_MSGSEND = YES;
+
 PREBINDING = NO;
 STRIP_INSTALLED_PRODUCT = NO;
-WARNING_CFLAGS = -Wglobal-constructors -Wno-newline-eof -Wno-inconsistent-missing-override;
+WARNING_CFLAGS = -Wglobal-constructors -Wno-inconsistent-missing-override;
 
 SUPPORTED_PLATFORMS = iphoneos iphonesimulator macosx appletvos appletvsimulator watchos watchsimulator;
 
@@ -72,11 +80,24 @@ TARGET_MAC_OS_X_VERSION_MAJOR_16 = 101600;
 
 OTHER_CFLAGS = $(ASAN_OTHER_CFLAGS);
 OTHER_CPLUSPLUSFLAGS = $(ASAN_OTHER_CPLUSPLUSFLAGS);
-OTHER_LDFLAGS = $(ASAN_OTHER_LDFLAGS);
+OTHER_LDFLAGS = $(ASAN_OTHER_LDFLAGS) $(ANGLE_OTHER_LDFLAGS);
 
 ANGLE_INSTALL_PATH_PREFIX = $(ANGLE_INSTALL_PATH_PREFIX_DEPLOYMENT_$(DEPLOYMENT_LOCATION));
 ANGLE_INSTALL_PATH_PREFIX_DEPLOYMENT_YES = $(ANGLE_INSTALL_PATH_PREFIX_DEPLOYMENT_YES_USE_ALTERNATE_$(WK_USE_ALTERNATE_FRAMEWORKS_DIR));
-ANGLE_INSTALL_PATH_PREFIX_DEPLOYMENT_YES_USE_ALTERNATE_YES = $(WK_ALTERNATE_FRAMEWORKS_DIR)/;
+ANGLE_INSTALL_PATH_PREFIX_DEPLOYMENT_YES_USE_ALTERNATE_YES = $(WK_ALTERNATE_FRAMEWORKS_DIR);
+
+NORMAL_WEBCORE_FRAMEWORKS_DIR = $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks;
+NORMAL_WEBCORE_FRAMEWORKS_DIR[sdk=macosx*] = $(NORMAL_WEBCORE_FRAMEWORKS_DIR_$(WK_PLATFORM_NAME));
+NORMAL_WEBCORE_FRAMEWORKS_DIR_macosx = $(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks;
+NORMAL_WEBCORE_FRAMEWORKS_DIR_maccatalyst = $(WK_ALTERNATE_FRAMEWORKS_DIR)/$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks;
+
+WK_USE_OVERRIDE_FRAMEWORKS_DIR = $(WK_NOT_$(WK_EMPTY_$(WK_OVERRIDE_FRAMEWORKS_DIR)));
+
+WK_OVERRIDE_FRAMEWORKS_DIR = $(WK_OVERRIDE_FRAMEWORKS_DIR_USE_STAGING_INSTALL_PATH_$(USE_STAGING_INSTALL_PATH));
+WK_OVERRIDE_FRAMEWORKS_DIR_USE_STAGING_INSTALL_PATH_YES = $(WK_INSTALL_PATH_PREFIX)$(SYSTEM_LIBRARY_DIR)/StagedFrameworks/Safari;
+
+WK_INSTALL_PATH_PREFIX = $(WK_INSTALL_PATH_PREFIX_DEPLOYMENT_$(DEPLOYMENT_LOCATION)$(WK_MACOS_1015)_USE_STAGING_INSTALL_PATH_$(USE_STAGING_INSTALL_PATH));
+WK_INSTALL_PATH_PREFIX_DEPLOYMENT_YES_MACOS_SINCE_1015_USE_STAGING_INSTALL_PATH_YES = $(PLATFORM_OOB_SYSTEM_CONTENT_DIR);
 
 // Disable on all platforms other than macOS, due to <rdar://problem/49013399>.
 LLVM_LTO = NO;
index 486b914..48ad5ca 100644 (file)
@@ -20,6 +20,8 @@ SDKROOT = $(SDKROOT_$(USE_INTERNAL_SDK));
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
 
+WK_RELOCATABLE_FRAMEWORKS = YES;
+
 WK_DEFAULT_LTO_MODE = $(WK_USER_LTO_MODE_none);
 
 WK_CCACHE_DIR = $(SRCROOT)/../../../Tools/ccache;
index dcea392..2f6d5f7 100644 (file)
@@ -16,6 +16,7 @@ set(khr_headers ${includes})
 list(FILTER khr_headers INCLUDE REGEX "KHR/.*")
 
 set(glslang_headers
+    export.h
     GLSLANG/ShaderLang.h
     GLSLANG/ShaderVars.h
 )
index 964e937..12b1e1a 100644 (file)
@@ -525,26 +525,26 @@ namespace sh
 // Driver must call this first, once, before doing any other compiler operations.
 // If the function succeeds, the return value is true, else false.
 //
-bool Initialize();
+ANGLE_EXPORT bool Initialize();
 //
 // Driver should call this at shutdown.
 // If the function succeeds, the return value is true, else false.
 //
-bool Finalize();
+ANGLE_EXPORT bool Finalize();
 
 //
 // Initialize built-in resources with minimum expected values.
 // Parameters:
 // resources: The object to initialize. Will be comparable with memcmp.
 //
-void InitBuiltInResources(ShBuiltInResources *resources);
+ANGLE_EXPORT void InitBuiltInResources(ShBuiltInResources *resources);
 
 //
 // Returns the a concatenated list of the items in ShBuiltInResources as a null-terminated string.
 // This function must be updated whenever ShBuiltInResources is changed.
 // Parameters:
 // handle: Specifies the handle of the compiler to be used.
-const std::string &GetBuiltInResourcesString(const ShHandle handle);
+ANGLE_EXPORT const std::string &GetBuiltInResourcesString(const ShHandle handle);
 
 //
 // Driver calls these to create and destroy compiler objects.
@@ -557,11 +557,11 @@ const std::string &GetBuiltInResourcesString(const ShHandle handle);
 //         SH_HLSL_3_0_OUTPUT or SH_HLSL_4_1_OUTPUT. Note: Each output type may only
 //         be supported in some configurations.
 // resources: Specifies the built-in resources.
-ShHandle ConstructCompiler(sh::GLenum type,
-                           ShShaderSpec spec,
-                           ShShaderOutput output,
-                           const ShBuiltInResources *resources);
-void Destruct(ShHandle handle);
+ANGLE_EXPORT ShHandle ConstructCompiler(sh::GLenum type,
+                                        ShShaderSpec spec,
+                                        ShShaderOutput output,
+                                        const ShBuiltInResources *resources);
+ANGLE_EXPORT void Destruct(ShHandle handle);
 
 //
 // Compiles the given shader source.
@@ -587,35 +587,35 @@ void Destruct(ShHandle handle);
 // SH_VARIABLES: Extracts attributes, uniforms, and varyings.
 //               Can be queried by calling ShGetVariableInfo().
 //
-bool Compile(const ShHandle handle,
+ANGLE_EXPORT bool Compile(const ShHandle handle,
              const char *const shaderStrings[],
              size_t numStrings,
              ShCompileOptions compileOptions);
 
 // Clears the results from the previous compilation.
-void ClearResults(const ShHandle handle);
+ANGLE_EXPORT void ClearResults(const ShHandle handle);
 
 // Return the version of the shader language.
-int GetShaderVersion(const ShHandle handle);
+ANGLE_EXPORT int GetShaderVersion(const ShHandle handle);
 
 // Return the currently set language output type.
-ShShaderOutput GetShaderOutputType(const ShHandle handle);
+ANGLE_EXPORT ShShaderOutput GetShaderOutputType(const ShHandle handle);
 
 // Returns null-terminated information log for a compiled shader.
 // Parameters:
 // handle: Specifies the compiler
-const std::string &GetInfoLog(const ShHandle handle);
+ANGLE_EXPORT const std::string &GetInfoLog(const ShHandle handle);
 
 // Returns null-terminated object code for a compiled shader.
 // Parameters:
 // handle: Specifies the compiler
-const std::string &GetObjectCode(const ShHandle handle);
+ANGLE_EXPORT const std::string &GetObjectCode(const ShHandle handle);
 
 // Returns a (original_name, hash) map containing all the user defined names in the shader,
 // including variable names, function names, struct names, and struct field names.
 // Parameters:
 // handle: Specifies the compiler
-const std::map<std::string, std::string> *GetNameHashingMap(const ShHandle handle);
+ANGLE_EXPORT const std::map<std::string, std::string> *GetNameHashingMap(const ShHandle handle);
 
 // Shader variable inspection.
 // Returns a pointer to a list of variables of the designated type.
@@ -623,19 +623,19 @@ const std::map<std::string, std::string> *GetNameHashingMap(const ShHandle handl
 // Returns NULL on failure.
 // Parameters:
 // handle: Specifies the compiler
-const std::vector<sh::ShaderVariable> *GetUniforms(const ShHandle handle);
-const std::vector<sh::ShaderVariable> *GetVaryings(const ShHandle handle);
-const std::vector<sh::ShaderVariable> *GetInputVaryings(const ShHandle handle);
-const std::vector<sh::ShaderVariable> *GetOutputVaryings(const ShHandle handle);
-const std::vector<sh::ShaderVariable> *GetAttributes(const ShHandle handle);
-const std::vector<sh::ShaderVariable> *GetOutputVariables(const ShHandle handle);
-const std::vector<sh::InterfaceBlock> *GetInterfaceBlocks(const ShHandle handle);
-const std::vector<sh::InterfaceBlock> *GetUniformBlocks(const ShHandle handle);
-const std::vector<sh::InterfaceBlock> *GetShaderStorageBlocks(const ShHandle handle);
-sh::WorkGroupSize GetComputeShaderLocalGroupSize(const ShHandle handle);
+ANGLE_EXPORT const std::vector<sh::ShaderVariable> *GetUniforms(const ShHandle handle);
+ANGLE_EXPORT const std::vector<sh::ShaderVariable> *GetVaryings(const ShHandle handle);
+ANGLE_EXPORT const std::vector<sh::ShaderVariable> *GetInputVaryings(const ShHandle handle);
+ANGLE_EXPORT const std::vector<sh::ShaderVariable> *GetOutputVaryings(const ShHandle handle);
+ANGLE_EXPORT const std::vector<sh::ShaderVariable> *GetAttributes(const ShHandle handle);
+ANGLE_EXPORT const std::vector<sh::ShaderVariable> *GetOutputVariables(const ShHandle handle);
+ANGLE_EXPORT const std::vector<sh::InterfaceBlock> *GetInterfaceBlocks(const ShHandle handle);
+ANGLE_EXPORT const std::vector<sh::InterfaceBlock> *GetUniformBlocks(const ShHandle handle);
+ANGLE_EXPORT const std::vector<sh::InterfaceBlock> *GetShaderStorageBlocks(const ShHandle handle);
+ANGLE_EXPORT sh::WorkGroupSize GetComputeShaderLocalGroupSize(const ShHandle handle);
 // Returns the number of views specified through the num_views layout qualifier. If num_views is
 // not set, the function returns -1.
-int GetVertexShaderNumViews(const ShHandle handle);
+ANGLE_EXPORT int GetVertexShaderNumViews(const ShHandle handle);
 
 // Returns true if the passed in variables pack in maxVectors followingthe packing rules from the
 // GLSL 1.017 spec, Appendix A, section 7.
@@ -644,8 +644,8 @@ int GetVertexShaderNumViews(const ShHandle handle);
 // Parameters:
 // maxVectors: the available rows of registers.
 // variables: an array of variables.
-bool CheckVariablesWithinPackingLimits(int maxVectors,
-                                       const std::vector<sh::ShaderVariable> &variables);
+ANGLE_EXPORT bool CheckVariablesWithinPackingLimits(int maxVectors,
+                                                    const std::vector<sh::ShaderVariable> &variables);
 
 // Gives the compiler-assigned register for a shader storage block.
 // The method writes the value to the output variable "indexOut".
@@ -654,9 +654,9 @@ bool CheckVariablesWithinPackingLimits(int maxVectors,
 // handle: Specifies the compiler
 // shaderStorageBlockName: Specifies the shader storage block
 // indexOut: output variable that stores the assigned register
-bool GetShaderStorageBlockRegister(const ShHandle handle,
-                                   const std::string &shaderStorageBlockName,
-                                   unsigned int *indexOut);
+ANGLE_EXPORT bool GetShaderStorageBlockRegister(const ShHandle handle,
+                                                const std::string &shaderStorageBlockName,
+                                                unsigned int *indexOut);
 
 // Gives the compiler-assigned register for a uniform block.
 // The method writes the value to the output variable "indexOut".
@@ -665,13 +665,13 @@ bool GetShaderStorageBlockRegister(const ShHandle handle,
 // handle: Specifies the compiler
 // uniformBlockName: Specifies the uniform block
 // indexOut: output variable that stores the assigned register
-bool GetUniformBlockRegister(const ShHandle handle,
-                             const std::string &uniformBlockName,
-                             unsigned int *indexOut);
+ANGLE_EXPORT bool GetUniformBlockRegister(const ShHandle handle,
+                                          const std::string &uniformBlockName,
+                                          unsigned int *indexOut);
 
 // Gives a map from uniform names to compiler-assigned registers in the default uniform block.
 // Note that the map contains also registers of samplers that have been extracted from structs.
-const std::map<std::string, unsigned int> *GetUniformRegisterMap(const ShHandle handle);
+ANGLE_EXPORT const std::map<std::string, unsigned int> *GetUniformRegisterMap(const ShHandle handle);
 
 // Sampler, image and atomic counters share registers(t type and u type),
 // GetReadonlyImage2DRegisterIndex and GetImage2DRegisterIndex return the first index into
index e2a67a2..4478aee 100644 (file)
@@ -10,6 +10,8 @@
 #ifndef GLSLANG_SHADERVARS_H_
 #define GLSLANG_SHADERVARS_H_
 
+#include "export.h"
+
 #include <algorithm>
 #include <array>
 #include <string>
@@ -62,12 +64,12 @@ enum class BlockType
 // See https://code.google.com/p/angleproject/issues/detail?id=697
 struct ShaderVariable
 {
-    ShaderVariable();
+    ANGLE_EXPORT ShaderVariable();
     ShaderVariable(GLenum typeIn);
     ShaderVariable(GLenum typeIn, unsigned int arraySizeIn);
-    ~ShaderVariable();
-    ShaderVariable(const ShaderVariable &other);
-    ShaderVariable &operator=(const ShaderVariable &other);
+    ANGLE_EXPORT ~ShaderVariable();
+    ANGLE_EXPORT ShaderVariable(const ShaderVariable &other);
+    ANGLE_EXPORT ShaderVariable &operator=(const ShaderVariable &other);
     bool operator==(const ShaderVariable &other) const;
     bool operator!=(const ShaderVariable &other) const { return !operator==(other); }
 
index cd8a6ca..1482139 100644 (file)
@@ -292,7 +292,7 @@ egl::Error DisplayCGL::restoreLostDevice(const egl::Display *display)
 
 bool DisplayCGL::isValidNativeWindow(EGLNativeWindowType window) const
 {
-    NSObject *layer = reinterpret_cast<NSObject *>(window);
+    NSObject *layer = (__bridge NSObject *)window;
     return [layer isKindOfClass:[CALayer class]];
 }
 
index 54d8320..9c49818 100644 (file)
@@ -153,7 +153,7 @@ WindowSurfaceCGL::WindowSurfaceCGL(const egl::SurfaceState &state,
     : SurfaceGL(state),
       mSwapLayer(nil),
       mCurrentSwapId(0),
-      mLayer(reinterpret_cast<CALayer *>(layer)),
+      mLayer((__bridge CALayer *)layer),
       mContext(context),
       mFunctions(renderer->getFunctions()),
       mStateManager(renderer->getStateManager()),
@@ -175,7 +175,6 @@ WindowSurfaceCGL::~WindowSurfaceCGL()
     if (mSwapLayer != nil)
     {
         [mSwapLayer removeFromSuperlayer];
-        [mSwapLayer release];
         mSwapLayer = nil;
     }
 
index 8be13cf..a4f4309 100644 (file)
@@ -137,7 +137,6 @@ void DisplayEAGL::terminate()
     if (mContext != nullptr)
     {
         [EAGLContext setCurrentContext:nil];
-        [mContext release];
         mContext = nullptr;
     }
 }
@@ -268,7 +267,7 @@ egl::Error DisplayEAGL::restoreLostDevice(const egl::Display *display)
 
 bool DisplayEAGL::isValidNativeWindow(EGLNativeWindowType window) const
 {
-    NSObject *layer = reinterpret_cast<NSObject *>(window);
+    NSObject *layer = (__bridge NSObject *)window;
     return [layer isKindOfClass:[CALayer class]];
 }
 
@@ -359,7 +358,6 @@ WorkerContextEAGL::WorkerContextEAGL(EAGLContextObj context) : mContext(context)
 WorkerContextEAGL::~WorkerContextEAGL()
 {
     [EAGLContext setCurrentContext:nil];
-    [mContext release];
     mContext = nullptr;
 }
 
index 65f3eb7..fd9d537 100644 (file)
@@ -138,7 +138,7 @@ WindowSurfaceEAGL::WindowSurfaceEAGL(const egl::SurfaceState &state,
     : SurfaceGL(state),
       mSwapLayer(nil),
       mCurrentSwapId(0),
-      mLayer(reinterpret_cast<CALayer *>(layer)),
+      mLayer((__bridge CALayer *)layer),
       mContext(context),
       mFunctions(renderer->getFunctions()),
       mStateManager(renderer->getStateManager()),
@@ -160,7 +160,6 @@ WindowSurfaceEAGL::~WindowSurfaceEAGL()
     if (mSwapLayer != nil)
     {
         [mSwapLayer removeFromSuperlayer];
-        [mSwapLayer release];
         mSwapLayer = nil;
     }
 
index 25e3b05..a77369a 100644 (file)
@@ -1,3 +1,25 @@
+2019-12-19  Dean Jackson  <dino@apple.com>
+
+        Build ANGLE as a dynamic library
+        https://bugs.webkit.org/show_bug.cgi?id=204708
+        rdar://57349384
+
+        Reviewed by Tim Horton.
+
+        Weak link against libANGLE-shared.dylib rather than strong link to libANGLE.a.
+
+        * Configurations/WebCore.xcconfig:
+        * Configurations/WebCoreTestSupport.xcconfig:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/ANGLEWebKitBridge.cpp:
+        (WebCore::ANGLEWebKitBridge::ANGLEWebKitBridge):
+        (WebCore::ANGLEWebKitBridge::cleanupCompilers):
+        (WebCore::ANGLEWebKitBridge::compileShaderSource):
+        (WebCore::ANGLEWebKitBridge::angleAvailable):
+        * platform/graphics/ANGLEWebKitBridge.h:
+        * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
+        (WebCore::GraphicsContext3D::GraphicsContext3D):
+
 2019-12-20  Antti Koivisto  <antti@apple.com>
 
         Invalidate only affected elements after media query evaluation changes
index a0add2a..4e448ff 100644 (file)
@@ -39,12 +39,12 @@ FRAMEWORK_SEARCH_PATHS[sdk=macosx*] = $(WK_QUOTED_OVERRIDE_FRAMEWORKS_DIR);
 
 SYSTEM_FRAMEWORK_SEARCH_PATHS = $(inherited) $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks
 
-WK_LIBWEBRTC_LIBRARY_DIR = $(WEBCORE_FRAMEWORKS_DIR)/WebCore.framework/Frameworks
-WK_LIBWEBRTC_LIBRARY_DIR[sdk=macosx*] = $(WK_LIBWEBRTC_LIBRARY_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_$(WK_USE_OVERRIDE_FRAMEWORKS_DIR));
-WK_LIBWEBRTC_LIBRARY_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_NO = $(WEBCORE_FRAMEWORKS_DIR)/WebCore.framework/Versions/A/Frameworks;
-WK_LIBWEBRTC_LIBRARY_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_YES = $(WK_OVERRIDE_FRAMEWORKS_DIR);
+WK_EMBEDDED_LIBRARY_DIR = $(WEBCORE_FRAMEWORKS_DIR)/WebCore.framework/Frameworks
+WK_EMBEDDED_LIBRARY_DIR[sdk=macosx*] = $(WK_EMBEDDED_LIBRARY_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_$(WK_USE_OVERRIDE_FRAMEWORKS_DIR));
+WK_EMBEDDED_LIBRARY_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_YES = $(WK_OVERRIDE_FRAMEWORKS_DIR);
+WK_EMBEDDED_LIBRARY_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_NO = $(WEBCORE_FRAMEWORKS_DIR)/WebCore.framework/Versions/A/Frameworks;
 
-LIBRARY_SEARCH_PATHS = $(inherited) "$(WK_LIBWEBRTC_LIBRARY_DIR)";
+LIBRARY_SEARCH_PATHS = $(inherited) "$(WK_EMBEDDED_LIBRARY_DIR)";
 
 WEBKITADDITIONS_HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include/WebKitAdditions $(SDKROOT)/usr/local/include/WebKitAdditions;
 ANGLE_HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include/ANGLE $(SDKROOT)/usr/local/include/ANGLE;
@@ -95,6 +95,8 @@ WK_IOSURFACE_ACCELERATOR_LDFLAGS_iphoneos = -framework IOSurfaceAccelerator;
 WK_IOSURFACE_ACCELERATOR_LDFLAGS_watchos = $(WK_IOSURFACE_ACCELERATOR_LDFLAGS_iphoneos);
 WK_IOSURFACE_ACCELERATOR_LDFLAGS_appletvos = $(WK_IOSURFACE_ACCELERATOR_LDFLAGS_iphoneos);
 
+WK_ANGLE_LDFLAGS = -weak-lANGLE-shared;
+
 WK_LIBWEBRTC_LDFLAGS = $(WK_LIBWEBRTC_LDFLAGS_$(ENABLE_WEB_RTC));
 WK_LIBWEBRTC_LDFLAGS_ENABLE_WEB_RTC = -framework VideoToolbox -framework CoreMedia -weak-lwebrtc;
 
@@ -125,7 +127,7 @@ WK_URL_FORMATTING_LDFLAGS = $(WK_URL_FORMATTING_LDFLAGS_$(WK_HAVE_URL_FORMATTING
 WK_URL_FORMATTING_LDFLAGS_YES = -framework URLFormatting;
 
 // FIXME: Reduce the number of allowable_clients <rdar://problem/31823969>
-OTHER_LDFLAGS = $(inherited) $(WK_RELOCATABLE_FRAMEWORK_LDFLAGS) $(WK_UNDEFINED_SYMBOLS_LDFLAGS) -lsqlite3 -lobjc -lANGLE -allowable_client WebCoreTestSupport -allowable_client WebKitLegacy -force_load $(BUILT_PRODUCTS_DIR)/libPAL.a -framework CFNetwork -framework CoreAudio -framework CoreGraphics -framework CoreText -framework Foundation -framework IOSurface -framework ImageIO -framework Metal $(OTHER_LDFLAGS_PLATFORM_$(WK_COCOA_TOUCH)) $(OTHER_LDFLAGS_PLATFORM_$(WK_PLATFORM_NAME)) $(WK_APPKIT_LDFLAGS) $(WK_APPSUPPORT_LDFLAGS) $(WK_AUDIO_UNIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_UI_LDFLAGS) $(WK_DATA_DETECTORS_CORE_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_IOSURFACE_ACCELERATOR_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_SYSTEM_CONFIGURATION_LDFLAGS) $(WK_SYSTEM_PREVIEW_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS);
+OTHER_LDFLAGS = $(inherited) $(WK_RELOCATABLE_FRAMEWORK_LDFLAGS) $(WK_UNDEFINED_SYMBOLS_LDFLAGS) -lsqlite3 -lobjc -allowable_client WebCoreTestSupport -allowable_client WebKitLegacy -force_load $(BUILT_PRODUCTS_DIR)/libPAL.a -framework CFNetwork -framework CoreAudio -framework CoreGraphics -framework CoreText -framework Foundation -framework IOSurface -framework ImageIO -framework Metal $(OTHER_LDFLAGS_PLATFORM_$(WK_COCOA_TOUCH)) $(OTHER_LDFLAGS_PLATFORM_$(WK_PLATFORM_NAME)) $(WK_APPKIT_LDFLAGS) $(WK_APPSUPPORT_LDFLAGS) $(WK_AUDIO_UNIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_UI_LDFLAGS) $(WK_DATA_DETECTORS_CORE_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_IOSURFACE_ACCELERATOR_LDFLAGS) $(WK_ANGLE_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_SYSTEM_CONFIGURATION_LDFLAGS) $(WK_SYSTEM_PREVIEW_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS);
 
 OTHER_LDFLAGS_PLATFORM_cocoatouch = -allowable_client WebKit -allowable_client iTunesU -allowable_client Casablanca -allowable_client Remote -allowable_client TVBooks -allowable_client DumpRenderTree -allowable_client WebKitTestRunner -allowable_client TestWebKitAPI;
 OTHER_LDFLAGS_PLATFORM_macosx = -sub_library libobjc -umbrella WebKit;
@@ -139,7 +141,9 @@ SECTORDER_FLAGS_Production[sdk=iphoneos*] = -Wl,-order_file,$(SDKROOT)/AppleInte
 SECTORDER_FLAGS_Production[sdk=macosx*] = -Wl,-order_file,WebCore.order;
 
 NORMAL_WEBCORE_FRAMEWORKS_DIR[sdk=iphone*] = $(PRODUCTION_FRAMEWORKS_DIR);
-NORMAL_WEBCORE_FRAMEWORKS_DIR[sdk=macosx*] = $(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks;
+NORMAL_WEBCORE_FRAMEWORKS_DIR[sdk=macosx*] = $(NORMAL_WEBCORE_FRAMEWORKS_DIR_$(WK_PLATFORM_NAME));
+NORMAL_WEBCORE_FRAMEWORKS_DIR_macosx = $(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks;
+NORMAL_WEBCORE_FRAMEWORKS_DIR_maccatalyst = $(WK_ALTERNATE_FRAMEWORKS_DIR)/$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks;
 
 WEBCORE_FRAMEWORKS_DIR = $(WEBCORE_FRAMEWORKS_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_$(WK_USE_OVERRIDE_FRAMEWORKS_DIR));
 WEBCORE_FRAMEWORKS_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_NO = $(NORMAL_WEBCORE_FRAMEWORKS_DIR);
index 5d17c3d..83d0acf 100644 (file)
@@ -48,6 +48,8 @@ DYLIB_INSTALL_NAME_BASE_Production = $(INSTALL_PATH);
 DYLIB_INSTALL_NAME_BASE_Debug = @rpath;
 DYLIB_INSTALL_NAME_BASE_Release = $(DYLIB_INSTALL_NAME_BASE_Debug);
 
+ANGLE_LDFLAGS = -weak-lANGLE-shared;
+
 LIBWEBRTC_LDFLAGS = $(LIBWEBRTC_LDFLAGS_$(ENABLE_WEB_RTC));
 LIBWEBRTC_LDFLAGS_ = ;
 LIBWEBRTC_LDFLAGS_ENABLE_WEB_RTC = -weak-lwebrtc;
@@ -56,9 +58,10 @@ PRODUCT_NAME = WebCoreTestSupport;
 EXECUTABLE_PREFIX = lib;
 EXPORTED_SYMBOLS_FILE = ;
 GCC_SYMBOLS_PRIVATE_EXTERN = YES;
-OTHER_LDFLAGS = $(ASAN_OTHER_LDFLAGS);
-OTHER_LDFLAGS[sdk=macos*] = $(ASAN_OTHER_LDFLAGS) -framework AppKit $(LIBWEBRTC_LDFLAGS);
 
-OTHER_LDFLAGS[sdk=iphoneos*] = $(ASAN_OTHER_LDFLAGS) -lAccessibility $(LIBWEBRTC_LDFLAGS);
-OTHER_LDFLAGS[sdk=iphonesimulator*] = $(ASAN_OTHER_LDFLAGS) -lAccessibility $(LIBWEBRTC_LDFLAGS);
+OTHER_LDFLAGS = $(ASAN_OTHER_LDFLAGS) $(ANGLE_LDFLAGS);
+OTHER_LDFLAGS[sdk=macos*] = $(ASAN_OTHER_LDFLAGS) -framework AppKit $(LIBWEBRTC_LDFLAGS) $(ANGLE_LDFLAGS);
+OTHER_LDFLAGS[sdk=iphoneos*] = $(ASAN_OTHER_LDFLAGS) -lAccessibility $(LIBWEBRTC_LDFLAGS) $(ANGLE_LDFLAGS);
+OTHER_LDFLAGS[sdk=iphonesimulator*] = $(ASAN_OTHER_LDFLAGS) -lAccessibility $(LIBWEBRTC_LDFLAGS) $(ANGLE_LDFLAGS);
+
 SECT_ORDER_FLAGS = ;
index ed78c97..7767ed6 100644 (file)
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
-                       shellScript = "if [[ ${WK_PLATFORM_NAME} != \"macosx\" ]]; then\n    exit 0\nfi\n\nif [[ ${WK_USE_OVERRIDE_FRAMEWORKS_DIR} == \"YES\" ]]; then\n    exit 0\nfi\n\n# ENABLE_WEB_RTC cannot be relied on because of its conditionals.\nif [[ ${CONFIGURATION} == \"Production\" && ${TARGET_MAC_OS_X_VERSION_MAJOR} < 101300 ]]; then\n    exit 0\nfi\n\nln -shf Versions/Current/Frameworks \"$TARGET_BUILD_DIR/WebCore.framework/Frameworks\"\n";
+                       shellScript = "if [[ ${WK_PLATFORM_NAME} != \"macosx\" && ${WK_PLATFORM_NAME} != \"maccatalyst\" ]]; then\n    exit 0\nfi\n\nif [[ ${WK_USE_OVERRIDE_FRAMEWORKS_DIR} == \"YES\" ]]; then\n    exit 0\nfi\n\n# ENABLE_WEB_RTC cannot be relied on because of its conditionals.\nif [[ ${CONFIGURATION} == \"Production\" && ${TARGET_MAC_OS_X_VERSION_MAJOR} < 101300 ]]; then\n    exit 0\nfi\n\nln -shf Versions/Current/Frameworks \"$TARGET_BUILD_DIR/WebCore.framework/Frameworks\"\n";
                };
                DD041FBD09D9DDBE0010AF2A /* Generate Derived Sources */ = {
                        isa = PBXShellScriptBuildPhase;
index f40820c..a13fd6b 100644 (file)
 #include "Logging.h"
 #include <wtf/StdLibExtras.h>
 
+#if PLATFORM(COCOA)
+#include <wtf/darwin/WeakLinking.h>
+#endif
+
 namespace WebCore {
 
 // FIXME: This is awful. Get rid of ANGLEWebKitBridge completely and call the libANGLE API directly to validate shaders.
@@ -131,6 +135,10 @@ ANGLEWebKitBridge::ANGLEWebKitBridge(ShShaderOutput shaderOutput, ShShaderSpec s
     , m_shaderOutput(shaderOutput)
     , m_shaderSpec(shaderSpec)
 {
+    ASSERT(angleAvailable());
+    if (!angleAvailable())
+        return;
+
     // This is a no-op if it's already initialized.
     sh::Initialize();
 }
@@ -142,6 +150,10 @@ ANGLEWebKitBridge::~ANGLEWebKitBridge()
 
 void ANGLEWebKitBridge::cleanupCompilers()
 {
+    ASSERT(ANGLEWebKitBridge::angleAvailable());
+    if (!ANGLEWebKitBridge::angleAvailable())
+        return;
+
     if (m_fragmentCompiler)
         sh::Destruct(m_fragmentCompiler);
     m_fragmentCompiler = nullptr;
@@ -162,6 +174,10 @@ void ANGLEWebKitBridge::setResources(const ShBuiltInResources& resources)
 
 bool ANGLEWebKitBridge::compileShaderSource(const char* shaderSource, ANGLEShaderType shaderType, String& translatedShaderSource, String& shaderValidationLog, Vector<std::pair<ANGLEShaderSymbolType, sh::ShaderVariable>>& symbols, uint64_t extraCompileOptions)
 {
+    ASSERT(ANGLEWebKitBridge::angleAvailable());
+    if (!ANGLEWebKitBridge::angleAvailable())
+        return false;
+
     if (!builtCompilers) {
         m_fragmentCompiler = sh::ConstructCompiler(GL_FRAGMENT_SHADER, m_shaderSpec, m_shaderOutput, &m_resources);
         m_vertexCompiler = sh::ConstructCompiler(GL_VERTEX_SHADER, m_shaderSpec, m_shaderOutput, &m_resources);
@@ -204,6 +220,15 @@ bool ANGLEWebKitBridge::compileShaderSource(const char* shaderSource, ANGLEShade
     return true;
 }
 
+bool ANGLEWebKitBridge::angleAvailable()
+{
+#if PLATFORM(COCOA)
+    return !isNullFunctionPointer(sh::Compile);
+#else
+    return true;
+#endif
+}
+
 }
 
 #endif // ENABLE(GRAPHICS_CONTEXT_3D)
index d14ec4f..059b7b1 100644 (file)
@@ -90,6 +90,8 @@ public:
     
     bool compileShaderSource(const char* shaderSource, ANGLEShaderType, String& translatedShaderSource, String& shaderValidationLog, Vector<std::pair<ANGLEShaderSymbolType, sh::ShaderVariable>>& symbols, uint64_t extraCompileOptions = 0);
 
+    static bool angleAvailable();
+
 private:
 
     void cleanupCompilers();
index 63c1cbf..da6b3b6 100644 (file)
@@ -195,6 +195,10 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3DAttributes attrs, HostWind
 #endif
 
 #if !USE(ANGLE)
+    ASSERT(ANGLEWebKitBridge::angleAvailable());
+    if (!ANGLEWebKitBridge::angleAvailable())
+        return;
+
 #if USE(OPENGL_ES)
     if (m_attrs.isWebGL2)
         m_compiler = ANGLEWebKitBridge(SH_ESSL_OUTPUT, SH_WEBGL2_SPEC);
@@ -291,6 +295,10 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3DAttributes attrs, HostWind
 
 #elif USE(ANGLE)
 
+    ASSERT(ANGLEWebKitBridge::angleAvailable());
+    if (!ANGLEWebKitBridge::angleAvailable())
+        return;
+
     m_displayObj = EGL_GetDisplay(EGL_DEFAULT_DISPLAY);
     if (m_displayObj == EGL_NO_DISPLAY)
         return;