blob: 3bc0bf8f07cd8ce358fcbef9d312c83553b6bf32 [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() {
Tom Anderson17d6cdd2017-11-28 04:13:2571 # 'apt-cache search' takes a regex string, so eg. the +'s in packages like
72 # "libstdc++" need to be escaped.
73 local escaped="$(echo $1 | sed 's/[\~\+\.\:-]/\\&/g')"
74 [ ! -z "$(apt-cache search --names-only "${escaped}" | \
Tom Anderson9c70eb72017-11-27 21:47:3875 awk '$1 == "'$1'" { print $1; }')" ]
[email protected]4fc00712013-05-29 23:11:2076}
77
[email protected]fbeddf22014-01-17 23:59:0178# These default to on because (some) bots need them and it keeps things
79# simple for the bot setup if all bots just run the script in its default
80# mode. Developers who don't want stuff they don't need installed on their
81# own workstations can pass --no-arm --no-nacl when running the script.
82do_inst_arm=1
83do_inst_nacl=1
84
[email protected]1eae2bfb2010-01-26 18:17:5385while test "$1" != ""
86do
87 case "$1" in
[email protected]ce774642011-09-12 23:21:3988 --syms) do_inst_syms=1;;
89 --no-syms) do_inst_syms=0;;
[email protected]ce774642011-09-12 23:21:3990 --lib32) do_inst_lib32=1;;
[email protected]f2826b6a2012-11-15 01:06:2691 --arm) do_inst_arm=1;;
92 --no-arm) do_inst_arm=0;;
[email protected]bd29cdd2013-02-22 03:49:2093 --chromeos-fonts) do_inst_chromeos_fonts=1;;
94 --no-chromeos-fonts) do_inst_chromeos_fonts=0;;
[email protected]565416362014-01-16 21:26:4795 --nacl) do_inst_nacl=1;;
96 --no-nacl) do_inst_nacl=0;;
[email protected]e2544ed42012-04-23 04:48:3197 --no-prompt) do_default=1
98 do_quietly="-qq --assume-yes"
99 ;;
[email protected]ba48c4ca2013-10-25 16:11:46100 --quick-check) do_quick_check=1;;
[email protected]fe63a022013-01-15 22:11:47101 --unsupported) do_unsupported=1;;
[email protected]1eae2bfb2010-01-26 18:17:53102 *) usage;;
103 esac
104 shift
105done
106
johnme49bb458a2014-11-27 15:45:31107if test "$do_inst_arm" = "1"; then
108 do_inst_lib32=1
109fi
110
[email protected]0febc9b2014-05-22 20:07:19111# Check for lsb_release command in $PATH
112if ! which lsb_release > /dev/null; then
113 echo "ERROR: lsb_release not found in \$PATH" >&2
114 exit 1;
115fi
[email protected]f2826b6a2012-11-15 01:06:26116
thomasandersondfefc6c02017-05-04 01:29:11117distro_codename=$(lsb_release --codename --short)
118distro_id=$(lsb_release --id --short)
Marcin Wiacekd7577c32018-04-30 19:12:51119supported_codenames="(trusty|xenial|artful|bionic)"
thomasandersondfefc6c02017-05-04 01:29:11120supported_ids="(Debian)"
[email protected]ba48c4ca2013-10-25 16:11:46121if [ 0 -eq "${do_unsupported-0}" ] && [ 0 -eq "${do_quick_check-0}" ] ; then
thomasandersondfefc6c02017-05-04 01:29:11122 if [[ ! $distro_codename =~ $supported_codenames &&
123 ! $distro_id =~ $supported_ids ]]; then
thomasanderson05c40292017-03-28 19:28:45124 echo -e "ERROR: The only supported distros are\n" \
Marcin Wiacekd7577c32018-04-30 19:12:51125 "\tUbuntu 14.04 LTS (trusty)\n" \
126 "\tUbuntu 16.04 LTS (xenial)\n" \
marcin38933dd2017-10-30 00:05:52127 "\tUbuntu 17.10 (artful)\n" \
Marcin Wiacekd7577c32018-04-30 19:12:51128 "\tUbuntu 18.04 LTS (bionic)\n" \
thomasandersondfefc6c02017-05-04 01:29:11129 "\tDebian 8 (jessie) or later" >&2
anthonyvd2ae919e52016-11-21 19:47:12130 exit 1
[email protected]fe63a022013-01-15 22:11:47131 fi
[email protected]cf1df402008-10-31 21:45:30132
[email protected]fe63a022013-01-15 22:11:47133 if ! uname -m | egrep -q "i686|x86_64"; then
anthonyvd2ae919e52016-11-21 19:47:12134 echo "Only x86 architectures are currently supported" >&2
[email protected]fe63a022013-01-15 22:11:47135 exit
136 fi
[email protected]e041ed12009-03-10 16:43:01137fi
138
[email protected]ba48c4ca2013-10-25 16:11:46139if [ "x$(id -u)" != x0 ] && [ 0 -eq "${do_quick_check-0}" ]; then
[email protected]e041ed12009-03-10 16:43:01140 echo "Running as non-root user."
141 echo "You might have to enter your password one or more times for 'sudo'."
[email protected]8ada8c52009-03-10 21:53:08142 echo
[email protected]e041ed12009-03-10 16:43:01143fi
144
[email protected]fdc6bf52010-06-07 22:01:57145# Packages needed for chromeos only
Tom Anderson6b2b2ad52018-02-22 23:28:14146chromeos_dev_list="libbluetooth-dev libxkbcommon-dev"
147
148if package_exists realpath; then
149 chromeos_dev_list="${chromeos_dev_list} realpath"
150fi
[email protected]fdc6bf52010-06-07 22:01:57151
[email protected]b61f6882013-11-14 20:41:41152# Packages needed for development
thomasanderson20032a5c2017-03-02 00:28:20153dev_list="\
154 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 g++
165 git-core
166 git-svn
167 gperf
Tim Brown06ee43a2018-02-08 18:42:12168 libappindicator-dev
169 libappindicator3-dev
thomasanderson20032a5c2017-03-02 00:28:20170 libasound2-dev
171 libbrlapi-dev
thomasanderson20032a5c2017-03-02 00:28:20172 libbz2-dev
173 libcairo2-dev
174 libcap-dev
175 libcups2-dev
176 libcurl4-gnutls-dev
177 libdrm-dev
178 libelf-dev
179 libffi-dev
Tom Andersond4ea2522018-03-01 20:34:38180 libgbm-dev
thomasanderson20032a5c2017-03-02 00:28:20181 libglib2.0-dev
182 libglu1-mesa-dev
183 libgnome-keyring-dev
184 libgtk2.0-dev
185 libgtk-3-dev
186 libkrb5-dev
187 libnspr4-dev
188 libnss3-dev
189 libpam0g-dev
190 libpci-dev
191 libpulse-dev
192 libsctp-dev
193 libspeechd-dev
194 libsqlite3-dev
195 libssl-dev
196 libudev-dev
197 libwww-perl
198 libxslt1-dev
199 libxss-dev
200 libxt-dev
201 libxtst-dev
Andrew Grievee41aeae2017-08-21 20:53:21202 locales
thomasanderson20032a5c2017-03-02 00:28:20203 openbox
Nico Webera9fa6a72018-02-23 18:26:02204 p7zip
thomasanderson20032a5c2017-03-02 00:28:20205 patch
206 perl
207 pkg-config
208 python
209 python-cherrypy3
210 python-crypto
211 python-dev
212 python-numpy
213 python-opencv
214 python-openssl
215 python-psutil
216 python-yaml
217 rpm
218 ruby
219 subversion
thomasanderson20032a5c2017-03-02 00:28:20220 wdiff
Tom Andersond79de41d2017-08-08 00:23:23221 x11-utils
thomasanderson20032a5c2017-03-02 00:28:20222 xcompmgr
George Burgess IV3d20a812018-05-10 22:24:17223 xz-utils
thomasanderson20032a5c2017-03-02 00:28:20224 zip
225 $chromeos_dev_list
226"
[email protected]fdc6bf52010-06-07 22:01:57227
[email protected]f16aabf2012-08-15 21:00:14228# 64-bit systems need a minimum set of 32-bit compat packages for the pre-built
[email protected]f8ceadb2014-08-18 12:30:23229# NaCl binaries.
ki.stfu0a79d6992015-09-17 07:27:12230if file -L /sbin/init | grep -q 'ELF 64-bit'; then
[email protected]d93d68b12012-10-15 06:39:53231 dev_list="${dev_list} libc6-i386 lib32gcc1 lib32stdc++6"
[email protected]f16aabf2012-08-15 21:00:14232fi
233
[email protected]fdc6bf52010-06-07 22:01:57234# Run-time libraries required by chromeos only
[email protected]ba48c4ca2013-10-25 16:11:46235chromeos_lib_list="libpulse0 libbz2-1.0"
[email protected]e041ed12009-03-10 16:43:01236
237# Full list of required run-time libraries
thomasanderson20032a5c2017-03-02 00:28:20238lib_list="\
Tim Brown06ee43a2018-02-08 18:42:12239 libappindicator1
240 libappindicator3-1
241 libasound2
thomasanderson20032a5c2017-03-02 00:28:20242 libatk1.0-0
243 libc6
thomasanderson20032a5c2017-03-02 00:28:20244 libcairo2
245 libcap2
246 libcups2
247 libexpat1
248 libffi6
249 libfontconfig1
250 libfreetype6
251 libglib2.0-0
252 libgnome-keyring0
253 libgtk2.0-0
254 libgtk-3-0
255 libpam0g
256 libpango1.0-0
257 libpci3
258 libpcre3
259 libpixman-1-0
260 libspeechd2
261 libstdc++6
262 libsqlite3-0
Scott Violetdd7e2372018-04-12 01:11:26263 libwayland-egl1-mesa
thomasanderson20032a5c2017-03-02 00:28:20264 libx11-6
265 libx11-xcb1
266 libxau6
267 libxcb1
268 libxcomposite1
269 libxcursor1
270 libxdamage1
271 libxdmcp6
272 libxext6
273 libxfixes3
274 libxi6
275 libxinerama1
276 libxrandr2
277 libxrender1
278 libxtst6
279 zlib1g
280 $chromeos_lib_list
281"
[email protected]e041ed12009-03-10 16:43:01282
283# Debugging symbols for all of the run-time libraries
thomasanderson20032a5c2017-03-02 00:28:20284dbg_list="\
thomasanderson20032a5c2017-03-02 00:28:20285 libc6-dbg
thomasanderson20032a5c2017-03-02 00:28:20286 libffi6-dbg
thomasanderson20032a5c2017-03-02 00:28:20287 libgtk2.0-0-dbg
thomasanderson20032a5c2017-03-02 00:28:20288 libpcre3-dbg
289 libpixman-1-0-dbg
thomasanderson20032a5c2017-03-02 00:28:20290 libxau6-dbg
291 libxcb1-dbg
292 libxcomposite1-dbg
thomasanderson20032a5c2017-03-02 00:28:20293 libxdmcp6-dbg
294 libxext6-dbg
thomasanderson20032a5c2017-03-02 00:28:20295 libxinerama1-dbg
thomasanderson20032a5c2017-03-02 00:28:20296 zlib1g-dbg
297"
lfgad917d12015-03-17 23:28:00298
Tom Anderson17d6cdd2017-11-28 04:13:25299if package_exists libstdc++6-6-dbg; then
300 dbg_list="${dbg_list} libstdc++6-6-dbg"
301elif package_exists libstdc++6-4.9-dbg; then
lfgad917d12015-03-17 23:28:00302 dbg_list="${dbg_list} libstdc++6-4.9-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25303else
304 dbg_list="${dbg_list} libstdc++6-4.8-dbg"
305fi
306if package_exists libgtk-3-0-dbgsym; then
Tom Anderson1ce9314f2018-02-21 21:04:28307 dbg_list="${dbg_list} libgtk-3-0-dbgsym"
Tom Anderson17d6cdd2017-11-28 04:13:25308elif package_exists libgtk-3-0-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28309 dbg_list="${dbg_list} libgtk-3-0-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25310fi
311if package_exists libatk1.0-0-dbgsym; then
Tom Anderson1ce9314f2018-02-21 21:04:28312 dbg_list="${dbg_list} libatk1.0-0-dbgsym"
Tom Anderson17d6cdd2017-11-28 04:13:25313elif package_exists libatk1.0-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28314 dbg_list="${dbg_list} libatk1.0-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25315fi
316if package_exists libcairo2-dbgsym; then
Tom Anderson1ce9314f2018-02-21 21:04:28317 dbg_list="${dbg_list} libcairo2-dbgsym"
Tom Anderson17d6cdd2017-11-28 04:13:25318elif package_exists libcairo2-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28319 dbg_list="${dbg_list} libcairo2-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25320fi
321if package_exists libfontconfig1-dbgsym; then
Tom Anderson1ce9314f2018-02-21 21:04:28322 dbg_list="${dbg_list} libfontconfig1-dbgsym"
Tom Anderson17d6cdd2017-11-28 04:13:25323else
Tom Anderson1ce9314f2018-02-21 21:04:28324 dbg_list="${dbg_list} libfontconfig1-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25325fi
326if package_exists libxdamage1-dbgsym; then
Tom Anderson1ce9314f2018-02-21 21:04:28327 dbg_list="${dbg_list} libxdamage1-dbgsym"
Tom Anderson17d6cdd2017-11-28 04:13:25328elif package_exists libxdamage1-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28329 dbg_list="${dbg_list} libxdamage1-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25330fi
331if package_exists libpango1.0-dev-dbgsym; then
Tom Anderson1ce9314f2018-02-21 21:04:28332 dbg_list="${dbg_list} libpango1.0-dev-dbgsym"
Tom Anderson17d6cdd2017-11-28 04:13:25333elif package_exists libpango1.0-0-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28334 dbg_list="${dbg_list} libpango1.0-0-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25335fi
336if package_exists libx11-6-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28337 dbg_list="${dbg_list} libx11-6-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25338fi
339if package_exists libx11-xcb1-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28340 dbg_list="${dbg_list} libx11-xcb1-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25341fi
342if package_exists libxfixes3-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28343 dbg_list="${dbg_list} libxfixes3-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25344fi
345if package_exists libxi6-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28346 dbg_list="${dbg_list} libxi6-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25347fi
348if package_exists libxrandr2-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28349 dbg_list="${dbg_list} libxrandr2-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25350fi
351if package_exists libxrender1-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28352 dbg_list="${dbg_list} libxrender1-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25353fi
354if package_exists libxtst6-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28355 dbg_list="${dbg_list} libxtst6-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25356fi
357if package_exists libglib2.0-0-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28358 dbg_list="${dbg_list} libglib2.0-0-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25359fi
Tom Andersonb2582042018-02-22 16:56:07360if package_exists libxcursor1-dbgsym; then
361 dbg_list="${dbg_list} libxcursor1-dbgsym"
362elif package_exists libxcursor1-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28363 dbg_list="${dbg_list} libxcursor1-dbg"
lfgad917d12015-03-17 23:28:00364fi
Tom Andersonc9790a3b2018-04-11 00:42:28365if package_exists libsqlite3-0-dbgsym; then
366 dbg_list="${dbg_list} libsqlite3-0-dbgsym"
367else
368 dbg_list="${dbg_list} libsqlite3-0-dbg"
369fi
[email protected]e041ed12009-03-10 16:43:01370
johnme49bb458a2014-11-27 15:45:31371# 32-bit libraries needed e.g. to compile V8 snapshot for Android or armhf
Tanin Na Nakorn6cbe32e52017-05-30 19:37:04372lib32_list="linux-libc-dev:i386 libpci3:i386"
johnme49bb458a2014-11-27 15:45:31373
Tom Andersondd47ad32018-03-21 19:30:19374# 32-bit libraries needed for a 32-bit build
375lib32_list="$lib32_list libx11-xcb1:i386"
376
[email protected]3f85dac32013-10-29 02:38:46377# arm cross toolchain packages needed to build chrome on armhf
thomasanderson4e3d30fe2016-12-07 18:58:34378EM_REPO="deb http://emdebian.org/tools/debian/ jessie main"
379EM_SOURCE=$(cat <<EOF
380# Repo added by Chromium $0
381${EM_REPO}
382# deb-src http://emdebian.org/tools/debian/ jessie main
383EOF
384)
385EM_ARCHIVE_KEY_FINGER="084C6C6F39159EDB67969AA87DE089671804772E"
386GPP_ARM_PACKAGE="g++-arm-linux-gnueabihf"
thomasandersondfefc6c02017-05-04 01:29:11387case $distro_codename in
kjellander95504ae2017-03-30 12:30:31388 jessie)
thomasanderson4e3d30fe2016-12-07 18:58:34389 eval $(apt-config shell APT_SOURCESDIR 'Dir::Etc::sourceparts/d')
390 CROSSTOOLS_LIST="${APT_SOURCESDIR}/crosstools.list"
391 arm_list="libc6-dev:armhf
392 linux-libc-dev:armhf"
393 if test "$do_inst_arm" = "1"; then
394 if $(dpkg-query -W ${GPP_ARM_PACKAGE} &>/dev/null); then
395 arm_list+=" ${GPP_ARM_PACKAGE}"
396 else
397 echo "The Debian Cross-toolchains repository is necessary to"
398 echo "cross-compile Chromium for arm."
399 echo -n "Do you want me to add it for you (y/N) "
400 if yes_no 1; then
401 gpg --keyserver pgp.mit.edu --recv-keys ${EM_ARCHIVE_KEY_FINGER}
402 gpg -a --export ${EM_ARCHIVE_KEY_FINGER} | sudo apt-key add -
403 if ! grep "^${EM_REPO}" "${CROSSTOOLS_LIST}" &>/dev/null; then
404 echo "${EM_SOURCE}" | sudo tee -a "${CROSSTOOLS_LIST}" >/dev/null
405 fi
406 arm_list+=" ${GPP_ARM_PACKAGE}"
407 fi
408 fi
409 fi
410 ;;
thomasandersondfefc6c02017-05-04 01:29:11411 # All necessary ARM packages are available on the default repos on
412 # Debian 9 and later.
kjellander95504ae2017-03-30 12:30:31413 *)
Tom Anderson81e7f1792017-11-11 03:56:33414 arm_list="libc6-dev-armhf-cross
thomasanderson4e3d30fe2016-12-07 18:58:34415 linux-libc-dev-armhf-cross
416 ${GPP_ARM_PACKAGE}"
417 ;;
418esac
[email protected]31a605532011-08-23 22:27:35419
sbcb5d4ded2015-04-01 17:49:03420# Work around for dependency issue Ubuntu/Trusty: http://crbug.com/435056
thomasandersondfefc6c02017-05-04 01:29:11421case $distro_codename in
friedmanbf8b90a2016-04-21 01:15:48422 trusty)
423 arm_list+=" g++-4.8-multilib-arm-linux-gnueabihf
424 gcc-4.8-multilib-arm-linux-gnueabihf"
425 ;;
Marcin Wiacekd7577c32018-04-30 19:12:51426 xenial|artful|bionic)
krasineef3d4b2016-04-22 00:52:18427 arm_list+=" g++-5-multilib-arm-linux-gnueabihf
428 gcc-5-multilib-arm-linux-gnueabihf
429 gcc-arm-linux-gnueabihf"
430 ;;
friedmanbf8b90a2016-04-21 01:15:48431esac
sbcb5d4ded2015-04-01 17:49:03432
[email protected]713eac62014-06-02 23:10:03433# Packages to build NaCl, its toolchains, and its ports.
Brad Nelson5e59c2c2014-09-06 06:18:45434naclports_list="ant autoconf bison cmake gawk intltool xutils-dev xsltproc"
thomasanderson20032a5c2017-03-02 00:28:20435nacl_list="\
436 g++-mingw-w64-i686
437 lib32z1-dev
438 libasound2:i386
439 libcap2:i386
440 libelf-dev:i386
441 libfontconfig1:i386
thomasanderson20032a5c2017-03-02 00:28:20442 libglib2.0-0:i386
443 libgpm2:i386
444 libgtk2.0-0:i386
445 libgtk-3-0:i386
446 libncurses5:i386
447 lib32ncurses5-dev
448 libnss3:i386
449 libpango1.0-0:i386
thomasandersondfefc6c02017-05-04 01:29:11450 libssl-dev:i386
thomasanderson20032a5c2017-03-02 00:28:20451 libtinfo-dev
452 libtinfo-dev:i386
453 libtool
454 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
Tom Anderson0524b2b72017-12-11 20:39:18466if package_exists libssl1.1; then
467 nacl_list="${nacl_list} libssl1.1:i386"
468elif package_exists libssl1.0.2; then
thomasandersondfefc6c02017-05-04 01:29:11469 nacl_list="${nacl_list} libssl1.0.2:i386"
Tom Anderson0524b2b72017-12-11 20:39:18470else
471 nacl_list="${nacl_list} libssl1.0.0:i386"
thomasandersondfefc6c02017-05-04 01:29:11472fi
473
[email protected]757c2962012-03-15 19:05:18474# Some package names have changed over time
Tom Anderson0524b2b72017-12-11 20:39:18475if package_exists libpng16-16; then
marcin73929a72017-01-04 22:04:58476 lib_list="${lib_list} libpng16-16"
Tom Anderson0524b2b72017-12-11 20:39:18477else
478 lib_list="${lib_list} libpng12-0"
marcin73929a72017-01-04 22:04:58479fi
[email protected]4fc00712013-05-29 23:11:20480if package_exists libnspr4-dbg; then
[email protected]1a0f64a2011-05-20 17:53:55481 dbg_list="${dbg_list} libnspr4-dbg libnss3-dbg"
482 lib_list="${lib_list} libnspr4 libnss3"
[email protected]757c2962012-03-15 19:05:18483else
484 dbg_list="${dbg_list} libnspr4-0d-dbg libnss3-1d-dbg"
485 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
[email protected]3ea42912013-09-06 06:23:57499if package_exists libbrlapi0.6; then
500 dev_list="${dev_list} libbrlapi0.6"
501else
502 dev_list="${dev_list} libbrlapi0.5"
503fi
Tom Anderson0524b2b72017-12-11 20:39:18504if package_exists apache2.2-bin; then
halton.huo3e728c42016-01-20 05:12:23505 dev_list="${dev_list} apache2.2-bin"
Tom Anderson0524b2b72017-12-11 20:39:18506else
507 dev_list="${dev_list} apache2-bin"
halton.huo3e728c42016-01-20 05:12:23508fi
Marcin Wiacekd7577c32018-04-30 19:12:51509if package_exists libav-tools; then
510 dev_list="${dev_list} libav-tools"
511fi
512if package_exists php7.2-cgi; then
513 dev_list="${dev_list} php7.2-cgi libapache2-mod-php7.2"
514elif package_exists php7.1-cgi; then
marcin38933dd2017-10-30 00:05:52515 dev_list="${dev_list} php7.1-cgi libapache2-mod-php7.1"
516elif package_exists php7.0-cgi; then
vadimsh278ff0662016-05-19 00:06:28517 dev_list="${dev_list} php7.0-cgi libapache2-mod-php7.0"
krasineef3d4b2016-04-22 00:52:18518else
vadimsh278ff0662016-05-19 00:06:28519 dev_list="${dev_list} php5-cgi libapache2-mod-php5"
krasineef3d4b2016-04-22 00:52:18520fi
[email protected]757c2962012-03-15 19:05:18521
[email protected]dc099772013-09-30 22:06:58522# Some packages are only needed if the distribution actually supports
[email protected]757c2962012-03-15 19:05:18523# installing them.
[email protected]4fc00712013-05-29 23:11:20524if package_exists appmenu-gtk; then
[email protected]757c2962012-03-15 19:05:18525 lib_list="$lib_list appmenu-gtk"
[email protected]4da8fad2011-04-11 18:42:42526fi
527
Tom Anderson81e7f1792017-11-11 03:56:33528# Cross-toolchain strip is needed for building the sysroots.
529if package_exists binutils-arm-linux-gnueabihf; then
530 dev_list="${dev_list} binutils-arm-linux-gnueabihf"
531fi
532if package_exists binutils-aarch64-linux-gnu; then
533 dev_list="${dev_list} binutils-aarch64-linux-gnu"
534fi
535if package_exists binutils-mipsel-linux-gnu; then
536 dev_list="${dev_list} binutils-mipsel-linux-gnu"
537fi
538if package_exists binutils-mips64el-linux-gnuabi64; then
539 dev_list="${dev_list} binutils-mips64el-linux-gnuabi64"
540fi
541
johnme49bb458a2014-11-27 15:45:31542# When cross building for arm/Android on 64-bit systems the host binaries
543# that are part of v8 need to be compiled with -m32 which means
544# that basic multilib support is needed.
ki.stfu0a79d6992015-09-17 07:27:12545if file -L /sbin/init | grep -q 'ELF 64-bit'; then
johnme49bb458a2014-11-27 15:45:31546 # gcc-multilib conflicts with the arm cross compiler (at least in trusty) but
547 # g++-X.Y-multilib gives us the 32-bit support that we need. Find out the
548 # appropriate value of X and Y by seeing what version the current
549 # distribution's g++-multilib package depends on.
550 multilib_package=$(apt-cache depends g++-multilib --important | \
551 grep -E --color=never --only-matching '\bg\+\+-[0-9.]+-multilib\b')
552 lib32_list="$lib32_list $multilib_package"
553fi
554
[email protected]ba48c4ca2013-10-25 16:11:46555if test "$do_inst_syms" = "" && test 0 -eq ${do_quick_check-0}
[email protected]1eae2bfb2010-01-26 18:17:53556then
557 echo "This script installs all tools and libraries needed to build Chromium."
558 echo ""
559 echo "For most of the libraries, it can also install debugging symbols, which"
560 echo "will allow you to debug code in the system libraries. Most developers"
561 echo "won't need these symbols."
562 echo -n "Do you want me to install them for you (y/N) "
563 if yes_no 1; then
564 do_inst_syms=1
565 fi
566fi
567if test "$do_inst_syms" = "1"; then
[email protected]ba48c4ca2013-10-25 16:11:46568 echo "Including debugging symbols."
[email protected]8ada8c52009-03-10 21:53:08569else
[email protected]ba48c4ca2013-10-25 16:11:46570 echo "Skipping debugging symbols."
[email protected]8ada8c52009-03-10 21:53:08571 dbg_list=
572fi
573
johnme49bb458a2014-11-27 15:45:31574if test "$do_inst_lib32" = "1" ; then
Tom Andersondd47ad32018-03-21 19:30:19575 echo "Including 32-bit libraries."
johnme49bb458a2014-11-27 15:45:31576else
Tom Andersondd47ad32018-03-21 19:30:19577 echo "Skipping 32-bit libraries."
johnme49bb458a2014-11-27 15:45:31578 lib32_list=
[email protected]9f28a9cf2012-12-17 23:31:40579fi
580
[email protected]ba48c4ca2013-10-25 16:11:46581if test "$do_inst_arm" = "1" ; then
[email protected]ba48c4ca2013-10-25 16:11:46582 echo "Including ARM cross toolchain."
[email protected]f2826b6a2012-11-15 01:06:26583else
[email protected]ba48c4ca2013-10-25 16:11:46584 echo "Skipping ARM cross toolchain."
[email protected]f2826b6a2012-11-15 01:06:26585 arm_list=
586fi
587
[email protected]565416362014-01-16 21:26:47588if test "$do_inst_nacl" = "1"; then
[email protected]713eac62014-06-02 23:10:03589 echo "Including NaCl, NaCl toolchain, NaCl ports dependencies."
[email protected]565416362014-01-16 21:26:47590else
[email protected]713eac62014-06-02 23:10:03591 echo "Skipping NaCl, NaCl toolchain, NaCl ports dependencies."
[email protected]565416362014-01-16 21:26:47592 nacl_list=
593fi
594
johnme4bd10302015-01-06 11:25:52595# The `sort -r -s -t: -k2` sorts all the :i386 packages to the front, to avoid
596# confusing dpkg-query (crbug.com/446172).
[email protected]565416362014-01-16 21:26:47597packages="$(
johnme49bb458a2014-11-27 15:45:31598 echo "${dev_list} ${lib_list} ${dbg_list} ${lib32_list} ${arm_list}"\
johnme4bd10302015-01-06 11:25:52599 "${nacl_list}" | tr " " "\n" | sort -u | sort -r -s -t: -k2 | tr "\n" " "
[email protected]565416362014-01-16 21:26:47600)"
[email protected]ba48c4ca2013-10-25 16:11:46601
602if [ 1 -eq "${do_quick_check-0}" ] ; then
thomasanderson73b3a4412016-11-18 23:16:07603 if ! missing_packages="$(dpkg-query -W -f ' ' ${packages} 2>&1)"; then
604 # Distinguish between packages that actually aren't available to the
605 # system (i.e. not in any repo) and packages that just aren't known to
606 # dpkg (i.e. managed by apt).
607 missing_packages="$(echo "${missing_packages}" | awk '{print $NF}')"
608 not_installed=""
609 unknown=""
610 for p in ${missing_packages}; do
611 if apt-cache show ${p} > /dev/null 2>&1; then
612 not_installed="${p}\n${not_installed}"
613 else
614 unknown="${p}\n${unknown}"
[email protected]ba48c4ca2013-10-25 16:11:46615 fi
thomasanderson73b3a4412016-11-18 23:16:07616 done
617 if [ -n "${not_installed}" ]; then
[email protected]ba48c4ca2013-10-25 16:11:46618 echo "WARNING: The following packages are not installed:"
thomasanderson73b3a4412016-11-18 23:16:07619 echo -e "${not_installed}" | sed -e "s/^/ /"
620 fi
621 if [ -n "${unknown}" ]; then
622 echo "WARNING: The following packages are unknown to your system"
623 echo "(maybe missing a repo or need to 'sudo apt-get update'):"
624 echo -e "${unknown}" | sed -e "s/^/ /"
[email protected]ba48c4ca2013-10-25 16:11:46625 fi
626 exit 1
627 fi
628 exit 0
629fi
630
johnme49bb458a2014-11-27 15:45:31631if test "$do_inst_lib32" = "1" || test "$do_inst_nacl" = "1"; then
thomasanderson05c40292017-03-28 19:28:45632 sudo dpkg --add-architecture i386
johnme49bb458a2014-11-27 15:45:31633fi
sbc42564092015-04-01 01:01:28634sudo apt-get update
[email protected]e041ed12009-03-10 16:43:01635
636# We initially run "apt-get" with the --reinstall option and parse its output.
637# This way, we can find all the packages that need to be newly installed
638# without accidentally promoting any packages from "auto" to "manual".
639# We then re-run "apt-get" with just the list of missing packages.
640echo "Finding missing packages..."
[email protected]757c2962012-03-15 19:05:18641# Intentionally leaving $packages unquoted so it's more readable.
[email protected]b6e064522009-08-10 18:47:51642echo "Packages required: " $packages
643echo
[email protected]79a9d2962009-08-06 21:10:58644new_list_cmd="sudo apt-get install --reinstall $(echo $packages)"
[email protected]c3d8b152013-05-10 10:10:03645if new_list="$(yes n | LANGUAGE=en LANG=C $new_list_cmd)"; then
[email protected]b6e064522009-08-10 18:47:51646 # We probably never hit this following line.
thakis3e861de2016-06-14 14:24:01647 echo "No missing packages, and the packages are up to date."
[email protected]b62f11e72010-05-03 17:20:45648elif [ $? -eq 1 ]; then
[email protected]79a9d2962009-08-06 21:10:58649 # We expect apt-get to have exit status of 1.
[email protected]757c2962012-03-15 19:05:18650 # This indicates that we cancelled the install with "yes n|".
[email protected]b6e064522009-08-10 18:47:51651 new_list=$(echo "$new_list" |
[email protected]79a9d2962009-08-06 21:10:58652 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d')
[email protected]b6e064522009-08-10 18:47:51653 new_list=$(echo "$new_list" | sed 's/ *$//')
654 if [ -z "$new_list" ] ; then
thakis3e861de2016-06-14 14:24:01655 echo "No missing packages, and the packages are up to date."
[email protected]b6e064522009-08-10 18:47:51656 else
657 echo "Installing missing packages: $new_list."
[email protected]e2544ed42012-04-23 04:48:31658 sudo apt-get install ${do_quietly-} ${new_list}
[email protected]b6e064522009-08-10 18:47:51659 fi
660 echo
[email protected]79a9d2962009-08-06 21:10:58661else
662 # An apt-get exit status of 100 indicates that a real error has occurred.
[email protected]e041ed12009-03-10 16:43:01663
[email protected]79a9d2962009-08-06 21:10:58664 # I am intentionally leaving out the '"'s around new_list_cmd,
665 # as this makes it easier to cut and paste the output
[email protected]79a9d2962009-08-06 21:10:58666 echo "The following command failed: " ${new_list_cmd}
667 echo
668 echo "It produces the following output:"
669 yes n | $new_list_cmd || true
670 echo
671 echo "You will have to install the above packages yourself."
672 echo
673 exit 100
674fi
[email protected]e041ed12009-03-10 16:43:01675
[email protected]d96cc3472013-09-19 00:53:30676# Install the Chrome OS default fonts. This must go after running
677# apt-get, since install-chromeos-fonts depends on curl.
678if test "$do_inst_chromeos_fonts" != "0"; then
679 echo
680 echo "Installing Chrome OS fonts."
681 dir=`echo $0 | sed -r -e 's/\/[^/]+$//'`
682 if ! sudo $dir/linux/install-chromeos-fonts.py; then
683 echo "ERROR: The installation of the Chrome OS default fonts failed."
684 if [ `stat -f -c %T $dir` == "nfs" ]; then
685 echo "The reason is that your repo is installed on a remote file system."
686 else
687 echo "This is expected if your repo is installed on a remote file system."
688 fi
689 echo "It is recommended to install your repo on a local file system."
690 echo "You can skip the installation of the Chrome OS default founts with"
691 echo "the command line option: --no-chromeos-fonts."
692 exit 1
693 fi
694else
695 echo "Skipping installation of Chrome OS fonts."
696fi
697
thomasanderson5ef5c3d2016-12-08 01:59:19698echo "Installing locales."
699CHROMIUM_LOCALES="da_DK.UTF-8 fr_FR.UTF-8 he_IL.UTF-8 zh_TW.UTF-8"
700LOCALE_GEN=/etc/locale.gen
701if [ -e ${LOCALE_GEN} ]; then
702 OLD_LOCALE_GEN="$(cat /etc/locale.gen)"
703 for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do
704 sudo sed -i "s/^# ${CHROMIUM_LOCALE}/${CHROMIUM_LOCALE}/" ${LOCALE_GEN}
705 done
706 # Regenerating locales can take a while, so only do it if we need to.
707 if (echo "${OLD_LOCALE_GEN}" | cmp -s ${LOCALE_GEN}); then
708 echo "Locales already up-to-date."
709 else
710 sudo locale-gen
711 fi
712else
713 for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do
714 sudo locale-gen ${CHROMIUM_LOCALE}
715 done
716fi