mirror of
https://github.com/Alex313031/thorium.git
synced 2025-01-09 11:27:32 -03:00
update windows building docs
This commit is contained in:
parent
58ad31e860
commit
d36374264b
2 changed files with 74 additions and 47 deletions
|
@ -15,13 +15,13 @@ For Windows and Windows [AVX2](https://en.wikipedia.org/wiki/Advanced_Vector_Ext
|
|||
Depot_tools bundles an appropriate version of Python in `$depot_tools/python-bin`,
|
||||
if you don't have an appropriate version already on your system.
|
||||
|
||||
Most development is done on [Ubuntu 22.04](https://ubuntu.com/download), Jammy Jellyfish (This is what Chromium's build infrastructure currently runs).
|
||||
Most development is done on Ubuntu 22.04, Jammy Jellyfish (This is what Chromium's build infrastructure currently runs).
|
||||
Ubuntu 16.04/18.04 no longer works. 20.04 and Debian 10/11/12 will work.
|
||||
There are some instructions for other distros below, but they are mostly unsupported.
|
||||
|
||||
__The scripts to build Thorium assume that depot_tools, thorium and chromium are both in $HOME!__
|
||||
|
||||
## Install *depot_tools* <a name="depot-tools"></a>
|
||||
## Install `depot_tools` <a name="depot-tools"></a>
|
||||
|
||||
Clone the `depot_tools` repository:
|
||||
|
||||
|
@ -112,7 +112,8 @@ things like LLVM and a Debian Sysroot.:
|
|||
$ gclient runhooks
|
||||
```
|
||||
|
||||
*Optional*: You can also [build with API keys](https://www.chromium.org/developers/how-tos/api-keys) if you want your
|
||||
*Optional*: You can also [build with API
|
||||
keys](https://www.chromium.org/developers/how-tos/api-keys) if you want your
|
||||
build to talk to some Google services like Google Sync, Translate, and GeoLocation. <img src="https://github.com/Alex313031/thorium/blob/main/logos/NEW/Key_Light.svg#gh-dark-mode-only" width="26"> <img src="https://github.com/Alex313031/thorium/blob/main/logos/NEW/Key_Dark.svg#gh-light-mode-only" width="26"> Thorium has its own keys in a private repository, if you are a builder or would like access to them, contact me. Otherwise, for personal or development builds,
|
||||
you can create your own keys and add yourself to [google-browser-signin-testaccounts](https://groups.google.com/u/1/a/chromium.org/g/google-browser-signin-testaccounts)
|
||||
to enable Sync.
|
||||
|
@ -120,12 +121,13 @@ to enable Sync.
|
|||
## Setting up the build <a name="setup"></a>
|
||||
|
||||
First, we need to run `./trunk.sh` (in the root of the Thorium repo.) This will Rebase/Sync the Chromium repo, and revert it to stock Chromium. \
|
||||
It will also fetch all the tags/branches, which is needed for the version.sh script. It should be used before every seperate build. See the [Updating](#updating) section.
|
||||
It should be used before every seperate build. See the [Updating](#updating) section.
|
||||
|
||||
__IMPORTANT__
|
||||
This will update and sync the sources to the latest revision (tip of tree) and ensure you have all the version tags.
|
||||
|
||||
- Then, to check out the current Chromium revision that Thorium is using, run `./version.sh`. At the end it will download the [PGO profiles](https://chromium.googlesource.com/chromium/src.git/+/refs/heads/main/docs/pgo.md) for Chromium for all platforms. The file will be downloaded to *//chromium/src/chrome/build/pgo_profiles/*.profdata* with the actual file name looking something like 'chrome-linux-main-1632505958-ddbb37bcdfa7dbd7b10cf3a9b6a5bc45e7a958a6.profdata', which should be added to the end of args.gn as per below.
|
||||
- Then, to check out the current Chromium revision that Thorium is using, run `./version.sh`. At the end it will download the [PGO profiles](https://chromium.googlesource.com/chromium/src.git/+/refs/heads/main/docs/pgo.md) for Chromium for all platforms. The file will be downloaded to *//chromium/src/chrome/build/pgo_profiles/*.profdata* with the actual file name looking something like 'chrome-linux-6167-1706004111-41f78c57fb3a1fe49a5c549b16f0221465339af9.profdata', which should be added to the end of args.gn as per below.
|
||||
Take note of this, as we will be using it in the `args.gn` below.
|
||||
- Then, (from where you cloned this repo) run `./setup.sh`. This will copy all the files and patches to the needed locations and drop you to *//chromium/src*.
|
||||
- NOTE: To build for MacOS, use `./setup.sh --mac`. To build for Raspberry Pi, use `./setup.sh --raspi`. Use `./setup.sh --help` to see all options/platforms.
|
||||
|
||||
|
|
|
@ -4,19 +4,18 @@
|
|||
|
||||
* A 64-bit machine with at least 8GB of RAM. More than 16GB is highly
|
||||
recommended.
|
||||
* At least 75GB of free disk space on an NTFS-formatted hard drive. FAT32
|
||||
* At least 100GB of free disk space on an NTFS-formatted drive. FAT32
|
||||
will not work, as some of the Git packfiles are larger than 4GB.
|
||||
* An appropriate version of Visual Studio, as described below.
|
||||
* An appropriate version of Bash (such as Git Bash), as described below.
|
||||
* Windows 10 1809 or newer.
|
||||
|
||||
## Setting up Windows
|
||||
|
||||
### Visual Studio
|
||||
|
||||
Chromium requires [Visual Studio 2019](https://visualstudio.microsoft.com/vs/older-downloads/) (>=16.0.0)
|
||||
to build, but [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) (>=17.0.0)
|
||||
is preferred. Visual Studio can also be used to debug Chromium, and version 2022 is
|
||||
preferred for this as it handles Chromium's large debug information much better.
|
||||
Chromium requires [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) (>=17.0.0)
|
||||
to build. Visual Studio can also be used to debug Chromium.
|
||||
The *clang-cl* compiler is used, but Visual Studio's header files, libraries, and
|
||||
some tools are required. Visual Studio Community Edition will work. You must install the "Desktop development with
|
||||
C++" component and the "MFC/ATL support" sub-components. This can be done from
|
||||
|
@ -35,16 +34,17 @@ VisualStudioSetup.exe --add Microsoft.VisualStudio.Workload.NativeDesktop --add
|
|||
- You must have the version 10.1.22621.755 [Windows 11 SDK](https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/)
|
||||
installed. This can be installed separately or by checking the appropriate box
|
||||
in the Visual Studio Installer __(Note that MSVS 2022 will try to install the 22000 version by default, uncheck this and check the 22621 version)__.
|
||||
There is also experimental support for the Windows 11 10.1.22000.755 version.
|
||||
|
||||
The 10.0.22621.755 SDK Debugging Tools must also be installed. This
|
||||
version of the Debugging tools is needed in order to support reading the
|
||||
large-page PDBs that Chrome uses to allow greater-than 4 GiB PDBs.
|
||||
If the Windows 10 SDK was installed via the Visual Studio installer, then they can be installed by going
|
||||
to: Control Panel → Programs → Programs and Features → Select the "Windows
|
||||
Software Development Kit" → Change → Change → Check "Debugging Tools For
|
||||
Windows" → Change. Or, you can download the standalone SDK installer and use it
|
||||
to install the Debugging Tools.
|
||||
This can be installed after the matching Windows SDK version is installed, from:
|
||||
Control Panel -> Programs and Features -> Windows Software Development Kit [version] -> Change -> Debugging Tools for Windows.
|
||||
Or, you can download the standalone SDK installer and use it to install the Debugging Tools.
|
||||
If building on ARM64 Windows then you will need to manually copy the
|
||||
Debuggers\x64 directory from another machine because it does not get installed
|
||||
on ARM64 and is needed, whether you are building Chromium for x64 or ARM64 on
|
||||
ARM64.
|
||||
|
||||
## Install `depot_tools`
|
||||
|
||||
|
@ -80,15 +80,11 @@ Also, add a `DEPOT_TOOLS_WIN_TOOLCHAIN` environment variable in the same way, an
|
|||
it to __0__. This tells depot_tools to use your locally installed version of Visual
|
||||
Studio (by default, depot_tools will try to use a google-internal version).
|
||||
|
||||
You should also set the variable `vs2019_install` or
|
||||
`vs2022_install` to your installation path of Visual Studio 19 or 22, like
|
||||
`vs2019_install` = __C:\Program Files (x86)\Microsoft Visual Studio\2019\Community__
|
||||
for Visual Studio 2019, or
|
||||
You should also set the variable `vs2022_install` to your installation path of Visual Studio 22, like
|
||||
`vs2022_install` = __C:\Program Files\Microsoft Visual Studio\2022\Community__
|
||||
for Visual Studio 2022.
|
||||
|
||||
Once all of this is done, we will download some infra archives using `gclient`. \
|
||||
From a cmd.exe shell, run:
|
||||
From a __cmd.exe__ shell, run:
|
||||
```shell
|
||||
gclient
|
||||
```
|
||||
|
@ -117,7 +113,7 @@ that point to 'App Installer'.
|
|||
|
||||
## Downloading the Chromium code
|
||||
|
||||
First, configure Git:
|
||||
First, configure Git (you may want to backup your current .gitconfig file if it exists):
|
||||
|
||||
```shell
|
||||
git config --global user.name "My Name"
|
||||
|
@ -125,6 +121,7 @@ git config --global user.email "my-name@chromium.org"
|
|||
git config --global core.autocrlf false
|
||||
git config --global core.filemode false
|
||||
git config --global branch.autosetuprebase always
|
||||
git config --global core.longpaths true
|
||||
```
|
||||
|
||||
Create a `chromium` directory in *C:\src* for the checkout and change to it.
|
||||
|
@ -163,7 +160,7 @@ to enable Sync.
|
|||
## Downloading the Thorium code
|
||||
|
||||
Using Git:
|
||||
It should be placed side by side with the Chromium directory in *C:\src*. \
|
||||
It should be placed in $HOME, i.e. C:\Users\$USERNAME. \
|
||||
|
||||
```shell
|
||||
git clone --recursive https://github.com/Alex313031/thorium.git
|
||||
|
@ -171,50 +168,66 @@ git clone --recursive https://github.com/Alex313031/thorium.git
|
|||
|
||||
## Setting up the build
|
||||
|
||||
First, we need to check out the revision that Chromium is currently using. For this, run `version.bat`. \
|
||||
To use the build scripts, we need bash on Windows. It is recommended to use Git Bash from [Git for Windows](https://gitforwindows.org/).
|
||||
All the following script instructions assume that Chromium is in *C:\src\chromium\src* and that you have changed to the thorium repo in bash.
|
||||
|
||||
First, we need to make sure we have all the tags/branches and are on Tip of Tree.
|
||||
For this, run:
|
||||
|
||||
```shell
|
||||
./trunk.sh
|
||||
```
|
||||
|
||||
Secondly, we need to check out the revision that Chromium is currently using.
|
||||
For this, run:
|
||||
|
||||
```shell
|
||||
./version.sh
|
||||
```
|
||||
|
||||
Secondly, we need to copy the Thorium source files over the Chromium tree. \
|
||||
Run the `setup.bat` script in *Thorium\win_scripts* to automate this.
|
||||
For this, run:
|
||||
|
||||
```shell
|
||||
cd C:\src\Thorium\win_scripts && setup.bat
|
||||
./setup.sh
|
||||
```
|
||||
It will drop you back to *C:\src\chromium\src*, which is where the rest of the commands will be carried out.
|
||||
- NOTE: To build for AVX2, use `./setup.sh --avx2`. To build SSE3, use `./setup.sh --sse3`. Use `./setup.sh --help` to see all options/platforms.
|
||||
|
||||
Next, we will download the PGO profile for Thorium, which changes with every revision. Run:
|
||||
|
||||
```shell
|
||||
python3 tools\update_pgo_profiles.py --target=win64 update --gs-url-base=chromium-optimization-profiles/pgo_profiles
|
||||
```
|
||||
This will download a *.profdata file, looking something like `chrome-win64-main-1659409120-058034bd778fed227d12a29fd0edd0942810dbf8.profdata`. \
|
||||
At the end it will download the [PGO profiles](https://chromium.googlesource.com/chromium/src.git/+/refs/heads/main/docs/pgo.md) for Chromium for all platforms.
|
||||
The file for Windows will be downloaded to *C:\src\chromium\src\chrome\build\pgo_profiles\*.profdata* with the actual file name looking something like
|
||||
'chrome-win64-6167-1706032279-97e63d82a0938b7701d8cdf028299c39d523a3c6.profdata', which should be added to the end of args.gn as per below.
|
||||
Take note of this, as we will be using it in the `args.gn` below.
|
||||
|
||||
### Creating the build directory
|
||||
Chromium & Thorium use [Ninja](https://ninja-build.org) as its main build tool along with
|
||||
a tool called [GN](https://gn.googlesource.com/gn/+/main/docs/quick_start.md) to generate `.ninja` files. Create the build directory by running:
|
||||
a tool called [GN](https://gn.googlesource.com/gn/+/main/docs/quick_start.md) to generate `.ninja` files.
|
||||
|
||||
NOTE: Instructions from here on out assume you are back in __cmd.exe__ (not Bash), and have changed to the *C:\src\chromium\src* directory.
|
||||
|
||||
Create the build output directory by running:
|
||||
|
||||
```shell
|
||||
gn args out\thorium
|
||||
```
|
||||
|
||||
This will open up notepad.exe, and this is where we will specify build arguments ("args") which direct Ninja on how to lay out the build directory tree.
|
||||
We will be copy/pasting the contents of the [win_args.gn](https://github.com/Alex313031/thorium/blob/main/infra/win_args.gn) file (from *C:\src\Thorium\infra\win_args.gn*) into notepad.
|
||||
We will be copy/pasting the contents of the [win_args.gn](https://github.com/Alex313031/thorium/blob/main/win_args.gn) file (from *C:\src\Thorium\win_args.gn*) into notepad.
|
||||
Notice the three lines at the top, related to API Keys. It is fine to leave them blank, or add the ones you have made. \
|
||||
__At the bottom__, though, notice the line that says *pgo_data_path = ""*. This is where we will put the full path to the PGO profile data file we downloaded earlier.
|
||||
|
||||
That line should look something like:
|
||||
|
||||
`pgo_data_path = "C:\src\chromium\src\chrome\build\pgo_profiles\chrome-win64-main-1659409120-058034bd778fed227d12a29fd0edd0942810dbf8.profdata"`
|
||||
`pgo_data_path = "C:\src\chromium\src\chrome\build\pgo_profiles\chrome-win64-6167-1706032279-97e63d82a0938b7701d8cdf028299c39d523a3c6.profdata"`
|
||||
|
||||
* For other build arguments, and what the ones that Thorium uses do, see [ABOUT_GN_ARGS.md](https://github.com/Alex313031/thorium/blob/main/infra/DEBUG/ABOUT_GN_ARGS.md) & [win_args.list](https://github.com/Alex313031/thorium/blob/main/infra/win_args.list)
|
||||
* For more info on GN, run `gn help` on the command line or read the [quick
|
||||
start guide](https://gn.googlesource.com/gn/+/main/docs/quick_start.md).
|
||||
* For other build arguments, and what the ones that Thorium uses do, see [ABOUT_GN_ARGS.md](https://github.com/Alex313031/thorium/blob/main/docs/ABOUT_GN_ARGS.md) & [win_args.list](https://github.com/Alex313031/thorium/blob/main/infra/win_args.list)
|
||||
* For more info on GN, run `gn help` on the command line or read the [quick start guide](https://gn.googlesource.com/gn/+/main/docs/quick_start.md).
|
||||
|
||||
## Build Thorium
|
||||
## Build Thorium <a name="build"></a>
|
||||
|
||||
Build Thorium, and the other things like [chromedriver](https://chromedriver.chromium.org/home) and [thorium_shell](https://github.com/Alex313031/thorium/tree/main/thorium_shell#readme) with Ninja using the command:
|
||||
|
||||
```shell
|
||||
autoninja -C out\thorium chrome chromedriver thorium_shell setup mini_installer -j8
|
||||
autoninja -C out\thorium thorium chromedriver thorium_shell setup mini_installer -j8
|
||||
```
|
||||
(Where -j# can be any number, and should generally be set to the number of cores on your CPU).
|
||||
|
||||
|
@ -228,7 +241,13 @@ use autoninja -C out\thorium chrome/test:unit_tests).
|
|||
|
||||
## Install/Run Thorium
|
||||
|
||||
Once it is built, you can simply install the browser.
|
||||
Once it is built, you can simply run the browser:
|
||||
|
||||
```shell
|
||||
out\thorium\thorium.exe
|
||||
```
|
||||
|
||||
Or install it using the mini_installer:
|
||||
|
||||
```shell
|
||||
out\thorium\mini_installer.exe
|
||||
|
@ -236,12 +255,11 @@ out\thorium\mini_installer.exe
|
|||
|
||||
## Update your checkout
|
||||
|
||||
To update an existing Chromium checkout, you should run the `trunk.bat` script in win_scripts:
|
||||
To update an existing Chromium checkout, you should run the `trunk.sh` script again:
|
||||
|
||||
```shell
|
||||
cd C:\src\Thorium\win_scripts && trunk.bat
|
||||
./trunk.sh
|
||||
```
|
||||
(This script will also download the latest PGO profile data file at the end; useful when making fresh builds.)
|
||||
|
||||
This syncs the subrepositories to the appropriate versions,
|
||||
deleting those that are no longer needed, and re-runs the hooks as needed.
|
||||
|
@ -249,9 +267,16 @@ deleting those that are no longer needed, and re-runs the hooks as needed.
|
|||
To update an existing Thorium checkout, just download the latest .zip, or do a git pull:
|
||||
|
||||
```shell
|
||||
git pull origin main
|
||||
git pull --recurse-submodules origin main
|
||||
```
|
||||
|
||||
### Debugging <a name="debugging"></a>
|
||||
* See the [Thorium DEBUG](https://github.com/Alex313031/thorium/tree/main/infra/DEBUG#readme) dir, including the [More Info](https://github.com/Alex313031/thorium/blob/main/infra/DEBUG/README.md#more-info-) section, and [DEBUGGING.md](https://github.com/Alex313031/thorium/blob/main/infra/DEBUG/DEBUGGING.md).
|
||||
|
||||
If you suspect that Windows Defender is slowing your build then you can try Microsoft's
|
||||
[Performance analyzer for Microsoft Defender Antivirus](https://learn.microsoft.com/en-us/microsoft-365/security/defender-endpoint/tune-performance-defender-antivirus?view=o365-worldwide)
|
||||
to investigate in detail.
|
||||
|
||||
*Happy Thorium Building!*
|
||||
|
||||
<img src="https://github.com/Alex313031/thorium/blob/main/logos/STAGING/Thorium90_504.jpg" width="200">
|
||||
|
|
Loading…
Reference in a new issue