blob: 12ef7ebc63532b0919756953bfec4063e854dca9 [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)
Tom Anderson9f5be0792019-12-19 20:54:328# 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
Lei Zhangcd966ec2020-08-25 18:18:1455 # `grep` takes a regex string, so the +'s in package names, e.g. "libstdc++",
56 # need to be escaped.
Tom Anderson17d6cdd2017-11-28 04:13:2557 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
Junichi Uekawa05b8e2722020-06-12 06:18:44100 echo "try: sudo apt-get install lsb-release" >&2
[email protected]0febc9b2014-05-22 20:07:19101 exit 1;
102fi
[email protected]f2826b6a2012-11-15 01:06:26103
thomasandersondfefc6c02017-05-04 01:29:11104distro_codename=$(lsb_release --codename --short)
105distro_id=$(lsb_release --id --short)
Chisoon Jeong244004b2020-04-26 02:54:50106supported_codenames="(trusty|xenial|bionic|disco|eoan|focal)"
thomasandersondfefc6c02017-05-04 01:29:11107supported_ids="(Debian)"
[email protected]ba48c4ca2013-10-25 16:11:46108if [ 0 -eq "${do_unsupported-0}" ] && [ 0 -eq "${do_quick_check-0}" ] ; then
thomasandersondfefc6c02017-05-04 01:29:11109 if [[ ! $distro_codename =~ $supported_codenames &&
110 ! $distro_id =~ $supported_ids ]]; then
thomasanderson05c40292017-03-28 19:28:45111 echo -e "ERROR: The only supported distros are\n" \
Marcin WiÄ…cek73d9ec52019-04-24 21:40:17112 "\tUbuntu 14.04 LTS (trusty with EoL April 2022)\n" \
113 "\tUbuntu 16.04 LTS (xenial with EoL April 2024)\n" \
114 "\tUbuntu 18.04 LTS (bionic with EoL April 2028)\n" \
Chisoon Jeong244004b2020-04-26 02:54:50115 "\tUbuntu 20.04 LTS (focal with Eol April 2030)\n" \
Marcin WiÄ…cek73d9ec52019-04-24 21:40:17116 "\tUbuntu 19.04 (disco)\n" \
Marcin8dd4550a2019-11-21 08:42:36117 "\tUbuntu 19.10 (eoan)\n" \
thomasandersondfefc6c02017-05-04 01:29:11118 "\tDebian 8 (jessie) or later" >&2
anthonyvd2ae919e52016-11-21 19:47:12119 exit 1
[email protected]fe63a022013-01-15 22:11:47120 fi
[email protected]cf1df402008-10-31 21:45:30121
[email protected]fe63a022013-01-15 22:11:47122 if ! uname -m | egrep -q "i686|x86_64"; then
anthonyvd2ae919e52016-11-21 19:47:12123 echo "Only x86 architectures are currently supported" >&2
[email protected]fe63a022013-01-15 22:11:47124 exit
125 fi
[email protected]e041ed12009-03-10 16:43:01126fi
127
[email protected]ba48c4ca2013-10-25 16:11:46128if [ "x$(id -u)" != x0 ] && [ 0 -eq "${do_quick_check-0}" ]; then
[email protected]e041ed12009-03-10 16:43:01129 echo "Running as non-root user."
130 echo "You might have to enter your password one or more times for 'sudo'."
[email protected]8ada8c52009-03-10 21:53:08131 echo
[email protected]e041ed12009-03-10 16:43:01132fi
133
Ilya Sherman08edcfeb2020-05-13 17:18:24134if [ 0 -eq "${do_quick_check-0}" ] ; then
135 if [ "$do_inst_lib32" = "1" ] || [ "$do_inst_nacl" = "1" ]; then
136 sudo dpkg --add-architecture i386
137 fi
138 sudo apt-get update
Elliott Friedman91f373e2019-04-16 18:27:17139fi
Elliott Friedman91f373e2019-04-16 18:27:17140
141# Populate ${apt_package_list} for package_exists() parsing.
142apt_package_list=$(build_apt_package_list)
143
[email protected]fdc6bf52010-06-07 22:01:57144# Packages needed for chromeos only
Tom Anderson6b2b2ad52018-02-22 23:28:14145chromeos_dev_list="libbluetooth-dev libxkbcommon-dev"
146
147if package_exists realpath; then
148 chromeos_dev_list="${chromeos_dev_list} realpath"
149fi
[email protected]fdc6bf52010-06-07 22:01:57150
[email protected]b61f6882013-11-14 20:41:41151# Packages needed for development
thomasanderson20032a5c2017-03-02 00:28:20152dev_list="\
Tom Anderson2b8a8362018-08-01 17:41:34153 binutils
thomasanderson20032a5c2017-03-02 00:28:20154 bison
George Burgess IV3d20a812018-05-10 22:24:17155 bzip2
thomasanderson20032a5c2017-03-02 00:28:20156 cdbs
157 curl
Tom Anderson8bfb0b02018-02-17 00:44:15158 dbus-x11
thomasanderson20032a5c2017-03-02 00:28:20159 dpkg-dev
160 elfutils
161 devscripts
162 fakeroot
163 flex
thomasanderson20032a5c2017-03-02 00:28:20164 git-core
thomasanderson20032a5c2017-03-02 00:28:20165 gperf
Tim Brown06ee43a2018-02-08 18:42:12166 libappindicator3-dev
thomasanderson20032a5c2017-03-02 00:28:20167 libasound2-dev
Tom Anderson13200012018-09-10 22:29:02168 libatspi2.0-dev
thomasanderson20032a5c2017-03-02 00:28:20169 libbrlapi-dev
thomasanderson20032a5c2017-03-02 00:28:20170 libbz2-dev
171 libcairo2-dev
172 libcap-dev
Daniel Bratell8cc92d372019-03-12 16:42:06173 libc6-dev
thomasanderson20032a5c2017-03-02 00:28:20174 libcups2-dev
175 libcurl4-gnutls-dev
176 libdrm-dev
177 libelf-dev
Tom Anderson25a7c922019-12-17 20:09:44178 libevdev-dev
thomasanderson20032a5c2017-03-02 00:28:20179 libffi-dev
Tom Andersond4ea2522018-03-01 20:34:38180 libgbm-dev
thomasanderson20032a5c2017-03-02 00:28:20181 libglib2.0-dev
182 libglu1-mesa-dev
thomasanderson20032a5c2017-03-02 00:28:20183 libgtk-3-dev
184 libkrb5-dev
185 libnspr4-dev
186 libnss3-dev
187 libpam0g-dev
188 libpci-dev
189 libpulse-dev
190 libsctp-dev
191 libspeechd-dev
192 libsqlite3-dev
193 libssl-dev
194 libudev-dev
195 libwww-perl
196 libxslt1-dev
197 libxss-dev
198 libxt-dev
199 libxtst-dev
Andrew Grievee41aeae2017-08-21 20:53:21200 locales
thomasanderson20032a5c2017-03-02 00:28:20201 openbox
Nico Webera9fa6a72018-02-23 18:26:02202 p7zip
thomasanderson20032a5c2017-03-02 00:28:20203 patch
204 perl
205 pkg-config
206 python
thomasanderson20032a5c2017-03-02 00:28:20207 python-crypto
208 python-dev
209 python-numpy
thomasanderson20032a5c2017-03-02 00:28:20210 python-openssl
211 python-psutil
212 python-yaml
213 rpm
214 ruby
215 subversion
Daniel Bratellbec626a2018-06-26 17:40:52216 uuid-dev
thomasanderson20032a5c2017-03-02 00:28:20217 wdiff
Tom Andersond79de41d2017-08-08 00:23:23218 x11-utils
thomasanderson20032a5c2017-03-02 00:28:20219 xcompmgr
George Burgess IV3d20a812018-05-10 22:24:17220 xz-utils
thomasanderson20032a5c2017-03-02 00:28:20221 zip
222 $chromeos_dev_list
223"
[email protected]fdc6bf52010-06-07 22:01:57224
[email protected]f16aabf2012-08-15 21:00:14225# 64-bit systems need a minimum set of 32-bit compat packages for the pre-built
[email protected]f8ceadb2014-08-18 12:30:23226# NaCl binaries.
ki.stfu0a79d6992015-09-17 07:27:12227if file -L /sbin/init | grep -q 'ELF 64-bit'; then
Lei Zhang3ec3c1732020-08-25 17:29:25228 dev_list="${dev_list} libc6-i386 lib32stdc++6"
229
230 # lib32gcc-s1 used to be called lib32gcc1 in older distros.
231 if package_exists lib32gcc-s1; then
232 dev_list="${dev_list} lib32gcc-s1"
233 elif package_exists lib32gcc1; then
234 dev_list="${dev_list} lib32gcc1"
235 fi
[email protected]f16aabf2012-08-15 21:00:14236fi
237
[email protected]fdc6bf52010-06-07 22:01:57238# Run-time libraries required by chromeos only
[email protected]ba48c4ca2013-10-25 16:11:46239chromeos_lib_list="libpulse0 libbz2-1.0"
[email protected]e041ed12009-03-10 16:43:01240
Yves Gereye1fe0df2018-06-08 08:01:47241# List of required run-time libraries
242common_lib_list="\
Tim Brown06ee43a2018-02-08 18:42:12243 libappindicator3-1
244 libasound2
thomasanderson20032a5c2017-03-02 00:28:20245 libatk1.0-0
Tom Anderson13200012018-09-10 22:29:02246 libatspi2.0-0
thomasanderson20032a5c2017-03-02 00:28:20247 libc6
thomasanderson20032a5c2017-03-02 00:28:20248 libcairo2
249 libcap2
250 libcups2
Tom Anderson25a7c922019-12-17 20:09:44251 libdrm2
252 libevdev2
thomasanderson20032a5c2017-03-02 00:28:20253 libexpat1
thomasanderson20032a5c2017-03-02 00:28:20254 libfontconfig1
255 libfreetype6
Tom Anderson25a7c922019-12-17 20:09:44256 libgbm1
thomasanderson20032a5c2017-03-02 00:28:20257 libglib2.0-0
thomasanderson20032a5c2017-03-02 00:28:20258 libgtk-3-0
259 libpam0g
Sami Kyostila3c286522020-08-11 11:09:43260 libpango-1.0-0
thomasanderson20032a5c2017-03-02 00:28:20261 libpci3
262 libpcre3
263 libpixman-1-0
264 libspeechd2
265 libstdc++6
266 libsqlite3-0
Tom Andersonf8a0c662018-06-14 23:54:14267 libuuid1
Scott Violetdd7e2372018-04-12 01:11:26268 libwayland-egl1-mesa
thomasanderson20032a5c2017-03-02 00:28:20269 libx11-6
270 libx11-xcb1
271 libxau6
272 libxcb1
273 libxcomposite1
274 libxcursor1
275 libxdamage1
276 libxdmcp6
277 libxext6
278 libxfixes3
279 libxi6
280 libxinerama1
281 libxrandr2
282 libxrender1
283 libxtst6
284 zlib1g
Yves Gereye1fe0df2018-06-08 08:01:47285"
286
Chisoon Jeong244004b2020-04-26 02:54:50287if package_exists libffi7; then
288 common_lib_list="${common_lib_list} libffi7"
289elif package_exists libffi6; then
290 common_lib_list="${common_lib_list} libffi6"
291fi
292
Yves Gereye1fe0df2018-06-08 08:01:47293# Full list of required run-time libraries
294lib_list="\
295 $common_lib_list
thomasanderson20032a5c2017-03-02 00:28:20296 $chromeos_lib_list
297"
[email protected]e041ed12009-03-10 16:43:01298
johnme49bb458a2014-11-27 15:45:31299# 32-bit libraries needed e.g. to compile V8 snapshot for Android or armhf
Tanin Na Nakorn6cbe32e52017-05-30 19:37:04300lib32_list="linux-libc-dev:i386 libpci3:i386"
johnme49bb458a2014-11-27 15:45:31301
Tom Andersondd47ad32018-03-21 19:30:19302# 32-bit libraries needed for a 32-bit build
303lib32_list="$lib32_list libx11-xcb1:i386"
304
Tom Andersone9883cd2018-06-20 00:32:21305# Packages that have been removed from this script. Regardless of configuration
306# or options passed to this script, whenever a package is removed, it should be
307# added here.
308backwards_compatible_list="\
309 7za
310 fonts-indic
311 fonts-ipafont
312 fonts-stix
313 fonts-thai-tlwg
314 fonts-tlwg-garuda
Nico Weber255521f2019-08-21 18:07:22315 g++
316 git-svn
Tom Andersone9883cd2018-06-20 00:32:21317 language-pack-da
318 language-pack-fr
319 language-pack-he
320 language-pack-zh-hant
Tom Anderson287339e2018-08-22 21:52:02321 libappindicator-dev
322 libappindicator1
Tom Andersone9883cd2018-06-20 00:32:21323 libdconf-dev
Tom Andersone9883cd2018-06-20 00:32:21324 libdconf1
325 libdconf1:i386
326 libexif-dev
327 libexif12
328 libexif12:i386
329 libgbm-dev
330 libgconf-2-4:i386
331 libgconf2-dev
332 libgl1-mesa-dev
333 libgl1-mesa-glx:i386
334 libgles2-mesa-dev
Tom Anderson99ffaae2018-11-29 00:08:31335 libgtk-3-0:i386
Tom Anderson287339e2018-08-22 21:52:02336 libgtk2.0-0
337 libgtk2.0-0:i386
338 libgtk2.0-dev
Tom Andersone9883cd2018-06-20 00:32:21339 mesa-common-dev
340 msttcorefonts
341 ttf-dejavu-core
342 ttf-indic-fonts
343 ttf-kochi-gothic
344 ttf-kochi-mincho
345 ttf-mscorefonts-installer
346 xfonts-mathml
347"
348case $distro_codename in
349 trusty)
350 backwards_compatible_list+=" \
351 libgbm-dev-lts-trusty
352 libgl1-mesa-dev-lts-trusty
353 libgl1-mesa-glx-lts-trusty:i386
354 libgles2-mesa-dev-lts-trusty
355 mesa-common-dev-lts-trusty"
356 ;;
357 xenial)
358 backwards_compatible_list+=" \
359 libgbm-dev-lts-xenial
360 libgl1-mesa-dev-lts-xenial
361 libgl1-mesa-glx-lts-xenial:i386
362 libgles2-mesa-dev-lts-xenial
363 mesa-common-dev-lts-xenial"
364 ;;
365esac
366
[email protected]3f85dac32013-10-29 02:38:46367# arm cross toolchain packages needed to build chrome on armhf
thomasanderson4e3d30fe2016-12-07 18:58:34368EM_REPO="deb http://emdebian.org/tools/debian/ jessie main"
369EM_SOURCE=$(cat <<EOF
370# Repo added by Chromium $0
371${EM_REPO}
372# deb-src http://emdebian.org/tools/debian/ jessie main
373EOF
374)
375EM_ARCHIVE_KEY_FINGER="084C6C6F39159EDB67969AA87DE089671804772E"
376GPP_ARM_PACKAGE="g++-arm-linux-gnueabihf"
thomasandersondfefc6c02017-05-04 01:29:11377case $distro_codename in
kjellander95504ae2017-03-30 12:30:31378 jessie)
thomasanderson4e3d30fe2016-12-07 18:58:34379 eval $(apt-config shell APT_SOURCESDIR 'Dir::Etc::sourceparts/d')
380 CROSSTOOLS_LIST="${APT_SOURCESDIR}/crosstools.list"
381 arm_list="libc6-dev:armhf
382 linux-libc-dev:armhf"
Tom Anderson8e0a484e2018-06-14 22:47:02383 if [ "$do_inst_arm" = "1" ]; then
thomasanderson4e3d30fe2016-12-07 18:58:34384 if $(dpkg-query -W ${GPP_ARM_PACKAGE} &>/dev/null); then
385 arm_list+=" ${GPP_ARM_PACKAGE}"
386 else
Tom Anderson8e0a484e2018-06-14 22:47:02387 if [ "${add_cross_tool_repo}" = "1" ]; then
thomasanderson4e3d30fe2016-12-07 18:58:34388 gpg --keyserver pgp.mit.edu --recv-keys ${EM_ARCHIVE_KEY_FINGER}
389 gpg -a --export ${EM_ARCHIVE_KEY_FINGER} | sudo apt-key add -
390 if ! grep "^${EM_REPO}" "${CROSSTOOLS_LIST}" &>/dev/null; then
391 echo "${EM_SOURCE}" | sudo tee -a "${CROSSTOOLS_LIST}" >/dev/null
392 fi
393 arm_list+=" ${GPP_ARM_PACKAGE}"
Tom Anderson8e0a484e2018-06-14 22:47:02394 else
395 echo "The Debian Cross-toolchains repository is necessary to"
396 echo "cross-compile Chromium for arm."
397 echo "Rerun with --add-deb-cross-tool-repo to have it added for you."
thomasanderson4e3d30fe2016-12-07 18:58:34398 fi
399 fi
400 fi
401 ;;
thomasandersondfefc6c02017-05-04 01:29:11402 # All necessary ARM packages are available on the default repos on
403 # Debian 9 and later.
kjellander95504ae2017-03-30 12:30:31404 *)
Tom Anderson81e7f1792017-11-11 03:56:33405 arm_list="libc6-dev-armhf-cross
thomasanderson4e3d30fe2016-12-07 18:58:34406 linux-libc-dev-armhf-cross
407 ${GPP_ARM_PACKAGE}"
408 ;;
409esac
[email protected]31a605532011-08-23 22:27:35410
sbcb5d4ded2015-04-01 17:49:03411# Work around for dependency issue Ubuntu/Trusty: http://crbug.com/435056
thomasandersondfefc6c02017-05-04 01:29:11412case $distro_codename in
friedmanbf8b90a2016-04-21 01:15:48413 trusty)
414 arm_list+=" g++-4.8-multilib-arm-linux-gnueabihf
415 gcc-4.8-multilib-arm-linux-gnueabihf"
416 ;;
Marcin WiÄ…cek73d9ec52019-04-24 21:40:17417 xenial|bionic)
krasineef3d4b2016-04-22 00:52:18418 arm_list+=" g++-5-multilib-arm-linux-gnueabihf
419 gcc-5-multilib-arm-linux-gnueabihf
420 gcc-arm-linux-gnueabihf"
421 ;;
Marcin8dd4550a2019-11-21 08:42:36422 disco|eoan)
Marcin WiÄ…cek73d9ec52019-04-24 21:40:17423 arm_list+=" g++-9-multilib-arm-linux-gnueabihf
424 gcc-9-multilib-arm-linux-gnueabihf
425 gcc-arm-linux-gnueabihf"
426 ;;
Chisoon Jeong244004b2020-04-26 02:54:50427 focal)
428 arm_list+=" g++-10-multilib-arm-linux-gnueabihf
429 gcc-10-multilib-arm-linux-gnueabihf
430 gcc-arm-linux-gnueabihf"
431 ;;
friedmanbf8b90a2016-04-21 01:15:48432esac
sbcb5d4ded2015-04-01 17:49:03433
[email protected]713eac62014-06-02 23:10:03434# Packages to build NaCl, its toolchains, and its ports.
Brad Nelson5e59c2c2014-09-06 06:18:45435naclports_list="ant autoconf bison cmake gawk intltool xutils-dev xsltproc"
thomasanderson20032a5c2017-03-02 00:28:20436nacl_list="\
437 g++-mingw-w64-i686
438 lib32z1-dev
439 libasound2:i386
440 libcap2:i386
441 libelf-dev:i386
442 libfontconfig1:i386
thomasanderson20032a5c2017-03-02 00:28:20443 libglib2.0-0:i386
444 libgpm2:i386
thomasanderson20032a5c2017-03-02 00:28:20445 libncurses5:i386
446 lib32ncurses5-dev
447 libnss3:i386
Sami Kyostila3c286522020-08-11 11:09:43448 libpango-1.0-0:i386
thomasandersondfefc6c02017-05-04 01:29:11449 libssl-dev:i386
thomasanderson20032a5c2017-03-02 00:28:20450 libtinfo-dev
451 libtinfo-dev:i386
452 libtool
Tom Andersonf8a0c662018-06-14 23:54:14453 libuuid1:i386
thomasanderson20032a5c2017-03-02 00:28:20454 libxcomposite1:i386
455 libxcursor1:i386
456 libxdamage1:i386
457 libxi6:i386
458 libxrandr2:i386
459 libxss1:i386
460 libxtst6:i386
461 texinfo
462 xvfb
463 ${naclports_list}
464"
[email protected]419a9a62014-06-19 18:26:18465
Marcin8dd4550a2019-11-21 08:42:36466# Some package names have changed over time
Tom Anderson0524b2b72017-12-11 20:39:18467if package_exists libssl1.1; then
468 nacl_list="${nacl_list} libssl1.1:i386"
469elif package_exists libssl1.0.2; then
thomasandersondfefc6c02017-05-04 01:29:11470 nacl_list="${nacl_list} libssl1.0.2:i386"
Tom Anderson0524b2b72017-12-11 20:39:18471else
472 nacl_list="${nacl_list} libssl1.0.0:i386"
thomasandersondfefc6c02017-05-04 01:29:11473fi
kouhei64a8dce2020-08-26 06:07:06474if package_exists libtinfo5; then
475 nacl_list="${nacl_list} libtinfo5"
476fi
Tom Anderson0524b2b72017-12-11 20:39:18477if package_exists libpng16-16; then
marcin73929a72017-01-04 22:04:58478 lib_list="${lib_list} libpng16-16"
Tom Anderson0524b2b72017-12-11 20:39:18479else
480 lib_list="${lib_list} libpng12-0"
marcin73929a72017-01-04 22:04:58481fi
Tom Anderson96a2efc2018-06-14 01:12:14482if package_exists libnspr4; then
[email protected]1a0f64a2011-05-20 17:53:55483 lib_list="${lib_list} libnspr4 libnss3"
[email protected]757c2962012-03-15 19:05:18484else
[email protected]757c2962012-03-15 19:05:18485 lib_list="${lib_list} libnspr4-0d libnss3-1d"
486fi
[email protected]4fc00712013-05-29 23:11:20487if package_exists libjpeg-dev; then
[email protected]9e895962013-05-21 08:26:42488 dev_list="${dev_list} libjpeg-dev"
[email protected]b11411c2012-03-21 22:09:41489else
[email protected]9e895962013-05-21 08:26:42490 dev_list="${dev_list} libjpeg62-dev"
[email protected]b11411c2012-03-21 22:09:41491fi
[email protected]4fc00712013-05-29 23:11:20492if package_exists libudev1; then
[email protected]9e895962013-05-21 08:26:42493 dev_list="${dev_list} libudev1"
[email protected]ab9e69082014-06-05 15:28:52494 nacl_list="${nacl_list} libudev1:i386"
[email protected]9e895962013-05-21 08:26:42495else
496 dev_list="${dev_list} libudev0"
[email protected]ab9e69082014-06-05 15:28:52497 nacl_list="${nacl_list} libudev0:i386"
[email protected]9e895962013-05-21 08:26:42498fi
Sean McAllisterb611f442020-02-18 22:46:47499if package_exists libbrlapi0.7; then
500 dev_list="${dev_list} libbrlapi0.7"
501elif package_exists libbrlapi0.6; then
[email protected]3ea42912013-09-06 06:23:57502 dev_list="${dev_list} libbrlapi0.6"
503else
504 dev_list="${dev_list} libbrlapi0.5"
505fi
Tom Anderson0524b2b72017-12-11 20:39:18506if package_exists apache2.2-bin; then
halton.huo3e728c42016-01-20 05:12:23507 dev_list="${dev_list} apache2.2-bin"
Tom Anderson0524b2b72017-12-11 20:39:18508else
509 dev_list="${dev_list} apache2-bin"
halton.huo3e728c42016-01-20 05:12:23510fi
Marcin Wiacekd7577c32018-04-30 19:12:51511if package_exists libav-tools; then
512 dev_list="${dev_list} libav-tools"
513fi
Chisoon Jeong244004b2020-04-26 02:54:50514if package_exists php7.4-cgi; then
515 dev_list="${dev_list} php7.4-cgi libapache2-mod-php7.4"
516elif package_exists php7.3-cgi; then
Marcin8dd4550a2019-11-21 08:42:36517 dev_list="${dev_list} php7.3-cgi libapache2-mod-php7.3"
518elif package_exists php7.2-cgi; then
Marcin Wiacekd7577c32018-04-30 19:12:51519 dev_list="${dev_list} php7.2-cgi libapache2-mod-php7.2"
520elif package_exists php7.1-cgi; then
marcin38933dd2017-10-30 00:05:52521 dev_list="${dev_list} php7.1-cgi libapache2-mod-php7.1"
522elif package_exists php7.0-cgi; then
vadimsh278ff0662016-05-19 00:06:28523 dev_list="${dev_list} php7.0-cgi libapache2-mod-php7.0"
krasineef3d4b2016-04-22 00:52:18524else
vadimsh278ff0662016-05-19 00:06:28525 dev_list="${dev_list} php5-cgi libapache2-mod-php5"
krasineef3d4b2016-04-22 00:52:18526fi
[email protected]757c2962012-03-15 19:05:18527
[email protected]dc099772013-09-30 22:06:58528# Some packages are only needed if the distribution actually supports
[email protected]757c2962012-03-15 19:05:18529# installing them.
[email protected]4fc00712013-05-29 23:11:20530if package_exists appmenu-gtk; then
[email protected]757c2962012-03-15 19:05:18531 lib_list="$lib_list appmenu-gtk"
[email protected]4da8fad2011-04-11 18:42:42532fi
Marcin8dd4550a2019-11-21 08:42:36533if package_exists libgnome-keyring0; then
534 lib_list="${lib_list} libgnome-keyring0"
535fi
536if package_exists libgnome-keyring-dev; then
537 lib_list="${lib_list} libgnome-keyring-dev"
538fi
Tom Anderson25a7c922019-12-17 20:09:44539if package_exists libvulkan-dev; then
Tom Andersond51737312019-12-23 19:24:14540 dev_list="${dev_list} libvulkan-dev"
Tom Anderson25a7c922019-12-17 20:09:44541fi
542if package_exists libvulkan1; then
Tom Andersond51737312019-12-23 19:24:14543 lib_list="${lib_list} libvulkan1"
544fi
545if package_exists libinput10; then
546 lib_list="${lib_list} libinput10"
547fi
548if package_exists libinput-dev; then
Tom Andersone1fc6aa42020-02-22 01:38:36549 dev_list="${dev_list} libinput-dev"
550fi
551if package_exists snapcraft; then
552 dev_list="${dev_list} snapcraft"
Tom Anderson25a7c922019-12-17 20:09:44553fi
[email protected]4da8fad2011-04-11 18:42:42554
Tom Anderson81e7f1792017-11-11 03:56:33555# Cross-toolchain strip is needed for building the sysroots.
556if package_exists binutils-arm-linux-gnueabihf; then
557 dev_list="${dev_list} binutils-arm-linux-gnueabihf"
558fi
559if package_exists binutils-aarch64-linux-gnu; then
560 dev_list="${dev_list} binutils-aarch64-linux-gnu"
561fi
562if package_exists binutils-mipsel-linux-gnu; then
563 dev_list="${dev_list} binutils-mipsel-linux-gnu"
564fi
565if package_exists binutils-mips64el-linux-gnuabi64; then
566 dev_list="${dev_list} binutils-mips64el-linux-gnuabi64"
567fi
568
johnme49bb458a2014-11-27 15:45:31569# When cross building for arm/Android on 64-bit systems the host binaries
570# that are part of v8 need to be compiled with -m32 which means
571# that basic multilib support is needed.
ki.stfu0a79d6992015-09-17 07:27:12572if file -L /sbin/init | grep -q 'ELF 64-bit'; then
johnme49bb458a2014-11-27 15:45:31573 # gcc-multilib conflicts with the arm cross compiler (at least in trusty) but
574 # g++-X.Y-multilib gives us the 32-bit support that we need. Find out the
575 # appropriate value of X and Y by seeing what version the current
576 # distribution's g++-multilib package depends on.
577 multilib_package=$(apt-cache depends g++-multilib --important | \
578 grep -E --color=never --only-matching '\bg\+\+-[0-9.]+-multilib\b')
579 lib32_list="$lib32_list $multilib_package"
580fi
581
Tom Anderson8e0a484e2018-06-14 22:47:02582if [ "$do_inst_syms" = "1" ]; then
[email protected]ba48c4ca2013-10-25 16:11:46583 echo "Including debugging symbols."
Tom Anderson8206da9a2018-06-12 01:49:09584
585 # Debian is in the process of transitioning to automatic debug packages, which
586 # have the -dbgsym suffix (https://wiki.debian.org/AutomaticDebugPackages).
587 # Untransitioned packages have the -dbg suffix. And on some systems, neither
588 # will be available, so exclude the ones that are missing.
589 dbg_package_name() {
590 if package_exists "$1-dbgsym"; then
591 echo "$1-dbgsym"
592 elif package_exists "$1-dbg"; then
593 echo "$1-dbg"
594 fi
595 }
596
597 for package in "${common_lib_list}"; do
598 dbg_list="$dbg_list $(dbg_package_name ${package})"
599 done
600
601 # Debugging symbols packages not following common naming scheme
Tom Anderson8e0a484e2018-06-14 22:47:02602 if [ "$(dbg_package_name libstdc++6)" == "" ]; then
603 if package_exists libstdc++6-8-dbg; then
604 dbg_list="${dbg_list} libstdc++6-8-dbg"
605 elif package_exists libstdc++6-7-dbg; then
606 dbg_list="${dbg_list} libstdc++6-7-dbg"
607 elif package_exists libstdc++6-6-dbg; then
Tom Anderson8206da9a2018-06-12 01:49:09608 dbg_list="${dbg_list} libstdc++6-6-dbg"
Tom Anderson8e0a484e2018-06-14 22:47:02609 elif package_exists libstdc++6-5-dbg; then
610 dbg_list="${dbg_list} libstdc++6-5-dbg"
Tom Anderson8206da9a2018-06-12 01:49:09611 elif package_exists libstdc++6-4.9-dbg; then
612 dbg_list="${dbg_list} libstdc++6-4.9-dbg"
Tom Anderson8e0a484e2018-06-14 22:47:02613 elif package_exists libstdc++6-4.8-dbg; then
Tom Anderson8206da9a2018-06-12 01:49:09614 dbg_list="${dbg_list} libstdc++6-4.8-dbg"
Tom Anderson8e0a484e2018-06-14 22:47:02615 elif package_exists libstdc++6-4.7-dbg; then
616 dbg_list="${dbg_list} libstdc++6-4.7-dbg"
Tom Andersone9883cd2018-06-20 00:32:21617 elif package_exists libstdc++6-4.6-dbg; then
618 dbg_list="${dbg_list} libstdc++6-4.6-dbg"
Tom Anderson8206da9a2018-06-12 01:49:09619 fi
620 fi
Tom Anderson8e0a484e2018-06-14 22:47:02621 if [ "$(dbg_package_name libatk1.0-0)" == "" ]; then
Tom Anderson8206da9a2018-06-12 01:49:09622 dbg_list="$dbg_list $(dbg_package_name libatk1.0)"
623 fi
Sami Kyostila3c286522020-08-11 11:09:43624 if [ "$(dbg_package_name libpango-1.0-0)" == "" ]; then
Tom Anderson8206da9a2018-06-12 01:49:09625 dbg_list="$dbg_list $(dbg_package_name libpango1.0-dev)"
626 fi
[email protected]8ada8c52009-03-10 21:53:08627else
[email protected]ba48c4ca2013-10-25 16:11:46628 echo "Skipping debugging symbols."
[email protected]8ada8c52009-03-10 21:53:08629 dbg_list=
630fi
631
Tom Anderson8e0a484e2018-06-14 22:47:02632if [ "$do_inst_lib32" = "1" ]; then
Tom Andersondd47ad32018-03-21 19:30:19633 echo "Including 32-bit libraries."
johnme49bb458a2014-11-27 15:45:31634else
Tom Andersondd47ad32018-03-21 19:30:19635 echo "Skipping 32-bit libraries."
johnme49bb458a2014-11-27 15:45:31636 lib32_list=
[email protected]9f28a9cf2012-12-17 23:31:40637fi
638
Tom Anderson8e0a484e2018-06-14 22:47:02639if [ "$do_inst_arm" = "1" ]; then
[email protected]ba48c4ca2013-10-25 16:11:46640 echo "Including ARM cross toolchain."
[email protected]f2826b6a2012-11-15 01:06:26641else
[email protected]ba48c4ca2013-10-25 16:11:46642 echo "Skipping ARM cross toolchain."
[email protected]f2826b6a2012-11-15 01:06:26643 arm_list=
644fi
645
Tom Anderson8e0a484e2018-06-14 22:47:02646if [ "$do_inst_nacl" = "1" ]; then
[email protected]713eac62014-06-02 23:10:03647 echo "Including NaCl, NaCl toolchain, NaCl ports dependencies."
[email protected]565416362014-01-16 21:26:47648else
[email protected]713eac62014-06-02 23:10:03649 echo "Skipping NaCl, NaCl toolchain, NaCl ports dependencies."
[email protected]565416362014-01-16 21:26:47650 nacl_list=
651fi
652
Tom Andersone9883cd2018-06-20 00:32:21653filtered_backwards_compatible_list=
654if [ "$do_inst_backwards_compatible" = "1" ]; then
655 echo "Including backwards compatible packages."
656 for package in ${backwards_compatible_list}; do
657 if package_exists ${package}; then
658 filtered_backwards_compatible_list+=" ${package}"
659 fi
660 done
661fi
662
johnme4bd10302015-01-06 11:25:52663# The `sort -r -s -t: -k2` sorts all the :i386 packages to the front, to avoid
664# confusing dpkg-query (crbug.com/446172).
[email protected]565416362014-01-16 21:26:47665packages="$(
Tom Andersone9883cd2018-06-20 00:32:21666 echo "${dev_list} ${lib_list} ${dbg_list} ${lib32_list} ${arm_list}" \
667 "${nacl_list}" ${filtered_backwards_compatible_list} | tr " " "\n" | \
668 sort -u | sort -r -s -t: -k2 | tr "\n" " "
[email protected]565416362014-01-16 21:26:47669)"
[email protected]ba48c4ca2013-10-25 16:11:46670
671if [ 1 -eq "${do_quick_check-0}" ] ; then
thomasanderson73b3a4412016-11-18 23:16:07672 if ! missing_packages="$(dpkg-query -W -f ' ' ${packages} 2>&1)"; then
673 # Distinguish between packages that actually aren't available to the
674 # system (i.e. not in any repo) and packages that just aren't known to
675 # dpkg (i.e. managed by apt).
676 missing_packages="$(echo "${missing_packages}" | awk '{print $NF}')"
677 not_installed=""
678 unknown=""
679 for p in ${missing_packages}; do
680 if apt-cache show ${p} > /dev/null 2>&1; then
681 not_installed="${p}\n${not_installed}"
682 else
683 unknown="${p}\n${unknown}"
[email protected]ba48c4ca2013-10-25 16:11:46684 fi
thomasanderson73b3a4412016-11-18 23:16:07685 done
686 if [ -n "${not_installed}" ]; then
[email protected]ba48c4ca2013-10-25 16:11:46687 echo "WARNING: The following packages are not installed:"
thomasanderson73b3a4412016-11-18 23:16:07688 echo -e "${not_installed}" | sed -e "s/^/ /"
689 fi
690 if [ -n "${unknown}" ]; then
691 echo "WARNING: The following packages are unknown to your system"
692 echo "(maybe missing a repo or need to 'sudo apt-get update'):"
693 echo -e "${unknown}" | sed -e "s/^/ /"
[email protected]ba48c4ca2013-10-25 16:11:46694 fi
695 exit 1
696 fi
697 exit 0
698fi
699
[email protected]e041ed12009-03-10 16:43:01700echo "Finding missing packages..."
[email protected]757c2962012-03-15 19:05:18701# Intentionally leaving $packages unquoted so it's more readable.
[email protected]b6e064522009-08-10 18:47:51702echo "Packages required: " $packages
703echo
Daniel Bratell8cc92d372019-03-12 16:42:06704query_cmd="apt-get --just-print install $(echo $packages)"
705if cmd_output="$(LANGUAGE=en LANG=C $query_cmd)"; then
706 new_list=$(echo "$cmd_output" |
707 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d' |
708 sed 's/ *$//')
709 upgrade_list=$(echo "$cmd_output" |
710 sed -e '1,/The following packages will be upgraded:/d;s/^ //;t;d' |
711 sed 's/ *$//')
712 if [ -z "$new_list" ] && [ -z "$upgrade_list" ]; then
thakis3e861de2016-06-14 14:24:01713 echo "No missing packages, and the packages are up to date."
[email protected]b6e064522009-08-10 18:47:51714 else
Daniel Bratell8cc92d372019-03-12 16:42:06715 echo "Installing and upgrading packages: $new_list $upgrade_list."
716 sudo apt-get install ${do_quietly-} ${new_list} ${upgrade_list}
[email protected]b6e064522009-08-10 18:47:51717 fi
718 echo
[email protected]79a9d2962009-08-06 21:10:58719else
720 # An apt-get exit status of 100 indicates that a real error has occurred.
[email protected]e041ed12009-03-10 16:43:01721
Daniel Bratell8cc92d372019-03-12 16:42:06722 # I am intentionally leaving out the '"'s around query_cmd,
[email protected]79a9d2962009-08-06 21:10:58723 # as this makes it easier to cut and paste the output
Daniel Bratell8cc92d372019-03-12 16:42:06724 echo "The following command failed: " ${query_cmd}
[email protected]79a9d2962009-08-06 21:10:58725 echo
Daniel Bratell8cc92d372019-03-12 16:42:06726 echo "It produced the following output:"
727 echo "$cmd_output"
[email protected]79a9d2962009-08-06 21:10:58728 echo
729 echo "You will have to install the above packages yourself."
730 echo
731 exit 100
732fi
[email protected]e041ed12009-03-10 16:43:01733
[email protected]d96cc3472013-09-19 00:53:30734# Install the Chrome OS default fonts. This must go after running
735# apt-get, since install-chromeos-fonts depends on curl.
Tom Anderson8e0a484e2018-06-14 22:47:02736if [ "$do_inst_chromeos_fonts" != "0" ]; then
[email protected]d96cc3472013-09-19 00:53:30737 echo
738 echo "Installing Chrome OS fonts."
739 dir=`echo $0 | sed -r -e 's/\/[^/]+$//'`
740 if ! sudo $dir/linux/install-chromeos-fonts.py; then
741 echo "ERROR: The installation of the Chrome OS default fonts failed."
742 if [ `stat -f -c %T $dir` == "nfs" ]; then
743 echo "The reason is that your repo is installed on a remote file system."
744 else
745 echo "This is expected if your repo is installed on a remote file system."
746 fi
747 echo "It is recommended to install your repo on a local file system."
748 echo "You can skip the installation of the Chrome OS default founts with"
749 echo "the command line option: --no-chromeos-fonts."
750 exit 1
751 fi
752else
753 echo "Skipping installation of Chrome OS fonts."
754fi
755
thomasanderson5ef5c3d2016-12-08 01:59:19756echo "Installing locales."
757CHROMIUM_LOCALES="da_DK.UTF-8 fr_FR.UTF-8 he_IL.UTF-8 zh_TW.UTF-8"
758LOCALE_GEN=/etc/locale.gen
759if [ -e ${LOCALE_GEN} ]; then
760 OLD_LOCALE_GEN="$(cat /etc/locale.gen)"
761 for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do
762 sudo sed -i "s/^# ${CHROMIUM_LOCALE}/${CHROMIUM_LOCALE}/" ${LOCALE_GEN}
763 done
764 # Regenerating locales can take a while, so only do it if we need to.
765 if (echo "${OLD_LOCALE_GEN}" | cmp -s ${LOCALE_GEN}); then
766 echo "Locales already up-to-date."
767 else
768 sudo locale-gen
769 fi
770else
771 for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do
772 sudo locale-gen ${CHROMIUM_LOCALE}
773 done
774fi