Skip to content

Commit

Permalink
browser(webkit): copy MS VC++ redistributable libs from VS installati…
Browse files Browse the repository at this point in the history
…on (#4360)
  • Loading branch information
yury-s authored Nov 6, 2020
1 parent 5faf6f9 commit 040f9b0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
13 changes: 0 additions & 13 deletions browser_patches/buildbots/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
10 changes: 5 additions & 5 deletions browser_patches/firefox/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion browser_patches/webkit/archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand All @@ -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 -

Expand Down

0 comments on commit 040f9b0

Please sign in to comment.