Add files via upload

This commit is contained in:
Alexander David Frick 2022-07-18 19:44:51 -07:00 committed by GitHub
parent 4d4f4396bd
commit c574ca8c0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3273 additions and 0 deletions

145
docs/ABOUT_GN_ARGS.md Normal file
View File

@ -0,0 +1,145 @@
## <img src="https://raw.githubusercontent.com/Alex313031/Thorium/main/logos/NEW/GN_Light.svg#gh-dark-mode-only" width="36"> <img src="https://raw.githubusercontent.com/Alex313031/Thorium/main/logos/NEW/GN_Dark.svg#gh-light-mode-only" width="36"> &nbsp;When building Chromium/Thorium, you run gn args out/$DIR, where $DIR can be any name; in Thorium it is named out/thorium. These set build arguments for ninja (the Chromium build system) to parse and apply. Thorium has many set, and they vary from platform to platform, and whether or not it is a Debug build. This document explains what they do, why they are set a certain way in Thorium, and options available.
## API Keys
google_api_key = "" &#35;&#35; Set Google API Key. Unset in public Thorium repository.
google_default_client_id = "" &#35;&#35; Set the Client ID. Unset in public Thorium repository.
google_default_client_secret = "" &#35;&#35; Set the Client Secret. All three must be set to use Google Sync, Translate, etc. Unset in public Thorium repository. You can make and set your own by following https://www.chromium.org/developers/how-tos/api-keys/. &#35;&#35; NOTE: Thorium contributers, contact me for access to the private API_KEYS repo.
## Experimental
is_chancie_wancie_build &#35;&#35; Build the CrOS version of ffmpeg. Used for testing, I.E. to enable HEVC on Linux. Will break Windows/Android/Fuchsia builds. Contact me for info on usage cases and testing.
## MacOS
use_system_xcode = true &#35;&#35; Whether to use the local XCode. Only applicable on Mac, and must be enabled, as only internal Chrome builds have this set to false to use an internal checkout of XCode.
## Cross-Building
target_os &#35;&#35; Set the target Operating System. I.E. linux, win, mac, chromeos, fuchsia.
target_cpu &#35;&#35; Set the target CPU. I.E. x86, x64, arm, arm64, mipsel, mips64el, and ppc. Can be used to cross-compile. When using arm/arm64, you should set compiler options in //thorium/build/config/arm.gni
## Main
enable_linux_installer &#35;&#35; Enable making a linux .deb, .rpm, or .snap installer. (Linux Only) Disabled in Debug builds.
enable_distro_version_check &#35;&#35; Set whether to make the linux installer check for supported distro. (Linux Only) Disabled in Debug builds.
enable_stripping &#35;&#35; Set whether to strip binaries and .so/.dll libraries. Disabled in Debug builds.
is_official_build &#35;&#35; Set whether this is an Official Build. This enables other optimizations and sets "Official" instead of "Developer" in chrome://version and chrome://settings/help Disabled in Debug builds.
is_debug &#35;&#35; Set whether to link debugging constructs into the binary. Enabled in Debug builds. See > https://chromium.googlesource.com/chromium/src/+/0e94f26e8/docs/linux_debugging.md and https://www.chromium.org/developers/how-tos/debugging-on-windows/
dcheck_always_on &#35;&#35; Set whether to enable DCHECK, regardless of is_debug or is_official_build. Disabled in Thorium for perforance/size except for Debug builds.
exclude_unwind_tables &#35;&#35; Set whether to enable unwinding tables, regardless of is_debug or is_official_build. Enabled in Thorium for performance/size except for Debug builds.
enable_debugallocation &#35;&#35; DEPRECATED &#35;&#35; Set whether to allocate extra header space in binaries for debug constructs.
enable_iterator_debugging &#35;&#35; Set whether C++ iterator debugging is enabled. Only applicable if is_debug is true.
disable_fieldtrial_testing_config &#35;&#35; Set whether to disable fieldtrials. Disabled for stability, privacy, and reproducibility in Thorium. Decreases the number of variations at chrome://version See > https://chromium.googlesource.com/chromium/src/+/master/testing/variations/README.md
enable_resource_allowlist_generation &#35;&#35; Enables allowlist generation for IDR_ grit defines seen by the compiler. Only applicable for Android and Windows builds. Set to false in Thorium.
enable_profiling &#35;&#35; Set whether to enable profiling, I.E. for making your own PGO *.profdata files. Set to false in Thorium for performance. See > https://chromium.googlesource.com/chromium/src.git/+/HEAD/docs/profiling.md Should be disabled in public ThoriumOS builds.
is_component_build &#35;&#35; Splits many parts of Thorium/Chromium into shared libraries. Avoids the long linking step towards the end of building. In Debug builds, this is what disables the creation of an installer. See > https://chromium.googlesource.com/chromium/src/+/HEAD/docs/component_build.md Set to disabled in Thorium, even for Debug builds, where it is the default.
symbol_level &#35;&#35; Sets overall symbol level. Options are: 0, 1, and 2. Set to 0 for performance.
enable_nacl &#35;&#35; Set whether Native Client (NaCl) is built. Disabled in Thorium for size, and because it is being deprecated. Enable for using some Chrome Apps and for ChromiumOS/ThoriumOS builds. See > https://developer.chrome.com/docs/native-client/
optimize_webui &#35;&#35; Set whether WebUI components are optimized. Uses polymer-bundler to combine/compress HTML5 resources. See > https://chromium.googlesource.com/chromium/src/+/HEAD/docs/optimizing_web_uis.md Enabled in Thorium for performance.
enable_webui_tab_strip &#35;&#35; Set whether the Tab Strip, and some parts of the top bar (Top Chrome) are built using WebUI technologies. Should always be enabled, except on certain old linux distros.
use_lld &#35;&#35; Use LLVM lld instead of GNU ld for linking. Should always be enabled unless you are using another linker like MOLD.
v8_symbol_level &#35;&#35; Set the symbol level for V8 (Chromium's JavaScript engine), regardless of symbol_level value. Options are: 0, 1, and 2. Set to 0 for performance. For more info about V8, see > https://v8.dev/
use_v8_context_snapshot &#35;&#35; Build a seperate .bin file with V8's function templates and V8 contexts. Enabled in Thorium. &#35;&#35; TODO: Maybe disable this on Linux builds? Should be disabled in ThoriumOS.
blink_symbol_level &#35;&#35; Set the symbol level for Blink (Chromium's rendering engine.), regardless of symbol_level value. Options are: 0, 1, and 2. Set to 0 for performance.
enable_precompiled_headers &#35;&#35; Sets whether to precompile some .h files before main compiling. Can speed up compiling, but is disabled in Thorium for reproducibility and to ensure any Thorium .h files are properly #included in corresponding .cc files. See > https://cmake.org/cmake/help/latest/command/target_precompile_headers.html
media_use_ffmpeg &#35;&#35; Enable use of Chromium's ffmpeg implementation for media library/streams. Should always be enabled unless using a custom ffmpeg checkout.
media_use_libvpx &#35;&#35; Enable use of Chromium's libvpx implementation for media library/streams. Used for software based decoding of VP9 and VP8A type content. Should always be enabled.
enable_hls_sample_aes &#35;&#35; Enables demuxing of HLS media encrypted with AES. Uses the AES Cflags in Thorium to increase performance. See > https://en.wikipedia.org/wiki/AES_instruction_set
enable_hls_demuxer &#35;&#35; Enables HLS media demuxing. &#35;&#35; INCOMPLETE upstream. Enabled in Thorium for useability.
enable_ink &#35;&#35; Enable experimental Ink (PDF Annotation) on CrOS. Breaks non-ChromiumOS builds. &#35;&#35; NOTE: Bug filed by me upstream.
enable_discovery &#35;&#35; Enable the Discovery SWA (System Web App) on CrOS. Has no effect on non-ChromiumOS builds. Only fully works on internal ChromeOS builds.
enable_cros_media_app &#35;&#35; Enable the CrOS Media App, a native app for viewing media on ChromiumOS, to replace the native Files App views component. Breaks non-ChromiumOS builds. Should be enabled in ThoriumOS. &#35;&#35; NOTE: Bug filed by me upstream.
proprietary_codecs &#35;&#35; Enable building ffmpeg with proprietary codecs like H.254, H.265 (HEVC), and FLAC. Must be used with ffmpeg_branding = chrome or ffmpeg_branding = chromeos. Enabled in Thorium for useability. See > https://www.chromium.org/audio-video/
ffmpeg_branding &#35;&#35; Sets the internal BRANDING header in ffmpeg. Must be used with proprietary_codecs = true. Options are: "Chromium", "Chrome", and "Chromeos". is_chancie_wancie = true build will override the internal checks that "Chromeos" only be set when building for CrOS, and set it to Chromeos anyway for any platform.
enable_ffmpeg_video_decoders &#35;&#35; Set whether software ffmpeg video decoders are enabled. Should be set to true. Used in Thorium as a fallback for all platforms when a hardware decoder, I.E. VAAPI or VDPAU cannot be used.
is_component_ffmpeg &#35;&#35; Builds ffmpeg as a shared library even when is_component_build is false or is_official build is true. Enabled on Linux, so users can swap out libffmpeg.so for a FOSS one or different one, I.E a different version or from something like Opera or Vivaldi for extra Codec support. &#35;&#35; NOTE: Should be disabled on Mac, because building the installer will fail. Also, should be disabled on Windows, as it causes the compatibility mode bug on Win 10/11. &#35;&#35; TODO: Look into fixing on Windows, so that users can swap out ffmpeg.dll for another one.
use_webaudio_ffmpeg &#35;&#35; Use ffmpeg for computing FFT's (Fast Fourier Transform) in audio streams. Disabled in Thorium for performance, and because of bugs when building for AVX.
use_webaudio_pffft &#35;&#35; Use the pffft library for computing FFT's in audio streams. Enabled in Thorium for performance EXCEPT on MacOS, because the native FFT library there is much faster. See > https://bitbucket.org/jpommier/pffft/src
enable_av1_decoder &#35;&#35; Enable standard AV1 decoder. Commented out in Thorium to let ninja set appropriate value for the platform.
enable_dav1d_decoder &#35;&#35; Enable VideoLAN dav1d AV1 decoder. Commented out in Thorium to let ninja set appropriate value for the platform.
use_vaapi &#35;&#35; Set the availability of VAAPI in Chromium. Should always be enabled in Thorium, except on Windows.
enable_widevine &#35;&#35; Set the availability of the Widevine CDM (Content Decryption Module) for encrypted media streams like I.E on Netflix, Hulu, etc. Enabled in Thorium for useability. See > https://www.widevine.com/
bundle_widevine_cdm &#35;&#35; Set whether to bundle the Widevine CDM as a library in the installation folder. When enabled, it cannot be updated as its version is hard coded and tied with the chrome executable, and will not show in chrome://components as it is not built as a component. When disabled, it functions as a component and is downloaded with other components from Google servers to the user profile dir. Disabled in Thorium for transparency, and so that it can be updated irrespective of the Thorium version. Also disabled to make use of the widevine patches for Thorium on Linux. Could technically be enabled on Windows. Only enabled in ThoriumOS, with the widevine patches in that repository.
ignore_missing_widevine_signing_cert &#35;&#35; Set whether to ignore Widevine CDM host verification signing due to no signing cert, regardless of is_official_build. Enabled in Thorium to mitigate possible Widevine issues.
enable_media_drm_storage &#35;&#35; Enable whether Widevine can use LocalStorage to hold DRM files for certain encrypted streams, like I.E. Amazon Prime. Enabled in Thorium for useability.
enable_media_overlay &#35;&#35; Set whether certain media overlays, I.E. volume bar, etc. are enabled. Enabled in Thorium for useability.
enable_hangout_services_extension &#35;&#35; Enables building the Hangouts component Extension on Chromium/ChromiumOS. Enabled in Thorium for feature parity with Chrome. Should be enabled on ThoriumOS.
rtc_use_h264 &#35;&#35; Enable WebRTC (Real-Time Communication) to use H.264 for transmission/demuxing. Must be used with proprietary_codecs = true and ffmpeg_branding set to "Chrome" or "Chromeos". Enabled in Thorium for useability.
rtc_use_lto &#35;&#35; Set whether WebRTC uses thinLTO for optimization. Enabled in Thorium for performance.
rtc_include_ilbc &#35;&#35; Set whether to enable Google's Internet Low Bitrate Codec in WebRTC. Enabled in Thorium for performance and useability.
rtc_build_with_neon &#35;&#35; Set whether to use ARM NEON SIMD instructions when building RTC code. Only applicable for ARM/ARM64. Enabled in Thorium for performance.
rtc_build_examples &#35;&#35; Set whether to build example RTC data. Useful for debugging. Disabled in Thorium for size.
rtc_enable_avx2 &#35;&#35; Set whether to use AVX2 instructions when building RTC code. Enabled only in Thorium AVX2 builds for performance.
enable_vr &#35;&#35; Set whether to enable WebVR and WebXR in Chromium. Enabled in Thorium for useability. See > https://webvr.info/ and https://immersiveweb.dev/
use_vr_assets_component &#35;&#35; Set whether to enable the VR assets component. Disabled by default in non-Chrome builds. Enabled in Thorium for useability. Should also be enabled in ThoriumOS.
enable_platform_hevc &#35;&#35; Set the availability of using hardware HEVC decoders/encoders. Also needed to enable H.265. Enabled in Thorium on all platforms, despite H.264 being unavailable right now for Linux. Should be enabled in ThoriumOS.
enable_hevc_parser_and_hw_decoder &#35;&#35; Enable parsing and demuxing of HEVC media. Enabled in Thorium for useability. See > https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding
enable_platform_ac3_eac3_audio &#35;&#35; Enable building ac3 and eac3 audio codecs in ffmpeg. Enabled in Thorium for useability, despite being unavailable for some platforms. &#35;&#35; TODO: What platforms?
enable_platform_dolby_vision &#35;&#35; Enable Dolby vision in Chromium. Enabled in Thorium for all platforms, despite only working fully on ChromiumOS and ChromeCast. Should be enabled in ThoriumOS.
enable_platform_mpeg_h_audio &#35;&#35; Enable experimental MPEG H audio. Enabled in Thorium for useability.
enable_mse_mpeg2ts_stream_parser &#35;&#35; Enable experimental MPEG-TS media stream parsing/demuxing. Doesn't seem to work on non CrOS platforms. Enabled anyway in Thorium for all platforms for useability.
## Optimizations
use_thin_lto &#35;&#35; Enable thinLTO optimizations. Should be enabled for all Thorium builds, even Debug ones. See > https://clang.llvm.org/docs/ThinLTO.html
thin_lto_enable_optimizations &#35;&#35; Enable more aggressive thinLTO optimizations. Enabled in Thorium for performance, and makes use of the -O3 Cflags, LDflags, and import_instr_limit = 30 flags in the main chrome BUILD.gn file. Disabled for Debug builds.
chrome_pgo_phase &#35;&#35; Set the implementation of PGO in Chromium. Options are: 0 (none), 1 (Instrumentation Phase Only), and 2 (Full PGO). 1 and 2 requires setting a *.profdata file for the platform below. Thorium uses 2, except for Debug builds. 1 should only be used when profiling. Cannot be enabled on ChromiumOS/ThoriumOS. Can be disabled for faster compilation. Disabled for Debug builds. See > https://en.wikipedia.org/wiki/Profile-guided_optimization
pgo_data_path &#35;&#35; Set the full path to the *.profdata file for PGO. Downloaded when running trunk.sh in Thorium. Disabled in Debug builds and ThoriumOS.

2810
docs/CMDLINE_FLAGS_LIST.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,143 @@
## These are instruction for cross building Thorium for Windows, on Linux. Preliminary file for @gz83, to be eventually migrated to a Wiki with building instructions for all paltforms.
## Copyright (c) 2022 Alex313031
## In general, this document follows information from > https://chromium.googlesource.com/chromium/src.git/+/HEAD/docs/win_cross.md and https://chromium.googlesource.com/chromium/src/+/main/docs/linux/build_instructions.md
## Preparatory setup
First, make sure you are running Ubuntu 18.04/20.04, or Debian 10/11, or Arch, and have nano and unrar installed.
First, we need to install depot_tools. depot_tools is a .zip that contains tools for all Google projects like Chromium, ChromiumOS, NaCl, V8, Infra, Android, Google Cloud, and Fuschia.
We are assuming that depot_tools, chromium, and thorium will all be in $HOME.
First, (in $HOME), download depot_tools.
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
Then, open your .bashrc and add these to the end. (SUBSTITUTING FOR THE ACTUAL PATH, I.E. mine says alex because my name is Alex lol.)
umask 022
export EDITOR=nano
export VISUAL=nano
export NINJA_SUMMARIZE_BUILD=1
export PATH=/home/alex/depot_tools:$PATH
export DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL=/home/alex/chromium/win/
export GYP_MSVS_HASH_1023ce2e82=b86447e8fb
Then make these dirs
mkdir ~/chromium
mkdir ~/chromium/win
Then cd ~/chromium, and run
fetch --nohooks chromium
Let it download, it is large.
Then cd ~/chromium/src, and run
./build/install-build-deps.sh --no-arm --lib32
Then run
gclient runhooks
We now have a Chromium checkout, however we need to modify the .gclient file to download Windows dependencies.
Edit the .gclient file in chromium (not chromium/src)
And append to the bottom this line:
target_os = [ 'linux', 'win' ]
Lastly, cross building requires artifacts from Visual Studio as per > https://chromium.googlesource.com/chromium/src.git/+/HEAD/docs/win_cross.md
Download a .zip I already made from here > https://github.com/Alex313031/Snippets/releases/tag/10.1.20348.1
And place it in ~/chromium/win
## Setting up Thorium
Now, lets download the Thorium tree, so run (in $HOME)
git clone https://github.com/Alex313031/Thorium.git OR
Download the latest .zip > https://github.com/Alex313031/Thorium/archive/refs/heads/main.zip
Then cd ~/Thorium, and we need to make some files executable. So run
sudo chmod +x build.sh
sudo chmod +x build_win.sh
sudo chmod +x setup.sh
sudo chmod +x trunk.sh
sudo chmod +x clean.sh
sudo chmod +x misc/autoninja
## Setting up the build
Then, run (in order)
./trunk.sh // Pay attention to the PGO profile that is downloaded, the script downloads the PGO profile *.profdata files for Linux, Windows, and MacOS.
./setup.sh
Now we need to set up the PGO profile and set the args.gn
Open ~/Thorium/misc/windows_arg.gn and edit the last line that looks like
/home/alex/chromium/src/chrome/build/pgo_profiles/chrome-win64-main-1649213807-91f73deff0cf33b43bdbec74d7cefebdfe29830a.profdata
And edit it to point to the actual location of that PGO file from above.
You can also add API Keys to the top three lines of this file to enable Google Sync, Translate, etc. (Out of the scope of this article, for help, contact me.)
Now, go to ~/chromium/src, and run
gn args out/thorium
A nano editor will come up, and you will copy/paste the contents of the win_args.gn OR win_AVX2_args.gn (for AVX2) Or win_ARM_args.gn (for Windows on ARM) file into this.
Save and exit and the terminal will show "Generating files..." Wait for it to complete, and then to actually build it:
Go back to ~/Thorium, and run ./build_win.sh
NOTE: Run ./build_win.sh --help to see the (only) option, which is the number of jobs. The command it ultimately runs is:
./misc/autoninja -C ~/chromium/src/out/thorium chrome chromedriver thorium_shell setup mini_installer -j
You can substitute the -j# for the number of jobs. I use 8 because I have an 8 core cpu. Do not use a number more than the number of threads your CPU has.
So for example, I run ./build_win.sh 8
In the end, you will have a nice installer called mini_installer.exe in ~/chromium/src/out/thorium/
I rename it to thorium_mini_installer.exe or thorium_avx2_mini_installer.exe for releases. Just double click to install Thorium to C:\Users\$USERNAME\AppData\Local\Thorium
## AVX2 Release
Speaking of which! Thorium by default compiles with AVX and AES. To make the AVX2 version of it, you will follow all the steps above, except before running gn args out\thorium,
we need to download the avx2 sources.
git clone https://github.com/Alex313031/Thorium-AVX2.git or https://github.com/Alex313031/Thorium-AVX2/archive/refs/heads/main.zip
And simply copy the build directory over ~/chromium/src/build
## Make a portable release.
To make a portable release, it is easiest to copy an already made portable release from GitHub, extract it, and then:
1. Delete the contents of the BIN folder.
2. Use 7-Zip to extract the contents of the new mini_installer you just made, and then extract the chrome.7z that was inside it.
3. Copy the contents of Chrome-bin into the BIN folder in the portable folder.
4. Edit CONTENT_SHELL.bat to point to the actual location as the version number will have changed.
5. Likewise, edit the version number in the name of the whole portable folder to reflect the new Thorium.
6. Finally, rezip it up with 7-Zip. To use it, read the README.txt inside.
## Updating your checkout
To update the Chromium checkout, just run (from ~/Thorium)
./trunk
To update Thorium, do a git pull main or redownload the latest .zip
Enjoy!

175
docs/WIN_INSTRUCTIONS.txt Normal file
View File

@ -0,0 +1,175 @@
## These are instruction for building Thorium for Windows, natively on Windows. Preliminary file for @gz83, to be eventually migrated to a Wiki with building instructions for all paltforms.
## Copyright (c) 2022 Alex313031
## Preparatory setup
First, we need to install depot_tools and Visual Studio. depot_tools is a .zip that contains tools for all Google projects like Chromium, ChromiumOS, NaCl, V8, Infra, Android, Google Cloud, and Fuschia.
We will be in general following instructions from > https://chromium.googlesource.com/chromium/src/+/main/docs/windows_build_instructions.md
Visual Studio 2019 or 2022 is needed, and the Windows SDK version 10.0.20348.0 is needed along with its Debugging Tools.
EVERYTHING in this document is to be done in command prompt. No powershell, no windows terminal (Win 11).
The easiest way to do this is (and even if you already have Visual Studio installed, go ahead and redownload the latest installer to do this)
(VISUAL_STUDIO_INSTALLER is the actual path/name of the installer .exe)
$VISUAL_STUDIO_INSTALLER --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Component.VC.ATLMFC --includeRecommended
As noted above The SDK Debugging Tools must also be installed. 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.
Then download depot_tools. We are assuming that depot_tools, chromium, and thorium will all be in C:\src\.
https://storage.googleapis.com/chrome-infra/depot_tools.zip
Then, If you have Administrator access, Modify the PATH system variable and put C:\src\depot_tools at the front (or at least in front of any directory that might already have a copy of Python or Git).
Also, add a DEPOT_TOOLS_WIN_TOOLCHAIN environment variable in the same way, and set 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).
Also, add a NINJA_SUMMARIZE_BUILD environment variable the same way, and set it to 1.
Then, go to C:\src in cmd, and run
gclient
Now, lets configure git (you can skip the user.name and user.email if it is already configured)
git config --global user.name "My Name"
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
Now let's make the chromium dir.
mkdir chromium && cd chromium
So you should be in C:\src\chromium
Now run
fetch chromium
Let it download, it is large.
Then cd src\v8, so that we are in C:\src\chromium\src\v8, and run (one after another)
git checkout -f origin/main
cd ..
git checkout -f origin/main
git rebase-update
git fetch --tags
gclient sync --with_branch_heads --with_tags -f -R -D
gclient runhooks
Good, now we have a full Chromium checkout ready to be built, but to turn it into Thorium, we must copy the Thorium sources over the Chromium tree.
## Thorium Setup
So, lets download Thorium in C:\src
git clone https://github.com/Alex313031/Thorium.git or download the .zip and unpack it there > https://github.com/Alex313031/Thorium/archive/refs/heads/main.zip
Now, go back to C:\chromium\src
We are going to download the PGO profile (which changes with every release) so that we can set it in our args.gn file, which ninja (the build system) parses before compiling. So run
python3 tools/update_pgo_profiles.py --target=win64 update --gs-url-base=chromium-optimization-profiles/pgo_profiles
Now pay attention to the the file that is downloaded.
In C:\src\Thorium\misc, there is a file called win_args.gn. In that file toward the bottom there will be a line that says
pgo_data_path = "/home/alex/chromium/src/chrome/build/pgo_profiles/chrome-win64-main-1649213807-91f73deff0cf33b43bdbec74d7cefebdfe29830a.profdata"
We are going to change that to the actual location and name of the PGO profile data file we just downloaded i.e. it should look similar to this:
C:\src\chromium\src\chrome\build\pgo_profiles\chrome-win64-main-1649213807-91f73deff0cf33b43bdbec74d7cefebdfe29830a.profdata
You can also add API Keys to the top three lines of this file to enable Google Sync, Translate, etc. (Out of the scope of this article, for help, contact me.)
Now, we are going to copy the Thorium sources. Select (via Ctrl + Left Mouse button) these folders in C:\src\Thorium:
ash, base, build, chrome, components, content, extensions, media, net, sandbox, third_party, tools, ui, v8 as well as the BUILD.gn in the root of Thorium.
Then paste these in C:\chromium\src (overwriting everything)
Now, we are going to set up the build.
Go to C:\src\chromium\src and run
gn args out\thorium
It will pull up notepad. Copy and paste the contents of the win_args.gn we just edited into notepad, save it, and then exit notepad. Cmd will show "generating files..."
#NOTE: For AVX2 you should use the win_AVX2_args.gn and for ARM you should use the win_ARM_args.gn.
But wait, we also need to cherry pick some files from Thorium and copy them into C:\src\chromium\src\out\thorium (These are things like logos, the pak binaries, etc. that are thorium specific)
content_shell\thorium-devtools.ico and content_shell\thorium-devtools.png AND
All the files in pak_src\bin\pak-win
## Compilation
Finally, we are ready to compile Thorium!
Make sure you are in C:\src\chromium\src
And run:
autoninja -C out\thorium chrome chromedriver thorium_shell setup mini_installer -j8
You can substitute the -j# for the number of jobs. I use 8 because I have an 8 core cpu. Do not use a number more than the number of threads your CPU has.
In the end, you will have a nice installer:
C:\src\chromium\src\out\thorium\mini_installer.exe
I rename it to thorium_mini_installer.exe or thorium_avx2_mini_installer.exe for releases. Just double click to install Thorium to C:\Users\$USERNAME\AppData\Local\Thorium
## AVX2 Release
Speaking of which! Thorium by default compiles with AVX and AES. To make the AVX2 version of it, you will follow all the steps above, except before running gn args out\thorium, we need to download the avx2 sources. You should also use the win_AVX2_args.gn in the Thorium-AVX2 repo.
git clone https://github.com/Alex313031/Thorium-AVX2.git or https://github.com/Alex313031/Thorium-AVX2/archive/refs/heads/main.zip
And simply copy the build directory over C:\src\chromium\src\build
## Portable release
To make a portable release, it is easiest to copy an already made portable release from GitHub, extract it, and then:
1. Delete the contents of the BIN folder.
2. Use 7-Zip to extract the contents of the new mini_installer you just made, and then extract the chrome.7z that was inside it.
3. Copy the contents of Chrome-bin into the BIN folder in the portable folder.
4. Edit CONTENT_SHELL.bat to point to the actual location as the version number will have changed.
5. Likewise, edit the version number in the name of the whole portable folder to reflect the new Thorium.
6. Finally, rezip it up with 7-Zip. To use it, read the README.txt inside.
## Updating your checkout
To update the Chromium checkout, just run the same commands from above (in C:\src\chromium\src\v8\)
git checkout -f origin/main
cd ..
git checkout -f origin/main
git rebase-update
git fetch --tags
gclient sync --with_branch_heads --with_tags -f -R -D
gclient runhooks
To update Thorium, do a git pull main or redownload the latest .zip
Enjoy!