blob: e0ae6d86c995805b54b66f53893248c0ef96968b [file] [log] [blame]
[email protected]e041ed12009-03-10 16:43:011#!/bin/bash -e
2
[email protected]aac39c92012-02-08 18:39:533# Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]e46cdae2009-08-25 20:59:274# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
[email protected]cf1df402008-10-31 21:45:307# Script to install everything needed to build chromium (well, ideally, anyway)
mostynbdf175a82016-02-08 23:27:208# See https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_instructions.md
[email protected]cf1df402008-10-31 21:45:309
[email protected]1eae2bfb2010-01-26 18:17:5310usage() {
11 echo "Usage: $0 [--options]"
12 echo "Options:"
13 echo "--[no-]syms: enable or disable installation of debugging symbols"
johnme49bb458a2014-11-27 15:45:3114 echo "--lib32: enable installation of 32-bit libraries, e.g. for V8 snapshot"
[email protected]f2826b6a2012-11-15 01:06:2615 echo "--[no-]arm: enable or disable installation of arm cross toolchain"
[email protected]bd29cdd2013-02-22 03:49:2016 echo "--[no-]chromeos-fonts: enable or disable installation of Chrome OS"\
17 "fonts"
[email protected]565416362014-01-16 21:26:4718 echo "--[no-]nacl: enable or disable installation of prerequisites for"\
19 "building standalone NaCl and all its toolchains"
[email protected]e2544ed42012-04-23 04:48:3120 echo "--no-prompt: silently select standard options/defaults"
[email protected]ba48c4ca2013-10-25 16:11:4621 echo "--quick-check: quickly try to determine if dependencies are installed"
22 echo " (this avoids interactive prompts and sudo commands,"
23 echo " so might not be 100% accurate)"
24 echo "--unsupported: attempt installation even on unsupported systems"
[email protected]1eae2bfb2010-01-26 18:17:5325 echo "Script will prompt interactively if options not given."
26 exit 1
27}
28
thomasanderson4e3d30fe2016-12-07 18:58:3429# Waits for the user to press 'Y' or 'N'. Either uppercase of lowercase is
30# accepted. Returns 0 for 'Y' and 1 for 'N'. If an optional parameter has
31# been provided to yes_no(), the function also accepts RETURN as a user input.
32# The parameter specifies the exit code that should be returned in that case.
33# The function will echo the user's selection followed by a newline character.
34# Users can abort the function by pressing CTRL-C. This will call "exit 1".
35yes_no() {
36 if [ 0 -ne "${do_default-0}" ] ; then
37 [ $1 -eq 0 ] && echo "Y" || echo "N"
38 return $1
39 fi
40 local c
41 while :; do
42 c="$(trap 'stty echo -iuclc icanon 2>/dev/null' EXIT INT TERM QUIT
43 stty -echo iuclc -icanon 2>/dev/null
44 dd count=1 bs=1 2>/dev/null | od -An -tx1)"
45 case "$c" in
46 " 0a") if [ -n "$1" ]; then
47 [ $1 -eq 0 ] && echo "Y" || echo "N"
48 return $1
49 fi
50 ;;
51 " 79") echo "Y"
52 return 0
53 ;;
54 " 6e") echo "N"
55 return 1
56 ;;
57 "") echo "Aborted" >&2
58 exit 1
59 ;;
60 *) # The user pressed an unrecognized key. As we are not echoing
61 # any incorrect user input, alert the user by ringing the bell.
62 (tput bel) 2>/dev/null
63 ;;
64 esac
65 done
66}
67
[email protected]4fc00712013-05-29 23:11:2068# Checks whether a particular package is available in the repos.
69# USAGE: $ package_exists <package name>
70package_exists() {
thomasandersonb4a2bca2016-12-08 06:46:0571 [ ! -z "`apt-cache search --names-only "$1"`" ]
[email protected]4fc00712013-05-29 23:11:2072}
73
[email protected]fbeddf22014-01-17 23:59:0174# These default to on because (some) bots need them and it keeps things
75# simple for the bot setup if all bots just run the script in its default
76# mode. Developers who don't want stuff they don't need installed on their
77# own workstations can pass --no-arm --no-nacl when running the script.
78do_inst_arm=1
79do_inst_nacl=1
80
[email protected]1eae2bfb2010-01-26 18:17:5381while test "$1" != ""
82do
83 case "$1" in
[email protected]ce774642011-09-12 23:21:3984 --syms) do_inst_syms=1;;
85 --no-syms) do_inst_syms=0;;
[email protected]ce774642011-09-12 23:21:3986 --lib32) do_inst_lib32=1;;
[email protected]f2826b6a2012-11-15 01:06:2687 --arm) do_inst_arm=1;;
88 --no-arm) do_inst_arm=0;;
[email protected]bd29cdd2013-02-22 03:49:2089 --chromeos-fonts) do_inst_chromeos_fonts=1;;
90 --no-chromeos-fonts) do_inst_chromeos_fonts=0;;
[email protected]565416362014-01-16 21:26:4791 --nacl) do_inst_nacl=1;;
92 --no-nacl) do_inst_nacl=0;;
[email protected]e2544ed42012-04-23 04:48:3193 --no-prompt) do_default=1
94 do_quietly="-qq --assume-yes"
95 ;;
[email protected]ba48c4ca2013-10-25 16:11:4696 --quick-check) do_quick_check=1;;
[email protected]fe63a022013-01-15 22:11:4797 --unsupported) do_unsupported=1;;
[email protected]1eae2bfb2010-01-26 18:17:5398 *) usage;;
99 esac
100 shift
101done
102
johnme49bb458a2014-11-27 15:45:31103if test "$do_inst_arm" = "1"; then
104 do_inst_lib32=1
105fi
106
[email protected]0febc9b2014-05-22 20:07:19107# Check for lsb_release command in $PATH
108if ! which lsb_release > /dev/null; then
109 echo "ERROR: lsb_release not found in \$PATH" >&2
110 exit 1;
111fi
[email protected]f2826b6a2012-11-15 01:06:26112
thomasandersondfefc6c02017-05-04 01:29:11113distro_codename=$(lsb_release --codename --short)
114distro_id=$(lsb_release --id --short)
marcin38933dd2017-10-30 00:05:52115supported_codenames="(trusty|xenial|zesty|artful)"
thomasandersondfefc6c02017-05-04 01:29:11116supported_ids="(Debian)"
[email protected]ba48c4ca2013-10-25 16:11:46117if [ 0 -eq "${do_unsupported-0}" ] && [ 0 -eq "${do_quick_check-0}" ] ; then
thomasandersondfefc6c02017-05-04 01:29:11118 if [[ ! $distro_codename =~ $supported_codenames &&
119 ! $distro_id =~ $supported_ids ]]; then
thomasanderson05c40292017-03-28 19:28:45120 echo -e "ERROR: The only supported distros are\n" \
121 "\tUbuntu 14.04 (trusty)\n" \
122 "\tUbuntu 16.04 (xenial)\n" \
marcin3a0793a2017-06-30 03:51:28123 "\tUbuntu 17.04 (zesty)\n" \
marcin38933dd2017-10-30 00:05:52124 "\tUbuntu 17.10 (artful)\n" \
thomasandersondfefc6c02017-05-04 01:29:11125 "\tDebian 8 (jessie) or later" >&2
anthonyvd2ae919e52016-11-21 19:47:12126 exit 1
[email protected]fe63a022013-01-15 22:11:47127 fi
[email protected]cf1df402008-10-31 21:45:30128
[email protected]fe63a022013-01-15 22:11:47129 if ! uname -m | egrep -q "i686|x86_64"; then
anthonyvd2ae919e52016-11-21 19:47:12130 echo "Only x86 architectures are currently supported" >&2
[email protected]fe63a022013-01-15 22:11:47131 exit
132 fi
[email protected]e041ed12009-03-10 16:43:01133fi
134
[email protected]ba48c4ca2013-10-25 16:11:46135if [ "x$(id -u)" != x0 ] && [ 0 -eq "${do_quick_check-0}" ]; then
[email protected]e041ed12009-03-10 16:43:01136 echo "Running as non-root user."
137 echo "You might have to enter your password one or more times for 'sudo'."
[email protected]8ada8c52009-03-10 21:53:08138 echo
[email protected]e041ed12009-03-10 16:43:01139fi
140
[email protected]fdc6bf52010-06-07 22:01:57141# Packages needed for chromeos only
dnj6a8491d12015-05-26 21:08:12142chromeos_dev_list="libbluetooth-dev libxkbcommon-dev realpath"
[email protected]fdc6bf52010-06-07 22:01:57143
[email protected]b61f6882013-11-14 20:41:41144# Packages needed for development
thomasanderson20032a5c2017-03-02 00:28:20145dev_list="\
146 bison
147 cdbs
148 curl
149 dpkg-dev
150 elfutils
151 devscripts
152 fakeroot
153 flex
154 fonts-ipafont
155 fonts-thai-tlwg
156 g++
157 git-core
158 git-svn
159 gperf
160 libasound2-dev
161 libbrlapi-dev
162 libav-tools
163 libbz2-dev
164 libcairo2-dev
165 libcap-dev
166 libcups2-dev
167 libcurl4-gnutls-dev
Tim Brown357bdbf2017-09-29 19:11:29168 libdconf-dev
thomasanderson20032a5c2017-03-02 00:28:20169 libdrm-dev
170 libelf-dev
171 libffi-dev
172 libgconf2-dev
173 libglib2.0-dev
174 libglu1-mesa-dev
175 libgnome-keyring-dev
176 libgtk2.0-dev
177 libgtk-3-dev
178 libkrb5-dev
179 libnspr4-dev
180 libnss3-dev
181 libpam0g-dev
182 libpci-dev
183 libpulse-dev
184 libsctp-dev
185 libspeechd-dev
186 libsqlite3-dev
187 libssl-dev
188 libudev-dev
189 libwww-perl
190 libxslt1-dev
191 libxss-dev
192 libxt-dev
193 libxtst-dev
Andrew Grievee41aeae2017-08-21 20:53:21194 locales
thomasanderson20032a5c2017-03-02 00:28:20195 openbox
196 patch
197 perl
198 pkg-config
199 python
200 python-cherrypy3
201 python-crypto
202 python-dev
203 python-numpy
204 python-opencv
205 python-openssl
206 python-psutil
207 python-yaml
208 rpm
209 ruby
210 subversion
thomasanderson20032a5c2017-03-02 00:28:20211 wdiff
Tom Andersond79de41d2017-08-08 00:23:23212 x11-utils
thomasanderson20032a5c2017-03-02 00:28:20213 xcompmgr
214 zip
215 $chromeos_dev_list
216"
[email protected]fdc6bf52010-06-07 22:01:57217
[email protected]f16aabf2012-08-15 21:00:14218# 64-bit systems need a minimum set of 32-bit compat packages for the pre-built
[email protected]f8ceadb2014-08-18 12:30:23219# NaCl binaries.
ki.stfu0a79d6992015-09-17 07:27:12220if file -L /sbin/init | grep -q 'ELF 64-bit'; then
[email protected]d93d68b12012-10-15 06:39:53221 dev_list="${dev_list} libc6-i386 lib32gcc1 lib32stdc++6"
[email protected]f16aabf2012-08-15 21:00:14222fi
223
[email protected]fdc6bf52010-06-07 22:01:57224# Run-time libraries required by chromeos only
[email protected]ba48c4ca2013-10-25 16:11:46225chromeos_lib_list="libpulse0 libbz2-1.0"
[email protected]e041ed12009-03-10 16:43:01226
227# Full list of required run-time libraries
thomasanderson20032a5c2017-03-02 00:28:20228lib_list="\
229 libatk1.0-0
230 libc6
231 libasound2
232 libcairo2
233 libcap2
234 libcups2
Tim Brown357bdbf2017-09-29 19:11:29235 libdconf1
thomasanderson20032a5c2017-03-02 00:28:20236 libexpat1
237 libffi6
238 libfontconfig1
239 libfreetype6
240 libglib2.0-0
241 libgnome-keyring0
242 libgtk2.0-0
243 libgtk-3-0
244 libpam0g
245 libpango1.0-0
246 libpci3
247 libpcre3
248 libpixman-1-0
249 libspeechd2
250 libstdc++6
251 libsqlite3-0
252 libx11-6
253 libx11-xcb1
254 libxau6
255 libxcb1
256 libxcomposite1
257 libxcursor1
258 libxdamage1
259 libxdmcp6
260 libxext6
261 libxfixes3
262 libxi6
263 libxinerama1
264 libxrandr2
265 libxrender1
266 libxtst6
267 zlib1g
268 $chromeos_lib_list
269"
[email protected]e041ed12009-03-10 16:43:01270
271# Debugging symbols for all of the run-time libraries
thomasanderson20032a5c2017-03-02 00:28:20272dbg_list="\
273 libatk1.0-dbg
274 libc6-dbg
275 libcairo2-dbg
276 libffi6-dbg
277 libfontconfig1-dbg
278 libglib2.0-0-dbg
279 libgtk2.0-0-dbg
280 libgtk-3-0-dbg
281 libpango1.0-0-dbg
282 libpcre3-dbg
283 libpixman-1-0-dbg
284 libsqlite3-0-dbg
285 libx11-6-dbg
286 libx11-xcb1-dbg
287 libxau6-dbg
288 libxcb1-dbg
289 libxcomposite1-dbg
290 libxcursor1-dbg
291 libxdamage1-dbg
292 libxdmcp6-dbg
293 libxext6-dbg
marcin38933dd2017-10-30 00:05:52294 libxfixes3-dbg
thomasanderson20032a5c2017-03-02 00:28:20295 libxi6-dbg
296 libxinerama1-dbg
297 libxrandr2-dbg
298 libxrender1-dbg
299 libxtst6-dbg
300 zlib1g-dbg
301"
lfgad917d12015-03-17 23:28:00302
303# Find the proper version of libstdc++6-4.x-dbg.
thomasandersondfefc6c02017-05-04 01:29:11304if [ "x$distro_codename" = "xtrusty" ]; then
lfgad917d12015-03-17 23:28:00305 dbg_list="${dbg_list} libstdc++6-4.8-dbg"
306else
307 dbg_list="${dbg_list} libstdc++6-4.9-dbg"
308fi
[email protected]e041ed12009-03-10 16:43:01309
johnme49bb458a2014-11-27 15:45:31310# 32-bit libraries needed e.g. to compile V8 snapshot for Android or armhf
Tanin Na Nakorn6cbe32e52017-05-30 19:37:04311lib32_list="linux-libc-dev:i386 libpci3:i386"
johnme49bb458a2014-11-27 15:45:31312
[email protected]3f85dac32013-10-29 02:38:46313# arm cross toolchain packages needed to build chrome on armhf
thomasanderson4e3d30fe2016-12-07 18:58:34314EM_REPO="deb http://emdebian.org/tools/debian/ jessie main"
315EM_SOURCE=$(cat <<EOF
316# Repo added by Chromium $0
317${EM_REPO}
318# deb-src http://emdebian.org/tools/debian/ jessie main
319EOF
320)
321EM_ARCHIVE_KEY_FINGER="084C6C6F39159EDB67969AA87DE089671804772E"
322GPP_ARM_PACKAGE="g++-arm-linux-gnueabihf"
thomasandersondfefc6c02017-05-04 01:29:11323case $distro_codename in
kjellander95504ae2017-03-30 12:30:31324 jessie)
thomasanderson4e3d30fe2016-12-07 18:58:34325 eval $(apt-config shell APT_SOURCESDIR 'Dir::Etc::sourceparts/d')
326 CROSSTOOLS_LIST="${APT_SOURCESDIR}/crosstools.list"
327 arm_list="libc6-dev:armhf
328 linux-libc-dev:armhf"
329 if test "$do_inst_arm" = "1"; then
330 if $(dpkg-query -W ${GPP_ARM_PACKAGE} &>/dev/null); then
331 arm_list+=" ${GPP_ARM_PACKAGE}"
332 else
333 echo "The Debian Cross-toolchains repository is necessary to"
334 echo "cross-compile Chromium for arm."
335 echo -n "Do you want me to add it for you (y/N) "
336 if yes_no 1; then
337 gpg --keyserver pgp.mit.edu --recv-keys ${EM_ARCHIVE_KEY_FINGER}
338 gpg -a --export ${EM_ARCHIVE_KEY_FINGER} | sudo apt-key add -
339 if ! grep "^${EM_REPO}" "${CROSSTOOLS_LIST}" &>/dev/null; then
340 echo "${EM_SOURCE}" | sudo tee -a "${CROSSTOOLS_LIST}" >/dev/null
341 fi
342 arm_list+=" ${GPP_ARM_PACKAGE}"
343 fi
344 fi
345 fi
346 ;;
thomasandersondfefc6c02017-05-04 01:29:11347 # All necessary ARM packages are available on the default repos on
348 # Debian 9 and later.
kjellander95504ae2017-03-30 12:30:31349 *)
Tom Anderson81e7f1792017-11-11 03:56:33350 arm_list="libc6-dev-armhf-cross
thomasanderson4e3d30fe2016-12-07 18:58:34351 linux-libc-dev-armhf-cross
352 ${GPP_ARM_PACKAGE}"
353 ;;
354esac
[email protected]31a605532011-08-23 22:27:35355
sbcb5d4ded2015-04-01 17:49:03356# Work around for dependency issue Ubuntu/Trusty: http://crbug.com/435056
thomasandersondfefc6c02017-05-04 01:29:11357case $distro_codename in
friedmanbf8b90a2016-04-21 01:15:48358 trusty)
359 arm_list+=" g++-4.8-multilib-arm-linux-gnueabihf
360 gcc-4.8-multilib-arm-linux-gnueabihf"
361 ;;
marcin38933dd2017-10-30 00:05:52362 xenial|zesty|artful)
krasineef3d4b2016-04-22 00:52:18363 arm_list+=" g++-5-multilib-arm-linux-gnueabihf
364 gcc-5-multilib-arm-linux-gnueabihf
365 gcc-arm-linux-gnueabihf"
366 ;;
friedmanbf8b90a2016-04-21 01:15:48367esac
sbcb5d4ded2015-04-01 17:49:03368
[email protected]713eac62014-06-02 23:10:03369# Packages to build NaCl, its toolchains, and its ports.
Brad Nelson5e59c2c2014-09-06 06:18:45370naclports_list="ant autoconf bison cmake gawk intltool xutils-dev xsltproc"
thomasanderson20032a5c2017-03-02 00:28:20371nacl_list="\
372 g++-mingw-w64-i686
373 lib32z1-dev
374 libasound2:i386
375 libcap2:i386
376 libelf-dev:i386
Tim Brown357bdbf2017-09-29 19:11:29377 libdconf1:i386
thomasanderson20032a5c2017-03-02 00:28:20378 libfontconfig1:i386
379 libgconf-2-4:i386
380 libglib2.0-0:i386
381 libgpm2:i386
382 libgtk2.0-0:i386
383 libgtk-3-0:i386
384 libncurses5:i386
385 lib32ncurses5-dev
386 libnss3:i386
387 libpango1.0-0:i386
thomasandersondfefc6c02017-05-04 01:29:11388 libssl-dev:i386
thomasanderson20032a5c2017-03-02 00:28:20389 libtinfo-dev
390 libtinfo-dev:i386
391 libtool
392 libxcomposite1:i386
393 libxcursor1:i386
394 libxdamage1:i386
395 libxi6:i386
396 libxrandr2:i386
397 libxss1:i386
398 libxtst6:i386
399 texinfo
400 xvfb
401 ${naclports_list}
402"
[email protected]419a9a62014-06-19 18:26:18403
thomasandersondfefc6c02017-05-04 01:29:11404if package_exists libssl1.0.0; then
405 nacl_list="${nacl_list} libssl1.0.0:i386"
406else
407 nacl_list="${nacl_list} libssl1.0.2:i386"
408fi
409
torne8a6eb692015-11-05 12:43:08410# Find the proper version of packages that depend on mesa. Only one -lts variant
411# of mesa can be installed and everything that depends on it must match.
412
413# Query for the name and status of all mesa LTS variants, filter for only
414# installed packages, extract just the name, and eliminate duplicates (there can
415# be more than one with the same name in the case of multiarch). Expand into an
416# array.
417mesa_packages=($(dpkg-query -Wf'${package} ${status}\n' \
torne12cd9f6c2016-02-24 18:52:23418 libgl1-mesa-glx-lts-\* 2>/dev/null | \
torne8a6eb692015-11-05 12:43:08419 grep " ok installed" | cut -d " " -f 1 | sort -u))
420if [ "${#mesa_packages[@]}" -eq 0 ]; then
421 mesa_variant=""
422elif [ "${#mesa_packages[@]}" -eq 1 ]; then
423 # Strip the base package name and leave just "-lts-whatever"
424 mesa_variant="${mesa_packages[0]#libgl1-mesa-glx}"
425else
426 echo "ERROR: unable to determine which libgl1-mesa-glx variant is installed."
427 exit 1
428fi
[email protected]3a4bd5d2014-06-25 23:55:04429dev_list="${dev_list} libgbm-dev${mesa_variant}
vabrf1e8b17f2015-03-17 10:56:37430 libgles2-mesa-dev${mesa_variant} libgl1-mesa-dev${mesa_variant}
431 mesa-common-dev${mesa_variant}"
[email protected]419a9a62014-06-19 18:26:18432nacl_list="${nacl_list} libgl1-mesa-glx${mesa_variant}:i386"
[email protected]565416362014-01-16 21:26:47433
[email protected]757c2962012-03-15 19:05:18434# Some package names have changed over time
marcin73929a72017-01-04 22:04:58435if package_exists libpng12-0; then
436 lib_list="${lib_list} libpng12-0"
437else
438 lib_list="${lib_list} libpng16-16"
439fi
[email protected]4fc00712013-05-29 23:11:20440if package_exists libnspr4-dbg; then
[email protected]1a0f64a2011-05-20 17:53:55441 dbg_list="${dbg_list} libnspr4-dbg libnss3-dbg"
442 lib_list="${lib_list} libnspr4 libnss3"
[email protected]757c2962012-03-15 19:05:18443else
444 dbg_list="${dbg_list} libnspr4-0d-dbg libnss3-1d-dbg"
445 lib_list="${lib_list} libnspr4-0d libnss3-1d"
446fi
[email protected]4fc00712013-05-29 23:11:20447if package_exists libjpeg-dev; then
[email protected]9e895962013-05-21 08:26:42448 dev_list="${dev_list} libjpeg-dev"
[email protected]b11411c2012-03-21 22:09:41449else
[email protected]9e895962013-05-21 08:26:42450 dev_list="${dev_list} libjpeg62-dev"
[email protected]b11411c2012-03-21 22:09:41451fi
[email protected]4fc00712013-05-29 23:11:20452if package_exists libudev1; then
[email protected]9e895962013-05-21 08:26:42453 dev_list="${dev_list} libudev1"
[email protected]ab9e69082014-06-05 15:28:52454 nacl_list="${nacl_list} libudev1:i386"
[email protected]9e895962013-05-21 08:26:42455else
456 dev_list="${dev_list} libudev0"
[email protected]ab9e69082014-06-05 15:28:52457 nacl_list="${nacl_list} libudev0:i386"
[email protected]9e895962013-05-21 08:26:42458fi
[email protected]3ea42912013-09-06 06:23:57459if package_exists libbrlapi0.6; then
460 dev_list="${dev_list} libbrlapi0.6"
461else
462 dev_list="${dev_list} libbrlapi0.5"
463fi
halton.huo3e728c42016-01-20 05:12:23464if package_exists apache2-bin; then
465 dev_list="${dev_list} apache2-bin"
466else
467 dev_list="${dev_list} apache2.2-bin"
468fi
vadimsh278ff0662016-05-19 00:06:28469if package_exists xfonts-mathml; then
halton.huo3e728c42016-01-20 05:12:23470 dev_list="${dev_list} xfonts-mathml"
471fi
marcin38933dd2017-10-30 00:05:52472if package_exists php7.1-cgi; then
473 dev_list="${dev_list} php7.1-cgi libapache2-mod-php7.1"
474elif package_exists php7.0-cgi; then
vadimsh278ff0662016-05-19 00:06:28475 dev_list="${dev_list} php7.0-cgi libapache2-mod-php7.0"
krasineef3d4b2016-04-22 00:52:18476else
vadimsh278ff0662016-05-19 00:06:28477 dev_list="${dev_list} php5-cgi libapache2-mod-php5"
krasineef3d4b2016-04-22 00:52:18478fi
thomasandersonb4a2bca2016-12-08 06:46:05479# ttf-mscorefonts-installer is in the Debian contrib repo, which has
480# dependencies on non-free software. Install it only if the user has already
481# enabled contrib.
482if package_exists ttf-mscorefonts-installer; then
483 dev_list="${dev_list} ttf-mscorefonts-installer"
484elif package_exists msttcorefonts; then
485 dev_list="${dev_list} msttcorefonts"
486fi
[email protected]757c2962012-03-15 19:05:18487
[email protected]dc099772013-09-30 22:06:58488# Some packages are only needed if the distribution actually supports
[email protected]757c2962012-03-15 19:05:18489# installing them.
[email protected]4fc00712013-05-29 23:11:20490if package_exists appmenu-gtk; then
[email protected]757c2962012-03-15 19:05:18491 lib_list="$lib_list appmenu-gtk"
[email protected]4da8fad2011-04-11 18:42:42492fi
493
Tom Anderson81e7f1792017-11-11 03:56:33494# Cross-toolchain strip is needed for building the sysroots.
495if package_exists binutils-arm-linux-gnueabihf; then
496 dev_list="${dev_list} binutils-arm-linux-gnueabihf"
497fi
498if package_exists binutils-aarch64-linux-gnu; then
499 dev_list="${dev_list} binutils-aarch64-linux-gnu"
500fi
501if package_exists binutils-mipsel-linux-gnu; then
502 dev_list="${dev_list} binutils-mipsel-linux-gnu"
503fi
504if package_exists binutils-mips64el-linux-gnuabi64; then
505 dev_list="${dev_list} binutils-mips64el-linux-gnuabi64"
506fi
507
johnme49bb458a2014-11-27 15:45:31508# When cross building for arm/Android on 64-bit systems the host binaries
509# that are part of v8 need to be compiled with -m32 which means
510# that basic multilib support is needed.
ki.stfu0a79d6992015-09-17 07:27:12511if file -L /sbin/init | grep -q 'ELF 64-bit'; then
johnme49bb458a2014-11-27 15:45:31512 # gcc-multilib conflicts with the arm cross compiler (at least in trusty) but
513 # g++-X.Y-multilib gives us the 32-bit support that we need. Find out the
514 # appropriate value of X and Y by seeing what version the current
515 # distribution's g++-multilib package depends on.
516 multilib_package=$(apt-cache depends g++-multilib --important | \
517 grep -E --color=never --only-matching '\bg\+\+-[0-9.]+-multilib\b')
518 lib32_list="$lib32_list $multilib_package"
519fi
520
[email protected]ba48c4ca2013-10-25 16:11:46521if test "$do_inst_syms" = "" && test 0 -eq ${do_quick_check-0}
[email protected]1eae2bfb2010-01-26 18:17:53522then
523 echo "This script installs all tools and libraries needed to build Chromium."
524 echo ""
525 echo "For most of the libraries, it can also install debugging symbols, which"
526 echo "will allow you to debug code in the system libraries. Most developers"
527 echo "won't need these symbols."
528 echo -n "Do you want me to install them for you (y/N) "
529 if yes_no 1; then
530 do_inst_syms=1
531 fi
532fi
533if test "$do_inst_syms" = "1"; then
[email protected]ba48c4ca2013-10-25 16:11:46534 echo "Including debugging symbols."
thomasandersondfefc6c02017-05-04 01:29:11535 # Many debug packages are not available in Debian stretch,
536 # so exclude the ones that are missing.
537 available_dbg_packages=""
538 for package in ${dbg_list}; do
539 if package_exists ${package}; then
540 available_dbg_packages="${available_dbg_packages} ${package}"
541 fi
542 done
543 dbg_list="${available_dbg_packages}"
[email protected]8ada8c52009-03-10 21:53:08544else
[email protected]ba48c4ca2013-10-25 16:11:46545 echo "Skipping debugging symbols."
[email protected]8ada8c52009-03-10 21:53:08546 dbg_list=
547fi
548
johnme49bb458a2014-11-27 15:45:31549if test "$do_inst_lib32" = "1" ; then
550 echo "Including 32-bit libraries for ARM/Android."
551else
552 echo "Skipping 32-bit libraries for ARM/Android."
553 lib32_list=
[email protected]9f28a9cf2012-12-17 23:31:40554fi
555
[email protected]ba48c4ca2013-10-25 16:11:46556if test "$do_inst_arm" = "1" ; then
[email protected]ba48c4ca2013-10-25 16:11:46557 echo "Including ARM cross toolchain."
[email protected]f2826b6a2012-11-15 01:06:26558else
[email protected]ba48c4ca2013-10-25 16:11:46559 echo "Skipping ARM cross toolchain."
[email protected]f2826b6a2012-11-15 01:06:26560 arm_list=
561fi
562
[email protected]565416362014-01-16 21:26:47563if test "$do_inst_nacl" = "1"; then
[email protected]713eac62014-06-02 23:10:03564 echo "Including NaCl, NaCl toolchain, NaCl ports dependencies."
[email protected]565416362014-01-16 21:26:47565else
[email protected]713eac62014-06-02 23:10:03566 echo "Skipping NaCl, NaCl toolchain, NaCl ports dependencies."
[email protected]565416362014-01-16 21:26:47567 nacl_list=
568fi
569
johnme4bd10302015-01-06 11:25:52570# The `sort -r -s -t: -k2` sorts all the :i386 packages to the front, to avoid
571# confusing dpkg-query (crbug.com/446172).
[email protected]565416362014-01-16 21:26:47572packages="$(
johnme49bb458a2014-11-27 15:45:31573 echo "${dev_list} ${lib_list} ${dbg_list} ${lib32_list} ${arm_list}"\
johnme4bd10302015-01-06 11:25:52574 "${nacl_list}" | tr " " "\n" | sort -u | sort -r -s -t: -k2 | tr "\n" " "
[email protected]565416362014-01-16 21:26:47575)"
[email protected]ba48c4ca2013-10-25 16:11:46576
577if [ 1 -eq "${do_quick_check-0}" ] ; then
thomasanderson73b3a4412016-11-18 23:16:07578 if ! missing_packages="$(dpkg-query -W -f ' ' ${packages} 2>&1)"; then
579 # Distinguish between packages that actually aren't available to the
580 # system (i.e. not in any repo) and packages that just aren't known to
581 # dpkg (i.e. managed by apt).
582 missing_packages="$(echo "${missing_packages}" | awk '{print $NF}')"
583 not_installed=""
584 unknown=""
585 for p in ${missing_packages}; do
586 if apt-cache show ${p} > /dev/null 2>&1; then
587 not_installed="${p}\n${not_installed}"
588 else
589 unknown="${p}\n${unknown}"
[email protected]ba48c4ca2013-10-25 16:11:46590 fi
thomasanderson73b3a4412016-11-18 23:16:07591 done
592 if [ -n "${not_installed}" ]; then
[email protected]ba48c4ca2013-10-25 16:11:46593 echo "WARNING: The following packages are not installed:"
thomasanderson73b3a4412016-11-18 23:16:07594 echo -e "${not_installed}" | sed -e "s/^/ /"
595 fi
596 if [ -n "${unknown}" ]; then
597 echo "WARNING: The following packages are unknown to your system"
598 echo "(maybe missing a repo or need to 'sudo apt-get update'):"
599 echo -e "${unknown}" | sed -e "s/^/ /"
[email protected]ba48c4ca2013-10-25 16:11:46600 fi
601 exit 1
602 fi
603 exit 0
604fi
605
johnme49bb458a2014-11-27 15:45:31606if test "$do_inst_lib32" = "1" || test "$do_inst_nacl" = "1"; then
thomasanderson05c40292017-03-28 19:28:45607 sudo dpkg --add-architecture i386
johnme49bb458a2014-11-27 15:45:31608fi
sbc42564092015-04-01 01:01:28609sudo apt-get update
[email protected]e041ed12009-03-10 16:43:01610
611# We initially run "apt-get" with the --reinstall option and parse its output.
612# This way, we can find all the packages that need to be newly installed
613# without accidentally promoting any packages from "auto" to "manual".
614# We then re-run "apt-get" with just the list of missing packages.
615echo "Finding missing packages..."
[email protected]757c2962012-03-15 19:05:18616# Intentionally leaving $packages unquoted so it's more readable.
[email protected]b6e064522009-08-10 18:47:51617echo "Packages required: " $packages
618echo
[email protected]79a9d2962009-08-06 21:10:58619new_list_cmd="sudo apt-get install --reinstall $(echo $packages)"
[email protected]c3d8b152013-05-10 10:10:03620if new_list="$(yes n | LANGUAGE=en LANG=C $new_list_cmd)"; then
[email protected]b6e064522009-08-10 18:47:51621 # We probably never hit this following line.
thakis3e861de2016-06-14 14:24:01622 echo "No missing packages, and the packages are up to date."
[email protected]b62f11e72010-05-03 17:20:45623elif [ $? -eq 1 ]; then
[email protected]79a9d2962009-08-06 21:10:58624 # We expect apt-get to have exit status of 1.
[email protected]757c2962012-03-15 19:05:18625 # This indicates that we cancelled the install with "yes n|".
[email protected]b6e064522009-08-10 18:47:51626 new_list=$(echo "$new_list" |
[email protected]79a9d2962009-08-06 21:10:58627 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d')
[email protected]b6e064522009-08-10 18:47:51628 new_list=$(echo "$new_list" | sed 's/ *$//')
629 if [ -z "$new_list" ] ; then
thakis3e861de2016-06-14 14:24:01630 echo "No missing packages, and the packages are up to date."
[email protected]b6e064522009-08-10 18:47:51631 else
632 echo "Installing missing packages: $new_list."
[email protected]e2544ed42012-04-23 04:48:31633 sudo apt-get install ${do_quietly-} ${new_list}
[email protected]b6e064522009-08-10 18:47:51634 fi
635 echo
[email protected]79a9d2962009-08-06 21:10:58636else
637 # An apt-get exit status of 100 indicates that a real error has occurred.
[email protected]e041ed12009-03-10 16:43:01638
[email protected]79a9d2962009-08-06 21:10:58639 # I am intentionally leaving out the '"'s around new_list_cmd,
640 # as this makes it easier to cut and paste the output
[email protected]79a9d2962009-08-06 21:10:58641 echo "The following command failed: " ${new_list_cmd}
642 echo
643 echo "It produces the following output:"
644 yes n | $new_list_cmd || true
645 echo
646 echo "You will have to install the above packages yourself."
647 echo
648 exit 100
649fi
[email protected]e041ed12009-03-10 16:43:01650
[email protected]d96cc3472013-09-19 00:53:30651# Install the Chrome OS default fonts. This must go after running
652# apt-get, since install-chromeos-fonts depends on curl.
653if test "$do_inst_chromeos_fonts" != "0"; then
654 echo
655 echo "Installing Chrome OS fonts."
656 dir=`echo $0 | sed -r -e 's/\/[^/]+$//'`
657 if ! sudo $dir/linux/install-chromeos-fonts.py; then
658 echo "ERROR: The installation of the Chrome OS default fonts failed."
659 if [ `stat -f -c %T $dir` == "nfs" ]; then
660 echo "The reason is that your repo is installed on a remote file system."
661 else
662 echo "This is expected if your repo is installed on a remote file system."
663 fi
664 echo "It is recommended to install your repo on a local file system."
665 echo "You can skip the installation of the Chrome OS default founts with"
666 echo "the command line option: --no-chromeos-fonts."
667 exit 1
668 fi
669else
670 echo "Skipping installation of Chrome OS fonts."
671fi
672
thomasanderson5ef5c3d2016-12-08 01:59:19673echo "Installing locales."
674CHROMIUM_LOCALES="da_DK.UTF-8 fr_FR.UTF-8 he_IL.UTF-8 zh_TW.UTF-8"
675LOCALE_GEN=/etc/locale.gen
676if [ -e ${LOCALE_GEN} ]; then
677 OLD_LOCALE_GEN="$(cat /etc/locale.gen)"
678 for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do
679 sudo sed -i "s/^# ${CHROMIUM_LOCALE}/${CHROMIUM_LOCALE}/" ${LOCALE_GEN}
680 done
681 # Regenerating locales can take a while, so only do it if we need to.
682 if (echo "${OLD_LOCALE_GEN}" | cmp -s ${LOCALE_GEN}); then
683 echo "Locales already up-to-date."
684 else
685 sudo locale-gen
686 fi
687else
688 for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do
689 sudo locale-gen ${CHROMIUM_LOCALE}
690 done
691fi