https://wiki.raptorcs.com/w/api.php?action=feedcontributions&user=Jessesimpson&feedformat=atomRCS Wiki - User contributions [en]2024-03-29T15:37:09ZUser contributionsMediaWiki 1.33.1https://wiki.raptorcs.com/w/index.php?title=Porting/Chromium_(New)&diff=2751Porting/Chromium (New)2019-10-10T11:37:55Z<p>Jessesimpson: /* Build */ updated clang_base_path to point to the llvm we built earlier in this wiki's instructions</p>
<hr />
<div>== Chromium on POWER ==<br />
The repository of all required patches for ppc64le is available here: https://github.com/shawnanastasio/chromium_power.<br />
<br />
A source distribution of ungoogled-chromium with the patches incorporated is available here: https://github.com/leo-lb/ungoogled-chromium.<br />
<br />
Additional patches required for ppc64 (Big Endian) are available here: [[Porting/Chromium/BE]].<br />
<br />
The old Chromium wiki page is available here: [[Porting/Chromium_(Old)]].<br />
<br />
=== Introduction ===<br />
Google's Chromium browser has been ported by the community to run on POWER systems. The base patch set targets CPUs running in Little Endian mode (ppc64le), but <br />
[[Porting/Chromium/BE|additional patches for Big Endian support]] exist as well.<br />
<br />
There is an ongoing effort to get the patches upstreamed, but at the moment it is still required to apply some out-of-tree patches to get the browser to build.<br />
This page documents how to download and build Chromium for ppc64le.<br />
<br />
=== Prerequisites ===<br />
To build chromium, you'll need a ppc64le Linux environment with around 70GB of free disk space and at least 8GB of RAM. For parallel builds (recommended), the<br />
amount of RAM required will scale with the number of cores in your machine. Approximately 1GB per SMT thread seems to be reasonable.<br />
<br />
Before beginning, you will need to install Chromium's dependencies from your distribution's package manager.<br />
For Ubuntu, the following should be sufficient:<br />
<br />
<nowiki><br />
# apt install git vim cmake python libcups2-dev pkg-config libnss3-dev libssl-dev libglib2.0-dev libgnome-keyring-dev libpango1.0-dev libdbus-1-dev libatk1.0-dev libatk-bridge2.0-dev libgtk-3-dev libkrb5-dev libpulse-dev libxss-dev re2c subversion curl libasound2-dev libpci-dev mesa-common-dev gperf bison nodejs uuid-dev clang-format ninja-build </nowiki><br />
<br />
Next, you'll need some utilities that most likely aren't available in your distribution's repositories. <br />
<br />
It is recommended to complete these steps in a new directory reserved for chromium and its dependencies, like ~/chromium_build. This directory will henceforth be referred to as $CHROMIUM_DIR.<br />
<br />
==== GN ====<br />
First is gn, the meta-build system:<br />
<nowiki><br />
$ cd $CHROMIUM_DIR<br />
$ git clone https://gn.googlesource.com/gn<br />
$ git checkout 81ee1967d3fcbc829bac1c005c3da59739c88df9 # Latest GN is broken with chromium...<br />
<br />
$ export CC=gcc<br />
$ export CXX=g++<br />
$ export AR=ar<br />
<br />
$ cd gn<br />
$ python build/gen.py<br />
$ ninja -C out<br />
<br />
$ unset CXX<br />
$ unset CC<br />
$ unset AR </nowiki><br />
<br />
==== depot_tools ====<br />
Next is depot_tools, a collection of source code management tools used by Google.<br />
<nowiki><br />
$ cd $CHROMIUM_DIR<br />
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git </nowiki><br />
<br />
In order to use the tools, they'll need to be in your path. It is recommended to place the following lines in a file named <code>env.sh</code> that you <code>source</code>, or in your <br />
<code>.bashrc</code>:<br />
<nowiki><br />
$ cd $CHROMIUM_DIR<br />
$ echo 'export PATH="$PATH:${HOME}/ninja"' >> env.sh<br />
$ echo 'export PATH="$PATH:${HOME}/depot_tools"' >> env.sh<br />
$ echo 'export VPYTHON_BYPASS="manually managed python not supported by chrome operations"' >> env.sh<br />
$ source env.sh </nowiki><br />
<br />
==== LLVM/Clang ====<br />
Chromium is only tested against specific revisions of the Clang compiler. As such, it is '''highly recommended''' to compile the specific version Chromium expects manually.<br />
The current version expected by Chromium may always be found [https://chromium.googlesource.com/chromium/src.git/+/refs/heads/master/tools/clang/scripts/update.py#38 here].<br />
<br />
First, we must check out LLVM and Clang:<br />
<nowiki><br />
$ cd $CHROMIUM_DIR<br />
$ export CLANG_SVN_REVISION=357692 # Check the above link for the current version<br />
$ svn checkout --force https://llvm.org/svn/llvm-project/llvm/trunk@$CLANG_SVN_REVISION llvm<br />
$ svn checkout --force https://llvm.org/svn/llvm-project/cfe/trunk@$CLANG_SVN_REVISION llvm/tools/clang<br />
$ svn checkout --force https://llvm.org/svn/llvm-project/compiler-rt/trunk@$CLANG_SVN_REVISION llvm/compiler-rt </nowiki><br />
<br />
Next, we'll create a build directory and build the compiler.<br />
<nowiki><br />
$ mkdir llvm_build && cd llvm_build<br />
$ cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="PowerPC" -G "Unix Makefiles" ../llvm<br />
$ make -j64 # Replace with # of threads to compile with </nowiki><br />
<br />
=== Downloading the source code ===<br />
After completing the prerequisite steps, you can download the Chromium source code. Make sure that `depot_tools` is in your PATH by sourcing your <code>env.sh</code> and run the following:<br />
<nowiki><br />
$ cd $CHROMIUM_DIR<br />
$ mkdir chromium && cd chromium<br />
$ fetch --no-history --nohooks chromium </nowiki><br />
<br />
To finish the source code checkout, we need to apply a single patch, disable NaCL, and replace the included GN binary with our own.<br />
<nowiki><br />
$ cd src<br />
$ curl 'https://raw.githubusercontent.com/shawnanastasio/chromium_power/master/build_toolchain/Binutils-download.py-PPC.patch' | patch -p1<br />
$ cp -f $CHROMIUM_DIR/gn/out/gn buildtools/linux64/gn<br />
$ cd ..<br />
$ sed -i 's/\"custom_vars\"\: {},/\"custom_vars\"\: { \"checkout_nacl\"\: False },/g' .gclient<br />
$ gclient sync </nowiki><br />
<br />
=== Patching Chromium ===<br />
The patches required to build Chromium are maintained [https://github.com/shawnanastasio/chromium_power here]. Included is a script which will apply all the patches to a Chromium source directory.<br />
To patch your local copy of the Chromium source, do the following:<br />
<nowiki><br />
$ cd $CHROMIUM_DIR<br />
$ git clone https://github.com/shawnanastasio/chromium_power<br />
$ cd chromium_power<br />
$ python3 cpf.py $CHROMIUM_DIR/chromium/src </nowiki><br />
<br />
This will attempt to apply all the patches. If an error is encountered, you can attempt to rebase the patch manually by following the prompts, or you can create a GitHub issue to notify<br />
the maintainers. Note that any errors about already applied patches can be safely ignored.<br />
<br />
=== Pre-build ===<br />
Now Chromium is almost ready to be built. First though, the ppc64le build files for ffmpeg and libvpx will need to be generated.<br />
<nowiki><br />
$ cd $CHROMIUM_DIR/chromium/src/third_party/ffmpeg<br />
$ ./chromium/scripts/build_ffmpeg.py linux ppc64<br />
$ ./chromium/scripts/generate_gn.py<br />
$ ./chromium/scripts/copy_config.sh<br />
<br />
$ cd ../libvpx<br />
$ mkdir source/config/linux/ppc64<br />
$ ./generate_gni.sh<br />
$ cd ../../ </nowiki><br />
<br />
=== Build ===<br />
Now you're ready to build Chromium. First, the build parameters must be configured with gn. To do this, perform the following:<br />
<nowiki><br />
$ cd $CHROMIUM_DIR/chromium/src<br />
$ gn args out/Default </nowiki><br />
<br />
A text editor will open. Paste in the following configuration, modified to suit your needs if necessary:<br />
<nowiki><br />
# Release mode<br />
is_component_build = false<br />
is_debug = false<br />
<br />
# Disable broken features<br />
enable_nacl = false<br />
treat_warnings_as_errors = false<br />
enable_dav1d_decoder = false<br />
<br />
# For clang, add the following lines:<br />
is_clang = true<br />
clang_base_path = "$CHROMIUM_DIR/llvm_build"<br />
clang_use_chrome_plugins = false<br />
use_lld = false </nowiki><br />
<br />
Note that <code>clang_base_path</code> will have to be modified to contain the full path to your $CHROMIUM_DIR/llvm_build directory that was created earlier.<br />
<br />
Close and save the text file and perform the following to build Chromium:<br />
<nowiki><br />
$ ninja -C out/Default chrome </nowiki><br />
<br />
This will perform a parallel build of Chromium using all available threads. To limit the number of threads, append <code>-jX</code> where X is the number of threads you wish to use.<br />
If all goes well, you will have a compiled Chromium binary at <code>$CHROMIUM_DIR/chromium/src/out/Default/chrome</code>. If you encounter an error, <br />
[https://github.com/shawnanastasio/chromium_power/issues please report an issue here].</div>Jessesimpsonhttps://wiki.raptorcs.com/w/index.php?title=Porting/Chromium_(New)&diff=2750Porting/Chromium (New)2019-10-10T11:34:49Z<p>Jessesimpson: /* LLVM/Clang */ renamed CLANG_REVISION to CLANG_SVN_REVISION to be consistent with the variable name in https://chromium.googlesource.com/chromium/src.git/+/refs/heads/master/tools/clang/scripts/update.py#38</p>
<hr />
<div>== Chromium on POWER ==<br />
The repository of all required patches for ppc64le is available here: https://github.com/shawnanastasio/chromium_power.<br />
<br />
A source distribution of ungoogled-chromium with the patches incorporated is available here: https://github.com/leo-lb/ungoogled-chromium.<br />
<br />
Additional patches required for ppc64 (Big Endian) are available here: [[Porting/Chromium/BE]].<br />
<br />
The old Chromium wiki page is available here: [[Porting/Chromium_(Old)]].<br />
<br />
=== Introduction ===<br />
Google's Chromium browser has been ported by the community to run on POWER systems. The base patch set targets CPUs running in Little Endian mode (ppc64le), but <br />
[[Porting/Chromium/BE|additional patches for Big Endian support]] exist as well.<br />
<br />
There is an ongoing effort to get the patches upstreamed, but at the moment it is still required to apply some out-of-tree patches to get the browser to build.<br />
This page documents how to download and build Chromium for ppc64le.<br />
<br />
=== Prerequisites ===<br />
To build chromium, you'll need a ppc64le Linux environment with around 70GB of free disk space and at least 8GB of RAM. For parallel builds (recommended), the<br />
amount of RAM required will scale with the number of cores in your machine. Approximately 1GB per SMT thread seems to be reasonable.<br />
<br />
Before beginning, you will need to install Chromium's dependencies from your distribution's package manager.<br />
For Ubuntu, the following should be sufficient:<br />
<br />
<nowiki><br />
# apt install git vim cmake python libcups2-dev pkg-config libnss3-dev libssl-dev libglib2.0-dev libgnome-keyring-dev libpango1.0-dev libdbus-1-dev libatk1.0-dev libatk-bridge2.0-dev libgtk-3-dev libkrb5-dev libpulse-dev libxss-dev re2c subversion curl libasound2-dev libpci-dev mesa-common-dev gperf bison nodejs uuid-dev clang-format ninja-build </nowiki><br />
<br />
Next, you'll need some utilities that most likely aren't available in your distribution's repositories. <br />
<br />
It is recommended to complete these steps in a new directory reserved for chromium and its dependencies, like ~/chromium_build. This directory will henceforth be referred to as $CHROMIUM_DIR.<br />
<br />
==== GN ====<br />
First is gn, the meta-build system:<br />
<nowiki><br />
$ cd $CHROMIUM_DIR<br />
$ git clone https://gn.googlesource.com/gn<br />
$ git checkout 81ee1967d3fcbc829bac1c005c3da59739c88df9 # Latest GN is broken with chromium...<br />
<br />
$ export CC=gcc<br />
$ export CXX=g++<br />
$ export AR=ar<br />
<br />
$ cd gn<br />
$ python build/gen.py<br />
$ ninja -C out<br />
<br />
$ unset CXX<br />
$ unset CC<br />
$ unset AR </nowiki><br />
<br />
==== depot_tools ====<br />
Next is depot_tools, a collection of source code management tools used by Google.<br />
<nowiki><br />
$ cd $CHROMIUM_DIR<br />
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git </nowiki><br />
<br />
In order to use the tools, they'll need to be in your path. It is recommended to place the following lines in a file named <code>env.sh</code> that you <code>source</code>, or in your <br />
<code>.bashrc</code>:<br />
<nowiki><br />
$ cd $CHROMIUM_DIR<br />
$ echo 'export PATH="$PATH:${HOME}/ninja"' >> env.sh<br />
$ echo 'export PATH="$PATH:${HOME}/depot_tools"' >> env.sh<br />
$ echo 'export VPYTHON_BYPASS="manually managed python not supported by chrome operations"' >> env.sh<br />
$ source env.sh </nowiki><br />
<br />
==== LLVM/Clang ====<br />
Chromium is only tested against specific revisions of the Clang compiler. As such, it is '''highly recommended''' to compile the specific version Chromium expects manually.<br />
The current version expected by Chromium may always be found [https://chromium.googlesource.com/chromium/src.git/+/refs/heads/master/tools/clang/scripts/update.py#38 here].<br />
<br />
First, we must check out LLVM and Clang:<br />
<nowiki><br />
$ cd $CHROMIUM_DIR<br />
$ export CLANG_SVN_REVISION=357692 # Check the above link for the current version<br />
$ svn checkout --force https://llvm.org/svn/llvm-project/llvm/trunk@$CLANG_SVN_REVISION llvm<br />
$ svn checkout --force https://llvm.org/svn/llvm-project/cfe/trunk@$CLANG_SVN_REVISION llvm/tools/clang<br />
$ svn checkout --force https://llvm.org/svn/llvm-project/compiler-rt/trunk@$CLANG_SVN_REVISION llvm/compiler-rt </nowiki><br />
<br />
Next, we'll create a build directory and build the compiler.<br />
<nowiki><br />
$ mkdir llvm_build && cd llvm_build<br />
$ cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="PowerPC" -G "Unix Makefiles" ../llvm<br />
$ make -j64 # Replace with # of threads to compile with </nowiki><br />
<br />
=== Downloading the source code ===<br />
After completing the prerequisite steps, you can download the Chromium source code. Make sure that `depot_tools` is in your PATH by sourcing your <code>env.sh</code> and run the following:<br />
<nowiki><br />
$ cd $CHROMIUM_DIR<br />
$ mkdir chromium && cd chromium<br />
$ fetch --no-history --nohooks chromium </nowiki><br />
<br />
To finish the source code checkout, we need to apply a single patch, disable NaCL, and replace the included GN binary with our own.<br />
<nowiki><br />
$ cd src<br />
$ curl 'https://raw.githubusercontent.com/shawnanastasio/chromium_power/master/build_toolchain/Binutils-download.py-PPC.patch' | patch -p1<br />
$ cp -f $CHROMIUM_DIR/gn/out/gn buildtools/linux64/gn<br />
$ cd ..<br />
$ sed -i 's/\"custom_vars\"\: {},/\"custom_vars\"\: { \"checkout_nacl\"\: False },/g' .gclient<br />
$ gclient sync </nowiki><br />
<br />
=== Patching Chromium ===<br />
The patches required to build Chromium are maintained [https://github.com/shawnanastasio/chromium_power here]. Included is a script which will apply all the patches to a Chromium source directory.<br />
To patch your local copy of the Chromium source, do the following:<br />
<nowiki><br />
$ cd $CHROMIUM_DIR<br />
$ git clone https://github.com/shawnanastasio/chromium_power<br />
$ cd chromium_power<br />
$ python3 cpf.py $CHROMIUM_DIR/chromium/src </nowiki><br />
<br />
This will attempt to apply all the patches. If an error is encountered, you can attempt to rebase the patch manually by following the prompts, or you can create a GitHub issue to notify<br />
the maintainers. Note that any errors about already applied patches can be safely ignored.<br />
<br />
=== Pre-build ===<br />
Now Chromium is almost ready to be built. First though, the ppc64le build files for ffmpeg and libvpx will need to be generated.<br />
<nowiki><br />
$ cd $CHROMIUM_DIR/chromium/src/third_party/ffmpeg<br />
$ ./chromium/scripts/build_ffmpeg.py linux ppc64<br />
$ ./chromium/scripts/generate_gn.py<br />
$ ./chromium/scripts/copy_config.sh<br />
<br />
$ cd ../libvpx<br />
$ mkdir source/config/linux/ppc64<br />
$ ./generate_gni.sh<br />
$ cd ../../ </nowiki><br />
<br />
=== Build ===<br />
Now you're ready to build Chromium. First, the build parameters must be configured with gn. To do this, perform the following:<br />
<nowiki><br />
$ cd $CHROMIUM_DIR/chromium/src<br />
$ gn args out/Default </nowiki><br />
<br />
A text editor will open. Paste in the following configuration, modified to suit your needs if necessary:<br />
<nowiki><br />
# Release mode<br />
is_component_build = false<br />
is_debug = false<br />
<br />
# Disable broken features<br />
enable_nacl = false<br />
treat_warnings_as_errors = false<br />
enable_dav1d_decoder = false<br />
<br />
# For clang, add the following lines:<br />
is_clang = true<br />
clang_base_path = "/path/to/your/llvm_build"<br />
clang_use_chrome_plugins = false<br />
use_lld = false </nowiki><br />
<br />
Note that <code>clang_base_path</code> will have to be modified to contain the full path to your $CHROMIUM_DIR/llvm_build directory that was created earlier.<br />
<br />
Close and save the text file and perform the following to build Chromium:<br />
<nowiki><br />
$ ninja -C out/Default chrome </nowiki><br />
<br />
This will perform a parallel build of Chromium using all available threads. To limit the number of threads, append <code>-jX</code> where X is the number of threads you wish to use.<br />
If all goes well, you will have a compiled Chromium binary at <code>$CHROMIUM_DIR/chromium/src/out/Default/chrome</code>. If you encounter an error, <br />
[https://github.com/shawnanastasio/chromium_power/issues please report an issue here].</div>Jessesimpsonhttps://wiki.raptorcs.com/w/index.php?title=Porting/Chromium_(New)&diff=2749Porting/Chromium (New)2019-10-10T10:29:06Z<p>Jessesimpson: /* Prerequisites: changed ninja to ninja-build */</p>
<hr />
<div>== Chromium on POWER ==<br />
The repository of all required patches for ppc64le is available here: https://github.com/shawnanastasio/chromium_power.<br />
<br />
A source distribution of ungoogled-chromium with the patches incorporated is available here: https://github.com/leo-lb/ungoogled-chromium.<br />
<br />
Additional patches required for ppc64 (Big Endian) are available here: [[Porting/Chromium/BE]].<br />
<br />
The old Chromium wiki page is available here: [[Porting/Chromium_(Old)]].<br />
<br />
=== Introduction ===<br />
Google's Chromium browser has been ported by the community to run on POWER systems. The base patch set targets CPUs running in Little Endian mode (ppc64le), but <br />
[[Porting/Chromium/BE|additional patches for Big Endian support]] exist as well.<br />
<br />
There is an ongoing effort to get the patches upstreamed, but at the moment it is still required to apply some out-of-tree patches to get the browser to build.<br />
This page documents how to download and build Chromium for ppc64le.<br />
<br />
=== Prerequisites ===<br />
To build chromium, you'll need a ppc64le Linux environment with around 70GB of free disk space and at least 8GB of RAM. For parallel builds (recommended), the<br />
amount of RAM required will scale with the number of cores in your machine. Approximately 1GB per SMT thread seems to be reasonable.<br />
<br />
Before beginning, you will need to install Chromium's dependencies from your distribution's package manager.<br />
For Ubuntu, the following should be sufficient:<br />
<br />
<nowiki><br />
# apt install git vim cmake python libcups2-dev pkg-config libnss3-dev libssl-dev libglib2.0-dev libgnome-keyring-dev libpango1.0-dev libdbus-1-dev libatk1.0-dev libatk-bridge2.0-dev libgtk-3-dev libkrb5-dev libpulse-dev libxss-dev re2c subversion curl libasound2-dev libpci-dev mesa-common-dev gperf bison nodejs uuid-dev clang-format ninja-build </nowiki><br />
<br />
Next, you'll need some utilities that most likely aren't available in your distribution's repositories. <br />
<br />
It is recommended to complete these steps in a new directory reserved for chromium and its dependencies, like ~/chromium_build. This directory will henceforth be referred to as $CHROMIUM_DIR.<br />
<br />
==== GN ====<br />
First is gn, the meta-build system:<br />
<nowiki><br />
$ cd $CHROMIUM_DIR<br />
$ git clone https://gn.googlesource.com/gn<br />
$ git checkout 81ee1967d3fcbc829bac1c005c3da59739c88df9 # Latest GN is broken with chromium...<br />
<br />
$ export CC=gcc<br />
$ export CXX=g++<br />
$ export AR=ar<br />
<br />
$ cd gn<br />
$ python build/gen.py<br />
$ ninja -C out<br />
<br />
$ unset CXX<br />
$ unset CC<br />
$ unset AR </nowiki><br />
<br />
==== depot_tools ====<br />
Next is depot_tools, a collection of source code management tools used by Google.<br />
<nowiki><br />
$ cd $CHROMIUM_DIR<br />
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git </nowiki><br />
<br />
In order to use the tools, they'll need to be in your path. It is recommended to place the following lines in a file named <code>env.sh</code> that you <code>source</code>, or in your <br />
<code>.bashrc</code>:<br />
<nowiki><br />
$ cd $CHROMIUM_DIR<br />
$ echo 'export PATH="$PATH:${HOME}/ninja"' >> env.sh<br />
$ echo 'export PATH="$PATH:${HOME}/depot_tools"' >> env.sh<br />
$ echo 'export VPYTHON_BYPASS="manually managed python not supported by chrome operations"' >> env.sh<br />
$ source env.sh </nowiki><br />
<br />
==== LLVM/Clang ====<br />
Chromium is only tested against specific revisions of the Clang compiler. As such, it is '''highly recommended''' to compile the specific version Chromium expects manually.<br />
The current version expected by Chromium may always be found [https://chromium.googlesource.com/chromium/src.git/+/refs/heads/master/tools/clang/scripts/update.py#38 here].<br />
<br />
First, we must check out LLVM and Clang:<br />
<nowiki><br />
$ cd $CHROMIUM_DIR<br />
$ export CLANG_REVISION=357692 # Check the above link for the current version<br />
$ svn checkout --force https://llvm.org/svn/llvm-project/llvm/trunk@$CLANG_REVISION llvm<br />
$ svn checkout --force https://llvm.org/svn/llvm-project/cfe/trunk@$CLANG_REVISION llvm/tools/clang<br />
$ svn checkout --force https://llvm.org/svn/llvm-project/compiler-rt/trunk@$CLANG_REVISION llvm/compiler-rt </nowiki><br />
<br />
Next, we'll create a build directory and build the compiler.<br />
<nowiki><br />
$ mkdir llvm_build && cd llvm_build<br />
$ cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="PowerPC" -G "Unix Makefiles" ../llvm<br />
$ make -j64 # Replace with # of threads to compile with </nowiki><br />
<br />
=== Downloading the source code ===<br />
After completing the prerequisite steps, you can download the Chromium source code. Make sure that `depot_tools` is in your PATH by sourcing your <code>env.sh</code> and run the following:<br />
<nowiki><br />
$ cd $CHROMIUM_DIR<br />
$ mkdir chromium && cd chromium<br />
$ fetch --no-history --nohooks chromium </nowiki><br />
<br />
To finish the source code checkout, we need to apply a single patch, disable NaCL, and replace the included GN binary with our own.<br />
<nowiki><br />
$ cd src<br />
$ curl 'https://raw.githubusercontent.com/shawnanastasio/chromium_power/master/build_toolchain/Binutils-download.py-PPC.patch' | patch -p1<br />
$ cp -f $CHROMIUM_DIR/gn/out/gn buildtools/linux64/gn<br />
$ cd ..<br />
$ sed -i 's/\"custom_vars\"\: {},/\"custom_vars\"\: { \"checkout_nacl\"\: False },/g' .gclient<br />
$ gclient sync </nowiki><br />
<br />
=== Patching Chromium ===<br />
The patches required to build Chromium are maintained [https://github.com/shawnanastasio/chromium_power here]. Included is a script which will apply all the patches to a Chromium source directory.<br />
To patch your local copy of the Chromium source, do the following:<br />
<nowiki><br />
$ cd $CHROMIUM_DIR<br />
$ git clone https://github.com/shawnanastasio/chromium_power<br />
$ cd chromium_power<br />
$ python3 cpf.py $CHROMIUM_DIR/chromium/src </nowiki><br />
<br />
This will attempt to apply all the patches. If an error is encountered, you can attempt to rebase the patch manually by following the prompts, or you can create a GitHub issue to notify<br />
the maintainers. Note that any errors about already applied patches can be safely ignored.<br />
<br />
=== Pre-build ===<br />
Now Chromium is almost ready to be built. First though, the ppc64le build files for ffmpeg and libvpx will need to be generated.<br />
<nowiki><br />
$ cd $CHROMIUM_DIR/chromium/src/third_party/ffmpeg<br />
$ ./chromium/scripts/build_ffmpeg.py linux ppc64<br />
$ ./chromium/scripts/generate_gn.py<br />
$ ./chromium/scripts/copy_config.sh<br />
<br />
$ cd ../libvpx<br />
$ mkdir source/config/linux/ppc64<br />
$ ./generate_gni.sh<br />
$ cd ../../ </nowiki><br />
<br />
=== Build ===<br />
Now you're ready to build Chromium. First, the build parameters must be configured with gn. To do this, perform the following:<br />
<nowiki><br />
$ cd $CHROMIUM_DIR/chromium/src<br />
$ gn args out/Default </nowiki><br />
<br />
A text editor will open. Paste in the following configuration, modified to suit your needs if necessary:<br />
<nowiki><br />
# Release mode<br />
is_component_build = false<br />
is_debug = false<br />
<br />
# Disable broken features<br />
enable_nacl = false<br />
treat_warnings_as_errors = false<br />
enable_dav1d_decoder = false<br />
<br />
# For clang, add the following lines:<br />
is_clang = true<br />
clang_base_path = "/path/to/your/llvm_build"<br />
clang_use_chrome_plugins = false<br />
use_lld = false </nowiki><br />
<br />
Note that <code>clang_base_path</code> will have to be modified to contain the full path to your $CHROMIUM_DIR/llvm_build directory that was created earlier.<br />
<br />
Close and save the text file and perform the following to build Chromium:<br />
<nowiki><br />
$ ninja -C out/Default chrome </nowiki><br />
<br />
This will perform a parallel build of Chromium using all available threads. To limit the number of threads, append <code>-jX</code> where X is the number of threads you wish to use.<br />
If all goes well, you will have a compiled Chromium binary at <code>$CHROMIUM_DIR/chromium/src/out/Default/chrome</code>. If you encounter an error, <br />
[https://github.com/shawnanastasio/chromium_power/issues please report an issue here].</div>Jessesimpson