2009-03-10 19:43:01 +03:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
2012-02-08 22:39:53 +04:00
|
|
|
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
2009-08-26 00:59:27 +04:00
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
2008-11-01 00:45:30 +03:00
|
|
|
# Script to install everything needed to build chromium (well, ideally, anyway)
|
2016-02-09 02:27:20 +03:00
|
|
|
# See https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_instructions.md
|
2009-02-25 23:51:44 +03:00
|
|
|
|
2010-01-26 21:17:53 +03:00
|
|
|
usage() {
|
|
|
|
echo "Usage: $0 [--options]"
|
|
|
|
echo "Options:"
|
|
|
|
echo "--[no-]syms: enable or disable installation of debugging symbols"
|
2014-11-27 18:45:31 +03:00
|
|
|
echo "--lib32: enable installation of 32-bit libraries, e.g. for V8 snapshot"
|
2012-11-15 05:06:26 +04:00
|
|
|
echo "--[no-]arm: enable or disable installation of arm cross toolchain"
|
2013-02-22 07:49:20 +04:00
|
|
|
echo "--[no-]chromeos-fonts: enable or disable installation of Chrome OS"\
|
|
|
|
"fonts"
|
2014-01-17 01:26:47 +04:00
|
|
|
echo "--[no-]nacl: enable or disable installation of prerequisites for"\
|
|
|
|
"building standalone NaCl and all its toolchains"
|
2012-04-23 08:48:31 +04:00
|
|
|
echo "--no-prompt: silently select standard options/defaults"
|
2013-10-25 20:11:46 +04:00
|
|
|
echo "--quick-check: quickly try to determine if dependencies are installed"
|
|
|
|
echo " (this avoids interactive prompts and sudo commands,"
|
|
|
|
echo " so might not be 100% accurate)"
|
|
|
|
echo "--unsupported: attempt installation even on unsupported systems"
|
2010-01-26 21:17:53 +03:00
|
|
|
echo "Script will prompt interactively if options not given."
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2016-12-07 21:58:34 +03:00
|
|
|
# Waits for the user to press 'Y' or 'N'. Either uppercase of lowercase is
|
|
|
|
# accepted. Returns 0 for 'Y' and 1 for 'N'. If an optional parameter has
|
|
|
|
# been provided to yes_no(), the function also accepts RETURN as a user input.
|
|
|
|
# The parameter specifies the exit code that should be returned in that case.
|
|
|
|
# The function will echo the user's selection followed by a newline character.
|
|
|
|
# Users can abort the function by pressing CTRL-C. This will call "exit 1".
|
|
|
|
yes_no() {
|
|
|
|
if [ 0 -ne "${do_default-0}" ] ; then
|
|
|
|
[ $1 -eq 0 ] && echo "Y" || echo "N"
|
|
|
|
return $1
|
|
|
|
fi
|
|
|
|
local c
|
|
|
|
while :; do
|
|
|
|
c="$(trap 'stty echo -iuclc icanon 2>/dev/null' EXIT INT TERM QUIT
|
|
|
|
stty -echo iuclc -icanon 2>/dev/null
|
|
|
|
dd count=1 bs=1 2>/dev/null | od -An -tx1)"
|
|
|
|
case "$c" in
|
|
|
|
" 0a") if [ -n "$1" ]; then
|
|
|
|
[ $1 -eq 0 ] && echo "Y" || echo "N"
|
|
|
|
return $1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
" 79") echo "Y"
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
" 6e") echo "N"
|
|
|
|
return 1
|
|
|
|
;;
|
|
|
|
"") echo "Aborted" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*) # The user pressed an unrecognized key. As we are not echoing
|
|
|
|
# any incorrect user input, alert the user by ringing the bell.
|
|
|
|
(tput bel) 2>/dev/null
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2013-05-30 03:11:20 +04:00
|
|
|
# Checks whether a particular package is available in the repos.
|
|
|
|
# USAGE: $ package_exists <package name>
|
|
|
|
package_exists() {
|
2017-11-28 07:13:25 +03:00
|
|
|
# 'apt-cache search' takes a regex string, so eg. the +'s in packages like
|
|
|
|
# "libstdc++" need to be escaped.
|
|
|
|
local escaped="$(echo $1 | sed 's/[\~\+\.\:-]/\\&/g')"
|
|
|
|
[ ! -z "$(apt-cache search --names-only "${escaped}" | \
|
2017-11-28 00:47:38 +03:00
|
|
|
awk '$1 == "'$1'" { print $1; }')" ]
|
2013-05-30 03:11:20 +04:00
|
|
|
}
|
|
|
|
|
2014-01-18 03:59:01 +04:00
|
|
|
# These default to on because (some) bots need them and it keeps things
|
|
|
|
# simple for the bot setup if all bots just run the script in its default
|
|
|
|
# mode. Developers who don't want stuff they don't need installed on their
|
|
|
|
# own workstations can pass --no-arm --no-nacl when running the script.
|
|
|
|
do_inst_arm=1
|
|
|
|
do_inst_nacl=1
|
|
|
|
|
2010-01-26 21:17:53 +03:00
|
|
|
while test "$1" != ""
|
|
|
|
do
|
|
|
|
case "$1" in
|
2011-09-13 03:21:39 +04:00
|
|
|
--syms) do_inst_syms=1;;
|
|
|
|
--no-syms) do_inst_syms=0;;
|
|
|
|
--lib32) do_inst_lib32=1;;
|
2012-11-15 05:06:26 +04:00
|
|
|
--arm) do_inst_arm=1;;
|
|
|
|
--no-arm) do_inst_arm=0;;
|
2013-02-22 07:49:20 +04:00
|
|
|
--chromeos-fonts) do_inst_chromeos_fonts=1;;
|
|
|
|
--no-chromeos-fonts) do_inst_chromeos_fonts=0;;
|
2014-01-17 01:26:47 +04:00
|
|
|
--nacl) do_inst_nacl=1;;
|
|
|
|
--no-nacl) do_inst_nacl=0;;
|
2012-04-23 08:48:31 +04:00
|
|
|
--no-prompt) do_default=1
|
|
|
|
do_quietly="-qq --assume-yes"
|
|
|
|
;;
|
2013-10-25 20:11:46 +04:00
|
|
|
--quick-check) do_quick_check=1;;
|
2013-01-16 02:11:47 +04:00
|
|
|
--unsupported) do_unsupported=1;;
|
2010-01-26 21:17:53 +03:00
|
|
|
*) usage;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2014-11-27 18:45:31 +03:00
|
|
|
if test "$do_inst_arm" = "1"; then
|
|
|
|
do_inst_lib32=1
|
|
|
|
fi
|
|
|
|
|
2014-05-23 00:07:19 +04:00
|
|
|
# Check for lsb_release command in $PATH
|
|
|
|
if ! which lsb_release > /dev/null; then
|
|
|
|
echo "ERROR: lsb_release not found in \$PATH" >&2
|
|
|
|
exit 1;
|
|
|
|
fi
|
2012-11-15 05:06:26 +04:00
|
|
|
|
2017-05-04 04:29:11 +03:00
|
|
|
distro_codename=$(lsb_release --codename --short)
|
|
|
|
distro_id=$(lsb_release --id --short)
|
2017-10-30 03:05:52 +03:00
|
|
|
supported_codenames="(trusty|xenial|zesty|artful)"
|
2017-05-04 04:29:11 +03:00
|
|
|
supported_ids="(Debian)"
|
2013-10-25 20:11:46 +04:00
|
|
|
if [ 0 -eq "${do_unsupported-0}" ] && [ 0 -eq "${do_quick_check-0}" ] ; then
|
2017-05-04 04:29:11 +03:00
|
|
|
if [[ ! $distro_codename =~ $supported_codenames &&
|
|
|
|
! $distro_id =~ $supported_ids ]]; then
|
2017-03-28 22:28:45 +03:00
|
|
|
echo -e "ERROR: The only supported distros are\n" \
|
|
|
|
"\tUbuntu 14.04 (trusty)\n" \
|
|
|
|
"\tUbuntu 16.04 (xenial)\n" \
|
2017-06-30 06:51:28 +03:00
|
|
|
"\tUbuntu 17.04 (zesty)\n" \
|
2017-10-30 03:05:52 +03:00
|
|
|
"\tUbuntu 17.10 (artful)\n" \
|
2017-05-04 04:29:11 +03:00
|
|
|
"\tDebian 8 (jessie) or later" >&2
|
2016-11-21 22:47:12 +03:00
|
|
|
exit 1
|
2013-01-16 02:11:47 +04:00
|
|
|
fi
|
2008-11-01 00:45:30 +03:00
|
|
|
|
2013-01-16 02:11:47 +04:00
|
|
|
if ! uname -m | egrep -q "i686|x86_64"; then
|
2016-11-21 22:47:12 +03:00
|
|
|
echo "Only x86 architectures are currently supported" >&2
|
2013-01-16 02:11:47 +04:00
|
|
|
exit
|
|
|
|
fi
|
2009-03-10 19:43:01 +03:00
|
|
|
fi
|
|
|
|
|
2013-10-25 20:11:46 +04:00
|
|
|
if [ "x$(id -u)" != x0 ] && [ 0 -eq "${do_quick_check-0}" ]; then
|
2009-03-10 19:43:01 +03:00
|
|
|
echo "Running as non-root user."
|
|
|
|
echo "You might have to enter your password one or more times for 'sudo'."
|
2009-03-11 00:53:08 +03:00
|
|
|
echo
|
2009-03-10 19:43:01 +03:00
|
|
|
fi
|
|
|
|
|
2010-06-08 02:01:57 +04:00
|
|
|
# Packages needed for chromeos only
|
2015-05-27 00:08:12 +03:00
|
|
|
chromeos_dev_list="libbluetooth-dev libxkbcommon-dev realpath"
|
2010-06-08 02:01:57 +04:00
|
|
|
|
2013-11-15 00:41:41 +04:00
|
|
|
# Packages needed for development
|
2017-03-02 03:28:20 +03:00
|
|
|
dev_list="\
|
|
|
|
bison
|
|
|
|
cdbs
|
|
|
|
curl
|
|
|
|
dpkg-dev
|
|
|
|
elfutils
|
|
|
|
devscripts
|
|
|
|
fakeroot
|
|
|
|
flex
|
|
|
|
fonts-ipafont
|
|
|
|
g++
|
|
|
|
git-core
|
|
|
|
git-svn
|
|
|
|
gperf
|
|
|
|
libasound2-dev
|
|
|
|
libbrlapi-dev
|
|
|
|
libav-tools
|
|
|
|
libbz2-dev
|
|
|
|
libcairo2-dev
|
|
|
|
libcap-dev
|
|
|
|
libcups2-dev
|
|
|
|
libcurl4-gnutls-dev
|
|
|
|
libdrm-dev
|
|
|
|
libelf-dev
|
|
|
|
libffi-dev
|
|
|
|
libglib2.0-dev
|
|
|
|
libglu1-mesa-dev
|
|
|
|
libgnome-keyring-dev
|
|
|
|
libgtk2.0-dev
|
|
|
|
libgtk-3-dev
|
|
|
|
libkrb5-dev
|
|
|
|
libnspr4-dev
|
|
|
|
libnss3-dev
|
|
|
|
libpam0g-dev
|
|
|
|
libpci-dev
|
|
|
|
libpulse-dev
|
|
|
|
libsctp-dev
|
|
|
|
libspeechd-dev
|
|
|
|
libsqlite3-dev
|
|
|
|
libssl-dev
|
|
|
|
libudev-dev
|
|
|
|
libwww-perl
|
|
|
|
libxslt1-dev
|
|
|
|
libxss-dev
|
|
|
|
libxt-dev
|
|
|
|
libxtst-dev
|
2017-08-21 23:53:21 +03:00
|
|
|
locales
|
2017-03-02 03:28:20 +03:00
|
|
|
openbox
|
|
|
|
patch
|
|
|
|
perl
|
|
|
|
pkg-config
|
|
|
|
python
|
|
|
|
python-cherrypy3
|
|
|
|
python-crypto
|
|
|
|
python-dev
|
|
|
|
python-numpy
|
|
|
|
python-opencv
|
|
|
|
python-openssl
|
|
|
|
python-psutil
|
|
|
|
python-yaml
|
|
|
|
rpm
|
|
|
|
ruby
|
|
|
|
subversion
|
|
|
|
wdiff
|
2017-08-08 03:23:23 +03:00
|
|
|
x11-utils
|
2017-03-02 03:28:20 +03:00
|
|
|
xcompmgr
|
|
|
|
zip
|
|
|
|
$chromeos_dev_list
|
|
|
|
"
|
2010-06-08 02:01:57 +04:00
|
|
|
|
2012-08-16 01:00:14 +04:00
|
|
|
# 64-bit systems need a minimum set of 32-bit compat packages for the pre-built
|
2014-08-18 16:30:23 +04:00
|
|
|
# NaCl binaries.
|
2015-09-17 10:27:12 +03:00
|
|
|
if file -L /sbin/init | grep -q 'ELF 64-bit'; then
|
2012-10-15 10:39:53 +04:00
|
|
|
dev_list="${dev_list} libc6-i386 lib32gcc1 lib32stdc++6"
|
2012-08-16 01:00:14 +04:00
|
|
|
fi
|
|
|
|
|
2010-06-08 02:01:57 +04:00
|
|
|
# Run-time libraries required by chromeos only
|
2013-10-25 20:11:46 +04:00
|
|
|
chromeos_lib_list="libpulse0 libbz2-1.0"
|
2009-03-10 19:43:01 +03:00
|
|
|
|
|
|
|
# Full list of required run-time libraries
|
2017-03-02 03:28:20 +03:00
|
|
|
lib_list="\
|
|
|
|
libatk1.0-0
|
|
|
|
libc6
|
|
|
|
libasound2
|
|
|
|
libcairo2
|
|
|
|
libcap2
|
|
|
|
libcups2
|
|
|
|
libexpat1
|
|
|
|
libffi6
|
|
|
|
libfontconfig1
|
|
|
|
libfreetype6
|
|
|
|
libglib2.0-0
|
|
|
|
libgnome-keyring0
|
|
|
|
libgtk2.0-0
|
|
|
|
libgtk-3-0
|
|
|
|
libpam0g
|
|
|
|
libpango1.0-0
|
|
|
|
libpci3
|
|
|
|
libpcre3
|
|
|
|
libpixman-1-0
|
|
|
|
libspeechd2
|
|
|
|
libstdc++6
|
|
|
|
libsqlite3-0
|
|
|
|
libx11-6
|
|
|
|
libx11-xcb1
|
|
|
|
libxau6
|
|
|
|
libxcb1
|
|
|
|
libxcomposite1
|
|
|
|
libxcursor1
|
|
|
|
libxdamage1
|
|
|
|
libxdmcp6
|
|
|
|
libxext6
|
|
|
|
libxfixes3
|
|
|
|
libxi6
|
|
|
|
libxinerama1
|
|
|
|
libxrandr2
|
|
|
|
libxrender1
|
|
|
|
libxtst6
|
|
|
|
zlib1g
|
|
|
|
$chromeos_lib_list
|
|
|
|
"
|
2009-03-10 19:43:01 +03:00
|
|
|
|
|
|
|
# Debugging symbols for all of the run-time libraries
|
2017-03-02 03:28:20 +03:00
|
|
|
dbg_list="\
|
|
|
|
libc6-dbg
|
|
|
|
libffi6-dbg
|
|
|
|
libgtk2.0-0-dbg
|
|
|
|
libpcre3-dbg
|
|
|
|
libpixman-1-0-dbg
|
|
|
|
libsqlite3-0-dbg
|
|
|
|
libxau6-dbg
|
|
|
|
libxcb1-dbg
|
|
|
|
libxcomposite1-dbg
|
|
|
|
libxdmcp6-dbg
|
|
|
|
libxext6-dbg
|
|
|
|
libxinerama1-dbg
|
|
|
|
zlib1g-dbg
|
|
|
|
"
|
2015-03-18 02:28:00 +03:00
|
|
|
|
2017-11-28 07:13:25 +03:00
|
|
|
if package_exists libstdc++6-6-dbg; then
|
|
|
|
dbg_list="${dbg_list} libstdc++6-6-dbg"
|
|
|
|
elif package_exists libstdc++6-4.9-dbg; then
|
|
|
|
dbg_list="${dbg_list} libstdc++6-4.9-dbg"
|
|
|
|
else
|
2015-03-18 02:28:00 +03:00
|
|
|
dbg_list="${dbg_list} libstdc++6-4.8-dbg"
|
2017-11-28 07:13:25 +03:00
|
|
|
fi
|
|
|
|
if package_exists libgtk-3-0-dbgsym; then
|
|
|
|
lib_list="${lib_list} libgtk-3-0-dbgsym"
|
|
|
|
elif package_exists libgtk-3-0-dbg; then
|
|
|
|
lib_list="${lib_list} libgtk-3-0-dbg"
|
|
|
|
fi
|
|
|
|
if package_exists libatk1.0-0-dbgsym; then
|
|
|
|
lib_list="${lib_list} libatk1.0-0-dbgsym"
|
|
|
|
elif package_exists libatk1.0-dbg; then
|
|
|
|
lib_list="${lib_list} libatk1.0-dbg"
|
|
|
|
fi
|
|
|
|
if package_exists libcairo2-dbgsym; then
|
|
|
|
lib_list="${lib_list} libcairo2-dbgsym"
|
|
|
|
elif package_exists libcairo2-dbg; then
|
|
|
|
lib_list="${lib_list} libcairo2-dbg"
|
|
|
|
fi
|
|
|
|
if package_exists libfontconfig1-dbgsym; then
|
|
|
|
lib_list="${lib_list} libfontconfig1-dbgsym"
|
2015-03-18 02:28:00 +03:00
|
|
|
else
|
2017-11-28 07:13:25 +03:00
|
|
|
lib_list="${lib_list} libfontconfig1-dbg"
|
|
|
|
fi
|
|
|
|
if package_exists libxdamage1-dbgsym; then
|
|
|
|
lib_list="${lib_list} libxdamage1-dbgsym"
|
|
|
|
elif package_exists libxdamage1-dbg; then
|
|
|
|
lib_list="${lib_list} libxdamage1-dbg"
|
|
|
|
fi
|
|
|
|
if package_exists libpango1.0-dev-dbgsym; then
|
|
|
|
lib_list="${lib_list} libpango1.0-dev-dbgsym"
|
|
|
|
elif package_exists libpango1.0-0-dbg; then
|
|
|
|
lib_list="${lib_list} libpango1.0-0-dbg"
|
|
|
|
fi
|
|
|
|
if package_exists libx11-6-dbg; then
|
|
|
|
lib_list="${lib_list} libx11-6-dbg"
|
|
|
|
fi
|
|
|
|
if package_exists libx11-xcb1-dbg; then
|
|
|
|
lib_list="${lib_list} libx11-xcb1-dbg"
|
|
|
|
fi
|
|
|
|
if package_exists libxfixes3-dbg; then
|
|
|
|
lib_list="${lib_list} libxfixes3-dbg"
|
|
|
|
fi
|
|
|
|
if package_exists libxi6-dbg; then
|
|
|
|
lib_list="${lib_list} libxi6-dbg"
|
|
|
|
fi
|
|
|
|
if package_exists libxrandr2-dbg; then
|
|
|
|
lib_list="${lib_list} libxrandr2-dbg"
|
|
|
|
fi
|
|
|
|
if package_exists libxrender1-dbg; then
|
|
|
|
lib_list="${lib_list} libxrender1-dbg"
|
|
|
|
fi
|
|
|
|
if package_exists libxtst6-dbg; then
|
|
|
|
lib_list="${lib_list} libxtst6-dbg"
|
|
|
|
fi
|
|
|
|
if package_exists libglib2.0-0-dbg; then
|
|
|
|
lib_list="${lib_list} libglib2.0-0-dbg"
|
|
|
|
fi
|
|
|
|
if package_exists libxcursor1-dbg; then
|
|
|
|
lib_list="${lib_list} libxcursor1-dbg"
|
2015-03-18 02:28:00 +03:00
|
|
|
fi
|
2009-03-10 19:43:01 +03:00
|
|
|
|
2014-11-27 18:45:31 +03:00
|
|
|
# 32-bit libraries needed e.g. to compile V8 snapshot for Android or armhf
|
2017-05-30 22:37:04 +03:00
|
|
|
lib32_list="linux-libc-dev:i386 libpci3:i386"
|
2014-11-27 18:45:31 +03:00
|
|
|
|
2013-10-29 06:38:46 +04:00
|
|
|
# arm cross toolchain packages needed to build chrome on armhf
|
2016-12-07 21:58:34 +03:00
|
|
|
EM_REPO="deb http://emdebian.org/tools/debian/ jessie main"
|
|
|
|
EM_SOURCE=$(cat <<EOF
|
|
|
|
# Repo added by Chromium $0
|
|
|
|
${EM_REPO}
|
|
|
|
# deb-src http://emdebian.org/tools/debian/ jessie main
|
|
|
|
EOF
|
|
|
|
)
|
|
|
|
EM_ARCHIVE_KEY_FINGER="084C6C6F39159EDB67969AA87DE089671804772E"
|
|
|
|
GPP_ARM_PACKAGE="g++-arm-linux-gnueabihf"
|
2017-05-04 04:29:11 +03:00
|
|
|
case $distro_codename in
|
2017-03-30 15:30:31 +03:00
|
|
|
jessie)
|
2016-12-07 21:58:34 +03:00
|
|
|
eval $(apt-config shell APT_SOURCESDIR 'Dir::Etc::sourceparts/d')
|
|
|
|
CROSSTOOLS_LIST="${APT_SOURCESDIR}/crosstools.list"
|
|
|
|
arm_list="libc6-dev:armhf
|
|
|
|
linux-libc-dev:armhf"
|
|
|
|
if test "$do_inst_arm" = "1"; then
|
|
|
|
if $(dpkg-query -W ${GPP_ARM_PACKAGE} &>/dev/null); then
|
|
|
|
arm_list+=" ${GPP_ARM_PACKAGE}"
|
|
|
|
else
|
|
|
|
echo "The Debian Cross-toolchains repository is necessary to"
|
|
|
|
echo "cross-compile Chromium for arm."
|
|
|
|
echo -n "Do you want me to add it for you (y/N) "
|
|
|
|
if yes_no 1; then
|
|
|
|
gpg --keyserver pgp.mit.edu --recv-keys ${EM_ARCHIVE_KEY_FINGER}
|
|
|
|
gpg -a --export ${EM_ARCHIVE_KEY_FINGER} | sudo apt-key add -
|
|
|
|
if ! grep "^${EM_REPO}" "${CROSSTOOLS_LIST}" &>/dev/null; then
|
|
|
|
echo "${EM_SOURCE}" | sudo tee -a "${CROSSTOOLS_LIST}" >/dev/null
|
|
|
|
fi
|
|
|
|
arm_list+=" ${GPP_ARM_PACKAGE}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
;;
|
2017-05-04 04:29:11 +03:00
|
|
|
# All necessary ARM packages are available on the default repos on
|
|
|
|
# Debian 9 and later.
|
2017-03-30 15:30:31 +03:00
|
|
|
*)
|
2017-11-11 06:56:33 +03:00
|
|
|
arm_list="libc6-dev-armhf-cross
|
2016-12-07 21:58:34 +03:00
|
|
|
linux-libc-dev-armhf-cross
|
|
|
|
${GPP_ARM_PACKAGE}"
|
|
|
|
;;
|
|
|
|
esac
|
2011-08-24 02:27:35 +04:00
|
|
|
|
2015-04-01 20:49:03 +03:00
|
|
|
# Work around for dependency issue Ubuntu/Trusty: http://crbug.com/435056
|
2017-05-04 04:29:11 +03:00
|
|
|
case $distro_codename in
|
2016-04-21 04:15:48 +03:00
|
|
|
trusty)
|
|
|
|
arm_list+=" g++-4.8-multilib-arm-linux-gnueabihf
|
|
|
|
gcc-4.8-multilib-arm-linux-gnueabihf"
|
|
|
|
;;
|
2017-10-30 03:05:52 +03:00
|
|
|
xenial|zesty|artful)
|
2016-04-22 03:52:18 +03:00
|
|
|
arm_list+=" g++-5-multilib-arm-linux-gnueabihf
|
|
|
|
gcc-5-multilib-arm-linux-gnueabihf
|
|
|
|
gcc-arm-linux-gnueabihf"
|
|
|
|
;;
|
2016-04-21 04:15:48 +03:00
|
|
|
esac
|
2015-04-01 20:49:03 +03:00
|
|
|
|
2014-06-03 03:10:03 +04:00
|
|
|
# Packages to build NaCl, its toolchains, and its ports.
|
2014-09-06 10:18:45 +04:00
|
|
|
naclports_list="ant autoconf bison cmake gawk intltool xutils-dev xsltproc"
|
2017-03-02 03:28:20 +03:00
|
|
|
nacl_list="\
|
|
|
|
g++-mingw-w64-i686
|
|
|
|
lib32z1-dev
|
|
|
|
libasound2:i386
|
|
|
|
libcap2:i386
|
|
|
|
libelf-dev:i386
|
|
|
|
libfontconfig1:i386
|
|
|
|
libglib2.0-0:i386
|
|
|
|
libgpm2:i386
|
|
|
|
libgtk2.0-0:i386
|
|
|
|
libgtk-3-0:i386
|
|
|
|
libncurses5:i386
|
|
|
|
lib32ncurses5-dev
|
|
|
|
libnss3:i386
|
|
|
|
libpango1.0-0:i386
|
2017-05-04 04:29:11 +03:00
|
|
|
libssl-dev:i386
|
2017-03-02 03:28:20 +03:00
|
|
|
libtinfo-dev
|
|
|
|
libtinfo-dev:i386
|
|
|
|
libtool
|
|
|
|
libxcomposite1:i386
|
|
|
|
libxcursor1:i386
|
|
|
|
libxdamage1:i386
|
|
|
|
libxi6:i386
|
|
|
|
libxrandr2:i386
|
|
|
|
libxss1:i386
|
|
|
|
libxtst6:i386
|
|
|
|
texinfo
|
|
|
|
xvfb
|
|
|
|
${naclports_list}
|
|
|
|
"
|
2014-06-19 22:26:18 +04:00
|
|
|
|
2017-12-11 23:39:18 +03:00
|
|
|
if package_exists libssl1.1; then
|
|
|
|
nacl_list="${nacl_list} libssl1.1:i386"
|
|
|
|
elif package_exists libssl1.0.2; then
|
2017-05-04 04:29:11 +03:00
|
|
|
nacl_list="${nacl_list} libssl1.0.2:i386"
|
2017-12-11 23:39:18 +03:00
|
|
|
else
|
|
|
|
nacl_list="${nacl_list} libssl1.0.0:i386"
|
2017-05-04 04:29:11 +03:00
|
|
|
fi
|
|
|
|
|
2015-11-05 15:43:08 +03:00
|
|
|
# Find the proper version of packages that depend on mesa. Only one -lts variant
|
|
|
|
# of mesa can be installed and everything that depends on it must match.
|
|
|
|
|
|
|
|
# Query for the name and status of all mesa LTS variants, filter for only
|
|
|
|
# installed packages, extract just the name, and eliminate duplicates (there can
|
|
|
|
# be more than one with the same name in the case of multiarch). Expand into an
|
|
|
|
# array.
|
|
|
|
mesa_packages=($(dpkg-query -Wf'${package} ${status}\n' \
|
2016-02-24 21:52:23 +03:00
|
|
|
libgl1-mesa-glx-lts-\* 2>/dev/null | \
|
2015-11-05 15:43:08 +03:00
|
|
|
grep " ok installed" | cut -d " " -f 1 | sort -u))
|
|
|
|
if [ "${#mesa_packages[@]}" -eq 0 ]; then
|
|
|
|
mesa_variant=""
|
|
|
|
elif [ "${#mesa_packages[@]}" -eq 1 ]; then
|
|
|
|
# Strip the base package name and leave just "-lts-whatever"
|
|
|
|
mesa_variant="${mesa_packages[0]#libgl1-mesa-glx}"
|
|
|
|
else
|
|
|
|
echo "ERROR: unable to determine which libgl1-mesa-glx variant is installed."
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-06-26 03:55:04 +04:00
|
|
|
dev_list="${dev_list} libgbm-dev${mesa_variant}
|
2015-03-17 13:56:37 +03:00
|
|
|
libgles2-mesa-dev${mesa_variant} libgl1-mesa-dev${mesa_variant}
|
|
|
|
mesa-common-dev${mesa_variant}"
|
2014-06-19 22:26:18 +04:00
|
|
|
nacl_list="${nacl_list} libgl1-mesa-glx${mesa_variant}:i386"
|
2014-01-17 01:26:47 +04:00
|
|
|
|
2012-03-15 23:05:18 +04:00
|
|
|
# Some package names have changed over time
|
2017-12-11 23:39:18 +03:00
|
|
|
if package_exists libpng16-16; then
|
2017-01-05 01:04:58 +03:00
|
|
|
lib_list="${lib_list} libpng16-16"
|
2017-12-11 23:39:18 +03:00
|
|
|
else
|
|
|
|
lib_list="${lib_list} libpng12-0"
|
2017-01-05 01:04:58 +03:00
|
|
|
fi
|
2013-05-30 03:11:20 +04:00
|
|
|
if package_exists libnspr4-dbg; then
|
2011-05-20 21:53:55 +04:00
|
|
|
dbg_list="${dbg_list} libnspr4-dbg libnss3-dbg"
|
|
|
|
lib_list="${lib_list} libnspr4 libnss3"
|
2012-03-15 23:05:18 +04:00
|
|
|
else
|
|
|
|
dbg_list="${dbg_list} libnspr4-0d-dbg libnss3-1d-dbg"
|
|
|
|
lib_list="${lib_list} libnspr4-0d libnss3-1d"
|
|
|
|
fi
|
2013-05-30 03:11:20 +04:00
|
|
|
if package_exists libjpeg-dev; then
|
2013-05-21 12:26:42 +04:00
|
|
|
dev_list="${dev_list} libjpeg-dev"
|
2012-03-22 02:09:41 +04:00
|
|
|
else
|
2013-05-21 12:26:42 +04:00
|
|
|
dev_list="${dev_list} libjpeg62-dev"
|
2012-03-22 02:09:41 +04:00
|
|
|
fi
|
2013-05-30 03:11:20 +04:00
|
|
|
if package_exists libudev1; then
|
2013-05-21 12:26:42 +04:00
|
|
|
dev_list="${dev_list} libudev1"
|
2014-06-05 19:28:52 +04:00
|
|
|
nacl_list="${nacl_list} libudev1:i386"
|
2013-05-21 12:26:42 +04:00
|
|
|
else
|
|
|
|
dev_list="${dev_list} libudev0"
|
2014-06-05 19:28:52 +04:00
|
|
|
nacl_list="${nacl_list} libudev0:i386"
|
2013-05-21 12:26:42 +04:00
|
|
|
fi
|
2013-09-06 10:23:57 +04:00
|
|
|
if package_exists libbrlapi0.6; then
|
|
|
|
dev_list="${dev_list} libbrlapi0.6"
|
|
|
|
else
|
|
|
|
dev_list="${dev_list} libbrlapi0.5"
|
|
|
|
fi
|
2017-12-11 23:39:18 +03:00
|
|
|
if package_exists apache2.2-bin; then
|
2016-01-20 08:12:23 +03:00
|
|
|
dev_list="${dev_list} apache2.2-bin"
|
2017-12-11 23:39:18 +03:00
|
|
|
else
|
|
|
|
dev_list="${dev_list} apache2-bin"
|
2016-01-20 08:12:23 +03:00
|
|
|
fi
|
2016-05-19 03:06:28 +03:00
|
|
|
if package_exists xfonts-mathml; then
|
2016-01-20 08:12:23 +03:00
|
|
|
dev_list="${dev_list} xfonts-mathml"
|
|
|
|
fi
|
2017-10-30 03:05:52 +03:00
|
|
|
if package_exists php7.1-cgi; then
|
|
|
|
dev_list="${dev_list} php7.1-cgi libapache2-mod-php7.1"
|
|
|
|
elif package_exists php7.0-cgi; then
|
2016-05-19 03:06:28 +03:00
|
|
|
dev_list="${dev_list} php7.0-cgi libapache2-mod-php7.0"
|
2016-04-22 03:52:18 +03:00
|
|
|
else
|
2016-05-19 03:06:28 +03:00
|
|
|
dev_list="${dev_list} php5-cgi libapache2-mod-php5"
|
2016-04-22 03:52:18 +03:00
|
|
|
fi
|
2016-12-08 09:46:05 +03:00
|
|
|
# ttf-mscorefonts-installer is in the Debian contrib repo, which has
|
|
|
|
# dependencies on non-free software. Install it only if the user has already
|
|
|
|
# enabled contrib.
|
|
|
|
if package_exists ttf-mscorefonts-installer; then
|
|
|
|
dev_list="${dev_list} ttf-mscorefonts-installer"
|
|
|
|
elif package_exists msttcorefonts; then
|
|
|
|
dev_list="${dev_list} msttcorefonts"
|
|
|
|
fi
|
2012-03-15 23:05:18 +04:00
|
|
|
|
2013-10-01 02:06:58 +04:00
|
|
|
# Some packages are only needed if the distribution actually supports
|
2012-03-15 23:05:18 +04:00
|
|
|
# installing them.
|
2013-05-30 03:11:20 +04:00
|
|
|
if package_exists appmenu-gtk; then
|
2012-03-15 23:05:18 +04:00
|
|
|
lib_list="$lib_list appmenu-gtk"
|
2011-04-11 22:42:42 +04:00
|
|
|
fi
|
|
|
|
|
2017-11-11 06:56:33 +03:00
|
|
|
# Cross-toolchain strip is needed for building the sysroots.
|
|
|
|
if package_exists binutils-arm-linux-gnueabihf; then
|
|
|
|
dev_list="${dev_list} binutils-arm-linux-gnueabihf"
|
|
|
|
fi
|
|
|
|
if package_exists binutils-aarch64-linux-gnu; then
|
|
|
|
dev_list="${dev_list} binutils-aarch64-linux-gnu"
|
|
|
|
fi
|
|
|
|
if package_exists binutils-mipsel-linux-gnu; then
|
|
|
|
dev_list="${dev_list} binutils-mipsel-linux-gnu"
|
|
|
|
fi
|
|
|
|
if package_exists binutils-mips64el-linux-gnuabi64; then
|
|
|
|
dev_list="${dev_list} binutils-mips64el-linux-gnuabi64"
|
|
|
|
fi
|
|
|
|
|
2014-11-27 18:45:31 +03:00
|
|
|
# When cross building for arm/Android on 64-bit systems the host binaries
|
|
|
|
# that are part of v8 need to be compiled with -m32 which means
|
|
|
|
# that basic multilib support is needed.
|
2015-09-17 10:27:12 +03:00
|
|
|
if file -L /sbin/init | grep -q 'ELF 64-bit'; then
|
2014-11-27 18:45:31 +03:00
|
|
|
# gcc-multilib conflicts with the arm cross compiler (at least in trusty) but
|
|
|
|
# g++-X.Y-multilib gives us the 32-bit support that we need. Find out the
|
|
|
|
# appropriate value of X and Y by seeing what version the current
|
|
|
|
# distribution's g++-multilib package depends on.
|
|
|
|
multilib_package=$(apt-cache depends g++-multilib --important | \
|
|
|
|
grep -E --color=never --only-matching '\bg\+\+-[0-9.]+-multilib\b')
|
|
|
|
lib32_list="$lib32_list $multilib_package"
|
|
|
|
fi
|
|
|
|
|
2013-10-25 20:11:46 +04:00
|
|
|
if test "$do_inst_syms" = "" && test 0 -eq ${do_quick_check-0}
|
2010-01-26 21:17:53 +03:00
|
|
|
then
|
|
|
|
echo "This script installs all tools and libraries needed to build Chromium."
|
|
|
|
echo ""
|
|
|
|
echo "For most of the libraries, it can also install debugging symbols, which"
|
|
|
|
echo "will allow you to debug code in the system libraries. Most developers"
|
|
|
|
echo "won't need these symbols."
|
|
|
|
echo -n "Do you want me to install them for you (y/N) "
|
|
|
|
if yes_no 1; then
|
|
|
|
do_inst_syms=1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if test "$do_inst_syms" = "1"; then
|
2013-10-25 20:11:46 +04:00
|
|
|
echo "Including debugging symbols."
|
2009-03-11 00:53:08 +03:00
|
|
|
else
|
2013-10-25 20:11:46 +04:00
|
|
|
echo "Skipping debugging symbols."
|
2009-03-11 00:53:08 +03:00
|
|
|
dbg_list=
|
|
|
|
fi
|
|
|
|
|
2014-11-27 18:45:31 +03:00
|
|
|
if test "$do_inst_lib32" = "1" ; then
|
|
|
|
echo "Including 32-bit libraries for ARM/Android."
|
|
|
|
else
|
|
|
|
echo "Skipping 32-bit libraries for ARM/Android."
|
|
|
|
lib32_list=
|
2012-12-18 03:31:40 +04:00
|
|
|
fi
|
|
|
|
|
2013-10-25 20:11:46 +04:00
|
|
|
if test "$do_inst_arm" = "1" ; then
|
|
|
|
echo "Including ARM cross toolchain."
|
2012-11-15 05:06:26 +04:00
|
|
|
else
|
2013-10-25 20:11:46 +04:00
|
|
|
echo "Skipping ARM cross toolchain."
|
2012-11-15 05:06:26 +04:00
|
|
|
arm_list=
|
|
|
|
fi
|
|
|
|
|
2014-01-17 01:26:47 +04:00
|
|
|
if test "$do_inst_nacl" = "1"; then
|
2014-06-03 03:10:03 +04:00
|
|
|
echo "Including NaCl, NaCl toolchain, NaCl ports dependencies."
|
2014-01-17 01:26:47 +04:00
|
|
|
else
|
2014-06-03 03:10:03 +04:00
|
|
|
echo "Skipping NaCl, NaCl toolchain, NaCl ports dependencies."
|
2014-01-17 01:26:47 +04:00
|
|
|
nacl_list=
|
|
|
|
fi
|
|
|
|
|
2015-01-06 14:25:52 +03:00
|
|
|
# The `sort -r -s -t: -k2` sorts all the :i386 packages to the front, to avoid
|
|
|
|
# confusing dpkg-query (crbug.com/446172).
|
2014-01-17 01:26:47 +04:00
|
|
|
packages="$(
|
2014-11-27 18:45:31 +03:00
|
|
|
echo "${dev_list} ${lib_list} ${dbg_list} ${lib32_list} ${arm_list}"\
|
2015-01-06 14:25:52 +03:00
|
|
|
"${nacl_list}" | tr " " "\n" | sort -u | sort -r -s -t: -k2 | tr "\n" " "
|
2014-01-17 01:26:47 +04:00
|
|
|
)"
|
2013-10-25 20:11:46 +04:00
|
|
|
|
|
|
|
if [ 1 -eq "${do_quick_check-0}" ] ; then
|
2016-11-19 02:16:07 +03:00
|
|
|
if ! missing_packages="$(dpkg-query -W -f ' ' ${packages} 2>&1)"; then
|
|
|
|
# Distinguish between packages that actually aren't available to the
|
|
|
|
# system (i.e. not in any repo) and packages that just aren't known to
|
|
|
|
# dpkg (i.e. managed by apt).
|
|
|
|
missing_packages="$(echo "${missing_packages}" | awk '{print $NF}')"
|
|
|
|
not_installed=""
|
|
|
|
unknown=""
|
|
|
|
for p in ${missing_packages}; do
|
|
|
|
if apt-cache show ${p} > /dev/null 2>&1; then
|
|
|
|
not_installed="${p}\n${not_installed}"
|
|
|
|
else
|
|
|
|
unknown="${p}\n${unknown}"
|
2013-10-25 20:11:46 +04:00
|
|
|
fi
|
2016-11-19 02:16:07 +03:00
|
|
|
done
|
|
|
|
if [ -n "${not_installed}" ]; then
|
2013-10-25 20:11:46 +04:00
|
|
|
echo "WARNING: The following packages are not installed:"
|
2016-11-19 02:16:07 +03:00
|
|
|
echo -e "${not_installed}" | sed -e "s/^/ /"
|
|
|
|
fi
|
|
|
|
if [ -n "${unknown}" ]; then
|
|
|
|
echo "WARNING: The following packages are unknown to your system"
|
|
|
|
echo "(maybe missing a repo or need to 'sudo apt-get update'):"
|
|
|
|
echo -e "${unknown}" | sed -e "s/^/ /"
|
2013-10-25 20:11:46 +04:00
|
|
|
fi
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2014-11-27 18:45:31 +03:00
|
|
|
if test "$do_inst_lib32" = "1" || test "$do_inst_nacl" = "1"; then
|
2017-03-28 22:28:45 +03:00
|
|
|
sudo dpkg --add-architecture i386
|
2014-11-27 18:45:31 +03:00
|
|
|
fi
|
2015-04-01 04:01:28 +03:00
|
|
|
sudo apt-get update
|
2009-03-10 19:43:01 +03:00
|
|
|
|
|
|
|
# We initially run "apt-get" with the --reinstall option and parse its output.
|
|
|
|
# This way, we can find all the packages that need to be newly installed
|
|
|
|
# without accidentally promoting any packages from "auto" to "manual".
|
|
|
|
# We then re-run "apt-get" with just the list of missing packages.
|
|
|
|
echo "Finding missing packages..."
|
2012-03-15 23:05:18 +04:00
|
|
|
# Intentionally leaving $packages unquoted so it's more readable.
|
2009-08-10 22:47:51 +04:00
|
|
|
echo "Packages required: " $packages
|
|
|
|
echo
|
2009-08-07 01:10:58 +04:00
|
|
|
new_list_cmd="sudo apt-get install --reinstall $(echo $packages)"
|
2013-05-10 14:10:03 +04:00
|
|
|
if new_list="$(yes n | LANGUAGE=en LANG=C $new_list_cmd)"; then
|
2009-08-10 22:47:51 +04:00
|
|
|
# We probably never hit this following line.
|
2016-06-14 17:24:01 +03:00
|
|
|
echo "No missing packages, and the packages are up to date."
|
2010-05-03 21:20:45 +04:00
|
|
|
elif [ $? -eq 1 ]; then
|
2009-08-07 01:10:58 +04:00
|
|
|
# We expect apt-get to have exit status of 1.
|
2012-03-15 23:05:18 +04:00
|
|
|
# This indicates that we cancelled the install with "yes n|".
|
2009-08-10 22:47:51 +04:00
|
|
|
new_list=$(echo "$new_list" |
|
2009-08-07 01:10:58 +04:00
|
|
|
sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d')
|
2009-08-10 22:47:51 +04:00
|
|
|
new_list=$(echo "$new_list" | sed 's/ *$//')
|
|
|
|
if [ -z "$new_list" ] ; then
|
2016-06-14 17:24:01 +03:00
|
|
|
echo "No missing packages, and the packages are up to date."
|
2009-08-10 22:47:51 +04:00
|
|
|
else
|
|
|
|
echo "Installing missing packages: $new_list."
|
2012-04-23 08:48:31 +04:00
|
|
|
sudo apt-get install ${do_quietly-} ${new_list}
|
2009-08-10 22:47:51 +04:00
|
|
|
fi
|
|
|
|
echo
|
2009-08-07 01:10:58 +04:00
|
|
|
else
|
|
|
|
# An apt-get exit status of 100 indicates that a real error has occurred.
|
2009-03-10 19:43:01 +03:00
|
|
|
|
2009-08-07 01:10:58 +04:00
|
|
|
# I am intentionally leaving out the '"'s around new_list_cmd,
|
|
|
|
# as this makes it easier to cut and paste the output
|
|
|
|
echo "The following command failed: " ${new_list_cmd}
|
|
|
|
echo
|
|
|
|
echo "It produces the following output:"
|
|
|
|
yes n | $new_list_cmd || true
|
|
|
|
echo
|
|
|
|
echo "You will have to install the above packages yourself."
|
|
|
|
echo
|
|
|
|
exit 100
|
|
|
|
fi
|
2009-03-10 19:43:01 +03:00
|
|
|
|
2013-09-19 04:53:30 +04:00
|
|
|
# Install the Chrome OS default fonts. This must go after running
|
|
|
|
# apt-get, since install-chromeos-fonts depends on curl.
|
|
|
|
if test "$do_inst_chromeos_fonts" != "0"; then
|
|
|
|
echo
|
|
|
|
echo "Installing Chrome OS fonts."
|
|
|
|
dir=`echo $0 | sed -r -e 's/\/[^/]+$//'`
|
|
|
|
if ! sudo $dir/linux/install-chromeos-fonts.py; then
|
|
|
|
echo "ERROR: The installation of the Chrome OS default fonts failed."
|
|
|
|
if [ `stat -f -c %T $dir` == "nfs" ]; then
|
|
|
|
echo "The reason is that your repo is installed on a remote file system."
|
|
|
|
else
|
|
|
|
echo "This is expected if your repo is installed on a remote file system."
|
|
|
|
fi
|
|
|
|
echo "It is recommended to install your repo on a local file system."
|
|
|
|
echo "You can skip the installation of the Chrome OS default founts with"
|
|
|
|
echo "the command line option: --no-chromeos-fonts."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Skipping installation of Chrome OS fonts."
|
|
|
|
fi
|
|
|
|
|
2016-12-08 04:59:19 +03:00
|
|
|
echo "Installing locales."
|
|
|
|
CHROMIUM_LOCALES="da_DK.UTF-8 fr_FR.UTF-8 he_IL.UTF-8 zh_TW.UTF-8"
|
|
|
|
LOCALE_GEN=/etc/locale.gen
|
|
|
|
if [ -e ${LOCALE_GEN} ]; then
|
|
|
|
OLD_LOCALE_GEN="$(cat /etc/locale.gen)"
|
|
|
|
for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do
|
|
|
|
sudo sed -i "s/^# ${CHROMIUM_LOCALE}/${CHROMIUM_LOCALE}/" ${LOCALE_GEN}
|
|
|
|
done
|
|
|
|
# Regenerating locales can take a while, so only do it if we need to.
|
|
|
|
if (echo "${OLD_LOCALE_GEN}" | cmp -s ${LOCALE_GEN}); then
|
|
|
|
echo "Locales already up-to-date."
|
|
|
|
else
|
|
|
|
sudo locale-gen
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do
|
|
|
|
sudo locale-gen ${CHROMIUM_LOCALE}
|
|
|
|
done
|
|
|
|
fi
|