Full Code of Alex313031/Thorium-AVX2 for AI

main aa2ab55932ad
9 files
19.1 KB
5.3k tokens
Repository: Alex313031/Thorium-AVX2
Branch: main
Commit: aa2ab55932ad
Files: 9
Total size: 19.1 KB

Directory structure:
gitextract_blniep1j/

├── .github/
│   ├── FUNDING.yml
│   └── ISSUE_TEMPLATE/
│       ├── bug-report.md
│       ├── feature-request.md
│       └── general-feedback.md
├── LICENSE
├── README.md
├── WIN_CROSS_BUILD_INSTRUCTIONS.txt
├── WIN_INSTRUCTIONS.txt
└── thor_compat_mode.bat

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms

github: ['Alex313031']
custom: ['https://paypal.me/alex313031?country.x=US&locale.x=en_US']
patreon: ThoriumDeveloper


================================================
FILE: .github/ISSUE_TEMPLATE/bug-report.md
================================================
---
name: Bug Report
about: Create a report to help me improve Thorium
title: ''
labels: ''
assignees: ''

---

**System Details**
 - OS: [e.g.  Ubuntu 22.04, Windows 7, 8.1, 10, 11]
 - Thorium Version [e.g.107.0.5347.0]

**Problem**
A clear and concise description of what the bug is.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional Notes**
Add any other context about the problem here.


================================================
FILE: .github/ISSUE_TEMPLATE/feature-request.md
================================================
---
name: Feature Request
about: Suggest an idea for Thorium
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like, including relevant patches or source**
A clear and concise description of what you want to happen.

**Additional Notes**
Add any other context or screenshots about the feature request here.


================================================
FILE: .github/ISSUE_TEMPLATE/general-feedback.md
================================================
---
name: General Feedback
about: Feedback, praise, hate, comments, or anything else that doesn't fit lol.
title: ''
labels: ''
assignees: ''

---

**Add all the stuffz here**


================================================
FILE: LICENSE
================================================
BSD 3-Clause License

Copyright (c) 2023, Alexander David Frick

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
   contributors may be used to endorse or promote products derived from
   this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


================================================
FILE: README.md
================================================
![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/alex313031/thorium-win-avx2?label=Version%3A)  ![GitHub](https://img.shields.io/github/license/alex313031/thorium-win-avx2?color=green&label=License%3A)  ![GitHub commit activity](https://img.shields.io/github/commit-activity/w/alex313031/thorium?color=blueviolet&label=Commit%20Activity%3A)  ![Subreddit subscribers](https://img.shields.io/reddit/subreddit-subscribers/ChromiumBrowser?style=social)

# Thorium AVX2 for Windows
__Repo to serve Windows AVX2 ([most Intel/AMD CPUs since 2017](https://en.wikipedia.org/wiki/Advanced_Vector_Extensions#CPUs_with_AVX2)) builds of [Thorium](https://github.com/Alex313031/Thorium)!__ \
__*NEW!* Linux builds are here > https://github.com/Alex313031/Thorium-Linux-AVX2__ \
__*IMPORTANT: PLEASE USE THE NEW WINDOWS 7/8 REPO HERE FOR WINDOWS 7/8/8.1 RELEASES* > https://github.com/Alex313031/thorium-win7__ 

<img src="https://github.com/Alex313031/Thorium-Win-AVX2/blob/main/ThoriumLogo.png"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="https://github.com/Alex313031/Thorium/blob/main/logos/STAGING/AVX2.png" width="200">

The other Thorium repos :

Main repo that hosts the source code for all platforms and serves linux builds > https://github.com/Alex313031/Thorium

Windows repo that serves regular (AVX) Windows builds (the source code there is out of date and was merged with the main repo above) > https://github.com/Alex313031/Thorium-Win

MacOS builds for x64 and M1 ARM64 are here > https://github.com/Alex313031/Thorium-MacOS \

Android builds for ARM32 and ARM64 are here > https://github.com/Alex313031/Thorium-Android \

Raspberry Pi (ARM64) builds are here > https://github.com/Alex313031/Thorium-Raspi \

Builds for Windows 7/8/8.1 are here > https://github.com/Alex313031/thorium-win7 \

Windows on ARM (arm64) builds are here > https://github.com/Alex313031/Thorium-WOA \

Special repo which serves builds for SSE3, SSE4, and 32 bit builds are here > https://github.com/Alex313031/Thorium-Special \

Another related project I'm trying to share is ThoriumOS : ChromiumOS builds with Thorium, Widevine, Google Sync, Google Drive, Kernel 5.15, firmware, and extra packages > https://github.com/Alex313031/ThoriumOS

## Building <img src="https://github.com/Alex313031/Thorium/blob/main/logos/NEW/build_light.svg#gh-dark-mode-only"> <img src="https://github.com/Alex313031/Thorium/blob/main/logos/NEW/build_dark.svg#gh-light-mode-only">
For building yourself, follow instructions at [BUILDING_WIN.md](https://github.com/Alex313031/thorium/blob/main/docs/BUILDING_WIN.md) (if building natively on Windows), OR [BUILDING_WIN_CROSS.md](https://github.com/Alex313031/thorium/blob/main/docs/BUILDING_WIN_CROSS.md) (if cross building for Windows on Linux).

*Thanks for using Thorium!*

<img src="https://github.com/Alex313031/Thorium/blob/main/logos/STAGING/Thorium90_504.jpg" width="200">


================================================
FILE: WIN_CROSS_BUILD_INSTRUCTIONS.txt
================================================
## 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!


================================================
FILE: WIN_INSTRUCTIONS.txt
================================================
## 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!


================================================
FILE: thor_compat_mode.bat
================================================
@echo off
echo:
echo Copyright (c) 2022 Alex313031
echo:
echo Automatically sets the compatibility mode for Thorium on Windows 10/11,
echo as a mitigation to the "Error code: RESULT_CODE_MISSING_DATA" bug.
echo _________________________________________________________________________
echo:

reg.exe Add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "%LOCALAPPDATA%\Thorium\Application\chrome.exe" /d "~ WIN8RTM"
reg.exe Add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "%LOCALAPPDATA%\Thorium\Application\chrome.exe" /d "~ WIN8RTM"
gitextract_blniep1j/

├── .github/
│   ├── FUNDING.yml
│   └── ISSUE_TEMPLATE/
│       ├── bug-report.md
│       ├── feature-request.md
│       └── general-feedback.md
├── LICENSE
├── README.md
├── WIN_CROSS_BUILD_INSTRUCTIONS.txt
├── WIN_INSTRUCTIONS.txt
└── thor_compat_mode.bat
Condensed preview — 9 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (21K chars).
[
  {
    "path": ".github/FUNDING.yml",
    "chars": 165,
    "preview": "# These are supported funding model platforms\n\ngithub: ['Alex313031']\ncustom: ['https://paypal.me/alex313031?country.x=U..."
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug-report.md",
    "chars": 432,
    "preview": "---\nname: Bug Report\nabout: Create a report to help me improve Thorium\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**System..."
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature-request.md",
    "chars": 489,
    "preview": "---\nname: Feature Request\nabout: Suggest an idea for Thorium\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Is your feature..."
  },
  {
    "path": ".github/ISSUE_TEMPLATE/general-feedback.md",
    "chars": 176,
    "preview": "---\nname: General Feedback\nabout: Feedback, praise, hate, comments, or anything else that doesn't fit lol.\ntitle: ''\nlab..."
  },
  {
    "path": "LICENSE",
    "chars": 1508,
    "preview": "BSD 3-Clause License\n\nCopyright (c) 2023, Alexander David Frick\n\nRedistribution and use in source and binary forms, with..."
  },
  {
    "path": "README.md",
    "chars": 2935,
    "preview": "![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/alex313031/thorium-win-avx2?label=Version%3A) &nbsp;![..."
  },
  {
    "path": "WIN_CROSS_BUILD_INSTRUCTIONS.txt",
    "chars": 5645,
    "preview": "## These are instruction for cross building Thorium for Windows, on Linux. Preliminary file for @gz83, to be eventually..."
  },
  {
    "path": "WIN_INSTRUCTIONS.txt",
    "chars": 7654,
    "preview": "## These are instruction for building Thorium for Windows, natively on Windows. Preliminary file for @gz83, to be eventu..."
  },
  {
    "path": "thor_compat_mode.bat",
    "chars": 605,
    "preview": "@echo off\r\necho:\r\necho Copyright (c) 2022 Alex313031\r\necho:\r\necho Automatically sets the compatibility mode for Thorium..."
  }
]

About this extraction

This page contains the full source code of the Alex313031/Thorium-AVX2 GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 9 files (19.1 KB), approximately 5.3k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!