Introduction to Chromium
Chromium is an open-source browser
project that aims to build a safer, faster, and more stable way for
all users to experience the web.
This package is known to build and work properly using an LFS-8.2
platform.
Package Information
Additional Downloads
Required patch:
Optional Chrome binaries to extract the WideVine plug-in (Netflix) support:
Chromium Dependencies
Required
alsa-lib-1.1.5, Cups-2.2.6, desktop-file-utils-0.23, dbus-1.12.4, File::BaseDir-0.07, GTK+-3.22.28, hicolor-icon-theme-0.17, MIT Kerberos V5-1.16, Mesa-17.3.4,
nodejs-9.5.0, NSS-3.35, Python-2.7.14, usbutils-009,
and X Window
System
Recommended
make-ca-0.7 (runtime), FLAC-1.3.2,
git-2.16.2, Liberation fonts libexif-0.6.21, libjpeg-turbo-1.5.3, libsecret-0.18.5, libwebp-0.6.1,
pciutils-3.5.6, PulseAudio-11.1, xdg-utils-1.1.2, and
yasm-1.3.0
Optional
FFmpeg-3.4.2 (currently broken), GConf-3.2.6,
ICU-60.2 (currently broken), gnome-keyring-3.20.1, libevent-2.1.8, libpng-1.6.34
(currently broken), libvpx-1.7.0
(currently broken), libxml2-2.9.7 (currently broken),
UPower-0.99.7 (runtime), speech-dispatcher (for
the screen reader), and snappy
User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/chromium
Installation of Chromium
Enable the use of the WideVine plugin, needed for Netflix
support (see the WideVine section below). Define an available
product name ("Pinkie Pie" in this case) with the following
command:
line='#define WIDEVINE_CDM_VERSION_STRING "Pinkie Pie"'
sed "/WIDEVINE_CDM_AVAILABLE/a$line" \
-i third_party/widevine/cdm/stub/widevine_cdm_version.h
Optionally silence several (2000+) invalid warnings:
sed '/static_assert/s:^://:' \
-i third_party/WebKit/Source/platform/wtf/text/TextCodec.h
Fix a build issue with recent versions of GCC:
patch -Np1 -i ../chromium-64.0.3282.186-constexpr-1.patch
Remove third-party build files that interfere with system versions:
Note
Chromium uses many external projects, the selections below are
not set in stone, however they have been tested thoroughly. With
Chromium 64.0.3282.186, system versions of libvpx, libxml2, and
zlib are known to break the build at this time.
for LIB in flac freetype harfbuzz-ng libjpeg \
libjpeg_turbo libwebp libxslt yasm; do
find -type f -path "*third_party/$LIB/*" \
\! -path "*third_party/$LIB/chromium/*" \
\! -path "*third_party/$LIB/google/*" \
\! -path "*base/third_party/icu/*" \
\! -path './third_party/yasm/run_yasm.py' \
\! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
\! -path './third_party/freetype/src/src/psnames/pstables.h' \
-delete
done &&
python build/linux/unbundle/replace_gn_files.py \
--system-libraries flac libjpeg libxml libevent \
libwebp libxslt opus yasm &&
python third_party/libaddressinput/chromium/tools/update-strings.py
Chromium uses an internal tool,
gn,
to generate the Ninja build files.
Complete configuration of the build using the following commands:
Note
The Google API Key and OAuth tokens below are specific to LFS. If
using these instructions for another distro, or if you intend to
distribute binary copies of the software using these
instructions, please obtain your own keys following the
instructions located at http://www.chromium.org/developers/how-tos/api-keys.
GN_CONFIG=('google_api_key="AIzaSyDxKL42zsPjbke5O8_rPVpVrLrJ8aeE9rQ"'
'google_default_client_id="595013732528-llk8trb03f0ldpqq6nprjp1s79596646.apps.googleusercontent.com"'
'google_default_client_secret="5ntt6GbbkjnTVXx-MSxbmx5e"'
'clang_use_chrome_plugins=false'
'enable_hangout_services_extension=true'
'enable_nacl=false'
'enable_nacl_nonsfi=false'
'enable_swiftshader=false'
'enable_widevine=true'
'fatal_linker_warnings=false'
'ffmpeg_branding="Chrome"'
'fieldtrial_testing_like_official_build=true'
'is_debug=false'
'is_clang=false'
'link_pulseaudio=true'
'linux_use_bundled_binutils=false'
'proprietary_codecs=true'
'remove_webcore_debug_symbols=true'
'symbol_level=0'
'treat_warnings_as_errors=false'
'use_allocator="none"'
'use_cups=true'
'use_gconf=false'
'use_gnome_keyring=false'
'use_gold=false'
'use_gtk3=true'
'use_kerberos=true'
'use_pulseaudio=true'
'use_sysroot=false'
'use_system_freetype=true'
'use_system_harfbuzz=true')
Build gn and use it to prepare the
Ninja build files:
python tools/gn/bootstrap/bootstrap.py --gn-gen-args "${GN_CONFIG[*]}" &&
out/Release/gn gen out/Release --args="${GN_CONFIG[*]}"
Warning
Ninja, by default, sets the number of jobs to the number of
available threads. If your machine is memory constrained, with
regard to number of threads, you should reduce the number of jobs
by passing the -j#
switch
to the ninja
command below. Plan for roughly 1.25GB per thread while linking
WebKit to avoid out of memory
errors.
Build Chromium using the following
commands:
mkdir -p third_party/node/linux/node-linux-x64/bin &&
ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/ &&
ninja -C out/Release chrome chrome_sandbox chromedriver widevinecdmadapter
This package was already tested as part of the build.
Now, as the root
user, install the
package:
install -vDm755 out/Release/chrome \
/usr/lib/chromium/chromium &&
install -vDm4755 out/Release/chrome_sandbox \
/usr/lib/chromium/chrome-sandbox &&
install -vDm755 out/Release/chromedriver \
/usr/lib/chromium/chromedriver &&
ln -svf /usr/lib/chromium/chromium /usr/bin &&
ln -svf /usr/lib/chromium/chromedriver /usr/bin &&
install -vDm644 out/Release/gen/content/content_resources.pak \
/usr/lib/chromium/ &&
install -vDm644 out/Release/icudtl.dat \
/usr/lib/chromium/icudtl.dat &&
install -vDm644 out/Release/{*.pak,*.bin} \
/usr/lib/chromium/ &&
sed -i \
-e "s/@@MENUNAME@@/Chromium/g" \
-e "s/@@PACKAGE@@/chromium/g" \
-e "s/@@USR_BIN_SYMLINK_NAME@@/chromium/g" \
chrome/installer/linux/common/desktop.template \
chrome/app/resources/manpage.1.in &&
install -vDm644 chrome/installer/linux/common/desktop.template \
/usr/share/applications/chromium.desktop &&
install -vDm644 chrome/app/resources/manpage.1.in \
/usr/share/man/man1/chromium.1 &&
cp -av out/Release/locales /usr/lib/chromium/ &&
chown -Rv root:root /usr/lib/chromium/locales &&
for size in 16 32; do
install -vDm644 \
"chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
"/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
done &&
for size in 22 24 48 64 128 256; do
install -vDm644 "chrome/app/theme/chromium/product_logo_$size.png" \
"/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
done
Note
If upgrading from a previous build of chromium using gtk+-2.x,
you may need to remove the ~/.config/chromium
directory.
Extracting the WideVine plugin from Chrome
Extract the downloaded deb file with the following commands:
mkdir temp &&
cd temp &&
case $(uname -m) in
x86_64) ar -x ../../google-chrome-stable_64.0.3282.186-1_amd64.deb
;;
i?86) ar -x ../../google-chrome-stable_48.0.2564.116-1_i386.deb
;;
esac
As the root
user, enable the
WideVine plugin with the following commands:
tar -xf data.tar.xz &&
install -vm755 ../out/Release/libwidevinecdmadapter.so /usr/lib/chromium/ &&
install -vm755 opt/google/chrome/libwidevinecdm.so /usr/lib/chromium/
Command Explanations
GN_CONFIG=(...): this
array contains all of the defines used in the build.
python
tools/gn/bootstrap/bootstrap.py --gn-gen-args
"${GN_CONFIG[*]}": this command replaces defines in
the gn files with the values contained in ${GN_CONFIG[@]}
.
out/Release/gn gen out/Release
--args="${GN_CONFIG[*]}": this command runs a
Google provided configuration script gn on the source tree to produce a
Ninja configuration suitable for
the build machine.
mkdir...ln -s /usr/bin/node
third_party/node/linux/node-linux-x64/bin/: these
commands replaced the local Node.js (no longer available) with the system
installed Node.js.
ar -x
../../google-chrome-stable*.deb: the ar utility is used to extract
Debian archives.