Browse Source

build: replace Chromium ANGLE with WebKit ANGLE

pull/5581/head
osy 2 years ago
parent
commit
f37dabe1eb
  1. 119
      patches/angle-toolchain.patch
  2. 7
      patches/sources
  3. 70
      scripts/build_dependencies.sh

119
patches/angle-toolchain.patch

@ -1,119 +0,0 @@
From 0287d27a409fb257bdfa6fe1eb38fcba30d7ac70 Mon Sep 17 00:00:00 2001
From: osy <osy@turing.llc>
Date: Sat, 5 Aug 2023 18:38:51 -0700
Subject: [PATCH] Add xrOS support
---
config/apple/sdk_info.py | 2 +-
config/compiler/BUILD.gn | 2 +-
config/ios/BUILD.gn | 5 +----
config/ios/codesign.py | 2 ++
config/ios/config.gni | 3 +++
config/ios/ios_sdk.gni | 18 ++++++++++++++----
6 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/config/apple/sdk_info.py b/config/apple/sdk_info.py
index 81b06d438..94b260971 100755
--- a/config/apple/sdk_info.py
+++ b/config/apple/sdk_info.py
@@ -134,7 +134,7 @@ def main():
default='.',
help='Value of gn $root_build_dir')
parser.add_argument('platform',
- choices=['iphoneos', 'iphonesimulator', 'macosx'])
+ choices=['iphoneos', 'iphonesimulator', 'macosx', 'xros', 'xrsimulator'])
args = parser.parse_args()
if args.developer_dir:
os.environ['DEVELOPER_DIR'] = args.developer_dir
diff --git a/config/compiler/BUILD.gn b/config/compiler/BUILD.gn
index 944a039d0..685f79da4 100644
--- a/config/compiler/BUILD.gn
+++ b/config/compiler/BUILD.gn
@@ -1592,7 +1592,7 @@ config("default_warnings") {
if (is_clang) {
cflags += [
- "-Wloop-analysis",
+ "-Wloop-analysis", "-Wno-deprecated-declarations",
# TODO(thakis): This used to be implied by -Wno-unused-function,
# which we no longer use. Check if it makes sense to remove
diff --git a/config/ios/BUILD.gn b/config/ios/BUILD.gn
index f0b85cc65..9a31fa30d 100644
--- a/config/ios/BUILD.gn
+++ b/config/ios/BUILD.gn
@@ -39,13 +39,10 @@ config("compiler") {
assert(false, "unsupported environment: $target_environment")
}
- # OS.
- triplet_os = "apple-ios"
-
# Set target.
common_flags = [
"-target",
- "$triplet_cpu-$triplet_os$ios_deployment_target$triplet_environment",
+ "$triplet_cpu-apple-$target_platform$ios_deployment_target$triplet_environment",
]
# This is here so that all files get recompiled after an Xcode update.
diff --git a/config/ios/codesign.py b/config/ios/codesign.py
index a475302e8..ca1cb05ca 100644
--- a/config/ios/codesign.py
+++ b/config/ios/codesign.py
@@ -92,6 +92,8 @@ class Bundle(object):
def Kind(platform, extension):
if platform == 'iphonesimulator' or platform == 'iphoneos':
return 'ios'
+ if platform == 'xrsimulator' or platform == 'xros':
+ return 'xros'
if platform == 'macosx':
if extension == '.framework':
return 'mac_framework'
diff --git a/config/ios/config.gni b/config/ios/config.gni
index 74d064532..5f3f25ad5 100644
--- a/config/ios/config.gni
+++ b/config/ios/config.gni
@@ -14,6 +14,9 @@ declare_args() {
# components/cronet/tools/cr_cronet.py as cronet requires specific
# gn args to build correctly).
is_cronet_build = false
+
+ # Platform to build (ios,xros,tvos,watchos)
+ target_platform = "ios"
}
if (target_environment == "") {
diff --git a/config/ios/ios_sdk.gni b/config/ios/ios_sdk.gni
index af498ced8..1faab75f3 100644
--- a/config/ios/ios_sdk.gni
+++ b/config/ios/ios_sdk.gni
@@ -118,11 +118,21 @@ if (additional_target_cpus != [] && !is_fat_secondary_toolchain) {
if (ios_sdk_path == "") {
# Compute default target.
if (target_environment == "simulator") {
- ios_sdk_name = "iphonesimulator"
- ios_sdk_platform = "iPhoneSimulator"
+ if (target_platform == "xros") {
+ ios_sdk_name = "xrsimulator"
+ ios_sdk_platform = "XRSimulator"
+ } else {
+ ios_sdk_name = "iphonesimulator"
+ ios_sdk_platform = "iPhoneSimulator"
+ }
} else if (target_environment == "device") {
- ios_sdk_name = "iphoneos"
- ios_sdk_platform = "iPhoneOS"
+ if (target_platform == "xros") {
+ ios_sdk_name = "xros"
+ ios_sdk_platform = "XROS"
+ } else {
+ ios_sdk_name = "iphoneos"
+ ios_sdk_platform = "iPhoneOS"
+ }
} else if (target_environment == "catalyst") {
ios_sdk_name = "macosx"
ios_sdk_platform = "MacOSX"
--
2.41.0

7
patches/sources

@ -36,10 +36,9 @@ PHODAV_SRC="https://download.gnome.org/sources/phodav/2.5/phodav-2.5.tar.xz"
SPICE_CLIENT_SRC="https://www.spice-space.org/download/gtk/spice-gtk-0.40.tar.xz"
# Source files for GPU acceleration
DEPOT_TOOLS_REPO="https://chromium.googlesource.com/chromium/tools/depot_tools.git"
DEPOT_TOOLS_COMMIT="5da65ec20db9b17b03420d928240092e5955a769"
ANGLE_REPO="https://github.com/utmapp/angle.git"
ANGLE_COMMIT="18e942b3e66d45d0ac5404eb3cfc89390788e11f"
WEBKIT_REPO="https://github.com/utmapp/WebKit.git"
WEBKIT_COMMIT="59f88f623d5547039760848f188ac961b6cc85e2"
WEBKIT_SUBDIRS="Source/ThirdParty/ANGLE Configurations Tools/ccache"
EPOXY_REPO="https://github.com/utmapp/libepoxy.git"
EPOXY_COMMIT="266d2290a437c655f7419e85af06bfbb73a720c4"
VIRGLRENDERER_REPO="https://github.com/utmapp/virglrenderer.git"

70
scripts/build_dependencies.sh

@ -110,6 +110,7 @@ download () {
clone () {
REPO="$1"
COMMIT="$2"
SUBDIRS="$3"
NAME="$(basename $REPO)"
DIR="$BUILD_DIR/$NAME"
if [ -d "$DIR" -a -z "$REDOWNLOAD" ]; then
@ -117,11 +118,12 @@ clone () {
else
rm -rf "$DIR"
echo "${GREEN}Cloning ${URL}...${NC}"
mkdir "$DIR"
git -C "$DIR" init
git -C "$DIR" remote add origin "$REPO"
git clone --filter=tree:0 --no-checkout "$REPO" "$DIR"
if [ ! -z "$SUBDIRS" ]; then
git -C "$DIR" sparse-checkout init
git -C "$DIR" sparse-checkout set $SUBDIRS
fi
fi
git -C "$DIR" fetch --depth 1 origin "$COMMIT"
git -C "$DIR" checkout "$COMMIT"
}
@ -158,8 +160,7 @@ download_all () {
download $USB_SRC
download $USBREDIR_SRC
fi
clone $DEPOT_TOOLS_REPO $DEPOT_TOOLS_COMMIT
clone $ANGLE_REPO $ANGLE_COMMIT
clone $WEBKIT_REPO $WEBKIT_COMMIT "$WEBKIT_SUBDIRS"
clone $EPOXY_REPO $EPOXY_COMMIT
clone $VIRGLRENDERER_REPO $VIRGLRENDERER_COMMIT
clone $HYPERVISOR_REPO $HYPERVISOR_COMMIT
@ -406,60 +407,9 @@ build_angle () {
OLD_PATH=$PATH
export PATH="$(realpath "$BUILD_DIR/depot_tools.git"):$OLD_PATH"
pwd="$(pwd)"
cd "$BUILD_DIR/angle.git"
DEPOT_TOOLS_UPDATE=0 python3 scripts/bootstrap.py
DEPOT_TOOLS_UPDATE=0 gclient sync
case $PLATFORM in
ios* )
TARGET_OS="ios"
IOS_BUILD_ARGS="ios_enable_code_signing=false ios_deployment_target=\"$IOS_SDKMINVER\""
if [ "$PLATFORM" == "ios_simulator" ]; then
IOS_BUILD_ARGS="$IOS_BUILD_ARGS target_environment=\"simulator\""
else
IOS_BUILD_ARGS="$IOS_BUILD_ARGS target_environment=\"device\""
fi
;;
visionos* )
TARGET_OS="ios"
CLANG_BASE_PATH="$(dirname $(dirname $OBJCC))"
IOS_BUILD_ARGS="ios_enable_code_signing=false ios_deployment_target=\"$VISIONOS_SDKMINVER\" angle_enable_gl=false angle_enable_glsl=true target_platform=\"xros\" clang_base_path=\"$CLANG_BASE_PATH\" clang_use_chrome_plugins=false use_lld=false"
if [ "$PLATFORM" == "visionos_simulator" ]; then
IOS_BUILD_ARGS="$IOS_BUILD_ARGS target_environment=\"simulator\""
else
IOS_BUILD_ARGS="$IOS_BUILD_ARGS target_environment=\"device\""
fi
;;
macos )
TARGET_OS="mac"
;;
esac
case $ARCH in
armv7 | armv7s )
TARGET_CPU="arm"
;;
arm64 )
TARGET_CPU="arm64"
;;
i386 )
TARGET_CPU="x86"
;;
x86_64 )
TARGET_CPU="x64"
;;
esac
git -C build am "$PATCHES_DIR/angle-toolchain.patch"
gn gen "--args=is_debug=false angle_build_all=false angle_enable_metal=true $IOS_BUILD_ARGS target_os=\"$TARGET_OS\" target_cpu=\"$TARGET_CPU\"" utm_build
ninja -C utm_build -j $NCPU
if [ "$TARGET_OS" == "ios" ]; then
cp -a "utm_build/libEGL.framework/libEGL" "$PREFIX/lib/libEGL.dylib"
cp -a "utm_build/libGLESv2.framework/libGLESv2" "$PREFIX/lib/libGLESv2.dylib"
else
cp -a "utm_build/libEGL.dylib" "$PREFIX/lib/libEGL.dylib"
cp -a "utm_build/libGLESv2.dylib" "$PREFIX/lib/libGLESv2.dylib"
fi
# -headerpad_max_install_names is broken and these still fail on long paths so we just make sure they run at the end with a short path
#install_name_tool -id "$PREFIX/lib/libEGL.dylib" "$PREFIX/lib/libEGL.dylib"
#install_name_tool -id "$PREFIX/lib/libGLESv2.dylib" "$PREFIX/lib/libGLESv2.dylib"
cd "$BUILD_DIR/WebKit.git/Source/ThirdParty/ANGLE"
xcodebuild archive -archivePath "ANGLE" -scheme "ANGLE" -sdk $SDK -arch $ARCH -configuration Release WEBCORE_LIBRARY_DIR="/usr/local/lib" IPHONEOS_DEPLOYMENT_TARGET="14.0" MACOSX_DEPLOYMENT_TARGET="11.0" XROS_DEPLOYMENT_TARGET="1.0"
rsync -a "ANGLE.xcarchive/Products/usr/local/lib/" "$PREFIX/lib"
rsync -a "include/" "$PREFIX/include"
cd "$pwd"
export PATH=$OLD_PATH

Loading…
Cancel
Save