Skip to content

Commit 040f9b0

Browse files
authored
browser(webkit): copy MS VC++ redistributable libs from VS installation (#4360)
1 parent 5faf6f9 commit 040f9b0

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

browser_patches/buildbots/README.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -120,19 +120,6 @@ The `core.longpaths` is needed for webkit since it has some very long layout pat
120120

121121
Run `c:\mozilla-build\start-shell.bat` and checkout Playwright repo to `/c/playwright`.
122122

123-
### 7. Create a c:\WEBKIT_WIN64_LIBS\ directory with win64 dlls
124-
125-
126-
Create a new `c:\WEBKIT_WIN64_LIBS` folder and copy the following libraries from `C:\Windows\System32` into it:
127-
- `msvcp140.dll`
128-
- `msvcp140_2.dll`
129-
- `vcruntime140.dll`
130-
- `vcruntime140_1.dll`
131-
132-
> **NOTE**: these libraries are expected by `//browser_patches/webkit/archive.sh`.
133-
134-
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))
135-
136123
## Running Build Loop
137124

138125
1. Launch `c:\mozilla-build/start-shell.bat`

browser_patches/firefox/build.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ elif [[ "$(uname)" == "Linux" ]]; then
2626
echo "-- building on Linux"
2727
echo "ac_add_options --disable-av1" > .mozconfig
2828
elif [[ "$(uname)" == MINGW* ]]; then
29-
TMPFILE=$(mktemp)
29+
DLL_FILE=""
3030
if [[ $1 == "--win64" ]]; then
3131
echo "-- building win64 build on MINGW"
3232
echo "ac_add_options --target=x86_64-pc-mingw32" > .mozconfig
3333
echo "ac_add_options --host=x86_64-pc-mingw32" >> .mozconfig
34-
"$PROGRAMFILES\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find '**\Redist\MSVC\*\x64\**\vcruntime140.dll' > $TMPFILE
34+
DLL_FILE=$("$PROGRAMFILES\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find '**\Redist\MSVC\*\x64\**\vcruntime140.dll')
3535
else
3636
echo "-- building win32 build on MINGW"
37-
"$PROGRAMFILES\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find '**\Redist\MSVC\*\x86\**\vcruntime140.dll' > $TMPFILE
37+
DLL_FILE=$("$PROGRAMFILES\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find '**\Redist\MSVC\*\x86\**\vcruntime140.dll')
3838
fi
39-
WIN32_REDIST_DIR=$(dirname "$(cat $TMPFILE)")
39+
WIN32_REDIST_DIR=$(dirname "$DLL_FILE")
4040
if ! [[ -d $WIN32_REDIST_DIR ]]; then
41-
echo "Error: cannot find MS VS C++ redistributable $WIN32_REDIST_DIR"
41+
echo "ERROR: cannot find MS VS C++ redistributable $WIN32_REDIST_DIR"
4242
exit 1;
4343
fi
4444
echo "export WIN32_REDIST_DIR=\"$WIN32_REDIST_DIR\"" >> .mozconfig

browser_patches/webkit/archive.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ createZipForLinux() {
7171
rm -rf $tmpdir
7272
}
7373

74+
# see https://docs.microsoft.com/en-us/visualstudio/install/tools-for-managing-visual-studio-instances?view=vs-2019
75+
printMSVCRedistDir() {
76+
local dll_file=$("$PROGRAMFILES\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find '**\Redist\MSVC\*\x64\**\vcruntime140.dll')
77+
local redist_dir=$(dirname "$dll_file")
78+
if ! [[ -d $redist_dir ]]; then
79+
echo "ERROR: cannot find MS VS C++ redistributable $redist_dir"
80+
exit 1;
81+
fi
82+
echo "$redist_dir"
83+
}
84+
7485
createZipForWindows() {
7586
# create a TMP directory to copy all necessary files
7687
local tmpdir="/tmp/webkit-deploy-$(date +%s)"
@@ -82,7 +93,7 @@ createZipForWindows() {
8293
cp -t $tmpdir JavaScriptCore.dll PlaywrightLib.dll WTF.dll WebKit2.dll libEGL.dll libGLESv2.dll
8394
cp -t $tmpdir Playwright.exe WebKitNetworkProcess.exe WebKitWebProcess.exe
8495
cd -
85-
cd /c/WEBKIT_WIN64_LIBS
96+
cd "$(printMSVCRedistDir)"
8697
cp -t $tmpdir msvcp140.dll vcruntime140.dll vcruntime140_1.dll msvcp140_2.dll
8798
cd -
8899

0 commit comments

Comments
 (0)