-
-
Notifications
You must be signed in to change notification settings - Fork 153
Building
There are instructions for other platforms here in the Thorium Docs directory. You can also read the old building instructions.
For Windows and Windows AVX2, I made new dedicated instructions. If you are building on Windows use BUILDING_WIN.md and if you are building for Windows on Linux, use WIN_CROSS_BUILD_INSTRUCTIONS
- A x64 machine with at least 8GB of RAM. 16GB or more is highly recommended.
- At least 75GB of free disk space.
- You must have Git and Python v3.6+ installed already (and
python3
must point to a Python v3.6+ binary (i.e. in your path or as default python install).
Most development is done on Ubuntu (currently 22.04, Jammy Jellyfish). Ubuntu 16.04 no longer works. 18.04, 20.04 and Debian 10/11 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!
Clone the depot_tools
repository:
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
Add depot_tools to the end of your $PATH (you will probably want to put this
in your ~/.bashrc
or ~/.zshrc
). When cloning depot_tools to your home directory do not use ~
on PATH,
otherwise gclient runhooks
will fail to run. Rather, you should use either
$HOME
or the absolute path. So, assuming you cloned depot_tools to $HOME:
$ export PATH="$PATH:${HOME}/depot_tools" or $ export PATH="$PATH:/home/alex/depot_tools"
Clone the Thorium repo into $HOME
$ git clone https://github.com/Alex313031/Thorium.git
Then, make the set_exec.sh
script executable and run it (this will set all the other scripts in the repo as executable).
$ chmod +x set_exec.sh && ./set_exec.sh
Create a chromium directory for the checkout and change to it.
$ mkdir ~/chromium && cd ~/chromium
Run the fetch tool from depot_tools to check out the code and its dependencies.
$ fetch --nohooks chromium
The --nohooks
flag is ommitted on other platforms, we just use it on linux to explicitly run the hooks
later, after installing the prerequisites.
fetch
and repo
are used to download, rebase, and sync all Google repositories, including Chromium, ChromiumOS,
Android, Fuchsia, Infra, Monorail, GN, etc.
If you don't want the full repo history, you can save a lot of time by
adding the --no-history
flag to fetch
. This is equivalent to a shallow git clone with a depth of 1.
Expect the command to take 20 minutes on a fast (150mbps+) connection, and many hours on slower ones.
If you've already installed the build dependencies on the machine (from another
checkout, for example), you can omit the --nohooks
flag and fetch
will automatically execute gclient runhooks
at the end.
When fetch completes, it will have created a hidden .gclient
file and a
directory called src
in the chromium directory. The remaining instructions
assume you have switched to the src
directory, so:
$ cd src
Once you have checked out the code, and assuming you're using Ubuntu, run the
install-build-deps.sh
script.
$ ./build/install-build-deps.sh
You can run it with the flag --help
to see arguments. For example, you would want --lib32
if building for 32 bit Linux, --arm
for building
a Raspberry Pi release, --chromeos-fonts
for building Thorium for ThoriumOS, and --quick-check
just to verify needed libraries are installed.
You may need to adjust the build dependencies for other distros. There are some notes at the end of this document, but we make no guarantees for their accuracy, as distros get updated over time.
Once you've run install-build-deps
at least once, you can now run the
Chromium-specific hooks, which will download additional binaries and other
things like LLVM and a Debian Sysroot.:
$ gclient runhooks
Optional: You can also build with API keys if you want your build to talk to some Google services like Google Sync, Translate, and GeoLocation. 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 to enable Sync.
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 should be used before every seperate build. See the Updating section.
This will update and sync the sources and at the end it will download the PGO profiles 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, (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
.
Chromium and Thorium use Ninja as their main build tool, along with
a tool called GN
to generate .ninja
files in the build output directory. You can create any number of build directories
with different configurations. To create a build directory:
- Run
gn args out/thorium
and the contents of 'args.gn' in the root of this repo should be copy/pasted into the editor. Note that for Windows, Mac, ChromiumOS, or Android there are seperate *_args.gn files for those platforms. --Include your api keys here at the top or leave blank, and edit the last line to point to the actual path and file name of '*.profdata' - For more info about args.gn, read the ABOUT_GN_ARGS.md file.
- 'infra/args.list' contains an alphabetical list with descriptions of all possible build arguments; gn_args.list gives a similar list but with the flags in args.gn added.
You can list all the possible build arguments and pipe it to a text file by running:
$ gn args out/thorium --list >> /path/to/ARGS.list
- You only have to run this once for each new build directory, Ninja will update the build files as needed.
- You can replace thorium with another name, but
it should be a subdirectory of out. Note that if you choose another name, the
trunk.sh
andbuild.sh
scripts will not work. - For information on the args.gn that Thorium uses, see ABOUT_GN_ARGS.md.
- For other build arguments, including release settings, see GN build configuration. The default will be a vanilla Chromium debug component build matching the current host operating system and CPU.
- For more info on GN, run
gn help
on the command line or read the quick start guide.
You can use ccache to speed up local builds.
Increase your ccache hit rate by setting CCACHE_BASEDIR
to a parent directory
that the working directories all have in common (e.g.,
/home/yourusername/development
). Consider using
CCACHE_SLOPPINESS=include_file_mtime
(since if you are using multiple working
directories, header times in svn sync'ed portions of your trees will be
different - see
the ccache troubleshooting section
for additional information). If you use symbolic links from your home directory
to get to the local physical disk directory where you keep those working
development directories, consider putting
alias cd="cd -P"
in your .bashrc
so that $PWD
or cwd
always refers to a physical, not
logical directory (and make sure CCACHE_BASEDIR
also refers to a physical
parent).
If you tune ccache correctly, a second working directory that uses a branch
tracking trunk and is up to date with trunk and was gclient sync'ed at about the
same time should build chrome in about 1/3 the time, and the cache misses as
reported by ccache -s
should barely increase.
This is especially useful if you use git-worktree and keep multiple local working directories going at once.
Build Thorium (the "chrome" target), as well as chrome_sandbox, chromedriver, and thorium_shell (based on content_shell ), using the build.sh
in the root of the Thorium repo (where the # is the number of jobs):
$ ./build.sh 8
You could also manually issue the command (where -j is the number of jobs):
$ autoninja -C ~/chromium/src/out/thorium chrome chrome_sandbox chromedriver thorium_shell -j8
autoninja
is a wrapper that automatically provides optimal values for the
arguments passed to ninja
. build.sh
uses a custom autoninja in the depot_tools directory in Thorium.
You can get a list of all of the other build targets from GN by running gn ls out/thorium
from the command line. To compile one, pass the GN label to Ninja
with no preceding "//" (so, for //chrome/test:unit_tests
use autoninja -C out/thorium chrome/test:unit_tests
).
Once it is built, you can simply run the browser:
$ out/thorium/thorium
RECOMMENDED - Copy and run clean.sh within this dir to clean up build artifacts.
Of course, you will probably want to make an installation package. To make a .deb file
run thordeb.sh
(where the # is the number of jobs) in the root of the repo:
$ ./thordeb.sh 8
To make an appimage, copy the .deb to //thorium/infra/APPIMAGE/
and follow the Instructions therein.
See the Debugging section below, as well as Thorium UI Debug Shell.
Learn about how to use Chromedriver and Google Test at its GitHub page.
Simply run trunk.sh
in the root of the Thorium repo or execute the commands inside.
$ ./trunk.sh
- Information about building with Clang.
- You may want to use a chroot to isolate yourself from versioning or packaging conflicts.
- Cross-compiling for ARM? (Raspberry Pi) See the Thorium ARM dir and chromium_arm.md.
- Atom and Geany are reccomended IDEs for working on Thorium.
- See the Thorium DEBUG dir, including the More Info section, and DEBUGGING.md.
Instead of running install-build-deps.sh
to install build dependencies, run:
$ sudo pacman -S --needed automake autoconf base-devel curl xz squashfs-tools p7zip \
git tk python python-pkgconfig python-virtualenv python-oauth2client python-oauthlib \
perl gcc gcc-libs bison flex gperf pkgconfig dbus icoutils \
nss alsa-lib glib2 gtk3 nspr freetype2 cairo libgnome-keyring \
xorg-server-xvfb xorg-xdpyinfo
For the optional packages on Arch Linux:
-
php-cgi
is provided withpacman
-
wdiff
is not in the main repository butdwdiff
is. You can getwdiff
in AUR/yaourt
First install the file
and lsb-release
commands for the script to run properly:
$ sudo apt-get install file lsb-release
Then invoke install-build-deps.sh with the --no-arm
argument,
because the ARM toolchain doesn't exist for this configuration:
$ sudo build/install-build-deps.sh --no-arm
Instead of running build/install-build-deps.sh
, run:
su -c 'yum install git python bzip2 tar pkgconfig atk-devel alsa-lib-devel \
bison binutils brlapi-devel bluez-libs-devel bzip2-devel cairo-devel \
cups-devel dbus-devel dbus-glib-devel expat-devel fontconfig-devel \
freetype-devel gcc-c++ glib2-devel glibc.i686 gperf glib2-devel \
gtk3-devel java-1.*.0-openjdk-devel libatomic libcap-devel libffi-devel \
libgcc.i686 libgnome-keyring-devel libjpeg-devel libstdc++.i686 libX11-devel \
libXScrnSaver-devel libXtst-devel libxkbcommon-x11-devel ncurses-compat-libs \
nspr-devel nss-devel pam-devel pango-devel pciutils-devel \
pulseaudio-libs-devel zlib.i686 httpd mod_ssl php php-cli python-psutil wdiff \
xorg-x11-server-Xvfb'
The fonts needed by Blink's web tests can be obtained by following these instructions. For the optional packages:
-
php-cgi
is provided by thephp-cli
package. -
sun-java6-fonts
is covered by the instructions linked above.
You can install the deps by doing a dry run of emerge www-client/chromium
.
Happy Thorium Building!
Thanks for using Thorium!