Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

browser(webkit): copy MS VC++ redistributable libs from VS installation (#4360)

Yury Semikhatsky040f9b04ca1d
diff --git a/browser_patches/buildbots/README.md b/browser_patches/buildbots/README.md
index efaef5c9e2..24bdf77117 100644
--- a/browser_patches/buildbots/README.md
+++ b/browser_patches/buildbots/README.md
@@ -120,19 +120,6 @@ The `core.longpaths` is needed for webkit since it has some very long layout pat
Run `c:\mozilla-build\start-shell.bat` and checkout Playwright repo to `/c/playwright`.
-### 7. Create a c:\WEBKIT_WIN64_LIBS\ directory with win64 dlls
-
-
-Create a new `c:\WEBKIT_WIN64_LIBS` folder and copy the following libraries from `C:\Windows\System32` into it:
-- `msvcp140.dll`
-- `msvcp140_2.dll`
-- `vcruntime140.dll`
-- `vcruntime140_1.dll`
-
-> **NOTE**: these libraries are expected by `//browser_patches/webkit/archive.sh`.
-
-This is necessary since mingw is a 32-bit application and cannot access the `C:\Windows\System32` folder due to [Windows FileSystem Redirector](https://docs.microsoft.com/en-us/windows/win32/winprog64/file-system-redirector?redirectedfrom=MSDN). ([StackOverflow question](https://stackoverflow.com/questions/18982551/is-mingw-caching-windows-directory-contents))
-
## Running Build Loop
1. Launch `c:\mozilla-build/start-shell.bat`
diff --git a/browser_patches/firefox/build.sh b/browser_patches/firefox/build.sh
index e06e112014..936372b8a2 100755
--- a/browser_patches/firefox/build.sh
+++ b/browser_patches/firefox/build.sh
@@ -26,19 +26,19 @@ elif [[ "$(uname)" == "Linux" ]]; then
echo "-- building on Linux"
echo "ac_add_options --disable-av1" > .mozconfig
elif [[ "$(uname)" == MINGW* ]]; then
- TMPFILE=$(mktemp)
+ DLL_FILE=""
if [[ $1 == "--win64" ]]; then
echo "-- building win64 build on MINGW"
echo "ac_add_options --target=x86_64-pc-mingw32" > .mozconfig
echo "ac_add_options --host=x86_64-pc-mingw32" >> .mozconfig
- "$PROGRAMFILES\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find '**\Redist\MSVC\*\x64\**\vcruntime140.dll' > $TMPFILE
+ DLL_FILE=$("$PROGRAMFILES\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find '**\Redist\MSVC\*\x64\**\vcruntime140.dll')
else
echo "-- building win32 build on MINGW"
- "$PROGRAMFILES\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find '**\Redist\MSVC\*\x86\**\vcruntime140.dll' > $TMPFILE
+ DLL_FILE=$("$PROGRAMFILES\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find '**\Redist\MSVC\*\x86\**\vcruntime140.dll')
fi
- WIN32_REDIST_DIR=$(dirname "$(cat $TMPFILE)")
+ WIN32_REDIST_DIR=$(dirname "$DLL_FILE")
if ! [[ -d $WIN32_REDIST_DIR ]]; then
- echo "Error: cannot find MS VS C++ redistributable $WIN32_REDIST_DIR"
+ echo "ERROR: cannot find MS VS C++ redistributable $WIN32_REDIST_DIR"
exit 1;
fi
echo "export WIN32_REDIST_DIR=\"$WIN32_REDIST_DIR\"" >> .mozconfig
diff --git a/browser_patches/webkit/archive.sh b/browser_patches/webkit/archive.sh
index 96f3fbc933..cd63905789 100755
--- a/browser_patches/webkit/archive.sh
+++ b/browser_patches/webkit/archive.sh
@@ -71,6 +71,17 @@ createZipForLinux() {
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=$("$PROGRAMFILES\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)"
@@ -82,7 +93,7 @@ createZipForWindows() {
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 /c/WEBKIT_WIN64_LIBS
+ cd "$(printMSVCRedistDir)"
cp -t $tmpdir msvcp140.dll vcruntime140.dll vcruntime140_1.dll msvcp140_2.dll
cd -