blob: 30331bcb71525efa46c9d57ac26f223443f78dc6 [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
Elliott Friedman91f373e2019-04-16 18:27:1732# Build list of apt packages in dpkg --get-selections format.
33build_apt_package_list() {
34 echo "Building apt package list." >&2
35 apt-cache dumpavail | \
36 python -c '\
Raul Tambre9e24293b2019-05-12 06:11:0737 from __future__ import print_function; \
Elliott Friedman91f373e2019-04-16 18:27:1738 import re,sys; \
39 o = sys.stdin.read(); \
40 p = {"i386": ":i386"}; \
41 f = re.M | re.S; \
42 r = re.compile(r"^Package: (.+?)$.+?^Architecture: (.+?)$", f); \
43 m = ["%s%s" % (x, p.get(y, "")) for x, y in re.findall(r, o)]; \
Raul Tambre9e24293b2019-05-12 06:11:0744 print("\n".join(m))'
Elliott Friedman91f373e2019-04-16 18:27:1745}
46
[email protected]4fc00712013-05-29 23:11:2047# Checks whether a particular package is available in the repos.
Elliott Friedman91f373e2019-04-16 18:27:1748# Uses pre-formatted ${apt_package_list}.
[email protected]4fc00712013-05-29 23:11:2049# USAGE: $ package_exists <package name>
50package_exists() {
Elliott Friedman91f373e2019-04-16 18:27:1751 if [ -z "${apt_package_list}" ]; then
52 echo "Call build_apt_package_list() prior to calling package_exists()" >&2
53 apt_package_list=$(build_apt_package_list)
54 fi
Tom Anderson17d6cdd2017-11-28 04:13:2555 # 'apt-cache search' takes a regex string, so eg. the +'s in packages like
56 # "libstdc++" need to be escaped.
57 local escaped="$(echo $1 | sed 's/[\~\+\.\:-]/\\&/g')"
Elliott Friedman91f373e2019-04-16 18:27:1758 [ ! -z "$(grep "^${escaped}$" <<< "${apt_package_list}")" ]
[email protected]4fc00712013-05-29 23:11:2059}
60
[email protected]fbeddf22014-01-17 23:59:0161# These default to on because (some) bots need them and it keeps things
62# simple for the bot setup if all bots just run the script in its default
63# mode. Developers who don't want stuff they don't need installed on their
64# own workstations can pass --no-arm --no-nacl when running the script.
65do_inst_arm=1
66do_inst_nacl=1
67
Tom Anderson8e0a484e2018-06-14 22:47:0268while [ "$1" != "" ]
[email protected]1eae2bfb2010-01-26 18:17:5369do
70 case "$1" in
Tom Andersone9883cd2018-06-20 00:32:2171 --syms) do_inst_syms=1;;
72 --no-syms) do_inst_syms=0;;
73 --lib32) do_inst_lib32=1;;
74 --arm) do_inst_arm=1;;
75 --no-arm) do_inst_arm=0;;
76 --chromeos-fonts) do_inst_chromeos_fonts=1;;
77 --no-chromeos-fonts) do_inst_chromeos_fonts=0;;
78 --nacl) do_inst_nacl=1;;
79 --no-nacl) do_inst_nacl=0;;
80 --backwards-compatible) do_inst_backwards_compatible=1;;
81 --no-backwards-compatible) do_inst_backwards_compatible=0;;
82 --add-cross-tool-repo) add_cross_tool_repo=1;;
83 --no-prompt) do_default=1
84 do_quietly="-qq --assume-yes"
[email protected]e2544ed42012-04-23 04:48:3185 ;;
Tom Andersone9883cd2018-06-20 00:32:2186 --quick-check) do_quick_check=1;;
87 --unsupported) do_unsupported=1;;
[email protected]1eae2bfb2010-01-26 18:17:5388 *) usage;;
89 esac
90 shift
91done
92
Tom Anderson8e0a484e2018-06-14 22:47:0293if [ "$do_inst_arm" = "1" ]; then
johnme49bb458a2014-11-27 15:45:3194 do_inst_lib32=1
95fi
96
[email protected]0febc9b2014-05-22 20:07:1997# Check for lsb_release command in $PATH
98if ! which lsb_release > /dev/null; then
99 echo "ERROR: lsb_release not found in \$PATH" >&2
100 exit 1;
101fi
[email protected]f2826b6a2012-11-15 01:06:26102
thomasandersondfefc6c02017-05-04 01:29:11103distro_codename=$(lsb_release --codename --short)
104distro_id=$(lsb_release --id --short)
Marcin WiÄ…cek73d9ec52019-04-24 21:40:17105supported_codenames="(trusty|xenial|bionic|disco)"
thomasandersondfefc6c02017-05-04 01:29:11106supported_ids="(Debian)"
[email protected]ba48c4ca2013-10-25 16:11:46107if [ 0 -eq "${do_unsupported-0}" ] && [ 0 -eq "${do_quick_check-0}" ] ; then
thomasandersondfefc6c02017-05-04 01:29:11108 if [[ ! $distro_codename =~ $supported_codenames &&
109 ! $distro_id =~ $supported_ids ]]; then
thomasanderson05c40292017-03-28 19:28:45110 echo -e "ERROR: The only supported distros are\n" \
Marcin WiÄ…cek73d9ec52019-04-24 21:40:17111 "\tUbuntu 14.04 LTS (trusty with EoL April 2022)\n" \
112 "\tUbuntu 16.04 LTS (xenial with EoL April 2024)\n" \
113 "\tUbuntu 18.04 LTS (bionic with EoL April 2028)\n" \
114 "\tUbuntu 19.04 (disco)\n" \
thomasandersondfefc6c02017-05-04 01:29:11115 "\tDebian 8 (jessie) or later" >&2
anthonyvd2ae919e52016-11-21 19:47:12116 exit 1
[email protected]fe63a022013-01-15 22:11:47117 fi
[email protected]cf1df402008-10-31 21:45:30118
[email protected]fe63a022013-01-15 22:11:47119 if ! uname -m | egrep -q "i686|x86_64"; then
anthonyvd2ae919e52016-11-21 19:47:12120 echo "Only x86 architectures are currently supported" >&2
[email protected]fe63a022013-01-15 22:11:47121 exit
122 fi
[email protected]e041ed12009-03-10 16:43:01123fi
124
[email protected]ba48c4ca2013-10-25 16:11:46125if [ "x$(id -u)" != x0 ] && [ 0 -eq "${do_quick_check-0}" ]; then
[email protected]e041ed12009-03-10 16:43:01126 echo "Running as non-root user."
127 echo "You might have to enter your password one or more times for 'sudo'."
[email protected]8ada8c52009-03-10 21:53:08128 echo
[email protected]e041ed12009-03-10 16:43:01129fi
130
Elliott Friedman91f373e2019-04-16 18:27:17131if [ "$do_inst_lib32" = "1" ] || [ "$do_inst_nacl" = "1" ]; then
132 sudo dpkg --add-architecture i386
133fi
134sudo apt-get update
135
136# Populate ${apt_package_list} for package_exists() parsing.
137apt_package_list=$(build_apt_package_list)
138
[email protected]fdc6bf52010-06-07 22:01:57139# Packages needed for chromeos only
Tom Anderson6b2b2ad52018-02-22 23:28:14140chromeos_dev_list="libbluetooth-dev libxkbcommon-dev"
141
142if package_exists realpath; then
143 chromeos_dev_list="${chromeos_dev_list} realpath"
144fi
[email protected]fdc6bf52010-06-07 22:01:57145
[email protected]b61f6882013-11-14 20:41:41146# Packages needed for development
thomasanderson20032a5c2017-03-02 00:28:20147dev_list="\
Tom Anderson2b8a8362018-08-01 17:41:34148 binutils
thomasanderson20032a5c2017-03-02 00:28:20149 bison
George Burgess IV3d20a812018-05-10 22:24:17150 bzip2
thomasanderson20032a5c2017-03-02 00:28:20151 cdbs
152 curl
Tom Anderson8bfb0b02018-02-17 00:44:15153 dbus-x11
thomasanderson20032a5c2017-03-02 00:28:20154 dpkg-dev
155 elfutils
156 devscripts
157 fakeroot
158 flex
thomasanderson20032a5c2017-03-02 00:28:20159 git-core
thomasanderson20032a5c2017-03-02 00:28:20160 gperf
Tim Brown06ee43a2018-02-08 18:42:12161 libappindicator3-dev
thomasanderson20032a5c2017-03-02 00:28:20162 libasound2-dev
Tom Anderson13200012018-09-10 22:29:02163 libatspi2.0-dev
thomasanderson20032a5c2017-03-02 00:28:20164 libbrlapi-dev
thomasanderson20032a5c2017-03-02 00:28:20165 libbz2-dev
166 libcairo2-dev
167 libcap-dev
Daniel Bratell8cc92d372019-03-12 16:42:06168 libc6-dev
thomasanderson20032a5c2017-03-02 00:28:20169 libcups2-dev
170 libcurl4-gnutls-dev
171 libdrm-dev
172 libelf-dev
173 libffi-dev
Tom Andersond4ea2522018-03-01 20:34:38174 libgbm-dev
thomasanderson20032a5c2017-03-02 00:28:20175 libglib2.0-dev
176 libglu1-mesa-dev
177 libgnome-keyring-dev
thomasanderson20032a5c2017-03-02 00:28:20178 libgtk-3-dev
179 libkrb5-dev
180 libnspr4-dev
181 libnss3-dev
182 libpam0g-dev
183 libpci-dev
184 libpulse-dev
185 libsctp-dev
186 libspeechd-dev
187 libsqlite3-dev
188 libssl-dev
189 libudev-dev
190 libwww-perl
191 libxslt1-dev
192 libxss-dev
193 libxt-dev
194 libxtst-dev
Andrew Grievee41aeae2017-08-21 20:53:21195 locales
thomasanderson20032a5c2017-03-02 00:28:20196 openbox
Nico Webera9fa6a72018-02-23 18:26:02197 p7zip
thomasanderson20032a5c2017-03-02 00:28:20198 patch
199 perl
200 pkg-config
201 python
202 python-cherrypy3
203 python-crypto
204 python-dev
205 python-numpy
206 python-opencv
207 python-openssl
208 python-psutil
209 python-yaml
210 rpm
211 ruby
212 subversion
Daniel Bratellbec626a2018-06-26 17:40:52213 uuid-dev
thomasanderson20032a5c2017-03-02 00:28:20214 wdiff
Tom Andersond79de41d2017-08-08 00:23:23215 x11-utils
thomasanderson20032a5c2017-03-02 00:28:20216 xcompmgr
George Burgess IV3d20a812018-05-10 22:24:17217 xz-utils
thomasanderson20032a5c2017-03-02 00:28:20218 zip
219 $chromeos_dev_list
220"
[email protected]fdc6bf52010-06-07 22:01:57221
[email protected]f16aabf2012-08-15 21:00:14222# 64-bit systems need a minimum set of 32-bit compat packages for the pre-built
[email protected]f8ceadb2014-08-18 12:30:23223# NaCl binaries.
ki.stfu0a79d6992015-09-17 07:27:12224if file -L /sbin/init | grep -q 'ELF 64-bit'; then
[email protected]d93d68b12012-10-15 06:39:53225 dev_list="${dev_list} libc6-i386 lib32gcc1 lib32stdc++6"
[email protected]f16aabf2012-08-15 21:00:14226fi
227
[email protected]fdc6bf52010-06-07 22:01:57228# Run-time libraries required by chromeos only
[email protected]ba48c4ca2013-10-25 16:11:46229chromeos_lib_list="libpulse0 libbz2-1.0"
[email protected]e041ed12009-03-10 16:43:01230
Yves Gereye1fe0df2018-06-08 08:01:47231# List of required run-time libraries
232common_lib_list="\
Tim Brown06ee43a2018-02-08 18:42:12233 libappindicator3-1
234 libasound2
thomasanderson20032a5c2017-03-02 00:28:20235 libatk1.0-0
Tom Anderson13200012018-09-10 22:29:02236 libatspi2.0-0
thomasanderson20032a5c2017-03-02 00:28:20237 libc6
thomasanderson20032a5c2017-03-02 00:28:20238 libcairo2
239 libcap2
240 libcups2
241 libexpat1
242 libffi6
243 libfontconfig1
244 libfreetype6
245 libglib2.0-0
246 libgnome-keyring0
thomasanderson20032a5c2017-03-02 00:28:20247 libgtk-3-0
248 libpam0g
249 libpango1.0-0
250 libpci3
251 libpcre3
252 libpixman-1-0
253 libspeechd2
254 libstdc++6
255 libsqlite3-0
Tom Andersonf8a0c662018-06-14 23:54:14256 libuuid1
Scott Violetdd7e2372018-04-12 01:11:26257 libwayland-egl1-mesa
thomasanderson20032a5c2017-03-02 00:28:20258 libx11-6
259 libx11-xcb1
260 libxau6
261 libxcb1
262 libxcomposite1
263 libxcursor1
264 libxdamage1
265 libxdmcp6
266 libxext6
267 libxfixes3
268 libxi6
269 libxinerama1
270 libxrandr2
271 libxrender1
272 libxtst6
273 zlib1g
Yves Gereye1fe0df2018-06-08 08:01:47274"
275
276# Full list of required run-time libraries
277lib_list="\
278 $common_lib_list
thomasanderson20032a5c2017-03-02 00:28:20279 $chromeos_lib_list
280"
[email protected]e041ed12009-03-10 16:43:01281
johnme49bb458a2014-11-27 15:45:31282# 32-bit libraries needed e.g. to compile V8 snapshot for Android or armhf
Tanin Na Nakorn6cbe32e52017-05-30 19:37:04283lib32_list="linux-libc-dev:i386 libpci3:i386"
johnme49bb458a2014-11-27 15:45:31284
Tom Andersondd47ad32018-03-21 19:30:19285# 32-bit libraries needed for a 32-bit build
286lib32_list="$lib32_list libx11-xcb1:i386"
287
Tom Andersone9883cd2018-06-20 00:32:21288# Packages that have been removed from this script. Regardless of configuration
289# or options passed to this script, whenever a package is removed, it should be
290# added here.
291backwards_compatible_list="\
292 7za
293 fonts-indic
294 fonts-ipafont
295 fonts-stix
296 fonts-thai-tlwg
297 fonts-tlwg-garuda
Nico Weber255521f2019-08-21 18:07:22298 g++
299 git-svn
Tom Andersone9883cd2018-06-20 00:32:21300 language-pack-da
301 language-pack-fr
302 language-pack-he
303 language-pack-zh-hant
Tom Anderson287339e2018-08-22 21:52:02304 libappindicator-dev
305 libappindicator1
Tom Andersone9883cd2018-06-20 00:32:21306 libdconf-dev
Tom Andersone9883cd2018-06-20 00:32:21307 libdconf1
308 libdconf1:i386
309 libexif-dev
310 libexif12
311 libexif12:i386
312 libgbm-dev
313 libgconf-2-4:i386
314 libgconf2-dev
315 libgl1-mesa-dev
316 libgl1-mesa-glx:i386
317 libgles2-mesa-dev
Tom Anderson99ffaae2018-11-29 00:08:31318 libgtk-3-0:i386
Tom Anderson287339e2018-08-22 21:52:02319 libgtk2.0-0
320 libgtk2.0-0:i386
321 libgtk2.0-dev
Tom Andersone9883cd2018-06-20 00:32:21322 mesa-common-dev
323 msttcorefonts
324 ttf-dejavu-core
325 ttf-indic-fonts
326 ttf-kochi-gothic
327 ttf-kochi-mincho
328 ttf-mscorefonts-installer
329 xfonts-mathml
330"
331case $distro_codename in
332 trusty)
333 backwards_compatible_list+=" \
334 libgbm-dev-lts-trusty
335 libgl1-mesa-dev-lts-trusty
336 libgl1-mesa-glx-lts-trusty:i386
337 libgles2-mesa-dev-lts-trusty
338 mesa-common-dev-lts-trusty"
339 ;;
340 xenial)
341 backwards_compatible_list+=" \
342 libgbm-dev-lts-xenial
343 libgl1-mesa-dev-lts-xenial
344 libgl1-mesa-glx-lts-xenial:i386
345 libgles2-mesa-dev-lts-xenial
346 mesa-common-dev-lts-xenial"
347 ;;
348esac
349
[email protected]3f85dac32013-10-29 02:38:46350# arm cross toolchain packages needed to build chrome on armhf
thomasanderson4e3d30fe2016-12-07 18:58:34351EM_REPO="deb http://emdebian.org/tools/debian/ jessie main"
352EM_SOURCE=$(cat <<EOF
353# Repo added by Chromium $0
354${EM_REPO}
355# deb-src http://emdebian.org/tools/debian/ jessie main
356EOF
357)
358EM_ARCHIVE_KEY_FINGER="084C6C6F39159EDB67969AA87DE089671804772E"
359GPP_ARM_PACKAGE="g++-arm-linux-gnueabihf"
thomasandersondfefc6c02017-05-04 01:29:11360case $distro_codename in
kjellander95504ae2017-03-30 12:30:31361 jessie)
thomasanderson4e3d30fe2016-12-07 18:58:34362 eval $(apt-config shell APT_SOURCESDIR 'Dir::Etc::sourceparts/d')
363 CROSSTOOLS_LIST="${APT_SOURCESDIR}/crosstools.list"
364 arm_list="libc6-dev:armhf
365 linux-libc-dev:armhf"
Tom Anderson8e0a484e2018-06-14 22:47:02366 if [ "$do_inst_arm" = "1" ]; then
thomasanderson4e3d30fe2016-12-07 18:58:34367 if $(dpkg-query -W ${GPP_ARM_PACKAGE} &>/dev/null); then
368 arm_list+=" ${GPP_ARM_PACKAGE}"
369 else
Tom Anderson8e0a484e2018-06-14 22:47:02370 if [ "${add_cross_tool_repo}" = "1" ]; then
thomasanderson4e3d30fe2016-12-07 18:58:34371 gpg --keyserver pgp.mit.edu --recv-keys ${EM_ARCHIVE_KEY_FINGER}
372 gpg -a --export ${EM_ARCHIVE_KEY_FINGER} | sudo apt-key add -
373 if ! grep "^${EM_REPO}" "${CROSSTOOLS_LIST}" &>/dev/null; then
374 echo "${EM_SOURCE}" | sudo tee -a "${CROSSTOOLS_LIST}" >/dev/null
375 fi
376 arm_list+=" ${GPP_ARM_PACKAGE}"
Tom Anderson8e0a484e2018-06-14 22:47:02377 else
378 echo "The Debian Cross-toolchains repository is necessary to"
379 echo "cross-compile Chromium for arm."
380 echo "Rerun with --add-deb-cross-tool-repo to have it added for you."
thomasanderson4e3d30fe2016-12-07 18:58:34381 fi
382 fi
383 fi
384 ;;
thomasandersondfefc6c02017-05-04 01:29:11385 # All necessary ARM packages are available on the default repos on
386 # Debian 9 and later.
kjellander95504ae2017-03-30 12:30:31387 *)
Tom Anderson81e7f1792017-11-11 03:56:33388 arm_list="libc6-dev-armhf-cross
thomasanderson4e3d30fe2016-12-07 18:58:34389 linux-libc-dev-armhf-cross
390 ${GPP_ARM_PACKAGE}"
391 ;;
392esac
[email protected]31a605532011-08-23 22:27:35393
sbcb5d4ded2015-04-01 17:49:03394# Work around for dependency issue Ubuntu/Trusty: http://crbug.com/435056
thomasandersondfefc6c02017-05-04 01:29:11395case $distro_codename in
friedmanbf8b90a2016-04-21 01:15:48396 trusty)
397 arm_list+=" g++-4.8-multilib-arm-linux-gnueabihf
398 gcc-4.8-multilib-arm-linux-gnueabihf"
399 ;;
Marcin WiÄ…cek73d9ec52019-04-24 21:40:17400 xenial|bionic)
krasineef3d4b2016-04-22 00:52:18401 arm_list+=" g++-5-multilib-arm-linux-gnueabihf
402 gcc-5-multilib-arm-linux-gnueabihf
403 gcc-arm-linux-gnueabihf"
404 ;;
Marcin WiÄ…cek73d9ec52019-04-24 21:40:17405 disco)
406 arm_list+=" g++-9-multilib-arm-linux-gnueabihf
407 gcc-9-multilib-arm-linux-gnueabihf
408 gcc-arm-linux-gnueabihf"
409 ;;
friedmanbf8b90a2016-04-21 01:15:48410esac
sbcb5d4ded2015-04-01 17:49:03411
[email protected]713eac62014-06-02 23:10:03412# Packages to build NaCl, its toolchains, and its ports.
Brad Nelson5e59c2c2014-09-06 06:18:45413naclports_list="ant autoconf bison cmake gawk intltool xutils-dev xsltproc"
thomasanderson20032a5c2017-03-02 00:28:20414nacl_list="\
415 g++-mingw-w64-i686
416 lib32z1-dev
417 libasound2:i386
418 libcap2:i386
419 libelf-dev:i386
420 libfontconfig1:i386
thomasanderson20032a5c2017-03-02 00:28:20421 libglib2.0-0:i386
422 libgpm2:i386
thomasanderson20032a5c2017-03-02 00:28:20423 libncurses5:i386
424 lib32ncurses5-dev
425 libnss3:i386
426 libpango1.0-0:i386
thomasandersondfefc6c02017-05-04 01:29:11427 libssl-dev:i386
thomasanderson20032a5c2017-03-02 00:28:20428 libtinfo-dev
429 libtinfo-dev:i386
430 libtool
Tom Andersonf8a0c662018-06-14 23:54:14431 libuuid1:i386
thomasanderson20032a5c2017-03-02 00:28:20432 libxcomposite1:i386
433 libxcursor1:i386
434 libxdamage1:i386
435 libxi6:i386
436 libxrandr2:i386
437 libxss1:i386
438 libxtst6:i386
439 texinfo
440 xvfb
441 ${naclports_list}
442"
[email protected]419a9a62014-06-19 18:26:18443
Tom Anderson0524b2b72017-12-11 20:39:18444if package_exists libssl1.1; then
445 nacl_list="${nacl_list} libssl1.1:i386"
446elif package_exists libssl1.0.2; then
thomasandersondfefc6c02017-05-04 01:29:11447 nacl_list="${nacl_list} libssl1.0.2:i386"
Tom Anderson0524b2b72017-12-11 20:39:18448else
449 nacl_list="${nacl_list} libssl1.0.0:i386"
thomasandersondfefc6c02017-05-04 01:29:11450fi
451
[email protected]757c2962012-03-15 19:05:18452# Some package names have changed over time
Tom Anderson0524b2b72017-12-11 20:39:18453if package_exists libpng16-16; then
marcin73929a72017-01-04 22:04:58454 lib_list="${lib_list} libpng16-16"
Tom Anderson0524b2b72017-12-11 20:39:18455else
456 lib_list="${lib_list} libpng12-0"
marcin73929a72017-01-04 22:04:58457fi
Tom Anderson96a2efc2018-06-14 01:12:14458if package_exists libnspr4; then
[email protected]1a0f64a2011-05-20 17:53:55459 lib_list="${lib_list} libnspr4 libnss3"
[email protected]757c2962012-03-15 19:05:18460else
[email protected]757c2962012-03-15 19:05:18461 lib_list="${lib_list} libnspr4-0d libnss3-1d"
462fi
[email protected]4fc00712013-05-29 23:11:20463if package_exists libjpeg-dev; then
[email protected]9e895962013-05-21 08:26:42464 dev_list="${dev_list} libjpeg-dev"
[email protected]b11411c2012-03-21 22:09:41465else
[email protected]9e895962013-05-21 08:26:42466 dev_list="${dev_list} libjpeg62-dev"
[email protected]b11411c2012-03-21 22:09:41467fi
[email protected]4fc00712013-05-29 23:11:20468if package_exists libudev1; then
[email protected]9e895962013-05-21 08:26:42469 dev_list="${dev_list} libudev1"
[email protected]ab9e69082014-06-05 15:28:52470 nacl_list="${nacl_list} libudev1:i386"
[email protected]9e895962013-05-21 08:26:42471else
472 dev_list="${dev_list} libudev0"
[email protected]ab9e69082014-06-05 15:28:52473 nacl_list="${nacl_list} libudev0:i386"
[email protected]9e895962013-05-21 08:26:42474fi
[email protected]3ea42912013-09-06 06:23:57475if package_exists libbrlapi0.6; then
476 dev_list="${dev_list} libbrlapi0.6"
477else
478 dev_list="${dev_list} libbrlapi0.5"
479fi
Tom Anderson0524b2b72017-12-11 20:39:18480if package_exists apache2.2-bin; then
halton.huo3e728c42016-01-20 05:12:23481 dev_list="${dev_list} apache2.2-bin"
Tom Anderson0524b2b72017-12-11 20:39:18482else
483 dev_list="${dev_list} apache2-bin"
halton.huo3e728c42016-01-20 05:12:23484fi
Marcin Wiacekd7577c32018-04-30 19:12:51485if package_exists libav-tools; then
486 dev_list="${dev_list} libav-tools"
487fi
488if package_exists php7.2-cgi; then
489 dev_list="${dev_list} php7.2-cgi libapache2-mod-php7.2"
490elif package_exists php7.1-cgi; then
marcin38933dd2017-10-30 00:05:52491 dev_list="${dev_list} php7.1-cgi libapache2-mod-php7.1"
492elif package_exists php7.0-cgi; then
vadimsh278ff0662016-05-19 00:06:28493 dev_list="${dev_list} php7.0-cgi libapache2-mod-php7.0"
krasineef3d4b2016-04-22 00:52:18494else
vadimsh278ff0662016-05-19 00:06:28495 dev_list="${dev_list} php5-cgi libapache2-mod-php5"
krasineef3d4b2016-04-22 00:52:18496fi
[email protected]757c2962012-03-15 19:05:18497
[email protected]dc099772013-09-30 22:06:58498# Some packages are only needed if the distribution actually supports
[email protected]757c2962012-03-15 19:05:18499# installing them.
[email protected]4fc00712013-05-29 23:11:20500if package_exists appmenu-gtk; then
[email protected]757c2962012-03-15 19:05:18501 lib_list="$lib_list appmenu-gtk"
[email protected]4da8fad2011-04-11 18:42:42502fi
503
Tom Anderson81e7f1792017-11-11 03:56:33504# Cross-toolchain strip is needed for building the sysroots.
505if package_exists binutils-arm-linux-gnueabihf; then
506 dev_list="${dev_list} binutils-arm-linux-gnueabihf"
507fi
508if package_exists binutils-aarch64-linux-gnu; then
509 dev_list="${dev_list} binutils-aarch64-linux-gnu"
510fi
511if package_exists binutils-mipsel-linux-gnu; then
512 dev_list="${dev_list} binutils-mipsel-linux-gnu"
513fi
514if package_exists binutils-mips64el-linux-gnuabi64; then
515 dev_list="${dev_list} binutils-mips64el-linux-gnuabi64"
516fi
517
johnme49bb458a2014-11-27 15:45:31518# When cross building for arm/Android on 64-bit systems the host binaries
519# that are part of v8 need to be compiled with -m32 which means
520# that basic multilib support is needed.
ki.stfu0a79d6992015-09-17 07:27:12521if file -L /sbin/init | grep -q 'ELF 64-bit'; then
johnme49bb458a2014-11-27 15:45:31522 # gcc-multilib conflicts with the arm cross compiler (at least in trusty) but
523 # g++-X.Y-multilib gives us the 32-bit support that we need. Find out the
524 # appropriate value of X and Y by seeing what version the current
525 # distribution's g++-multilib package depends on.
526 multilib_package=$(apt-cache depends g++-multilib --important | \
527 grep -E --color=never --only-matching '\bg\+\+-[0-9.]+-multilib\b')
528 lib32_list="$lib32_list $multilib_package"
529fi
530
Tom Anderson8e0a484e2018-06-14 22:47:02531if [ "$do_inst_syms" = "1" ]; then
[email protected]ba48c4ca2013-10-25 16:11:46532 echo "Including debugging symbols."
Tom Anderson8206da9a2018-06-12 01:49:09533
534 # Debian is in the process of transitioning to automatic debug packages, which
535 # have the -dbgsym suffix (https://wiki.debian.org/AutomaticDebugPackages).
536 # Untransitioned packages have the -dbg suffix. And on some systems, neither
537 # will be available, so exclude the ones that are missing.
538 dbg_package_name() {
539 if package_exists "$1-dbgsym"; then
540 echo "$1-dbgsym"
541 elif package_exists "$1-dbg"; then
542 echo "$1-dbg"
543 fi
544 }
545
546 for package in "${common_lib_list}"; do
547 dbg_list="$dbg_list $(dbg_package_name ${package})"
548 done
549
550 # Debugging symbols packages not following common naming scheme
Tom Anderson8e0a484e2018-06-14 22:47:02551 if [ "$(dbg_package_name libstdc++6)" == "" ]; then
552 if package_exists libstdc++6-8-dbg; then
553 dbg_list="${dbg_list} libstdc++6-8-dbg"
554 elif package_exists libstdc++6-7-dbg; then
555 dbg_list="${dbg_list} libstdc++6-7-dbg"
556 elif package_exists libstdc++6-6-dbg; then
Tom Anderson8206da9a2018-06-12 01:49:09557 dbg_list="${dbg_list} libstdc++6-6-dbg"
Tom Anderson8e0a484e2018-06-14 22:47:02558 elif package_exists libstdc++6-5-dbg; then
559 dbg_list="${dbg_list} libstdc++6-5-dbg"
Tom Anderson8206da9a2018-06-12 01:49:09560 elif package_exists libstdc++6-4.9-dbg; then
561 dbg_list="${dbg_list} libstdc++6-4.9-dbg"
Tom Anderson8e0a484e2018-06-14 22:47:02562 elif package_exists libstdc++6-4.8-dbg; then
Tom Anderson8206da9a2018-06-12 01:49:09563 dbg_list="${dbg_list} libstdc++6-4.8-dbg"
Tom Anderson8e0a484e2018-06-14 22:47:02564 elif package_exists libstdc++6-4.7-dbg; then
565 dbg_list="${dbg_list} libstdc++6-4.7-dbg"
Tom Andersone9883cd2018-06-20 00:32:21566 elif package_exists libstdc++6-4.6-dbg; then
567 dbg_list="${dbg_list} libstdc++6-4.6-dbg"
Tom Anderson8206da9a2018-06-12 01:49:09568 fi
569 fi
Tom Anderson8e0a484e2018-06-14 22:47:02570 if [ "$(dbg_package_name libatk1.0-0)" == "" ]; then
Tom Anderson8206da9a2018-06-12 01:49:09571 dbg_list="$dbg_list $(dbg_package_name libatk1.0)"
572 fi
Tom Anderson8e0a484e2018-06-14 22:47:02573 if [ "$(dbg_package_name libpango1.0-0)" == "" ]; then
Tom Anderson8206da9a2018-06-12 01:49:09574 dbg_list="$dbg_list $(dbg_package_name libpango1.0-dev)"
575 fi
[email protected]8ada8c52009-03-10 21:53:08576else
[email protected]ba48c4ca2013-10-25 16:11:46577 echo "Skipping debugging symbols."
[email protected]8ada8c52009-03-10 21:53:08578 dbg_list=
579fi
580
Tom Anderson8e0a484e2018-06-14 22:47:02581if [ "$do_inst_lib32" = "1" ]; then
Tom Andersondd47ad32018-03-21 19:30:19582 echo "Including 32-bit libraries."
johnme49bb458a2014-11-27 15:45:31583else
Tom Andersondd47ad32018-03-21 19:30:19584 echo "Skipping 32-bit libraries."
johnme49bb458a2014-11-27 15:45:31585 lib32_list=
[email protected]9f28a9cf2012-12-17 23:31:40586fi
587
Tom Anderson8e0a484e2018-06-14 22:47:02588if [ "$do_inst_arm" = "1" ]; then
[email protected]ba48c4ca2013-10-25 16:11:46589 echo "Including ARM cross toolchain."
[email protected]f2826b6a2012-11-15 01:06:26590else
[email protected]ba48c4ca2013-10-25 16:11:46591 echo "Skipping ARM cross toolchain."
[email protected]f2826b6a2012-11-15 01:06:26592 arm_list=
593fi
594
Tom Anderson8e0a484e2018-06-14 22:47:02595if [ "$do_inst_nacl" = "1" ]; then
[email protected]713eac62014-06-02 23:10:03596 echo "Including NaCl, NaCl toolchain, NaCl ports dependencies."
[email protected]565416362014-01-16 21:26:47597else
[email protected]713eac62014-06-02 23:10:03598 echo "Skipping NaCl, NaCl toolchain, NaCl ports dependencies."
[email protected]565416362014-01-16 21:26:47599 nacl_list=
600fi
601
Tom Andersone9883cd2018-06-20 00:32:21602filtered_backwards_compatible_list=
603if [ "$do_inst_backwards_compatible" = "1" ]; then
604 echo "Including backwards compatible packages."
605 for package in ${backwards_compatible_list}; do
606 if package_exists ${package}; then
607 filtered_backwards_compatible_list+=" ${package}"
608 fi
609 done
610fi
611
johnme4bd10302015-01-06 11:25:52612# The `sort -r -s -t: -k2` sorts all the :i386 packages to the front, to avoid
613# confusing dpkg-query (crbug.com/446172).
[email protected]565416362014-01-16 21:26:47614packages="$(
Tom Andersone9883cd2018-06-20 00:32:21615 echo "${dev_list} ${lib_list} ${dbg_list} ${lib32_list} ${arm_list}" \
616 "${nacl_list}" ${filtered_backwards_compatible_list} | tr " " "\n" | \
617 sort -u | sort -r -s -t: -k2 | tr "\n" " "
[email protected]565416362014-01-16 21:26:47618)"
[email protected]ba48c4ca2013-10-25 16:11:46619
620if [ 1 -eq "${do_quick_check-0}" ] ; then
thomasanderson73b3a4412016-11-18 23:16:07621 if ! missing_packages="$(dpkg-query -W -f ' ' ${packages} 2>&1)"; then
622 # Distinguish between packages that actually aren't available to the
623 # system (i.e. not in any repo) and packages that just aren't known to
624 # dpkg (i.e. managed by apt).
625 missing_packages="$(echo "${missing_packages}" | awk '{print $NF}')"
626 not_installed=""
627 unknown=""
628 for p in ${missing_packages}; do
629 if apt-cache show ${p} > /dev/null 2>&1; then
630 not_installed="${p}\n${not_installed}"
631 else
632 unknown="${p}\n${unknown}"
[email protected]ba48c4ca2013-10-25 16:11:46633 fi
thomasanderson73b3a4412016-11-18 23:16:07634 done
635 if [ -n "${not_installed}" ]; then
[email protected]ba48c4ca2013-10-25 16:11:46636 echo "WARNING: The following packages are not installed:"
thomasanderson73b3a4412016-11-18 23:16:07637 echo -e "${not_installed}" | sed -e "s/^/ /"
638 fi
639 if [ -n "${unknown}" ]; then
640 echo "WARNING: The following packages are unknown to your system"
641 echo "(maybe missing a repo or need to 'sudo apt-get update'):"
642 echo -e "${unknown}" | sed -e "s/^/ /"
[email protected]ba48c4ca2013-10-25 16:11:46643 fi
644 exit 1
645 fi
646 exit 0
647fi
648
[email protected]e041ed12009-03-10 16:43:01649echo "Finding missing packages..."
[email protected]757c2962012-03-15 19:05:18650# Intentionally leaving $packages unquoted so it's more readable.
[email protected]b6e064522009-08-10 18:47:51651echo "Packages required: " $packages
652echo
Daniel Bratell8cc92d372019-03-12 16:42:06653query_cmd="apt-get --just-print install $(echo $packages)"
654if cmd_output="$(LANGUAGE=en LANG=C $query_cmd)"; then
655 new_list=$(echo "$cmd_output" |
656 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d' |
657 sed 's/ *$//')
658 upgrade_list=$(echo "$cmd_output" |
659 sed -e '1,/The following packages will be upgraded:/d;s/^ //;t;d' |
660 sed 's/ *$//')
661 if [ -z "$new_list" ] && [ -z "$upgrade_list" ]; then
thakis3e861de2016-06-14 14:24:01662 echo "No missing packages, and the packages are up to date."
[email protected]b6e064522009-08-10 18:47:51663 else
Daniel Bratell8cc92d372019-03-12 16:42:06664 echo "Installing and upgrading packages: $new_list $upgrade_list."
665 sudo apt-get install ${do_quietly-} ${new_list} ${upgrade_list}
[email protected]b6e064522009-08-10 18:47:51666 fi
667 echo
[email protected]79a9d2962009-08-06 21:10:58668else
669 # An apt-get exit status of 100 indicates that a real error has occurred.
[email protected]e041ed12009-03-10 16:43:01670
Daniel Bratell8cc92d372019-03-12 16:42:06671 # I am intentionally leaving out the '"'s around query_cmd,
[email protected]79a9d2962009-08-06 21:10:58672 # as this makes it easier to cut and paste the output
Daniel Bratell8cc92d372019-03-12 16:42:06673 echo "The following command failed: " ${query_cmd}
[email protected]79a9d2962009-08-06 21:10:58674 echo
Daniel Bratell8cc92d372019-03-12 16:42:06675 echo "It produced the following output:"
676 echo "$cmd_output"
[email protected]79a9d2962009-08-06 21:10:58677 echo
678 echo "You will have to install the above packages yourself."
679 echo
680 exit 100
681fi
[email protected]e041ed12009-03-10 16:43:01682
[email protected]d96cc3472013-09-19 00:53:30683# Install the Chrome OS default fonts. This must go after running
684# apt-get, since install-chromeos-fonts depends on curl.
Tom Anderson8e0a484e2018-06-14 22:47:02685if [ "$do_inst_chromeos_fonts" != "0" ]; then
[email protected]d96cc3472013-09-19 00:53:30686 echo
687 echo "Installing Chrome OS fonts."
688 dir=`echo $0 | sed -r -e 's/\/[^/]+$//'`
689 if ! sudo $dir/linux/install-chromeos-fonts.py; then
690 echo "ERROR: The installation of the Chrome OS default fonts failed."
691 if [ `stat -f -c %T $dir` == "nfs" ]; then
692 echo "The reason is that your repo is installed on a remote file system."
693 else
694 echo "This is expected if your repo is installed on a remote file system."
695 fi
696 echo "It is recommended to install your repo on a local file system."
697 echo "You can skip the installation of the Chrome OS default founts with"
698 echo "the command line option: --no-chromeos-fonts."
699 exit 1
700 fi
701else
702 echo "Skipping installation of Chrome OS fonts."
703fi
704
thomasanderson5ef5c3d2016-12-08 01:59:19705echo "Installing locales."
706CHROMIUM_LOCALES="da_DK.UTF-8 fr_FR.UTF-8 he_IL.UTF-8 zh_TW.UTF-8"
707LOCALE_GEN=/etc/locale.gen
708if [ -e ${LOCALE_GEN} ]; then
709 OLD_LOCALE_GEN="$(cat /etc/locale.gen)"
710 for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do
711 sudo sed -i "s/^# ${CHROMIUM_LOCALE}/${CHROMIUM_LOCALE}/" ${LOCALE_GEN}
712 done
713 # Regenerating locales can take a while, so only do it if we need to.
714 if (echo "${OLD_LOCALE_GEN}" | cmp -s ${LOCALE_GEN}); then
715 echo "Locales already up-to-date."
716 else
717 sudo locale-gen
718 fi
719else
720 for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do
721 sudo locale-gen ${CHROMIUM_LOCALE}
722 done
723fi