blob: 340436bc4f4fddad174b97a16e93f46236c2accb [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
[email protected]4fc00712013-05-29 23:11:2029# Checks whether a particular package is available in the repos.
30# USAGE: $ package_exists <package name>
31package_exists() {
Tom Anderson17d6cdd2017-11-28 04:13:2532 # 'apt-cache search' takes a regex string, so eg. the +'s in packages like
33 # "libstdc++" need to be escaped.
34 local escaped="$(echo $1 | sed 's/[\~\+\.\:-]/\\&/g')"
35 [ ! -z "$(apt-cache search --names-only "${escaped}" | \
Tom Anderson9c70eb72017-11-27 21:47:3836 awk '$1 == "'$1'" { print $1; }')" ]
[email protected]4fc00712013-05-29 23:11:2037}
38
[email protected]fbeddf22014-01-17 23:59:0139# These default to on because (some) bots need them and it keeps things
40# simple for the bot setup if all bots just run the script in its default
41# mode. Developers who don't want stuff they don't need installed on their
42# own workstations can pass --no-arm --no-nacl when running the script.
43do_inst_arm=1
44do_inst_nacl=1
45
Tom Anderson8e0a484e2018-06-14 22:47:0246while [ "$1" != "" ]
[email protected]1eae2bfb2010-01-26 18:17:5347do
48 case "$1" in
[email protected]ce774642011-09-12 23:21:3949 --syms) do_inst_syms=1;;
50 --no-syms) do_inst_syms=0;;
[email protected]ce774642011-09-12 23:21:3951 --lib32) do_inst_lib32=1;;
[email protected]f2826b6a2012-11-15 01:06:2652 --arm) do_inst_arm=1;;
53 --no-arm) do_inst_arm=0;;
[email protected]bd29cdd2013-02-22 03:49:2054 --chromeos-fonts) do_inst_chromeos_fonts=1;;
55 --no-chromeos-fonts) do_inst_chromeos_fonts=0;;
[email protected]565416362014-01-16 21:26:4756 --nacl) do_inst_nacl=1;;
57 --no-nacl) do_inst_nacl=0;;
Tom Anderson8e0a484e2018-06-14 22:47:0258 --add-cross-tool-repo) add_cross_tool_repo=1;;
[email protected]e2544ed42012-04-23 04:48:3159 --no-prompt) do_default=1
60 do_quietly="-qq --assume-yes"
61 ;;
[email protected]ba48c4ca2013-10-25 16:11:4662 --quick-check) do_quick_check=1;;
[email protected]fe63a022013-01-15 22:11:4763 --unsupported) do_unsupported=1;;
[email protected]1eae2bfb2010-01-26 18:17:5364 *) usage;;
65 esac
66 shift
67done
68
Tom Anderson8e0a484e2018-06-14 22:47:0269if [ "$do_inst_arm" = "1" ]; then
johnme49bb458a2014-11-27 15:45:3170 do_inst_lib32=1
71fi
72
[email protected]0febc9b2014-05-22 20:07:1973# Check for lsb_release command in $PATH
74if ! which lsb_release > /dev/null; then
75 echo "ERROR: lsb_release not found in \$PATH" >&2
76 exit 1;
77fi
[email protected]f2826b6a2012-11-15 01:06:2678
thomasandersondfefc6c02017-05-04 01:29:1179distro_codename=$(lsb_release --codename --short)
80distro_id=$(lsb_release --id --short)
Marcin Wiacekd7577c32018-04-30 19:12:5181supported_codenames="(trusty|xenial|artful|bionic)"
thomasandersondfefc6c02017-05-04 01:29:1182supported_ids="(Debian)"
[email protected]ba48c4ca2013-10-25 16:11:4683if [ 0 -eq "${do_unsupported-0}" ] && [ 0 -eq "${do_quick_check-0}" ] ; then
thomasandersondfefc6c02017-05-04 01:29:1184 if [[ ! $distro_codename =~ $supported_codenames &&
85 ! $distro_id =~ $supported_ids ]]; then
thomasanderson05c40292017-03-28 19:28:4586 echo -e "ERROR: The only supported distros are\n" \
Marcin Wiacekd7577c32018-04-30 19:12:5187 "\tUbuntu 14.04 LTS (trusty)\n" \
88 "\tUbuntu 16.04 LTS (xenial)\n" \
marcin38933dd2017-10-30 00:05:5289 "\tUbuntu 17.10 (artful)\n" \
Marcin Wiacekd7577c32018-04-30 19:12:5190 "\tUbuntu 18.04 LTS (bionic)\n" \
thomasandersondfefc6c02017-05-04 01:29:1191 "\tDebian 8 (jessie) or later" >&2
anthonyvd2ae919e52016-11-21 19:47:1292 exit 1
[email protected]fe63a022013-01-15 22:11:4793 fi
[email protected]cf1df402008-10-31 21:45:3094
[email protected]fe63a022013-01-15 22:11:4795 if ! uname -m | egrep -q "i686|x86_64"; then
anthonyvd2ae919e52016-11-21 19:47:1296 echo "Only x86 architectures are currently supported" >&2
[email protected]fe63a022013-01-15 22:11:4797 exit
98 fi
[email protected]e041ed12009-03-10 16:43:0199fi
100
[email protected]ba48c4ca2013-10-25 16:11:46101if [ "x$(id -u)" != x0 ] && [ 0 -eq "${do_quick_check-0}" ]; then
[email protected]e041ed12009-03-10 16:43:01102 echo "Running as non-root user."
103 echo "You might have to enter your password one or more times for 'sudo'."
[email protected]8ada8c52009-03-10 21:53:08104 echo
[email protected]e041ed12009-03-10 16:43:01105fi
106
[email protected]fdc6bf52010-06-07 22:01:57107# Packages needed for chromeos only
Tom Anderson6b2b2ad52018-02-22 23:28:14108chromeos_dev_list="libbluetooth-dev libxkbcommon-dev"
109
110if package_exists realpath; then
111 chromeos_dev_list="${chromeos_dev_list} realpath"
112fi
[email protected]fdc6bf52010-06-07 22:01:57113
[email protected]b61f6882013-11-14 20:41:41114# Packages needed for development
thomasanderson20032a5c2017-03-02 00:28:20115dev_list="\
116 bison
George Burgess IV3d20a812018-05-10 22:24:17117 bzip2
thomasanderson20032a5c2017-03-02 00:28:20118 cdbs
119 curl
Tom Anderson8bfb0b02018-02-17 00:44:15120 dbus-x11
thomasanderson20032a5c2017-03-02 00:28:20121 dpkg-dev
122 elfutils
123 devscripts
124 fakeroot
125 flex
thomasanderson20032a5c2017-03-02 00:28:20126 g++
127 git-core
128 git-svn
129 gperf
Tim Brown06ee43a2018-02-08 18:42:12130 libappindicator-dev
131 libappindicator3-dev
thomasanderson20032a5c2017-03-02 00:28:20132 libasound2-dev
133 libbrlapi-dev
thomasanderson20032a5c2017-03-02 00:28:20134 libbz2-dev
135 libcairo2-dev
136 libcap-dev
137 libcups2-dev
138 libcurl4-gnutls-dev
139 libdrm-dev
140 libelf-dev
141 libffi-dev
Tom Andersond4ea2522018-03-01 20:34:38142 libgbm-dev
thomasanderson20032a5c2017-03-02 00:28:20143 libglib2.0-dev
144 libglu1-mesa-dev
145 libgnome-keyring-dev
146 libgtk2.0-dev
147 libgtk-3-dev
148 libkrb5-dev
149 libnspr4-dev
150 libnss3-dev
151 libpam0g-dev
152 libpci-dev
153 libpulse-dev
154 libsctp-dev
155 libspeechd-dev
156 libsqlite3-dev
157 libssl-dev
158 libudev-dev
159 libwww-perl
160 libxslt1-dev
161 libxss-dev
162 libxt-dev
163 libxtst-dev
Andrew Grievee41aeae2017-08-21 20:53:21164 locales
thomasanderson20032a5c2017-03-02 00:28:20165 openbox
Nico Webera9fa6a72018-02-23 18:26:02166 p7zip
thomasanderson20032a5c2017-03-02 00:28:20167 patch
168 perl
169 pkg-config
170 python
171 python-cherrypy3
172 python-crypto
173 python-dev
174 python-numpy
175 python-opencv
176 python-openssl
177 python-psutil
178 python-yaml
179 rpm
180 ruby
181 subversion
thomasanderson20032a5c2017-03-02 00:28:20182 wdiff
Tom Andersond79de41d2017-08-08 00:23:23183 x11-utils
thomasanderson20032a5c2017-03-02 00:28:20184 xcompmgr
George Burgess IV3d20a812018-05-10 22:24:17185 xz-utils
thomasanderson20032a5c2017-03-02 00:28:20186 zip
187 $chromeos_dev_list
188"
[email protected]fdc6bf52010-06-07 22:01:57189
[email protected]f16aabf2012-08-15 21:00:14190# 64-bit systems need a minimum set of 32-bit compat packages for the pre-built
[email protected]f8ceadb2014-08-18 12:30:23191# NaCl binaries.
ki.stfu0a79d6992015-09-17 07:27:12192if file -L /sbin/init | grep -q 'ELF 64-bit'; then
[email protected]d93d68b12012-10-15 06:39:53193 dev_list="${dev_list} libc6-i386 lib32gcc1 lib32stdc++6"
[email protected]f16aabf2012-08-15 21:00:14194fi
195
[email protected]fdc6bf52010-06-07 22:01:57196# Run-time libraries required by chromeos only
[email protected]ba48c4ca2013-10-25 16:11:46197chromeos_lib_list="libpulse0 libbz2-1.0"
[email protected]e041ed12009-03-10 16:43:01198
Yves Gereye1fe0df2018-06-08 08:01:47199# List of required run-time libraries
200common_lib_list="\
Tim Brown06ee43a2018-02-08 18:42:12201 libappindicator1
202 libappindicator3-1
203 libasound2
thomasanderson20032a5c2017-03-02 00:28:20204 libatk1.0-0
205 libc6
thomasanderson20032a5c2017-03-02 00:28:20206 libcairo2
207 libcap2
208 libcups2
209 libexpat1
210 libffi6
211 libfontconfig1
212 libfreetype6
213 libglib2.0-0
214 libgnome-keyring0
215 libgtk2.0-0
216 libgtk-3-0
217 libpam0g
218 libpango1.0-0
219 libpci3
220 libpcre3
221 libpixman-1-0
222 libspeechd2
223 libstdc++6
224 libsqlite3-0
Tom Andersonf8a0c662018-06-14 23:54:14225 libuuid1
Scott Violetdd7e2372018-04-12 01:11:26226 libwayland-egl1-mesa
thomasanderson20032a5c2017-03-02 00:28:20227 libx11-6
228 libx11-xcb1
229 libxau6
230 libxcb1
231 libxcomposite1
232 libxcursor1
233 libxdamage1
234 libxdmcp6
235 libxext6
236 libxfixes3
237 libxi6
238 libxinerama1
239 libxrandr2
240 libxrender1
241 libxtst6
242 zlib1g
Yves Gereye1fe0df2018-06-08 08:01:47243"
244
245# Full list of required run-time libraries
246lib_list="\
247 $common_lib_list
thomasanderson20032a5c2017-03-02 00:28:20248 $chromeos_lib_list
249"
[email protected]e041ed12009-03-10 16:43:01250
johnme49bb458a2014-11-27 15:45:31251# 32-bit libraries needed e.g. to compile V8 snapshot for Android or armhf
Tanin Na Nakorn6cbe32e52017-05-30 19:37:04252lib32_list="linux-libc-dev:i386 libpci3:i386"
johnme49bb458a2014-11-27 15:45:31253
Tom Andersondd47ad32018-03-21 19:30:19254# 32-bit libraries needed for a 32-bit build
255lib32_list="$lib32_list libx11-xcb1:i386"
256
[email protected]3f85dac32013-10-29 02:38:46257# arm cross toolchain packages needed to build chrome on armhf
thomasanderson4e3d30fe2016-12-07 18:58:34258EM_REPO="deb http://emdebian.org/tools/debian/ jessie main"
259EM_SOURCE=$(cat <<EOF
260# Repo added by Chromium $0
261${EM_REPO}
262# deb-src http://emdebian.org/tools/debian/ jessie main
263EOF
264)
265EM_ARCHIVE_KEY_FINGER="084C6C6F39159EDB67969AA87DE089671804772E"
266GPP_ARM_PACKAGE="g++-arm-linux-gnueabihf"
thomasandersondfefc6c02017-05-04 01:29:11267case $distro_codename in
kjellander95504ae2017-03-30 12:30:31268 jessie)
thomasanderson4e3d30fe2016-12-07 18:58:34269 eval $(apt-config shell APT_SOURCESDIR 'Dir::Etc::sourceparts/d')
270 CROSSTOOLS_LIST="${APT_SOURCESDIR}/crosstools.list"
271 arm_list="libc6-dev:armhf
272 linux-libc-dev:armhf"
Tom Anderson8e0a484e2018-06-14 22:47:02273 if [ "$do_inst_arm" = "1" ]; then
thomasanderson4e3d30fe2016-12-07 18:58:34274 if $(dpkg-query -W ${GPP_ARM_PACKAGE} &>/dev/null); then
275 arm_list+=" ${GPP_ARM_PACKAGE}"
276 else
Tom Anderson8e0a484e2018-06-14 22:47:02277 if [ "${add_cross_tool_repo}" = "1" ]; then
thomasanderson4e3d30fe2016-12-07 18:58:34278 gpg --keyserver pgp.mit.edu --recv-keys ${EM_ARCHIVE_KEY_FINGER}
279 gpg -a --export ${EM_ARCHIVE_KEY_FINGER} | sudo apt-key add -
280 if ! grep "^${EM_REPO}" "${CROSSTOOLS_LIST}" &>/dev/null; then
281 echo "${EM_SOURCE}" | sudo tee -a "${CROSSTOOLS_LIST}" >/dev/null
282 fi
283 arm_list+=" ${GPP_ARM_PACKAGE}"
Tom Anderson8e0a484e2018-06-14 22:47:02284 else
285 echo "The Debian Cross-toolchains repository is necessary to"
286 echo "cross-compile Chromium for arm."
287 echo "Rerun with --add-deb-cross-tool-repo to have it added for you."
thomasanderson4e3d30fe2016-12-07 18:58:34288 fi
289 fi
290 fi
291 ;;
thomasandersondfefc6c02017-05-04 01:29:11292 # All necessary ARM packages are available on the default repos on
293 # Debian 9 and later.
kjellander95504ae2017-03-30 12:30:31294 *)
Tom Anderson81e7f1792017-11-11 03:56:33295 arm_list="libc6-dev-armhf-cross
thomasanderson4e3d30fe2016-12-07 18:58:34296 linux-libc-dev-armhf-cross
297 ${GPP_ARM_PACKAGE}"
298 ;;
299esac
[email protected]31a605532011-08-23 22:27:35300
sbcb5d4ded2015-04-01 17:49:03301# Work around for dependency issue Ubuntu/Trusty: http://crbug.com/435056
thomasandersondfefc6c02017-05-04 01:29:11302case $distro_codename in
friedmanbf8b90a2016-04-21 01:15:48303 trusty)
304 arm_list+=" g++-4.8-multilib-arm-linux-gnueabihf
305 gcc-4.8-multilib-arm-linux-gnueabihf"
306 ;;
Marcin Wiacekd7577c32018-04-30 19:12:51307 xenial|artful|bionic)
krasineef3d4b2016-04-22 00:52:18308 arm_list+=" g++-5-multilib-arm-linux-gnueabihf
309 gcc-5-multilib-arm-linux-gnueabihf
310 gcc-arm-linux-gnueabihf"
311 ;;
friedmanbf8b90a2016-04-21 01:15:48312esac
sbcb5d4ded2015-04-01 17:49:03313
[email protected]713eac62014-06-02 23:10:03314# Packages to build NaCl, its toolchains, and its ports.
Brad Nelson5e59c2c2014-09-06 06:18:45315naclports_list="ant autoconf bison cmake gawk intltool xutils-dev xsltproc"
thomasanderson20032a5c2017-03-02 00:28:20316nacl_list="\
317 g++-mingw-w64-i686
318 lib32z1-dev
319 libasound2:i386
320 libcap2:i386
321 libelf-dev:i386
322 libfontconfig1:i386
thomasanderson20032a5c2017-03-02 00:28:20323 libglib2.0-0:i386
324 libgpm2:i386
325 libgtk2.0-0:i386
326 libgtk-3-0:i386
327 libncurses5:i386
328 lib32ncurses5-dev
329 libnss3:i386
330 libpango1.0-0:i386
thomasandersondfefc6c02017-05-04 01:29:11331 libssl-dev:i386
thomasanderson20032a5c2017-03-02 00:28:20332 libtinfo-dev
333 libtinfo-dev:i386
334 libtool
Tom Andersonf8a0c662018-06-14 23:54:14335 libuuid1:i386
thomasanderson20032a5c2017-03-02 00:28:20336 libxcomposite1:i386
337 libxcursor1:i386
338 libxdamage1:i386
339 libxi6:i386
340 libxrandr2:i386
341 libxss1:i386
342 libxtst6:i386
343 texinfo
344 xvfb
345 ${naclports_list}
346"
[email protected]419a9a62014-06-19 18:26:18347
Tom Anderson0524b2b72017-12-11 20:39:18348if package_exists libssl1.1; then
349 nacl_list="${nacl_list} libssl1.1:i386"
350elif package_exists libssl1.0.2; then
thomasandersondfefc6c02017-05-04 01:29:11351 nacl_list="${nacl_list} libssl1.0.2:i386"
Tom Anderson0524b2b72017-12-11 20:39:18352else
353 nacl_list="${nacl_list} libssl1.0.0:i386"
thomasandersondfefc6c02017-05-04 01:29:11354fi
355
[email protected]757c2962012-03-15 19:05:18356# Some package names have changed over time
Tom Anderson0524b2b72017-12-11 20:39:18357if package_exists libpng16-16; then
marcin73929a72017-01-04 22:04:58358 lib_list="${lib_list} libpng16-16"
Tom Anderson0524b2b72017-12-11 20:39:18359else
360 lib_list="${lib_list} libpng12-0"
marcin73929a72017-01-04 22:04:58361fi
Tom Anderson96a2efc2018-06-14 01:12:14362if package_exists libnspr4; then
[email protected]1a0f64a2011-05-20 17:53:55363 lib_list="${lib_list} libnspr4 libnss3"
[email protected]757c2962012-03-15 19:05:18364else
[email protected]757c2962012-03-15 19:05:18365 lib_list="${lib_list} libnspr4-0d libnss3-1d"
366fi
[email protected]4fc00712013-05-29 23:11:20367if package_exists libjpeg-dev; then
[email protected]9e895962013-05-21 08:26:42368 dev_list="${dev_list} libjpeg-dev"
[email protected]b11411c2012-03-21 22:09:41369else
[email protected]9e895962013-05-21 08:26:42370 dev_list="${dev_list} libjpeg62-dev"
[email protected]b11411c2012-03-21 22:09:41371fi
[email protected]4fc00712013-05-29 23:11:20372if package_exists libudev1; then
[email protected]9e895962013-05-21 08:26:42373 dev_list="${dev_list} libudev1"
[email protected]ab9e69082014-06-05 15:28:52374 nacl_list="${nacl_list} libudev1:i386"
[email protected]9e895962013-05-21 08:26:42375else
376 dev_list="${dev_list} libudev0"
[email protected]ab9e69082014-06-05 15:28:52377 nacl_list="${nacl_list} libudev0:i386"
[email protected]9e895962013-05-21 08:26:42378fi
[email protected]3ea42912013-09-06 06:23:57379if package_exists libbrlapi0.6; then
380 dev_list="${dev_list} libbrlapi0.6"
381else
382 dev_list="${dev_list} libbrlapi0.5"
383fi
Tom Anderson0524b2b72017-12-11 20:39:18384if package_exists apache2.2-bin; then
halton.huo3e728c42016-01-20 05:12:23385 dev_list="${dev_list} apache2.2-bin"
Tom Anderson0524b2b72017-12-11 20:39:18386else
387 dev_list="${dev_list} apache2-bin"
halton.huo3e728c42016-01-20 05:12:23388fi
Marcin Wiacekd7577c32018-04-30 19:12:51389if package_exists libav-tools; then
390 dev_list="${dev_list} libav-tools"
391fi
392if package_exists php7.2-cgi; then
393 dev_list="${dev_list} php7.2-cgi libapache2-mod-php7.2"
394elif package_exists php7.1-cgi; then
marcin38933dd2017-10-30 00:05:52395 dev_list="${dev_list} php7.1-cgi libapache2-mod-php7.1"
396elif package_exists php7.0-cgi; then
vadimsh278ff0662016-05-19 00:06:28397 dev_list="${dev_list} php7.0-cgi libapache2-mod-php7.0"
krasineef3d4b2016-04-22 00:52:18398else
vadimsh278ff0662016-05-19 00:06:28399 dev_list="${dev_list} php5-cgi libapache2-mod-php5"
krasineef3d4b2016-04-22 00:52:18400fi
[email protected]757c2962012-03-15 19:05:18401
[email protected]dc099772013-09-30 22:06:58402# Some packages are only needed if the distribution actually supports
[email protected]757c2962012-03-15 19:05:18403# installing them.
[email protected]4fc00712013-05-29 23:11:20404if package_exists appmenu-gtk; then
[email protected]757c2962012-03-15 19:05:18405 lib_list="$lib_list appmenu-gtk"
[email protected]4da8fad2011-04-11 18:42:42406fi
407
Tom Anderson81e7f1792017-11-11 03:56:33408# Cross-toolchain strip is needed for building the sysroots.
409if package_exists binutils-arm-linux-gnueabihf; then
410 dev_list="${dev_list} binutils-arm-linux-gnueabihf"
411fi
412if package_exists binutils-aarch64-linux-gnu; then
413 dev_list="${dev_list} binutils-aarch64-linux-gnu"
414fi
415if package_exists binutils-mipsel-linux-gnu; then
416 dev_list="${dev_list} binutils-mipsel-linux-gnu"
417fi
418if package_exists binutils-mips64el-linux-gnuabi64; then
419 dev_list="${dev_list} binutils-mips64el-linux-gnuabi64"
420fi
421
johnme49bb458a2014-11-27 15:45:31422# When cross building for arm/Android on 64-bit systems the host binaries
423# that are part of v8 need to be compiled with -m32 which means
424# that basic multilib support is needed.
ki.stfu0a79d6992015-09-17 07:27:12425if file -L /sbin/init | grep -q 'ELF 64-bit'; then
johnme49bb458a2014-11-27 15:45:31426 # gcc-multilib conflicts with the arm cross compiler (at least in trusty) but
427 # g++-X.Y-multilib gives us the 32-bit support that we need. Find out the
428 # appropriate value of X and Y by seeing what version the current
429 # distribution's g++-multilib package depends on.
430 multilib_package=$(apt-cache depends g++-multilib --important | \
431 grep -E --color=never --only-matching '\bg\+\+-[0-9.]+-multilib\b')
432 lib32_list="$lib32_list $multilib_package"
433fi
434
Tom Anderson8e0a484e2018-06-14 22:47:02435if [ "$do_inst_syms" = "1" ]; then
[email protected]ba48c4ca2013-10-25 16:11:46436 echo "Including debugging symbols."
Tom Anderson8206da9a2018-06-12 01:49:09437
438 # Debian is in the process of transitioning to automatic debug packages, which
439 # have the -dbgsym suffix (https://wiki.debian.org/AutomaticDebugPackages).
440 # Untransitioned packages have the -dbg suffix. And on some systems, neither
441 # will be available, so exclude the ones that are missing.
442 dbg_package_name() {
443 if package_exists "$1-dbgsym"; then
444 echo "$1-dbgsym"
445 elif package_exists "$1-dbg"; then
446 echo "$1-dbg"
447 fi
448 }
449
450 for package in "${common_lib_list}"; do
451 dbg_list="$dbg_list $(dbg_package_name ${package})"
452 done
453
454 # Debugging symbols packages not following common naming scheme
Tom Anderson8e0a484e2018-06-14 22:47:02455 if [ "$(dbg_package_name libstdc++6)" == "" ]; then
456 if package_exists libstdc++6-8-dbg; then
457 dbg_list="${dbg_list} libstdc++6-8-dbg"
458 elif package_exists libstdc++6-7-dbg; then
459 dbg_list="${dbg_list} libstdc++6-7-dbg"
460 elif package_exists libstdc++6-6-dbg; then
Tom Anderson8206da9a2018-06-12 01:49:09461 dbg_list="${dbg_list} libstdc++6-6-dbg"
Tom Anderson8e0a484e2018-06-14 22:47:02462 elif package_exists libstdc++6-5-dbg; then
463 dbg_list="${dbg_list} libstdc++6-5-dbg"
Tom Anderson8206da9a2018-06-12 01:49:09464 elif package_exists libstdc++6-4.9-dbg; then
465 dbg_list="${dbg_list} libstdc++6-4.9-dbg"
Tom Anderson8e0a484e2018-06-14 22:47:02466 elif package_exists libstdc++6-4.8-dbg; then
Tom Anderson8206da9a2018-06-12 01:49:09467 dbg_list="${dbg_list} libstdc++6-4.8-dbg"
Tom Anderson8e0a484e2018-06-14 22:47:02468 elif package_exists libstdc++6-4.7-dbg; then
469 dbg_list="${dbg_list} libstdc++6-4.7-dbg"
Tom Anderson8206da9a2018-06-12 01:49:09470 fi
471 fi
Tom Anderson8e0a484e2018-06-14 22:47:02472 if [ "$(dbg_package_name libatk1.0-0)" == "" ]; then
Tom Anderson8206da9a2018-06-12 01:49:09473 dbg_list="$dbg_list $(dbg_package_name libatk1.0)"
474 fi
Tom Anderson8e0a484e2018-06-14 22:47:02475 if [ "$(dbg_package_name libpango1.0-0)" == "" ]; then
Tom Anderson8206da9a2018-06-12 01:49:09476 dbg_list="$dbg_list $(dbg_package_name libpango1.0-dev)"
477 fi
[email protected]8ada8c52009-03-10 21:53:08478else
[email protected]ba48c4ca2013-10-25 16:11:46479 echo "Skipping debugging symbols."
[email protected]8ada8c52009-03-10 21:53:08480 dbg_list=
481fi
482
Tom Anderson8e0a484e2018-06-14 22:47:02483if [ "$do_inst_lib32" = "1" ]; then
Tom Andersondd47ad32018-03-21 19:30:19484 echo "Including 32-bit libraries."
johnme49bb458a2014-11-27 15:45:31485else
Tom Andersondd47ad32018-03-21 19:30:19486 echo "Skipping 32-bit libraries."
johnme49bb458a2014-11-27 15:45:31487 lib32_list=
[email protected]9f28a9cf2012-12-17 23:31:40488fi
489
Tom Anderson8e0a484e2018-06-14 22:47:02490if [ "$do_inst_arm" = "1" ]; then
[email protected]ba48c4ca2013-10-25 16:11:46491 echo "Including ARM cross toolchain."
[email protected]f2826b6a2012-11-15 01:06:26492else
[email protected]ba48c4ca2013-10-25 16:11:46493 echo "Skipping ARM cross toolchain."
[email protected]f2826b6a2012-11-15 01:06:26494 arm_list=
495fi
496
Tom Anderson8e0a484e2018-06-14 22:47:02497if [ "$do_inst_nacl" = "1" ]; then
[email protected]713eac62014-06-02 23:10:03498 echo "Including NaCl, NaCl toolchain, NaCl ports dependencies."
[email protected]565416362014-01-16 21:26:47499else
[email protected]713eac62014-06-02 23:10:03500 echo "Skipping NaCl, NaCl toolchain, NaCl ports dependencies."
[email protected]565416362014-01-16 21:26:47501 nacl_list=
502fi
503
johnme4bd10302015-01-06 11:25:52504# The `sort -r -s -t: -k2` sorts all the :i386 packages to the front, to avoid
505# confusing dpkg-query (crbug.com/446172).
[email protected]565416362014-01-16 21:26:47506packages="$(
johnme49bb458a2014-11-27 15:45:31507 echo "${dev_list} ${lib_list} ${dbg_list} ${lib32_list} ${arm_list}"\
johnme4bd10302015-01-06 11:25:52508 "${nacl_list}" | tr " " "\n" | sort -u | sort -r -s -t: -k2 | tr "\n" " "
[email protected]565416362014-01-16 21:26:47509)"
[email protected]ba48c4ca2013-10-25 16:11:46510
511if [ 1 -eq "${do_quick_check-0}" ] ; then
thomasanderson73b3a4412016-11-18 23:16:07512 if ! missing_packages="$(dpkg-query -W -f ' ' ${packages} 2>&1)"; then
513 # Distinguish between packages that actually aren't available to the
514 # system (i.e. not in any repo) and packages that just aren't known to
515 # dpkg (i.e. managed by apt).
516 missing_packages="$(echo "${missing_packages}" | awk '{print $NF}')"
517 not_installed=""
518 unknown=""
519 for p in ${missing_packages}; do
520 if apt-cache show ${p} > /dev/null 2>&1; then
521 not_installed="${p}\n${not_installed}"
522 else
523 unknown="${p}\n${unknown}"
[email protected]ba48c4ca2013-10-25 16:11:46524 fi
thomasanderson73b3a4412016-11-18 23:16:07525 done
526 if [ -n "${not_installed}" ]; then
[email protected]ba48c4ca2013-10-25 16:11:46527 echo "WARNING: The following packages are not installed:"
thomasanderson73b3a4412016-11-18 23:16:07528 echo -e "${not_installed}" | sed -e "s/^/ /"
529 fi
530 if [ -n "${unknown}" ]; then
531 echo "WARNING: The following packages are unknown to your system"
532 echo "(maybe missing a repo or need to 'sudo apt-get update'):"
533 echo -e "${unknown}" | sed -e "s/^/ /"
[email protected]ba48c4ca2013-10-25 16:11:46534 fi
535 exit 1
536 fi
537 exit 0
538fi
539
Tom Anderson8e0a484e2018-06-14 22:47:02540if [ "$do_inst_lib32" = "1" ] || [ "$do_inst_nacl" = "1" ]; then
thomasanderson05c40292017-03-28 19:28:45541 sudo dpkg --add-architecture i386
johnme49bb458a2014-11-27 15:45:31542fi
sbc42564092015-04-01 01:01:28543sudo apt-get update
[email protected]e041ed12009-03-10 16:43:01544
545# We initially run "apt-get" with the --reinstall option and parse its output.
546# This way, we can find all the packages that need to be newly installed
547# without accidentally promoting any packages from "auto" to "manual".
548# We then re-run "apt-get" with just the list of missing packages.
549echo "Finding missing packages..."
[email protected]757c2962012-03-15 19:05:18550# Intentionally leaving $packages unquoted so it's more readable.
[email protected]b6e064522009-08-10 18:47:51551echo "Packages required: " $packages
552echo
[email protected]79a9d2962009-08-06 21:10:58553new_list_cmd="sudo apt-get install --reinstall $(echo $packages)"
[email protected]c3d8b152013-05-10 10:10:03554if new_list="$(yes n | LANGUAGE=en LANG=C $new_list_cmd)"; then
[email protected]b6e064522009-08-10 18:47:51555 # We probably never hit this following line.
thakis3e861de2016-06-14 14:24:01556 echo "No missing packages, and the packages are up to date."
[email protected]b62f11e72010-05-03 17:20:45557elif [ $? -eq 1 ]; then
[email protected]79a9d2962009-08-06 21:10:58558 # We expect apt-get to have exit status of 1.
[email protected]757c2962012-03-15 19:05:18559 # This indicates that we cancelled the install with "yes n|".
[email protected]b6e064522009-08-10 18:47:51560 new_list=$(echo "$new_list" |
[email protected]79a9d2962009-08-06 21:10:58561 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d')
[email protected]b6e064522009-08-10 18:47:51562 new_list=$(echo "$new_list" | sed 's/ *$//')
563 if [ -z "$new_list" ] ; then
thakis3e861de2016-06-14 14:24:01564 echo "No missing packages, and the packages are up to date."
[email protected]b6e064522009-08-10 18:47:51565 else
566 echo "Installing missing packages: $new_list."
[email protected]e2544ed42012-04-23 04:48:31567 sudo apt-get install ${do_quietly-} ${new_list}
[email protected]b6e064522009-08-10 18:47:51568 fi
569 echo
[email protected]79a9d2962009-08-06 21:10:58570else
571 # An apt-get exit status of 100 indicates that a real error has occurred.
[email protected]e041ed12009-03-10 16:43:01572
[email protected]79a9d2962009-08-06 21:10:58573 # I am intentionally leaving out the '"'s around new_list_cmd,
574 # as this makes it easier to cut and paste the output
[email protected]79a9d2962009-08-06 21:10:58575 echo "The following command failed: " ${new_list_cmd}
576 echo
577 echo "It produces the following output:"
578 yes n | $new_list_cmd || true
579 echo
580 echo "You will have to install the above packages yourself."
581 echo
582 exit 100
583fi
[email protected]e041ed12009-03-10 16:43:01584
[email protected]d96cc3472013-09-19 00:53:30585# Install the Chrome OS default fonts. This must go after running
586# apt-get, since install-chromeos-fonts depends on curl.
Tom Anderson8e0a484e2018-06-14 22:47:02587if [ "$do_inst_chromeos_fonts" != "0" ]; then
[email protected]d96cc3472013-09-19 00:53:30588 echo
589 echo "Installing Chrome OS fonts."
590 dir=`echo $0 | sed -r -e 's/\/[^/]+$//'`
591 if ! sudo $dir/linux/install-chromeos-fonts.py; then
592 echo "ERROR: The installation of the Chrome OS default fonts failed."
593 if [ `stat -f -c %T $dir` == "nfs" ]; then
594 echo "The reason is that your repo is installed on a remote file system."
595 else
596 echo "This is expected if your repo is installed on a remote file system."
597 fi
598 echo "It is recommended to install your repo on a local file system."
599 echo "You can skip the installation of the Chrome OS default founts with"
600 echo "the command line option: --no-chromeos-fonts."
601 exit 1
602 fi
603else
604 echo "Skipping installation of Chrome OS fonts."
605fi
606
thomasanderson5ef5c3d2016-12-08 01:59:19607echo "Installing locales."
608CHROMIUM_LOCALES="da_DK.UTF-8 fr_FR.UTF-8 he_IL.UTF-8 zh_TW.UTF-8"
609LOCALE_GEN=/etc/locale.gen
610if [ -e ${LOCALE_GEN} ]; then
611 OLD_LOCALE_GEN="$(cat /etc/locale.gen)"
612 for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do
613 sudo sed -i "s/^# ${CHROMIUM_LOCALE}/${CHROMIUM_LOCALE}/" ${LOCALE_GEN}
614 done
615 # Regenerating locales can take a while, so only do it if we need to.
616 if (echo "${OLD_LOCALE_GEN}" | cmp -s ${LOCALE_GEN}); then
617 echo "Locales already up-to-date."
618 else
619 sudo locale-gen
620 fi
621else
622 for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do
623 sudo locale-gen ${CHROMIUM_LOCALE}
624 done
625fi