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

devops: fork webkit into a separate browser #5834

Merged
merged 1 commit into from
Mar 16, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions browser_patches/checkout_build_archive_upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,6 @@ elif [[ "$BUILD_FLAVOR" == "webkit-win64" ]]; then
BROWSER_NAME="webkit"
EXPECTED_HOST_OS="MINGW"
BUILD_BLOB_NAME="webkit-win64.zip"
elif [[ "$BUILD_FLAVOR" == "webkit-mac-10.14" ]]; then
BROWSER_NAME="webkit"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="10.14"
BUILD_BLOB_NAME="webkit-mac-10.14.zip"
elif [[ "$BUILD_FLAVOR" == "webkit-mac-10.15" ]]; then
BROWSER_NAME="webkit"
EXPECTED_HOST_OS="Darwin"
Expand All @@ -222,6 +217,16 @@ elif [[ "$BUILD_FLAVOR" == "webkit-mac-11.0-arm64" ]]; then
EXPECTED_HOST_OS_VERSION="11.0"
EXPECTED_ARCH="arm64"
BUILD_BLOB_NAME="webkit-mac-11.0-arm64.zip"


# ===================================
# DEPRECATED WEBKIT COMPILATION
# ===================================
elif [[ "$BUILD_FLAVOR" == "deprecated-webkit-mac-10.14" ]]; then
BROWSER_NAME="deprecated-webkit-mac-10.14"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="10.14"
BUILD_BLOB_NAME="deprecated-webkit-mac-10.14.zip"
else
echo ERROR: unknown build flavor - "$BUILD_FLAVOR"
exit 1
Expand Down
1 change: 1 addition & 0 deletions browser_patches/deprecated-webkit-mac-10.14/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/checkout
2 changes: 2 additions & 0 deletions browser_patches/deprecated-webkit-mac-10.14/BUILD_NUMBER
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1443
Changed: yurys@chromium.org Mon 01 Mar 2021 09:57:46 AM PST
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
REMOTE_URL="https://git.webkit.org/git/WebKit.git"
BASE_BRANCH="master"
BASE_REVISION="b3de1a5d49442523744d6326dbc852cea829a145"
146 changes: 146 additions & 0 deletions browser_patches/deprecated-webkit-mac-10.14/archive.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
#!/bin/bash
set -e
set +x

if [[ ("$1" == "-h") || ("$1" == "--help") ]]; then
echo "usage: $(basename $0) [output-absolute-path]"
echo
echo "Generate distributable .zip archive from ./checkout folder that was previously built."
echo
exit 0
fi

ZIP_PATH=$1
if [[ $ZIP_PATH != /* ]]; then
echo "ERROR: path $ZIP_PATH is not absolute"
exit 1
fi
if [[ $ZIP_PATH != *.zip ]]; then
echo "ERROR: path $ZIP_PATH must have .zip extension"
exit 1
fi
if [[ -f $ZIP_PATH ]]; then
echo "ERROR: path $ZIP_PATH exists; can't do anything."
exit 1
fi
if ! [[ -d $(dirname $ZIP_PATH) ]]; then
echo "ERROR: folder for path $($ZIP_PATH) does not exist."
exit 1
fi

main() {
if [[ ! -z "${WK_CHECKOUT_PATH}" ]]; then
cd "${WK_CHECKOUT_PATH}"
echo "WARNING: checkout path from WK_CHECKOUT_PATH env: ${WK_CHECKOUT_PATH}"
else
cd "checkout"
fi

set -x
if [[ "$(uname)" == "Darwin" ]]; then
createZipForMac
elif [[ "$(uname)" == "Linux" ]]; then
createZipForLinux
elif [[ "$(uname)" == MINGW* ]]; then
createZipForWindows
else
echo "ERROR: cannot upload on this platform!" 1>&2
exit 1;
fi
}


createZipForLinux() {
# create a TMP directory to copy all necessary files
local tmpdir=$(mktemp -d -t webkit-deploy-XXXXXXXXXX)
mkdir -p $tmpdir

# copy runner
cp -t $tmpdir $SCRIPTS_DIR/pw_run.sh
# copy protocol
node $SCRIPTS_DIR/concat_protocol.js > $tmpdir/protocol.json

# Generate and unpack MiniBrowser bundles for each port
for port in gtk wpe; do
WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/${port^^} Tools/Scripts/generate-bundle \
--bundle=MiniBrowser --release \
--platform=${port} --destination=${tmpdir}
unzip ${tmpdir}/MiniBrowser_${port}_release.zip -d ${tmpdir}/minibrowser-${port}
rm -f ${tmpdir}/MiniBrowser_${port}_release.zip
done

# tar resulting directory and cleanup TMP.
cd $tmpdir
zip --symlinks -r $ZIP_PATH ./
cd -
rm -rf $tmpdir
}

# see https://docs.microsoft.com/en-us/visualstudio/install/tools-for-managing-visual-studio-instances?view=vs-2019
printMSVCRedistDir() {
local dll_file=$("C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find '**\Redist\MSVC\*\x64\**\vcruntime140.dll')
local redist_dir=$(dirname "$dll_file")
if ! [[ -d $redist_dir ]]; then
echo "ERROR: cannot find MS VS C++ redistributable $redist_dir"
exit 1;
fi
echo "$redist_dir"
}

createZipForWindows() {
# create a TMP directory to copy all necessary files
local tmpdir="/tmp/webkit-deploy-$(date +%s)"
mkdir -p $tmpdir

cp -t $tmpdir ./WebKitLibraries/win/bin64/*.dll
cd WebKitBuild/Release/bin64
cp -r -t $tmpdir WebKit.resources
cp -t $tmpdir JavaScriptCore.dll PlaywrightLib.dll WTF.dll WebKit2.dll libEGL.dll libGLESv2.dll
cp -t $tmpdir Playwright.exe WebKitNetworkProcess.exe WebKitWebProcess.exe
cd -
cd "$(printMSVCRedistDir)"
cp -t $tmpdir msvcp140.dll vcruntime140.dll vcruntime140_1.dll msvcp140_2.dll
cd -

# copy protocol
node $SCRIPTS_DIR/concat_protocol.js > $tmpdir/protocol.json
# tar resulting directory and cleanup TMP.
cd $tmpdir
zip -r $ZIP_PATH ./
cd -
rm -rf $tmpdir
}

createZipForMac() {
# create a TMP directory to copy all necessary files
local tmpdir=$(mktemp -d)

# copy all relevant files
ditto {./WebKitBuild/Release,$tmpdir}/com.apple.WebKit.Networking.xpc
ditto {./WebKitBuild/Release,$tmpdir}/com.apple.WebKit.Plugin.64.xpc
ditto {./WebKitBuild/Release,$tmpdir}/com.apple.WebKit.WebContent.xpc
ditto {./WebKitBuild/Release,$tmpdir}/JavaScriptCore.framework
ditto {./WebKitBuild/Release,$tmpdir}/libwebrtc.dylib
ditto {./WebKitBuild/Release,$tmpdir}/Playwright.app
ditto {./WebKitBuild/Release,$tmpdir}/PluginProcessShim.dylib
ditto {./WebKitBuild/Release,$tmpdir}/WebCore.framework
ditto {./WebKitBuild/Release,$tmpdir}/WebInspectorUI.framework
ditto {./WebKitBuild/Release,$tmpdir}/WebKit.framework
ditto {./WebKitBuild/Release,$tmpdir}/WebKitLegacy.framework
ditto {$SCRIPTS_DIR,$tmpdir}/pw_run.sh
# copy protocol
node $SCRIPTS_DIR/concat_protocol.js > $tmpdir/protocol.json

# Remove all broken symlinks. @see https://github.com/microsoft/playwright/issues/5472
find "${tmpdir}" -type l ! -exec test -e {} \; -print | xargs rm

# zip resulting directory and cleanup TMP.
ditto -c -k $tmpdir $ZIP_PATH
rm -rf $tmpdir
}

trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
SCRIPTS_DIR="$(pwd -P)"

main "$@"
77 changes: 77 additions & 0 deletions browser_patches/deprecated-webkit-mac-10.14/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash
set -e
set +x

trap "cd $(pwd -P)" EXIT
cd "$(dirname $0)"
SCRIPT_FOLDER="$(pwd -P)"

build_gtk() {
if ! [[ -d ./WebKitBuild/GTK/DependenciesGTK ]]; then
yes | WEBKIT_JHBUILD=1 WEBKIT_JHBUILD_MODULESET=minimal WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/GTK DEBIAN_FRONTEND=noninteractive ./Tools/Scripts/update-webkitgtk-libs
fi
local CMAKE_ARGS=""
if [[ -n "${EXPORT_COMPILE_COMMANDS}" ]]; then
CMAKE_ARGS="--cmakeargs=\"-DCMAKE_EXPORT_COMPILE_COMMANDS=1\""
fi
WEBKIT_JHBUILD=1 WEBKIT_JHBUILD_MODULESET=minimal WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/GTK ./Tools/Scripts/build-webkit --gtk --release "${CMAKE_ARGS}" --touch-events --orientation-events --no-bubblewrap-sandbox --no-webxr MiniBrowser
}

build_wpe() {
if ! [[ -d ./WebKitBuild/WPE/DependenciesWPE ]]; then
yes | WEBKIT_JHBUILD=1 WEBKIT_JHBUILD_MODULESET=minimal WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/WPE DEBIAN_FRONTEND=noninteractive ./Tools/Scripts/update-webkitwpe-libs
fi
local CMAKE_ARGS=""
if [[ -n "${EXPORT_COMPILE_COMMANDS}" ]]; then
CMAKE_ARGS="--cmakeargs=\"-DCMAKE_EXPORT_COMPILE_COMMANDS=1\""
fi
WEBKIT_JHBUILD=1 WEBKIT_JHBUILD_MODULESET=minimal WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/WPE ./Tools/Scripts/build-webkit --wpe --release "${CMAKE_ARGS}" --touch-events --orientation-events --no-bubblewrap-sandbox --no-webxr MiniBrowser
}

ensure_linux_deps() {
yes | DEBIAN_FRONTEND=noninteractive ./Tools/gtk/install-dependencies
yes | DEBIAN_FRONTEND=noninteractive ./Tools/wpe/install-dependencies
yes | DEBIAN_FRONTEND=noninteractive WEBKIT_JHBUILD=1 WEBKIT_JHBUILD_MODULESET=minimal WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/WPE ./Tools/Scripts/update-webkitwpe-libs
yes | DEBIAN_FRONTEND=noninteractive WEBKIT_JHBUILD=1 WEBKIT_JHBUILD_MODULESET=minimal WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/GTK ./Tools/Scripts/update-webkitgtk-libs
}

if [[ ! -z "${WK_CHECKOUT_PATH}" ]]; then
cd "${WK_CHECKOUT_PATH}"
echo "WARNING: checkout path from WK_CHECKOUT_PATH env: ${WK_CHECKOUT_PATH}"
else
cd "checkout"
fi

if [[ "$(uname)" == "Darwin" ]]; then
./Tools/Scripts/build-webkit --release --touch-events --orientation-events
elif [[ "$(uname)" == "Linux" ]]; then
if [[ $# == 0 || (-z "$1") ]]; then
echo
echo BUILDING: GTK and WPE
echo
build_wpe
build_gtk
elif [[ "$1" == "--full" ]]; then
echo
echo BUILDING: GTK and WPE
echo
ensure_linux_deps
build_wpe
build_gtk
elif [[ "$1" == "--gtk" ]]; then
echo
echo BUILDING: GTK
echo
build_gtk
elif [[ "$1" == "--wpe" ]]; then
echo
echo BUILDING: WPE
echo
build_wpe
fi
elif [[ "$(uname)" == MINGW* ]]; then
/c/Windows/System32/cmd.exe "/c $(cygpath -w ${SCRIPT_FOLDER}/buildwin.bat)"
else
echo "ERROR: cannot upload on this platform!" 1>&2
exit 1;
fi
5 changes: 5 additions & 0 deletions browser_patches/deprecated-webkit-mac-10.14/buildwin.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set PATH=%WEBKIT_BUILD_PATH%
set WEBKIT_LIBRARIES=%CD%\WebKitLibraries\win
set WEBKIT_OUTPUTDIR=%CD%\WebKitBuild
perl %CD%\Tools\Scripts\build-webkit --wincairo --release --no-ninja --touch-events --orientation-events --dark-mode-css --generate-project-only --cmakeargs="-DLIBVPX_PACKAGE_PATH=C:\vcpkg\packages\libvpx_x64-windows"
%DEVENV% %CD%\WebKitBuild\Release\WebKit.sln /build "Release|x64"
23 changes: 23 additions & 0 deletions browser_patches/deprecated-webkit-mac-10.14/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
set -e
set +x

trap "cd $(pwd -P)" EXIT
cd "$(dirname $0)"

if [[ ! -z "${WK_CHECKOUT_PATH}" ]]; then
cd "${WK_CHECKOUT_PATH}"
echo "WARNING: checkout path from WK_CHECKOUT_PATH env: ${WK_CHECKOUT_PATH}"
else
cd "checkout"
fi

if [[ -d ./WebKitBuild ]]; then
rm -rf ./WebKitBuild/Release
fi
if [[ -d ./WebKitBuild/GTK ]]; then
rm -rf ./WebKitBuild/GTK/Release
fi
if [[ -d ./WebKitBuild/WPE ]]; then
rm -rf ./WebKitBuild/WPE/Release
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const fs = require('fs');
const path = require('path');
const checkoutPath = process.env.WK_CHECKOUT_PATH || path.join(__dirname, 'checkout');
const protocolDir = path.join(checkoutPath, './Source/JavaScriptCore/inspector/protocol');
const files = fs.readdirSync(protocolDir).filter(f => f.endsWith('.json')).map(f => path.join(protocolDir, f));
const json = files.map(file => JSON.parse(fs.readFileSync(file)));
console.log(JSON.stringify(json));
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// Copyright (C) 2010-2017 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include? "../../../../Internal/Configurations/HaveInternalSDK.xcconfig"
#include "SDKVariant.xcconfig"

USE_INTERNAL_SDK = $(USE_INTERNAL_SDK_$(CONFIGURATION));
USE_INTERNAL_SDK_Production = YES;
USE_INTERNAL_SDK_Debug = $(HAVE_INTERNAL_SDK);
USE_INTERNAL_SDK_Release = $(HAVE_INTERNAL_SDK);

GCC_PREPROCESSOR_DEFINITIONS = DISABLE_LEGACY_WEBKIT_DEPRECATIONS $(inherited);

CLANG_CXX_LANGUAGE_STANDARD = gnu++1z;
CLANG_CXX_LIBRARY = libc++;
CLANG_ENABLE_OBJC_WEAK = YES;
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym;
PREBINDING = NO
GCC_C_LANGUAGE_STANDARD = gnu99
GCC_ENABLE_CPP_EXCEPTIONS = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = YES
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = 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_STRICT_PROTOTYPES = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES
GCC_WARN_UNUSED_VARIABLE = YES
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
WARNING_CFLAGS = -Wall -W -Wno-unused-parameter
GCC_NO_COMMON_BLOCKS = YES;

SUPPORTED_PLATFORMS = iphoneos iphonesimulator macosx tvos tvsimulator watchos watchsimulator;

TARGET_MAC_OS_X_VERSION_MAJOR = $(TARGET_MAC_OS_X_VERSION_MAJOR$(MACOSX_DEPLOYMENT_TARGET:suffix:identifier));
TARGET_MAC_OS_X_VERSION_MAJOR_13 = 101300;
TARGET_MAC_OS_X_VERSION_MAJOR_14 = 101400;
TARGET_MAC_OS_X_VERSION_MAJOR_15 = 101500;
TARGET_MAC_OS_X_VERSION_MAJOR_16 = 101600;

SDKROOT = macosx.internal;

OTHER_CFLAGS = $(ASAN_OTHER_CFLAGS);
OTHER_CPLUSPLUSFLAGS = $(ASAN_OTHER_CPLUSPLUSFLAGS);
OTHER_LDFLAGS = $(ASAN_OTHER_LDFLAGS);

CODE_SIGN_IDENTITY = -;
Loading