Title: [270212] trunk/Source/ThirdParty/ANGLE
Revision
270212
Author
hironori.fu...@sony.com
Date
2020-11-27 19:56:52 -0800 (Fri, 27 Nov 2020)

Log Message

[ANGLE] Convert adjust-angle-include-paths.sh to a Python script for Windows without Cygwin
https://bugs.webkit.org/show_bug.cgi?id=219299

Reviewed by Kenneth Russell.

WinCairo port can't use shell scripts because it isn't using
Cygwin.

* ANGLE.xcodeproj/project.pbxproj:
* CMakeLists.txt:
* adjust-angle-include-paths.py: Added.
* adjust-angle-include-paths.sh: Removed.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj (270211 => 270212)


--- trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj	2020-11-28 03:51:11 UTC (rev 270211)
+++ trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj	2020-11-28 03:56:52 UTC (rev 270212)
@@ -4118,7 +4118,7 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "if [ \"${XCODE_VERSION_ACTUAL}\" -ge \"1140\" -a \"${WK_USE_NEW_BUILD_SYSTEM}\" = \"YES\" ]; then\n    # In this configuration, post-processing is performed at the same time as copying in the postprocess-header-rule script, so there's no need for this separate step.\n    exit 0\nfi\n\nexec \"$SRCROOT/adjust-angle-include-paths.sh\"\n";
+			shellScript = "if [ \"${XCODE_VERSION_ACTUAL}\" -ge \"1140\" -a \"${WK_USE_NEW_BUILD_SYSTEM}\" = \"YES\" ]; then\n    # In this configuration, post-processing is performed at the same time as copying in the postprocess-header-rule script, so there's no need for this separate step.\n    exit 0\nfi\n\nexec \"$SRCROOT/adjust-angle-include-paths.py\"\n";
 		};
 /* End PBXShellScriptBuildPhase section */
 

Modified: trunk/Source/ThirdParty/ANGLE/CMakeLists.txt (270211 => 270212)


--- trunk/Source/ThirdParty/ANGLE/CMakeLists.txt	2020-11-28 03:51:11 UTC (rev 270211)
+++ trunk/Source/ThirdParty/ANGLE/CMakeLists.txt	2020-11-28 03:56:52 UTC (rev 270212)
@@ -183,10 +183,10 @@
 
     add_custom_target(ANGLE-webgl-headers
         DEPENDS LibGLESv2EntryPointsHeaders ANGLEWebGLHeaders
-        COMMAND BUILT_PRODUCTS_DIR=${ANGLE_FRAMEWORK_HEADERS_DIR}/
-            DERIVED_FILE_DIR=${BUILT_PRODUCTS_DIR}
-            PUBLIC_HEADERS_FOLDER_PATH=ANGLE
-            ${CMAKE_CURRENT_SOURCE_DIR}/adjust-angle-include-paths.sh
+        COMMAND ${CMAKE_COMMAND} -E env
+            BUILT_PRODUCTS_DIR=${ANGLE_FRAMEWORK_HEADERS_DIR}
+            PUBLIC_HEADERS_FOLDER_PATH=/ANGLE
+            ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/adjust-angle-include-paths.py
         VERBATIM
     )
     add_dependencies(ANGLEFramework ANGLE-webgl-headers)

Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (270211 => 270212)


--- trunk/Source/ThirdParty/ANGLE/ChangeLog	2020-11-28 03:51:11 UTC (rev 270211)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog	2020-11-28 03:56:52 UTC (rev 270212)
@@ -1,3 +1,18 @@
+2020-11-27  Fujii Hironori  <hironori.fu...@sony.com>
+
+        [ANGLE] Convert adjust-angle-include-paths.sh to a Python script for Windows without Cygwin
+        https://bugs.webkit.org/show_bug.cgi?id=219299
+
+        Reviewed by Kenneth Russell.
+
+        WinCairo port can't use shell scripts because it isn't using
+        Cygwin.
+
+        * ANGLE.xcodeproj/project.pbxproj:
+        * CMakeLists.txt:
+        * adjust-angle-include-paths.py: Added.
+        * adjust-angle-include-paths.sh: Removed.
+
 2020-11-27  Rob Buis  <rb...@igalia.com>
 
         Fix ANGLE CMakeLists.txt warnings

Added: trunk/Source/ThirdParty/ANGLE/adjust-angle-include-paths.py (0 => 270212)


--- trunk/Source/ThirdParty/ANGLE/adjust-angle-include-paths.py	                        (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/adjust-angle-include-paths.py	2020-11-28 03:56:52 UTC (rev 270212)
@@ -0,0 +1,56 @@
+#! /usr/bin/python
+
+# WebKit builds ANGLE as a static library, and exports some of the
+# internal header files as "public headers" in the Xcode project for
+# consumption by other build targets - e.g. WebCore.
+#
+# The build phase which copies these headers also flattens the
+# directory structure (so that "ANGLE" is the top-level directory
+# containing all of them - e.g., "#include <ANGLE/gl2.h>").
+#
+# It isn't practical to override the include paths so drastically for
+# the other build targets (like WebCore) that we could make the
+# original include paths, like <GLES2/gl2.h> work. Changing them so
+# their namespace is "ANGLE", which implicitly occurs during the "copy
+# headers" phase, is a reasonable solution.
+#
+# This script processes the header files after they're copied during
+# the Copy Header Files build phase, and adjusts their #includes so
+# that they refer to each other. This avoids modifying the ANGLE
+# sources, and allows WebCore to more easily call ANGLE APIs directly.
+
+import os
+import re
+
+if os.getenv('DEPLOYMENT_LOCATION') == 'YES':
+    # Apple-internal build
+    output_dir = os.getenv('DSTROOT') + os.getenv('PUBLIC_HEADERS_FOLDER_PATH')
+else:
+    # External build
+    output_dir = os.getenv('BUILT_PRODUCTS_DIR') + os.getenv('PUBLIC_HEADERS_FOLDER_PATH')
+
+def replace(line):
+    match = re.match('#include [<"](.*)[>"]', line)
+    if match:
+        header = match.group(1)
+        match = re.match('(EGL|GLES[23]?|KHR)/(.*)', header)
+        if match:
+            return "#include <ANGLE/" + match.group(2) + ">\n"
+        match = re.match(r'(eglext_angle|gl2ext_angle|ShaderVars)\.h', header)
+        if match:
+            return "#include <ANGLE/" + match.group(1) + ".h>\n"
+        if header == 'export.h':
+            return "#include <ANGLE/export.h>\n"
+    return line
+
+os.chdir(output_dir)
+for filename in os.listdir('.'):
+    if not os.path.isfile(filename):
+        continue
+    if not filename.endswith('.h'):
+        continue
+    lines = open(filename, 'r').readlines()
+    newLines = [ replace(line) for line in lines ]
+    if lines != newLines:
+        open(filename, 'w').writelines(newLines)
+        print("Postprocessed ANGLE header {}".format(filename))
Property changes on: trunk/Source/ThirdParty/ANGLE/adjust-angle-include-paths.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Deleted: trunk/Source/ThirdParty/ANGLE/adjust-angle-include-paths.sh (270211 => 270212)


--- trunk/Source/ThirdParty/ANGLE/adjust-angle-include-paths.sh	2020-11-28 03:51:11 UTC (rev 270211)
+++ trunk/Source/ThirdParty/ANGLE/adjust-angle-include-paths.sh	2020-11-28 03:56:52 UTC (rev 270212)
@@ -1,51 +0,0 @@
-#!/bin/sh
-
-# WebKit builds ANGLE as a static library, and exports some of the
-# internal header files as "public headers" in the Xcode project for
-# consumption by other build targets - e.g. WebCore.
-#
-# The build phase which copies these headers also flattens the
-# directory structure (so that "ANGLE" is the top-level directory
-# containing all of them - e.g., "#include <ANGLE/gl2.h>").
-#
-# It isn't practical to override the include paths so drastically for
-# the other build targets (like WebCore) that we could make the
-# original include paths, like <GLES2/gl2.h> work. Changing them so
-# their namespace is "ANGLE", which implicitly occurs during the "copy
-# headers" phase, is a reasonable solution.
-#
-# This script processes the header files after they're copied during
-# the Copy Header Files build phase, and adjusts their #includes so
-# that they refer to each other. This avoids modifying the ANGLE
-# sources, and allows WebCore to more easily call ANGLE APIs directly.
-
-if [ "$DEPLOYMENT_LOCATION" == "YES" ] ; then
-    # Apple-internal build.
-    output_dir=${DSTROOT}${PUBLIC_HEADERS_FOLDER_PATH}
-else
-    # External build.
-    output_dir=${BUILT_PRODUCTS_DIR}${PUBLIC_HEADERS_FOLDER_PATH}
-fi
-
-mkdir -p "${DERIVED_FILE_DIR}"
-BASE_NAME=$(basename "$0")
-TEMP_FILE=$(mktemp "${DERIVED_FILE_DIR}/${BASE_NAME}.XXXXXX")
-
-for i in $output_dir/*.h ; do
-    sed -e '
-s/^#include [<"]EGL\/\(.*\)[>"]/#include <ANGLE\/\1>/
-s/^#include [<"]GLES\/\(.*\)[>"]/#include <ANGLE\/\1>/
-s/^#include [<"]GLES2\/\(.*\)[>"]/#include <ANGLE\/\1>/
-s/^#include [<"]GLES3\/\(.*\)[>"]/#include <ANGLE\/\1>/
-s/^#include [<"]KHR\/\(.*\)[>"]/#include <ANGLE\/\1>/
-s/^#include [<"]export.h[>"]/#include <ANGLE\/export.h>/
-s/^#include "\(eglext_angle\|gl2ext_angle\|ShaderVars\).h"/#include <ANGLE\/\1.h>/
-' < "$i" > "${TEMP_FILE}"
-    if ! diff -q "${TEMP_FILE}" "$i" &> /dev/null ; then
-        cp "${TEMP_FILE}" "$i"
-        echo Postprocessed ANGLE header `basename $i`
-    fi
-done
-
-rm -f "${TEMP_FILE}" &> /dev/null
-exit 0
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to