blob: 0f2c3740cff4aa7bcc7cc4e14477fdb5e5f20119 [file] [log] [blame]
[email protected]e041ed12009-03-10 16:43:011#!/bin/bash -e
2
[email protected]aac39c92012-02-08 18:39:533# Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]e46cdae2009-08-25 20:59:274# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
[email protected]cf1df402008-10-31 21:45:307# Script to install everything needed to build chromium (well, ideally, anyway)
mostynbdf175a82016-02-08 23:27:208# See https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_instructions.md
[email protected]cf1df402008-10-31 21:45:309
[email protected]1eae2bfb2010-01-26 18:17:5310usage() {
11 echo "Usage: $0 [--options]"
12 echo "Options:"
13 echo "--[no-]syms: enable or disable installation of debugging symbols"
johnme49bb458a2014-11-27 15:45:3114 echo "--lib32: enable installation of 32-bit libraries, e.g. for V8 snapshot"
[email protected]f2826b6a2012-11-15 01:06:2615 echo "--[no-]arm: enable or disable installation of arm cross toolchain"
[email protected]bd29cdd2013-02-22 03:49:2016 echo "--[no-]chromeos-fonts: enable or disable installation of Chrome OS"\
17 "fonts"
[email protected]565416362014-01-16 21:26:4718 echo "--[no-]nacl: enable or disable installation of prerequisites for"\
19 "building standalone NaCl and all its toolchains"
[email protected]e2544ed42012-04-23 04:48:3120 echo "--no-prompt: silently select standard options/defaults"
[email protected]ba48c4ca2013-10-25 16:11:4621 echo "--quick-check: quickly try to determine if dependencies are installed"
22 echo " (this avoids interactive prompts and sudo commands,"
23 echo " so might not be 100% accurate)"
24 echo "--unsupported: attempt installation even on unsupported systems"
[email protected]1eae2bfb2010-01-26 18:17:5325 echo "Script will prompt interactively if options not given."
26 exit 1
27}
28
thomasanderson4e3d30fe2016-12-07 18:58:3429# Waits for the user to press 'Y' or 'N'. Either uppercase of lowercase is
30# accepted. Returns 0 for 'Y' and 1 for 'N'. If an optional parameter has
31# been provided to yes_no(), the function also accepts RETURN as a user input.
32# The parameter specifies the exit code that should be returned in that case.
33# The function will echo the user's selection followed by a newline character.
34# Users can abort the function by pressing CTRL-C. This will call "exit 1".
35yes_no() {
36 if [ 0 -ne "${do_default-0}" ] ; then
37 [ $1 -eq 0 ] && echo "Y" || echo "N"
38 return $1
39 fi
40 local c
41 while :; do
42 c="$(trap 'stty echo -iuclc icanon 2>/dev/null' EXIT INT TERM QUIT
43 stty -echo iuclc -icanon 2>/dev/null
44 dd count=1 bs=1 2>/dev/null | od -An -tx1)"
45 case "$c" in
46 " 0a") if [ -n "$1" ]; then
47 [ $1 -eq 0 ] && echo "Y" || echo "N"
48 return $1
49 fi
50 ;;
51 " 79") echo "Y"
52 return 0
53 ;;
54 " 6e") echo "N"
55 return 1
56 ;;
57 "") echo "Aborted" >&2
58 exit 1
59 ;;
60 *) # The user pressed an unrecognized key. As we are not echoing
61 # any incorrect user input, alert the user by ringing the bell.
62 (tput bel) 2>/dev/null
63 ;;
64 esac
65 done
66}
67
[email protected]4fc00712013-05-29 23:11:2068# Checks whether a particular package is available in the repos.
69# USAGE: $ package_exists <package name>
70package_exists() {
71 apt-cache pkgnames | grep -x "$1" > /dev/null 2>&1
72}
73
[email protected]fbeddf22014-01-17 23:59:0174# These default to on because (some) bots need them and it keeps things
75# simple for the bot setup if all bots just run the script in its default
76# mode. Developers who don't want stuff they don't need installed on their
77# own workstations can pass --no-arm --no-nacl when running the script.
78do_inst_arm=1
79do_inst_nacl=1
80
[email protected]1eae2bfb2010-01-26 18:17:5381while test "$1" != ""
82do
83 case "$1" in
[email protected]ce774642011-09-12 23:21:3984 --syms) do_inst_syms=1;;
85 --no-syms) do_inst_syms=0;;
[email protected]ce774642011-09-12 23:21:3986 --lib32) do_inst_lib32=1;;
[email protected]f2826b6a2012-11-15 01:06:2687 --arm) do_inst_arm=1;;
88 --no-arm) do_inst_arm=0;;
[email protected]bd29cdd2013-02-22 03:49:2089 --chromeos-fonts) do_inst_chromeos_fonts=1;;
90 --no-chromeos-fonts) do_inst_chromeos_fonts=0;;
[email protected]565416362014-01-16 21:26:4791 --nacl) do_inst_nacl=1;;
92 --no-nacl) do_inst_nacl=0;;
[email protected]e2544ed42012-04-23 04:48:3193 --no-prompt) do_default=1
94 do_quietly="-qq --assume-yes"
95 ;;
[email protected]ba48c4ca2013-10-25 16:11:4696 --quick-check) do_quick_check=1;;
[email protected]fe63a022013-01-15 22:11:4797 --unsupported) do_unsupported=1;;
[email protected]1eae2bfb2010-01-26 18:17:5398 *) usage;;
99 esac
100 shift
101done
102
johnme49bb458a2014-11-27 15:45:31103if test "$do_inst_arm" = "1"; then
104 do_inst_lib32=1
105fi
106
[email protected]0febc9b2014-05-22 20:07:19107# Check for lsb_release command in $PATH
108if ! which lsb_release > /dev/null; then
109 echo "ERROR: lsb_release not found in \$PATH" >&2
110 exit 1;
111fi
[email protected]f2826b6a2012-11-15 01:06:26112
[email protected]0febc9b2014-05-22 20:07:19113lsb_release=$(lsb_release --codename --short)
anthonyvd2ae919e52016-11-21 19:47:12114ubuntu_codenames="(precise|trusty|utopic|vivid|wily|xenial)"
[email protected]ba48c4ca2013-10-25 16:11:46115if [ 0 -eq "${do_unsupported-0}" ] && [ 0 -eq "${do_quick_check-0}" ] ; then
[email protected]0febc9b2014-05-22 20:07:19116 if [[ ! $lsb_release =~ $ubuntu_codenames ]]; then
anthonyvd2ae919e52016-11-21 19:47:12117 echo "ERROR: Only Ubuntu 12.04 (precise), 14.04 (trusty), " \
118 "14.10 (utopic), 15.04 (vivid), 15.10 (wily) and 16.04 (xenial) " \
119 "are currently supported" >&2
120 exit 1
[email protected]fe63a022013-01-15 22:11:47121 fi
[email protected]cf1df402008-10-31 21:45:30122
[email protected]fe63a022013-01-15 22:11:47123 if ! uname -m | egrep -q "i686|x86_64"; then
anthonyvd2ae919e52016-11-21 19:47:12124 echo "Only x86 architectures are currently supported" >&2
[email protected]fe63a022013-01-15 22:11:47125 exit
126 fi
[email protected]e041ed12009-03-10 16:43:01127fi
128
[email protected]ba48c4ca2013-10-25 16:11:46129if [ "x$(id -u)" != x0 ] && [ 0 -eq "${do_quick_check-0}" ]; then
[email protected]e041ed12009-03-10 16:43:01130 echo "Running as non-root user."
131 echo "You might have to enter your password one or more times for 'sudo'."
[email protected]8ada8c52009-03-10 21:53:08132 echo
[email protected]e041ed12009-03-10 16:43:01133fi
134
[email protected]fdc6bf52010-06-07 22:01:57135# Packages needed for chromeos only
dnj6a8491d12015-05-26 21:08:12136chromeos_dev_list="libbluetooth-dev libxkbcommon-dev realpath"
[email protected]fdc6bf52010-06-07 22:01:57137
[email protected]b61f6882013-11-14 20:41:41138# Packages needed for development
halton.huo3e728c42016-01-20 05:12:23139dev_list="bison cdbs curl dpkg-dev elfutils devscripts fakeroot
jackf3d98882016-11-21 19:33:58140 flex fonts-ipafont fonts-thai-tlwg g++ git-core git-svn gperf
141 language-pack-da language-pack-fr language-pack-he
142 language-pack-zh-hant libasound2-dev libbrlapi-dev libav-tools
[email protected]48d96e92014-08-19 18:31:00143 libbz2-dev libcairo2-dev libcap-dev libcups2-dev libcurl4-gnutls-dev
tommyclicd96b6f2016-03-14 23:56:56144 libdrm-dev libelf-dev libffi-dev libgconf2-dev libglib2.0-dev
145 libglu1-mesa-dev libgnome-keyring-dev libgtk2.0-dev libkrb5-dev
146 libnspr4-dev libnss3-dev libpam0g-dev libpci-dev libpulse-dev
147 libsctp-dev libspeechd-dev libsqlite3-dev libssl-dev libudev-dev
148 libwww-perl libxslt1-dev libxss-dev libxt-dev libxtst-dev openbox
krasineef3d4b2016-04-22 00:52:18149 patch perl pkg-config python python-cherrypy3 python-crypto
tommyclicd96b6f2016-03-14 23:56:56150 python-dev python-numpy python-opencv python-openssl python-psutil
j.isorce5ecfacff2016-05-25 16:08:52151 python-yaml rpm ruby subversion ttf-dejavu-core wdiff xcompmgr zip
krasineef3d4b2016-04-22 00:52:18152 $chromeos_dev_list"
[email protected]fdc6bf52010-06-07 22:01:57153
[email protected]f16aabf2012-08-15 21:00:14154# 64-bit systems need a minimum set of 32-bit compat packages for the pre-built
[email protected]f8ceadb2014-08-18 12:30:23155# NaCl binaries.
ki.stfu0a79d6992015-09-17 07:27:12156if file -L /sbin/init | grep -q 'ELF 64-bit'; then
[email protected]d93d68b12012-10-15 06:39:53157 dev_list="${dev_list} libc6-i386 lib32gcc1 lib32stdc++6"
[email protected]f16aabf2012-08-15 21:00:14158fi
159
[email protected]fdc6bf52010-06-07 22:01:57160# Run-time libraries required by chromeos only
[email protected]ba48c4ca2013-10-25 16:11:46161chromeos_lib_list="libpulse0 libbz2-1.0"
[email protected]e041ed12009-03-10 16:43:01162
163# Full list of required run-time libraries
[email protected]d8f52322013-10-29 05:50:38164lib_list="libatk1.0-0 libc6 libasound2 libcairo2 libcap2 libcups2 libexpat1
tommyclicd96b6f2016-03-14 23:56:56165 libffi6 libfontconfig1 libfreetype6 libglib2.0-0 libgnome-keyring0
166 libgtk2.0-0 libpam0g libpango1.0-0 libpci3 libpcre3 libpixman-1-0
thomasanderson41f9e3952016-08-05 00:50:43167 libpng12-0 libspeechd2 libstdc++6 libsqlite3-0 libx11-6 libx11-xcb1
168 libxau6 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxdmcp6
169 libxext6 libxfixes3 libxi6 libxinerama1 libxrandr2 libxrender1
170 libxtst6 zlib1g $chromeos_lib_list"
[email protected]e041ed12009-03-10 16:43:01171
172# Debugging symbols for all of the run-time libraries
revemandd26069a2015-11-09 21:39:21173dbg_list="libatk1.0-dbg libc6-dbg libcairo2-dbg libffi6-dbg libfontconfig1-dbg
[email protected]6ffd19f352012-10-23 02:00:41174 libglib2.0-0-dbg libgtk2.0-0-dbg libpango1.0-0-dbg libpcre3-dbg
thomasanderson41f9e3952016-08-05 00:50:43175 libpixman-1-0-dbg libsqlite3-0-dbg libx11-6-dbg libx11-xcb1-dbg
176 libxau6-dbg libxcb1-dbg libxcomposite1-dbg libxcursor1-dbg
177 libxdamage1-dbg libxdmcp6-dbg libxext6-dbg libxfixes3-dbg libxi6-dbg
178 libxinerama1-dbg libxrandr2-dbg libxrender1-dbg libxtst6-dbg
179 zlib1g-dbg"
lfgad917d12015-03-17 23:28:00180
181# Find the proper version of libstdc++6-4.x-dbg.
182if [ "x$lsb_release" = "xprecise" ]; then
183 dbg_list="${dbg_list} libstdc++6-4.6-dbg"
184elif [ "x$lsb_release" = "xtrusty" ]; then
185 dbg_list="${dbg_list} libstdc++6-4.8-dbg"
186else
187 dbg_list="${dbg_list} libstdc++6-4.9-dbg"
188fi
[email protected]e041ed12009-03-10 16:43:01189
johnme49bb458a2014-11-27 15:45:31190# 32-bit libraries needed e.g. to compile V8 snapshot for Android or armhf
191lib32_list="linux-libc-dev:i386"
192
[email protected]3f85dac32013-10-29 02:38:46193# arm cross toolchain packages needed to build chrome on armhf
thomasanderson4e3d30fe2016-12-07 18:58:34194EM_REPO="deb http://emdebian.org/tools/debian/ jessie main"
195EM_SOURCE=$(cat <<EOF
196# Repo added by Chromium $0
197${EM_REPO}
198# deb-src http://emdebian.org/tools/debian/ jessie main
199EOF
200)
201EM_ARCHIVE_KEY_FINGER="084C6C6F39159EDB67969AA87DE089671804772E"
202GPP_ARM_PACKAGE="g++-arm-linux-gnueabihf"
203case $lsb_release in
204 "jessie")
205 eval $(apt-config shell APT_SOURCESDIR 'Dir::Etc::sourceparts/d')
206 CROSSTOOLS_LIST="${APT_SOURCESDIR}/crosstools.list"
207 arm_list="libc6-dev:armhf
208 linux-libc-dev:armhf"
209 if test "$do_inst_arm" = "1"; then
210 if $(dpkg-query -W ${GPP_ARM_PACKAGE} &>/dev/null); then
211 arm_list+=" ${GPP_ARM_PACKAGE}"
212 else
213 echo "The Debian Cross-toolchains repository is necessary to"
214 echo "cross-compile Chromium for arm."
215 echo -n "Do you want me to add it for you (y/N) "
216 if yes_no 1; then
217 gpg --keyserver pgp.mit.edu --recv-keys ${EM_ARCHIVE_KEY_FINGER}
218 gpg -a --export ${EM_ARCHIVE_KEY_FINGER} | sudo apt-key add -
219 if ! grep "^${EM_REPO}" "${CROSSTOOLS_LIST}" &>/dev/null; then
220 echo "${EM_SOURCE}" | sudo tee -a "${CROSSTOOLS_LIST}" >/dev/null
221 fi
222 arm_list+=" ${GPP_ARM_PACKAGE}"
223 fi
224 fi
225 fi
226 ;;
227 *)
228 arm_list="libc6-dev-armhf-cross
229 linux-libc-dev-armhf-cross
230 ${GPP_ARM_PACKAGE}"
231 ;;
232esac
[email protected]31a605532011-08-23 22:27:35233
sbcb5d4ded2015-04-01 17:49:03234# Work around for dependency issue Ubuntu/Trusty: http://crbug.com/435056
friedmanbf8b90a2016-04-21 01:15:48235case $lsb_release in
236 trusty)
237 arm_list+=" g++-4.8-multilib-arm-linux-gnueabihf
238 gcc-4.8-multilib-arm-linux-gnueabihf"
239 ;;
240 wily)
241 arm_list+=" g++-5-multilib-arm-linux-gnueabihf
242 gcc-5-multilib-arm-linux-gnueabihf
243 gcc-arm-linux-gnueabihf"
244 ;;
krasineef3d4b2016-04-22 00:52:18245 xenial)
246 arm_list+=" g++-5-multilib-arm-linux-gnueabihf
247 gcc-5-multilib-arm-linux-gnueabihf
248 gcc-arm-linux-gnueabihf"
249 ;;
friedmanbf8b90a2016-04-21 01:15:48250esac
sbcb5d4ded2015-04-01 17:49:03251
[email protected]713eac62014-06-02 23:10:03252# Packages to build NaCl, its toolchains, and its ports.
Brad Nelson5e59c2c2014-09-06 06:18:45253naclports_list="ant autoconf bison cmake gawk intltool xutils-dev xsltproc"
254nacl_list="g++-mingw-w64-i686 lib32z1-dev
tommyclicd96b6f2016-03-14 23:56:56255 libasound2:i386 libcap2:i386 libelf-dev:i386 libfontconfig1:i386
256 libgconf-2-4:i386 libglib2.0-0:i386 libgpm2:i386 libgtk2.0-0:i386
257 libncurses5:i386 lib32ncurses5-dev libnss3:i386 libpango1.0-0:i386
sbc6ab44c32015-02-13 23:19:17258 libssl1.0.0:i386 libtinfo-dev libtinfo-dev:i386 libtool
[email protected]419a9a62014-06-19 18:26:18259 libxcomposite1:i386 libxcursor1:i386 libxdamage1:i386 libxi6:i386
Brad Nelson5e59c2c2014-09-06 06:18:45260 libxrandr2:i386 libxss1:i386 libxtst6:i386 texinfo xvfb
261 ${naclports_list}"
[email protected]419a9a62014-06-19 18:26:18262
torne8a6eb692015-11-05 12:43:08263# Find the proper version of packages that depend on mesa. Only one -lts variant
264# of mesa can be installed and everything that depends on it must match.
265
266# Query for the name and status of all mesa LTS variants, filter for only
267# installed packages, extract just the name, and eliminate duplicates (there can
268# be more than one with the same name in the case of multiarch). Expand into an
269# array.
270mesa_packages=($(dpkg-query -Wf'${package} ${status}\n' \
torne12cd9f6c2016-02-24 18:52:23271 libgl1-mesa-glx-lts-\* 2>/dev/null | \
torne8a6eb692015-11-05 12:43:08272 grep " ok installed" | cut -d " " -f 1 | sort -u))
273if [ "${#mesa_packages[@]}" -eq 0 ]; then
274 mesa_variant=""
275elif [ "${#mesa_packages[@]}" -eq 1 ]; then
276 # Strip the base package name and leave just "-lts-whatever"
277 mesa_variant="${mesa_packages[0]#libgl1-mesa-glx}"
278else
279 echo "ERROR: unable to determine which libgl1-mesa-glx variant is installed."
280 exit 1
281fi
[email protected]3a4bd5d2014-06-25 23:55:04282dev_list="${dev_list} libgbm-dev${mesa_variant}
vabrf1e8b17f2015-03-17 10:56:37283 libgles2-mesa-dev${mesa_variant} libgl1-mesa-dev${mesa_variant}
284 mesa-common-dev${mesa_variant}"
[email protected]419a9a62014-06-19 18:26:18285nacl_list="${nacl_list} libgl1-mesa-glx${mesa_variant}:i386"
[email protected]565416362014-01-16 21:26:47286
[email protected]757c2962012-03-15 19:05:18287# Some package names have changed over time
[email protected]4fc00712013-05-29 23:11:20288if package_exists ttf-mscorefonts-installer; then
[email protected]757c2962012-03-15 19:05:18289 dev_list="${dev_list} ttf-mscorefonts-installer"
[email protected]b11411c2012-03-21 22:09:41290else
291 dev_list="${dev_list} msttcorefonts"
[email protected]757c2962012-03-15 19:05:18292fi
[email protected]4fc00712013-05-29 23:11:20293if package_exists libnspr4-dbg; then
[email protected]1a0f64a2011-05-20 17:53:55294 dbg_list="${dbg_list} libnspr4-dbg libnss3-dbg"
295 lib_list="${lib_list} libnspr4 libnss3"
[email protected]757c2962012-03-15 19:05:18296else
297 dbg_list="${dbg_list} libnspr4-0d-dbg libnss3-1d-dbg"
298 lib_list="${lib_list} libnspr4-0d libnss3-1d"
299fi
[email protected]4fc00712013-05-29 23:11:20300if package_exists libjpeg-dev; then
[email protected]9e895962013-05-21 08:26:42301 dev_list="${dev_list} libjpeg-dev"
[email protected]b11411c2012-03-21 22:09:41302else
[email protected]9e895962013-05-21 08:26:42303 dev_list="${dev_list} libjpeg62-dev"
[email protected]b11411c2012-03-21 22:09:41304fi
[email protected]4fc00712013-05-29 23:11:20305if package_exists libudev1; then
[email protected]9e895962013-05-21 08:26:42306 dev_list="${dev_list} libudev1"
[email protected]ab9e69082014-06-05 15:28:52307 nacl_list="${nacl_list} libudev1:i386"
[email protected]9e895962013-05-21 08:26:42308else
309 dev_list="${dev_list} libudev0"
[email protected]ab9e69082014-06-05 15:28:52310 nacl_list="${nacl_list} libudev0:i386"
[email protected]9e895962013-05-21 08:26:42311fi
[email protected]3ea42912013-09-06 06:23:57312if package_exists libbrlapi0.6; then
313 dev_list="${dev_list} libbrlapi0.6"
314else
315 dev_list="${dev_list} libbrlapi0.5"
316fi
halton.huo3e728c42016-01-20 05:12:23317if package_exists apache2-bin; then
318 dev_list="${dev_list} apache2-bin"
319else
320 dev_list="${dev_list} apache2.2-bin"
321fi
vadimsh278ff0662016-05-19 00:06:28322if package_exists xfonts-mathml; then
halton.huo3e728c42016-01-20 05:12:23323 dev_list="${dev_list} xfonts-mathml"
324fi
krasineef3d4b2016-04-22 00:52:18325if package_exists fonts-indic; then
vadimsh278ff0662016-05-19 00:06:28326 dev_list="${dev_list} fonts-indic"
krasineef3d4b2016-04-22 00:52:18327else
vadimsh278ff0662016-05-19 00:06:28328 dev_list="${dev_list} ttf-indic-fonts"
krasineef3d4b2016-04-22 00:52:18329fi
330if package_exists php7.0-cgi; then
vadimsh278ff0662016-05-19 00:06:28331 dev_list="${dev_list} php7.0-cgi libapache2-mod-php7.0"
krasineef3d4b2016-04-22 00:52:18332else
vadimsh278ff0662016-05-19 00:06:28333 dev_list="${dev_list} php5-cgi libapache2-mod-php5"
krasineef3d4b2016-04-22 00:52:18334fi
horo233d31c2016-11-16 03:43:00335# Ubuntu 16.04 has this package deleted.
336if package_exists ttf-kochi-gothic; then
337 dev_list="${dev_list} ttf-kochi-gothic"
338fi
339# Ubuntu 16.04 has this package deleted.
340if package_exists ttf-kochi-mincho; then
341 dev_list="${dev_list} ttf-kochi-mincho"
342fi
[email protected]757c2962012-03-15 19:05:18343
[email protected]dc099772013-09-30 22:06:58344# Some packages are only needed if the distribution actually supports
[email protected]757c2962012-03-15 19:05:18345# installing them.
[email protected]4fc00712013-05-29 23:11:20346if package_exists appmenu-gtk; then
[email protected]757c2962012-03-15 19:05:18347 lib_list="$lib_list appmenu-gtk"
[email protected]4da8fad2011-04-11 18:42:42348fi
349
johnme49bb458a2014-11-27 15:45:31350# When cross building for arm/Android on 64-bit systems the host binaries
351# that are part of v8 need to be compiled with -m32 which means
352# that basic multilib support is needed.
ki.stfu0a79d6992015-09-17 07:27:12353if file -L /sbin/init | grep -q 'ELF 64-bit'; then
johnme49bb458a2014-11-27 15:45:31354 # gcc-multilib conflicts with the arm cross compiler (at least in trusty) but
355 # g++-X.Y-multilib gives us the 32-bit support that we need. Find out the
356 # appropriate value of X and Y by seeing what version the current
357 # distribution's g++-multilib package depends on.
358 multilib_package=$(apt-cache depends g++-multilib --important | \
359 grep -E --color=never --only-matching '\bg\+\+-[0-9.]+-multilib\b')
360 lib32_list="$lib32_list $multilib_package"
361fi
362
[email protected]ba48c4ca2013-10-25 16:11:46363if test "$do_inst_syms" = "" && test 0 -eq ${do_quick_check-0}
[email protected]1eae2bfb2010-01-26 18:17:53364then
365 echo "This script installs all tools and libraries needed to build Chromium."
366 echo ""
367 echo "For most of the libraries, it can also install debugging symbols, which"
368 echo "will allow you to debug code in the system libraries. Most developers"
369 echo "won't need these symbols."
370 echo -n "Do you want me to install them for you (y/N) "
371 if yes_no 1; then
372 do_inst_syms=1
373 fi
374fi
375if test "$do_inst_syms" = "1"; then
[email protected]ba48c4ca2013-10-25 16:11:46376 echo "Including debugging symbols."
[email protected]8ada8c52009-03-10 21:53:08377else
[email protected]ba48c4ca2013-10-25 16:11:46378 echo "Skipping debugging symbols."
[email protected]8ada8c52009-03-10 21:53:08379 dbg_list=
380fi
381
johnme49bb458a2014-11-27 15:45:31382if test "$do_inst_lib32" = "1" ; then
383 echo "Including 32-bit libraries for ARM/Android."
384else
385 echo "Skipping 32-bit libraries for ARM/Android."
386 lib32_list=
[email protected]9f28a9cf2012-12-17 23:31:40387fi
388
[email protected]ba48c4ca2013-10-25 16:11:46389if test "$do_inst_arm" = "1" ; then
[email protected]ba48c4ca2013-10-25 16:11:46390 echo "Including ARM cross toolchain."
[email protected]f2826b6a2012-11-15 01:06:26391else
[email protected]ba48c4ca2013-10-25 16:11:46392 echo "Skipping ARM cross toolchain."
[email protected]f2826b6a2012-11-15 01:06:26393 arm_list=
394fi
395
[email protected]565416362014-01-16 21:26:47396if test "$do_inst_nacl" = "1"; then
[email protected]713eac62014-06-02 23:10:03397 echo "Including NaCl, NaCl toolchain, NaCl ports dependencies."
[email protected]565416362014-01-16 21:26:47398else
[email protected]713eac62014-06-02 23:10:03399 echo "Skipping NaCl, NaCl toolchain, NaCl ports dependencies."
[email protected]565416362014-01-16 21:26:47400 nacl_list=
401fi
402
johnme4bd10302015-01-06 11:25:52403# The `sort -r -s -t: -k2` sorts all the :i386 packages to the front, to avoid
404# confusing dpkg-query (crbug.com/446172).
[email protected]565416362014-01-16 21:26:47405packages="$(
johnme49bb458a2014-11-27 15:45:31406 echo "${dev_list} ${lib_list} ${dbg_list} ${lib32_list} ${arm_list}"\
johnme4bd10302015-01-06 11:25:52407 "${nacl_list}" | tr " " "\n" | sort -u | sort -r -s -t: -k2 | tr "\n" " "
[email protected]565416362014-01-16 21:26:47408)"
[email protected]ba48c4ca2013-10-25 16:11:46409
410if [ 1 -eq "${do_quick_check-0}" ] ; then
thomasanderson73b3a4412016-11-18 23:16:07411 if ! missing_packages="$(dpkg-query -W -f ' ' ${packages} 2>&1)"; then
412 # Distinguish between packages that actually aren't available to the
413 # system (i.e. not in any repo) and packages that just aren't known to
414 # dpkg (i.e. managed by apt).
415 missing_packages="$(echo "${missing_packages}" | awk '{print $NF}')"
416 not_installed=""
417 unknown=""
418 for p in ${missing_packages}; do
419 if apt-cache show ${p} > /dev/null 2>&1; then
420 not_installed="${p}\n${not_installed}"
421 else
422 unknown="${p}\n${unknown}"
[email protected]ba48c4ca2013-10-25 16:11:46423 fi
thomasanderson73b3a4412016-11-18 23:16:07424 done
425 if [ -n "${not_installed}" ]; then
[email protected]ba48c4ca2013-10-25 16:11:46426 echo "WARNING: The following packages are not installed:"
thomasanderson73b3a4412016-11-18 23:16:07427 echo -e "${not_installed}" | sed -e "s/^/ /"
428 fi
429 if [ -n "${unknown}" ]; then
430 echo "WARNING: The following packages are unknown to your system"
431 echo "(maybe missing a repo or need to 'sudo apt-get update'):"
432 echo -e "${unknown}" | sed -e "s/^/ /"
[email protected]ba48c4ca2013-10-25 16:11:46433 fi
434 exit 1
435 fi
436 exit 0
437fi
438
johnme49bb458a2014-11-27 15:45:31439if test "$do_inst_lib32" = "1" || test "$do_inst_nacl" = "1"; then
thestig83d03502015-03-20 08:06:12440 if [[ ! $lsb_release =~ (precise) ]]; then
johnme49bb458a2014-11-27 15:45:31441 sudo dpkg --add-architecture i386
442 fi
thomasanderson4e3d30fe2016-12-07 18:58:34443 if [[ $lsb_release = "jessie" ]]; then
444 sudo dpkg --add-architecture armhf
445 fi
johnme49bb458a2014-11-27 15:45:31446fi
sbc42564092015-04-01 01:01:28447sudo apt-get update
[email protected]e041ed12009-03-10 16:43:01448
449# We initially run "apt-get" with the --reinstall option and parse its output.
450# This way, we can find all the packages that need to be newly installed
451# without accidentally promoting any packages from "auto" to "manual".
452# We then re-run "apt-get" with just the list of missing packages.
453echo "Finding missing packages..."
[email protected]757c2962012-03-15 19:05:18454# Intentionally leaving $packages unquoted so it's more readable.
[email protected]b6e064522009-08-10 18:47:51455echo "Packages required: " $packages
456echo
[email protected]79a9d2962009-08-06 21:10:58457new_list_cmd="sudo apt-get install --reinstall $(echo $packages)"
[email protected]c3d8b152013-05-10 10:10:03458if new_list="$(yes n | LANGUAGE=en LANG=C $new_list_cmd)"; then
[email protected]b6e064522009-08-10 18:47:51459 # We probably never hit this following line.
thakis3e861de2016-06-14 14:24:01460 echo "No missing packages, and the packages are up to date."
[email protected]b62f11e72010-05-03 17:20:45461elif [ $? -eq 1 ]; then
[email protected]79a9d2962009-08-06 21:10:58462 # We expect apt-get to have exit status of 1.
[email protected]757c2962012-03-15 19:05:18463 # This indicates that we cancelled the install with "yes n|".
[email protected]b6e064522009-08-10 18:47:51464 new_list=$(echo "$new_list" |
[email protected]79a9d2962009-08-06 21:10:58465 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d')
[email protected]b6e064522009-08-10 18:47:51466 new_list=$(echo "$new_list" | sed 's/ *$//')
467 if [ -z "$new_list" ] ; then
thakis3e861de2016-06-14 14:24:01468 echo "No missing packages, and the packages are up to date."
[email protected]b6e064522009-08-10 18:47:51469 else
470 echo "Installing missing packages: $new_list."
[email protected]e2544ed42012-04-23 04:48:31471 sudo apt-get install ${do_quietly-} ${new_list}
[email protected]b6e064522009-08-10 18:47:51472 fi
473 echo
[email protected]79a9d2962009-08-06 21:10:58474else
475 # An apt-get exit status of 100 indicates that a real error has occurred.
[email protected]e041ed12009-03-10 16:43:01476
[email protected]79a9d2962009-08-06 21:10:58477 # I am intentionally leaving out the '"'s around new_list_cmd,
478 # as this makes it easier to cut and paste the output
[email protected]79a9d2962009-08-06 21:10:58479 echo "The following command failed: " ${new_list_cmd}
480 echo
481 echo "It produces the following output:"
482 yes n | $new_list_cmd || true
483 echo
484 echo "You will have to install the above packages yourself."
485 echo
486 exit 100
487fi
[email protected]e041ed12009-03-10 16:43:01488
[email protected]d96cc3472013-09-19 00:53:30489# Install the Chrome OS default fonts. This must go after running
490# apt-get, since install-chromeos-fonts depends on curl.
491if test "$do_inst_chromeos_fonts" != "0"; then
492 echo
493 echo "Installing Chrome OS fonts."
494 dir=`echo $0 | sed -r -e 's/\/[^/]+$//'`
495 if ! sudo $dir/linux/install-chromeos-fonts.py; then
496 echo "ERROR: The installation of the Chrome OS default fonts failed."
497 if [ `stat -f -c %T $dir` == "nfs" ]; then
498 echo "The reason is that your repo is installed on a remote file system."
499 else
500 echo "This is expected if your repo is installed on a remote file system."
501 fi
502 echo "It is recommended to install your repo on a local file system."
503 echo "You can skip the installation of the Chrome OS default founts with"
504 echo "the command line option: --no-chromeos-fonts."
505 exit 1
506 fi
507else
508 echo "Skipping installation of Chrome OS fonts."
509fi
510
sbc6ab44c32015-02-13 23:19:17511# $1 - target name
512# $2 - link name
513create_library_symlink() {
514 target=$1
515 linkname=$2
516 if [ -L $linkname ]; then
517 if [ "$(basename $(readlink $linkname))" != "$(basename $target)" ]; then
518 sudo rm $linkname
519 fi
520 fi
521 if [ ! -r $linkname ]; then
522 echo "Creating link: $linkname"
523 sudo ln -fs $target $linkname
524 fi
525}
526
[email protected]713eac62014-06-02 23:10:03527if test "$do_inst_nacl" = "1"; then
528 echo "Installing symbolic links for NaCl."
sbc6ab44c32015-02-13 23:19:17529 # naclports needs to cross build python for i386, but libssl1.0.0:i386
530 # only contains libcrypto.so.1.0.0 and not the symlink needed for
531 # linking (libcrypto.so).
532 create_library_symlink /lib/i386-linux-gnu/libcrypto.so.1.0.0 \
533 /usr/lib/i386-linux-gnu/libcrypto.so
534
535 create_library_symlink /lib/i386-linux-gnu/libssl.so.1.0.0 \
536 /usr/lib/i386-linux-gnu/libssl.so
[email protected]713eac62014-06-02 23:10:03537else
538 echo "Skipping symbolic links for NaCl."
539fi