blob: 78033f00b017ed033ac3029a8cf3ed3efab60fd0 [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"
Tom Andersone9883cd2018-06-20 00:32:2120 echo "--[no-]backwards-compatible: enable or disable installation of packages
21 that are no longer currently needed and have been removed from this
22 script. Useful for bisection."
[email protected]e2544ed42012-04-23 04:48:3123 echo "--no-prompt: silently select standard options/defaults"
[email protected]ba48c4ca2013-10-25 16:11:4624 echo "--quick-check: quickly try to determine if dependencies are installed"
25 echo " (this avoids interactive prompts and sudo commands,"
26 echo " so might not be 100% accurate)"
27 echo "--unsupported: attempt installation even on unsupported systems"
[email protected]1eae2bfb2010-01-26 18:17:5328 echo "Script will prompt interactively if options not given."
29 exit 1
30}
31
[email protected]4fc00712013-05-29 23:11:2032# Checks whether a particular package is available in the repos.
33# USAGE: $ package_exists <package name>
34package_exists() {
Tom Anderson17d6cdd2017-11-28 04:13:2535 # 'apt-cache search' takes a regex string, so eg. the +'s in packages like
36 # "libstdc++" need to be escaped.
37 local escaped="$(echo $1 | sed 's/[\~\+\.\:-]/\\&/g')"
38 [ ! -z "$(apt-cache search --names-only "${escaped}" | \
Tom Anderson9c70eb72017-11-27 21:47:3839 awk '$1 == "'$1'" { print $1; }')" ]
[email protected]4fc00712013-05-29 23:11:2040}
41
[email protected]fbeddf22014-01-17 23:59:0142# These default to on because (some) bots need them and it keeps things
43# simple for the bot setup if all bots just run the script in its default
44# mode. Developers who don't want stuff they don't need installed on their
45# own workstations can pass --no-arm --no-nacl when running the script.
46do_inst_arm=1
47do_inst_nacl=1
48
Tom Anderson8e0a484e2018-06-14 22:47:0249while [ "$1" != "" ]
[email protected]1eae2bfb2010-01-26 18:17:5350do
51 case "$1" in
Tom Andersone9883cd2018-06-20 00:32:2152 --syms) do_inst_syms=1;;
53 --no-syms) do_inst_syms=0;;
54 --lib32) do_inst_lib32=1;;
55 --arm) do_inst_arm=1;;
56 --no-arm) do_inst_arm=0;;
57 --chromeos-fonts) do_inst_chromeos_fonts=1;;
58 --no-chromeos-fonts) do_inst_chromeos_fonts=0;;
59 --nacl) do_inst_nacl=1;;
60 --no-nacl) do_inst_nacl=0;;
61 --backwards-compatible) do_inst_backwards_compatible=1;;
62 --no-backwards-compatible) do_inst_backwards_compatible=0;;
63 --add-cross-tool-repo) add_cross_tool_repo=1;;
64 --no-prompt) do_default=1
65 do_quietly="-qq --assume-yes"
[email protected]e2544ed42012-04-23 04:48:3166 ;;
Tom Andersone9883cd2018-06-20 00:32:2167 --quick-check) do_quick_check=1;;
68 --unsupported) do_unsupported=1;;
[email protected]1eae2bfb2010-01-26 18:17:5369 *) usage;;
70 esac
71 shift
72done
73
Tom Anderson8e0a484e2018-06-14 22:47:0274if [ "$do_inst_arm" = "1" ]; then
johnme49bb458a2014-11-27 15:45:3175 do_inst_lib32=1
76fi
77
[email protected]0febc9b2014-05-22 20:07:1978# Check for lsb_release command in $PATH
79if ! which lsb_release > /dev/null; then
80 echo "ERROR: lsb_release not found in \$PATH" >&2
81 exit 1;
82fi
[email protected]f2826b6a2012-11-15 01:06:2683
thomasandersondfefc6c02017-05-04 01:29:1184distro_codename=$(lsb_release --codename --short)
85distro_id=$(lsb_release --id --short)
Marcin Wiacekd7577c32018-04-30 19:12:5186supported_codenames="(trusty|xenial|artful|bionic)"
thomasandersondfefc6c02017-05-04 01:29:1187supported_ids="(Debian)"
[email protected]ba48c4ca2013-10-25 16:11:4688if [ 0 -eq "${do_unsupported-0}" ] && [ 0 -eq "${do_quick_check-0}" ] ; then
thomasandersondfefc6c02017-05-04 01:29:1189 if [[ ! $distro_codename =~ $supported_codenames &&
90 ! $distro_id =~ $supported_ids ]]; then
thomasanderson05c40292017-03-28 19:28:4591 echo -e "ERROR: The only supported distros are\n" \
Marcin Wiacekd7577c32018-04-30 19:12:5192 "\tUbuntu 14.04 LTS (trusty)\n" \
93 "\tUbuntu 16.04 LTS (xenial)\n" \
marcin38933dd2017-10-30 00:05:5294 "\tUbuntu 17.10 (artful)\n" \
Marcin Wiacekd7577c32018-04-30 19:12:5195 "\tUbuntu 18.04 LTS (bionic)\n" \
thomasandersondfefc6c02017-05-04 01:29:1196 "\tDebian 8 (jessie) or later" >&2
anthonyvd2ae919e52016-11-21 19:47:1297 exit 1
[email protected]fe63a022013-01-15 22:11:4798 fi
[email protected]cf1df402008-10-31 21:45:3099
[email protected]fe63a022013-01-15 22:11:47100 if ! uname -m | egrep -q "i686|x86_64"; then
anthonyvd2ae919e52016-11-21 19:47:12101 echo "Only x86 architectures are currently supported" >&2
[email protected]fe63a022013-01-15 22:11:47102 exit
103 fi
[email protected]e041ed12009-03-10 16:43:01104fi
105
[email protected]ba48c4ca2013-10-25 16:11:46106if [ "x$(id -u)" != x0 ] && [ 0 -eq "${do_quick_check-0}" ]; then
[email protected]e041ed12009-03-10 16:43:01107 echo "Running as non-root user."
108 echo "You might have to enter your password one or more times for 'sudo'."
[email protected]8ada8c52009-03-10 21:53:08109 echo
[email protected]e041ed12009-03-10 16:43:01110fi
111
[email protected]fdc6bf52010-06-07 22:01:57112# Packages needed for chromeos only
Tom Anderson6b2b2ad52018-02-22 23:28:14113chromeos_dev_list="libbluetooth-dev libxkbcommon-dev"
114
115if package_exists realpath; then
116 chromeos_dev_list="${chromeos_dev_list} realpath"
117fi
[email protected]fdc6bf52010-06-07 22:01:57118
[email protected]b61f6882013-11-14 20:41:41119# Packages needed for development
thomasanderson20032a5c2017-03-02 00:28:20120dev_list="\
Tom Anderson2b8a8362018-08-01 17:41:34121 binutils
thomasanderson20032a5c2017-03-02 00:28:20122 bison
George Burgess IV3d20a812018-05-10 22:24:17123 bzip2
thomasanderson20032a5c2017-03-02 00:28:20124 cdbs
125 curl
Tom Anderson8bfb0b02018-02-17 00:44:15126 dbus-x11
thomasanderson20032a5c2017-03-02 00:28:20127 dpkg-dev
128 elfutils
129 devscripts
130 fakeroot
131 flex
thomasanderson20032a5c2017-03-02 00:28:20132 g++
133 git-core
134 git-svn
135 gperf
Tim Brown06ee43a2018-02-08 18:42:12136 libappindicator3-dev
thomasanderson20032a5c2017-03-02 00:28:20137 libasound2-dev
Tom Anderson13200012018-09-10 22:29:02138 libatspi2.0-dev
thomasanderson20032a5c2017-03-02 00:28:20139 libbrlapi-dev
thomasanderson20032a5c2017-03-02 00:28:20140 libbz2-dev
141 libcairo2-dev
142 libcap-dev
143 libcups2-dev
144 libcurl4-gnutls-dev
145 libdrm-dev
146 libelf-dev
147 libffi-dev
Tom Andersond4ea2522018-03-01 20:34:38148 libgbm-dev
thomasanderson20032a5c2017-03-02 00:28:20149 libglib2.0-dev
150 libglu1-mesa-dev
151 libgnome-keyring-dev
thomasanderson20032a5c2017-03-02 00:28:20152 libgtk-3-dev
153 libkrb5-dev
154 libnspr4-dev
155 libnss3-dev
156 libpam0g-dev
157 libpci-dev
158 libpulse-dev
159 libsctp-dev
160 libspeechd-dev
161 libsqlite3-dev
162 libssl-dev
163 libudev-dev
164 libwww-perl
165 libxslt1-dev
166 libxss-dev
167 libxt-dev
168 libxtst-dev
Andrew Grievee41aeae2017-08-21 20:53:21169 locales
thomasanderson20032a5c2017-03-02 00:28:20170 openbox
Nico Webera9fa6a72018-02-23 18:26:02171 p7zip
thomasanderson20032a5c2017-03-02 00:28:20172 patch
173 perl
174 pkg-config
175 python
176 python-cherrypy3
177 python-crypto
178 python-dev
179 python-numpy
180 python-opencv
181 python-openssl
182 python-psutil
183 python-yaml
184 rpm
185 ruby
186 subversion
Daniel Bratellbec626a2018-06-26 17:40:52187 uuid-dev
thomasanderson20032a5c2017-03-02 00:28:20188 wdiff
Tom Andersond79de41d2017-08-08 00:23:23189 x11-utils
thomasanderson20032a5c2017-03-02 00:28:20190 xcompmgr
George Burgess IV3d20a812018-05-10 22:24:17191 xz-utils
thomasanderson20032a5c2017-03-02 00:28:20192 zip
193 $chromeos_dev_list
194"
[email protected]fdc6bf52010-06-07 22:01:57195
[email protected]f16aabf2012-08-15 21:00:14196# 64-bit systems need a minimum set of 32-bit compat packages for the pre-built
[email protected]f8ceadb2014-08-18 12:30:23197# NaCl binaries.
ki.stfu0a79d6992015-09-17 07:27:12198if file -L /sbin/init | grep -q 'ELF 64-bit'; then
[email protected]d93d68b12012-10-15 06:39:53199 dev_list="${dev_list} libc6-i386 lib32gcc1 lib32stdc++6"
[email protected]f16aabf2012-08-15 21:00:14200fi
201
[email protected]fdc6bf52010-06-07 22:01:57202# Run-time libraries required by chromeos only
[email protected]ba48c4ca2013-10-25 16:11:46203chromeos_lib_list="libpulse0 libbz2-1.0"
[email protected]e041ed12009-03-10 16:43:01204
Yves Gereye1fe0df2018-06-08 08:01:47205# List of required run-time libraries
206common_lib_list="\
Tim Brown06ee43a2018-02-08 18:42:12207 libappindicator3-1
208 libasound2
thomasanderson20032a5c2017-03-02 00:28:20209 libatk1.0-0
Tom Anderson13200012018-09-10 22:29:02210 libatspi2.0-0
thomasanderson20032a5c2017-03-02 00:28:20211 libc6
thomasanderson20032a5c2017-03-02 00:28:20212 libcairo2
213 libcap2
214 libcups2
215 libexpat1
216 libffi6
217 libfontconfig1
218 libfreetype6
219 libglib2.0-0
220 libgnome-keyring0
thomasanderson20032a5c2017-03-02 00:28:20221 libgtk-3-0
222 libpam0g
223 libpango1.0-0
224 libpci3
225 libpcre3
226 libpixman-1-0
227 libspeechd2
228 libstdc++6
229 libsqlite3-0
Tom Andersonf8a0c662018-06-14 23:54:14230 libuuid1
Scott Violetdd7e2372018-04-12 01:11:26231 libwayland-egl1-mesa
thomasanderson20032a5c2017-03-02 00:28:20232 libx11-6
233 libx11-xcb1
234 libxau6
235 libxcb1
236 libxcomposite1
237 libxcursor1
238 libxdamage1
239 libxdmcp6
240 libxext6
241 libxfixes3
242 libxi6
243 libxinerama1
244 libxrandr2
245 libxrender1
246 libxtst6
247 zlib1g
Yves Gereye1fe0df2018-06-08 08:01:47248"
249
250# Full list of required run-time libraries
251lib_list="\
252 $common_lib_list
thomasanderson20032a5c2017-03-02 00:28:20253 $chromeos_lib_list
254"
[email protected]e041ed12009-03-10 16:43:01255
johnme49bb458a2014-11-27 15:45:31256# 32-bit libraries needed e.g. to compile V8 snapshot for Android or armhf
Tanin Na Nakorn6cbe32e52017-05-30 19:37:04257lib32_list="linux-libc-dev:i386 libpci3:i386"
johnme49bb458a2014-11-27 15:45:31258
Tom Andersondd47ad32018-03-21 19:30:19259# 32-bit libraries needed for a 32-bit build
260lib32_list="$lib32_list libx11-xcb1:i386"
261
Tom Andersone9883cd2018-06-20 00:32:21262# Packages that have been removed from this script. Regardless of configuration
263# or options passed to this script, whenever a package is removed, it should be
264# added here.
265backwards_compatible_list="\
266 7za
267 fonts-indic
268 fonts-ipafont
269 fonts-stix
270 fonts-thai-tlwg
271 fonts-tlwg-garuda
272 language-pack-da
273 language-pack-fr
274 language-pack-he
275 language-pack-zh-hant
Tom Anderson287339e2018-08-22 21:52:02276 libappindicator-dev
277 libappindicator1
Tom Andersone9883cd2018-06-20 00:32:21278 libappindicator3-1:i386
279 libdconf-dev
280 libdconf-dev:i386
281 libdconf1
282 libdconf1:i386
283 libexif-dev
284 libexif12
285 libexif12:i386
286 libgbm-dev
287 libgconf-2-4:i386
288 libgconf2-dev
289 libgl1-mesa-dev
290 libgl1-mesa-glx:i386
291 libgles2-mesa-dev
Tom Anderson99ffaae2018-11-29 00:08:31292 libgtk-3-0:i386
Tom Anderson287339e2018-08-22 21:52:02293 libgtk2.0-0
294 libgtk2.0-0:i386
295 libgtk2.0-dev
Tom Andersone9883cd2018-06-20 00:32:21296 mesa-common-dev
297 msttcorefonts
298 ttf-dejavu-core
299 ttf-indic-fonts
300 ttf-kochi-gothic
301 ttf-kochi-mincho
302 ttf-mscorefonts-installer
303 xfonts-mathml
304"
305case $distro_codename in
306 trusty)
307 backwards_compatible_list+=" \
308 libgbm-dev-lts-trusty
309 libgl1-mesa-dev-lts-trusty
310 libgl1-mesa-glx-lts-trusty:i386
311 libgles2-mesa-dev-lts-trusty
312 mesa-common-dev-lts-trusty"
313 ;;
314 xenial)
315 backwards_compatible_list+=" \
316 libgbm-dev-lts-xenial
317 libgl1-mesa-dev-lts-xenial
318 libgl1-mesa-glx-lts-xenial:i386
319 libgles2-mesa-dev-lts-xenial
320 mesa-common-dev-lts-xenial"
321 ;;
322esac
323
[email protected]3f85dac32013-10-29 02:38:46324# arm cross toolchain packages needed to build chrome on armhf
thomasanderson4e3d30fe2016-12-07 18:58:34325EM_REPO="deb http://emdebian.org/tools/debian/ jessie main"
326EM_SOURCE=$(cat <<EOF
327# Repo added by Chromium $0
328${EM_REPO}
329# deb-src http://emdebian.org/tools/debian/ jessie main
330EOF
331)
332EM_ARCHIVE_KEY_FINGER="084C6C6F39159EDB67969AA87DE089671804772E"
333GPP_ARM_PACKAGE="g++-arm-linux-gnueabihf"
thomasandersondfefc6c02017-05-04 01:29:11334case $distro_codename in
kjellander95504ae2017-03-30 12:30:31335 jessie)
thomasanderson4e3d30fe2016-12-07 18:58:34336 eval $(apt-config shell APT_SOURCESDIR 'Dir::Etc::sourceparts/d')
337 CROSSTOOLS_LIST="${APT_SOURCESDIR}/crosstools.list"
338 arm_list="libc6-dev:armhf
339 linux-libc-dev:armhf"
Tom Anderson8e0a484e2018-06-14 22:47:02340 if [ "$do_inst_arm" = "1" ]; then
thomasanderson4e3d30fe2016-12-07 18:58:34341 if $(dpkg-query -W ${GPP_ARM_PACKAGE} &>/dev/null); then
342 arm_list+=" ${GPP_ARM_PACKAGE}"
343 else
Tom Anderson8e0a484e2018-06-14 22:47:02344 if [ "${add_cross_tool_repo}" = "1" ]; then
thomasanderson4e3d30fe2016-12-07 18:58:34345 gpg --keyserver pgp.mit.edu --recv-keys ${EM_ARCHIVE_KEY_FINGER}
346 gpg -a --export ${EM_ARCHIVE_KEY_FINGER} | sudo apt-key add -
347 if ! grep "^${EM_REPO}" "${CROSSTOOLS_LIST}" &>/dev/null; then
348 echo "${EM_SOURCE}" | sudo tee -a "${CROSSTOOLS_LIST}" >/dev/null
349 fi
350 arm_list+=" ${GPP_ARM_PACKAGE}"
Tom Anderson8e0a484e2018-06-14 22:47:02351 else
352 echo "The Debian Cross-toolchains repository is necessary to"
353 echo "cross-compile Chromium for arm."
354 echo "Rerun with --add-deb-cross-tool-repo to have it added for you."
thomasanderson4e3d30fe2016-12-07 18:58:34355 fi
356 fi
357 fi
358 ;;
thomasandersondfefc6c02017-05-04 01:29:11359 # All necessary ARM packages are available on the default repos on
360 # Debian 9 and later.
kjellander95504ae2017-03-30 12:30:31361 *)
Tom Anderson81e7f1792017-11-11 03:56:33362 arm_list="libc6-dev-armhf-cross
thomasanderson4e3d30fe2016-12-07 18:58:34363 linux-libc-dev-armhf-cross
364 ${GPP_ARM_PACKAGE}"
365 ;;
366esac
[email protected]31a605532011-08-23 22:27:35367
sbcb5d4ded2015-04-01 17:49:03368# Work around for dependency issue Ubuntu/Trusty: http://crbug.com/435056
thomasandersondfefc6c02017-05-04 01:29:11369case $distro_codename in
friedmanbf8b90a2016-04-21 01:15:48370 trusty)
371 arm_list+=" g++-4.8-multilib-arm-linux-gnueabihf
372 gcc-4.8-multilib-arm-linux-gnueabihf"
373 ;;
Marcin Wiacekd7577c32018-04-30 19:12:51374 xenial|artful|bionic)
krasineef3d4b2016-04-22 00:52:18375 arm_list+=" g++-5-multilib-arm-linux-gnueabihf
376 gcc-5-multilib-arm-linux-gnueabihf
377 gcc-arm-linux-gnueabihf"
378 ;;
friedmanbf8b90a2016-04-21 01:15:48379esac
sbcb5d4ded2015-04-01 17:49:03380
[email protected]713eac62014-06-02 23:10:03381# Packages to build NaCl, its toolchains, and its ports.
Brad Nelson5e59c2c2014-09-06 06:18:45382naclports_list="ant autoconf bison cmake gawk intltool xutils-dev xsltproc"
thomasanderson20032a5c2017-03-02 00:28:20383nacl_list="\
384 g++-mingw-w64-i686
385 lib32z1-dev
386 libasound2:i386
387 libcap2:i386
388 libelf-dev:i386
389 libfontconfig1:i386
thomasanderson20032a5c2017-03-02 00:28:20390 libglib2.0-0:i386
391 libgpm2:i386
thomasanderson20032a5c2017-03-02 00:28:20392 libncurses5:i386
393 lib32ncurses5-dev
394 libnss3:i386
395 libpango1.0-0:i386
thomasandersondfefc6c02017-05-04 01:29:11396 libssl-dev:i386
thomasanderson20032a5c2017-03-02 00:28:20397 libtinfo-dev
398 libtinfo-dev:i386
399 libtool
Tom Andersonf8a0c662018-06-14 23:54:14400 libuuid1:i386
thomasanderson20032a5c2017-03-02 00:28:20401 libxcomposite1:i386
402 libxcursor1:i386
403 libxdamage1:i386
404 libxi6:i386
405 libxrandr2:i386
406 libxss1:i386
407 libxtst6:i386
408 texinfo
409 xvfb
410 ${naclports_list}
411"
[email protected]419a9a62014-06-19 18:26:18412
Tom Anderson0524b2b72017-12-11 20:39:18413if package_exists libssl1.1; then
414 nacl_list="${nacl_list} libssl1.1:i386"
415elif package_exists libssl1.0.2; then
thomasandersondfefc6c02017-05-04 01:29:11416 nacl_list="${nacl_list} libssl1.0.2:i386"
Tom Anderson0524b2b72017-12-11 20:39:18417else
418 nacl_list="${nacl_list} libssl1.0.0:i386"
thomasandersondfefc6c02017-05-04 01:29:11419fi
420
[email protected]757c2962012-03-15 19:05:18421# Some package names have changed over time
Tom Anderson0524b2b72017-12-11 20:39:18422if package_exists libpng16-16; then
marcin73929a72017-01-04 22:04:58423 lib_list="${lib_list} libpng16-16"
Tom Anderson0524b2b72017-12-11 20:39:18424else
425 lib_list="${lib_list} libpng12-0"
marcin73929a72017-01-04 22:04:58426fi
Tom Anderson96a2efc2018-06-14 01:12:14427if package_exists libnspr4; then
[email protected]1a0f64a2011-05-20 17:53:55428 lib_list="${lib_list} libnspr4 libnss3"
[email protected]757c2962012-03-15 19:05:18429else
[email protected]757c2962012-03-15 19:05:18430 lib_list="${lib_list} libnspr4-0d libnss3-1d"
431fi
[email protected]4fc00712013-05-29 23:11:20432if package_exists libjpeg-dev; then
[email protected]9e895962013-05-21 08:26:42433 dev_list="${dev_list} libjpeg-dev"
[email protected]b11411c2012-03-21 22:09:41434else
[email protected]9e895962013-05-21 08:26:42435 dev_list="${dev_list} libjpeg62-dev"
[email protected]b11411c2012-03-21 22:09:41436fi
[email protected]4fc00712013-05-29 23:11:20437if package_exists libudev1; then
[email protected]9e895962013-05-21 08:26:42438 dev_list="${dev_list} libudev1"
[email protected]ab9e69082014-06-05 15:28:52439 nacl_list="${nacl_list} libudev1:i386"
[email protected]9e895962013-05-21 08:26:42440else
441 dev_list="${dev_list} libudev0"
[email protected]ab9e69082014-06-05 15:28:52442 nacl_list="${nacl_list} libudev0:i386"
[email protected]9e895962013-05-21 08:26:42443fi
[email protected]3ea42912013-09-06 06:23:57444if package_exists libbrlapi0.6; then
445 dev_list="${dev_list} libbrlapi0.6"
446else
447 dev_list="${dev_list} libbrlapi0.5"
448fi
Tom Anderson0524b2b72017-12-11 20:39:18449if package_exists apache2.2-bin; then
halton.huo3e728c42016-01-20 05:12:23450 dev_list="${dev_list} apache2.2-bin"
Tom Anderson0524b2b72017-12-11 20:39:18451else
452 dev_list="${dev_list} apache2-bin"
halton.huo3e728c42016-01-20 05:12:23453fi
Marcin Wiacekd7577c32018-04-30 19:12:51454if package_exists libav-tools; then
455 dev_list="${dev_list} libav-tools"
456fi
457if package_exists php7.2-cgi; then
458 dev_list="${dev_list} php7.2-cgi libapache2-mod-php7.2"
459elif package_exists php7.1-cgi; then
marcin38933dd2017-10-30 00:05:52460 dev_list="${dev_list} php7.1-cgi libapache2-mod-php7.1"
461elif package_exists php7.0-cgi; then
vadimsh278ff0662016-05-19 00:06:28462 dev_list="${dev_list} php7.0-cgi libapache2-mod-php7.0"
krasineef3d4b2016-04-22 00:52:18463else
vadimsh278ff0662016-05-19 00:06:28464 dev_list="${dev_list} php5-cgi libapache2-mod-php5"
krasineef3d4b2016-04-22 00:52:18465fi
[email protected]757c2962012-03-15 19:05:18466
[email protected]dc099772013-09-30 22:06:58467# Some packages are only needed if the distribution actually supports
[email protected]757c2962012-03-15 19:05:18468# installing them.
[email protected]4fc00712013-05-29 23:11:20469if package_exists appmenu-gtk; then
[email protected]757c2962012-03-15 19:05:18470 lib_list="$lib_list appmenu-gtk"
[email protected]4da8fad2011-04-11 18:42:42471fi
472
Tom Anderson81e7f1792017-11-11 03:56:33473# Cross-toolchain strip is needed for building the sysroots.
474if package_exists binutils-arm-linux-gnueabihf; then
475 dev_list="${dev_list} binutils-arm-linux-gnueabihf"
476fi
477if package_exists binutils-aarch64-linux-gnu; then
478 dev_list="${dev_list} binutils-aarch64-linux-gnu"
479fi
480if package_exists binutils-mipsel-linux-gnu; then
481 dev_list="${dev_list} binutils-mipsel-linux-gnu"
482fi
483if package_exists binutils-mips64el-linux-gnuabi64; then
484 dev_list="${dev_list} binutils-mips64el-linux-gnuabi64"
485fi
486
johnme49bb458a2014-11-27 15:45:31487# When cross building for arm/Android on 64-bit systems the host binaries
488# that are part of v8 need to be compiled with -m32 which means
489# that basic multilib support is needed.
ki.stfu0a79d6992015-09-17 07:27:12490if file -L /sbin/init | grep -q 'ELF 64-bit'; then
johnme49bb458a2014-11-27 15:45:31491 # gcc-multilib conflicts with the arm cross compiler (at least in trusty) but
492 # g++-X.Y-multilib gives us the 32-bit support that we need. Find out the
493 # appropriate value of X and Y by seeing what version the current
494 # distribution's g++-multilib package depends on.
495 multilib_package=$(apt-cache depends g++-multilib --important | \
496 grep -E --color=never --only-matching '\bg\+\+-[0-9.]+-multilib\b')
497 lib32_list="$lib32_list $multilib_package"
498fi
499
Tom Anderson8e0a484e2018-06-14 22:47:02500if [ "$do_inst_syms" = "1" ]; then
[email protected]ba48c4ca2013-10-25 16:11:46501 echo "Including debugging symbols."
Tom Anderson8206da9a2018-06-12 01:49:09502
503 # Debian is in the process of transitioning to automatic debug packages, which
504 # have the -dbgsym suffix (https://wiki.debian.org/AutomaticDebugPackages).
505 # Untransitioned packages have the -dbg suffix. And on some systems, neither
506 # will be available, so exclude the ones that are missing.
507 dbg_package_name() {
508 if package_exists "$1-dbgsym"; then
509 echo "$1-dbgsym"
510 elif package_exists "$1-dbg"; then
511 echo "$1-dbg"
512 fi
513 }
514
515 for package in "${common_lib_list}"; do
516 dbg_list="$dbg_list $(dbg_package_name ${package})"
517 done
518
519 # Debugging symbols packages not following common naming scheme
Tom Anderson8e0a484e2018-06-14 22:47:02520 if [ "$(dbg_package_name libstdc++6)" == "" ]; then
521 if package_exists libstdc++6-8-dbg; then
522 dbg_list="${dbg_list} libstdc++6-8-dbg"
523 elif package_exists libstdc++6-7-dbg; then
524 dbg_list="${dbg_list} libstdc++6-7-dbg"
525 elif package_exists libstdc++6-6-dbg; then
Tom Anderson8206da9a2018-06-12 01:49:09526 dbg_list="${dbg_list} libstdc++6-6-dbg"
Tom Anderson8e0a484e2018-06-14 22:47:02527 elif package_exists libstdc++6-5-dbg; then
528 dbg_list="${dbg_list} libstdc++6-5-dbg"
Tom Anderson8206da9a2018-06-12 01:49:09529 elif package_exists libstdc++6-4.9-dbg; then
530 dbg_list="${dbg_list} libstdc++6-4.9-dbg"
Tom Anderson8e0a484e2018-06-14 22:47:02531 elif package_exists libstdc++6-4.8-dbg; then
Tom Anderson8206da9a2018-06-12 01:49:09532 dbg_list="${dbg_list} libstdc++6-4.8-dbg"
Tom Anderson8e0a484e2018-06-14 22:47:02533 elif package_exists libstdc++6-4.7-dbg; then
534 dbg_list="${dbg_list} libstdc++6-4.7-dbg"
Tom Andersone9883cd2018-06-20 00:32:21535 elif package_exists libstdc++6-4.6-dbg; then
536 dbg_list="${dbg_list} libstdc++6-4.6-dbg"
Tom Anderson8206da9a2018-06-12 01:49:09537 fi
538 fi
Tom Anderson8e0a484e2018-06-14 22:47:02539 if [ "$(dbg_package_name libatk1.0-0)" == "" ]; then
Tom Anderson8206da9a2018-06-12 01:49:09540 dbg_list="$dbg_list $(dbg_package_name libatk1.0)"
541 fi
Tom Anderson8e0a484e2018-06-14 22:47:02542 if [ "$(dbg_package_name libpango1.0-0)" == "" ]; then
Tom Anderson8206da9a2018-06-12 01:49:09543 dbg_list="$dbg_list $(dbg_package_name libpango1.0-dev)"
544 fi
[email protected]8ada8c52009-03-10 21:53:08545else
[email protected]ba48c4ca2013-10-25 16:11:46546 echo "Skipping debugging symbols."
[email protected]8ada8c52009-03-10 21:53:08547 dbg_list=
548fi
549
Tom Anderson8e0a484e2018-06-14 22:47:02550if [ "$do_inst_lib32" = "1" ]; then
Tom Andersondd47ad32018-03-21 19:30:19551 echo "Including 32-bit libraries."
johnme49bb458a2014-11-27 15:45:31552else
Tom Andersondd47ad32018-03-21 19:30:19553 echo "Skipping 32-bit libraries."
johnme49bb458a2014-11-27 15:45:31554 lib32_list=
[email protected]9f28a9cf2012-12-17 23:31:40555fi
556
Tom Anderson8e0a484e2018-06-14 22:47:02557if [ "$do_inst_arm" = "1" ]; then
[email protected]ba48c4ca2013-10-25 16:11:46558 echo "Including ARM cross toolchain."
[email protected]f2826b6a2012-11-15 01:06:26559else
[email protected]ba48c4ca2013-10-25 16:11:46560 echo "Skipping ARM cross toolchain."
[email protected]f2826b6a2012-11-15 01:06:26561 arm_list=
562fi
563
Tom Anderson8e0a484e2018-06-14 22:47:02564if [ "$do_inst_nacl" = "1" ]; then
[email protected]713eac62014-06-02 23:10:03565 echo "Including NaCl, NaCl toolchain, NaCl ports dependencies."
[email protected]565416362014-01-16 21:26:47566else
[email protected]713eac62014-06-02 23:10:03567 echo "Skipping NaCl, NaCl toolchain, NaCl ports dependencies."
[email protected]565416362014-01-16 21:26:47568 nacl_list=
569fi
570
Tom Andersone9883cd2018-06-20 00:32:21571filtered_backwards_compatible_list=
572if [ "$do_inst_backwards_compatible" = "1" ]; then
573 echo "Including backwards compatible packages."
574 for package in ${backwards_compatible_list}; do
575 if package_exists ${package}; then
576 filtered_backwards_compatible_list+=" ${package}"
577 fi
578 done
579fi
580
johnme4bd10302015-01-06 11:25:52581# The `sort -r -s -t: -k2` sorts all the :i386 packages to the front, to avoid
582# confusing dpkg-query (crbug.com/446172).
[email protected]565416362014-01-16 21:26:47583packages="$(
Tom Andersone9883cd2018-06-20 00:32:21584 echo "${dev_list} ${lib_list} ${dbg_list} ${lib32_list} ${arm_list}" \
585 "${nacl_list}" ${filtered_backwards_compatible_list} | tr " " "\n" | \
586 sort -u | sort -r -s -t: -k2 | tr "\n" " "
[email protected]565416362014-01-16 21:26:47587)"
[email protected]ba48c4ca2013-10-25 16:11:46588
589if [ 1 -eq "${do_quick_check-0}" ] ; then
thomasanderson73b3a4412016-11-18 23:16:07590 if ! missing_packages="$(dpkg-query -W -f ' ' ${packages} 2>&1)"; then
591 # Distinguish between packages that actually aren't available to the
592 # system (i.e. not in any repo) and packages that just aren't known to
593 # dpkg (i.e. managed by apt).
594 missing_packages="$(echo "${missing_packages}" | awk '{print $NF}')"
595 not_installed=""
596 unknown=""
597 for p in ${missing_packages}; do
598 if apt-cache show ${p} > /dev/null 2>&1; then
599 not_installed="${p}\n${not_installed}"
600 else
601 unknown="${p}\n${unknown}"
[email protected]ba48c4ca2013-10-25 16:11:46602 fi
thomasanderson73b3a4412016-11-18 23:16:07603 done
604 if [ -n "${not_installed}" ]; then
[email protected]ba48c4ca2013-10-25 16:11:46605 echo "WARNING: The following packages are not installed:"
thomasanderson73b3a4412016-11-18 23:16:07606 echo -e "${not_installed}" | sed -e "s/^/ /"
607 fi
608 if [ -n "${unknown}" ]; then
609 echo "WARNING: The following packages are unknown to your system"
610 echo "(maybe missing a repo or need to 'sudo apt-get update'):"
611 echo -e "${unknown}" | sed -e "s/^/ /"
[email protected]ba48c4ca2013-10-25 16:11:46612 fi
613 exit 1
614 fi
615 exit 0
616fi
617
Tom Anderson8e0a484e2018-06-14 22:47:02618if [ "$do_inst_lib32" = "1" ] || [ "$do_inst_nacl" = "1" ]; then
thomasanderson05c40292017-03-28 19:28:45619 sudo dpkg --add-architecture i386
johnme49bb458a2014-11-27 15:45:31620fi
sbc42564092015-04-01 01:01:28621sudo apt-get update
[email protected]e041ed12009-03-10 16:43:01622
623# We initially run "apt-get" with the --reinstall option and parse its output.
624# This way, we can find all the packages that need to be newly installed
625# without accidentally promoting any packages from "auto" to "manual".
626# We then re-run "apt-get" with just the list of missing packages.
627echo "Finding missing packages..."
[email protected]757c2962012-03-15 19:05:18628# Intentionally leaving $packages unquoted so it's more readable.
[email protected]b6e064522009-08-10 18:47:51629echo "Packages required: " $packages
630echo
[email protected]79a9d2962009-08-06 21:10:58631new_list_cmd="sudo apt-get install --reinstall $(echo $packages)"
[email protected]c3d8b152013-05-10 10:10:03632if new_list="$(yes n | LANGUAGE=en LANG=C $new_list_cmd)"; then
[email protected]b6e064522009-08-10 18:47:51633 # We probably never hit this following line.
thakis3e861de2016-06-14 14:24:01634 echo "No missing packages, and the packages are up to date."
[email protected]b62f11e72010-05-03 17:20:45635elif [ $? -eq 1 ]; then
[email protected]79a9d2962009-08-06 21:10:58636 # We expect apt-get to have exit status of 1.
[email protected]757c2962012-03-15 19:05:18637 # This indicates that we cancelled the install with "yes n|".
[email protected]b6e064522009-08-10 18:47:51638 new_list=$(echo "$new_list" |
[email protected]79a9d2962009-08-06 21:10:58639 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d')
[email protected]b6e064522009-08-10 18:47:51640 new_list=$(echo "$new_list" | sed 's/ *$//')
641 if [ -z "$new_list" ] ; then
thakis3e861de2016-06-14 14:24:01642 echo "No missing packages, and the packages are up to date."
[email protected]b6e064522009-08-10 18:47:51643 else
644 echo "Installing missing packages: $new_list."
[email protected]e2544ed42012-04-23 04:48:31645 sudo apt-get install ${do_quietly-} ${new_list}
[email protected]b6e064522009-08-10 18:47:51646 fi
647 echo
[email protected]79a9d2962009-08-06 21:10:58648else
649 # An apt-get exit status of 100 indicates that a real error has occurred.
[email protected]e041ed12009-03-10 16:43:01650
[email protected]79a9d2962009-08-06 21:10:58651 # I am intentionally leaving out the '"'s around new_list_cmd,
652 # as this makes it easier to cut and paste the output
[email protected]79a9d2962009-08-06 21:10:58653 echo "The following command failed: " ${new_list_cmd}
654 echo
655 echo "It produces the following output:"
656 yes n | $new_list_cmd || true
657 echo
658 echo "You will have to install the above packages yourself."
659 echo
660 exit 100
661fi
[email protected]e041ed12009-03-10 16:43:01662
[email protected]d96cc3472013-09-19 00:53:30663# Install the Chrome OS default fonts. This must go after running
664# apt-get, since install-chromeos-fonts depends on curl.
Tom Anderson8e0a484e2018-06-14 22:47:02665if [ "$do_inst_chromeos_fonts" != "0" ]; then
[email protected]d96cc3472013-09-19 00:53:30666 echo
667 echo "Installing Chrome OS fonts."
668 dir=`echo $0 | sed -r -e 's/\/[^/]+$//'`
669 if ! sudo $dir/linux/install-chromeos-fonts.py; then
670 echo "ERROR: The installation of the Chrome OS default fonts failed."
671 if [ `stat -f -c %T $dir` == "nfs" ]; then
672 echo "The reason is that your repo is installed on a remote file system."
673 else
674 echo "This is expected if your repo is installed on a remote file system."
675 fi
676 echo "It is recommended to install your repo on a local file system."
677 echo "You can skip the installation of the Chrome OS default founts with"
678 echo "the command line option: --no-chromeos-fonts."
679 exit 1
680 fi
681else
682 echo "Skipping installation of Chrome OS fonts."
683fi
684
thomasanderson5ef5c3d2016-12-08 01:59:19685echo "Installing locales."
686CHROMIUM_LOCALES="da_DK.UTF-8 fr_FR.UTF-8 he_IL.UTF-8 zh_TW.UTF-8"
687LOCALE_GEN=/etc/locale.gen
688if [ -e ${LOCALE_GEN} ]; then
689 OLD_LOCALE_GEN="$(cat /etc/locale.gen)"
690 for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do
691 sudo sed -i "s/^# ${CHROMIUM_LOCALE}/${CHROMIUM_LOCALE}/" ${LOCALE_GEN}
692 done
693 # Regenerating locales can take a while, so only do it if we need to.
694 if (echo "${OLD_LOCALE_GEN}" | cmp -s ${LOCALE_GEN}); then
695 echo "Locales already up-to-date."
696 else
697 sudo locale-gen
698 fi
699else
700 for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do
701 sudo locale-gen ${CHROMIUM_LOCALE}
702 done
703fi