blob: 22e632753f59b9cfac975cf122f64eba78c54955 [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)
marcin38933dd2017-10-30 00:05:52119supported_codenames="(trusty|xenial|zesty|artful)"
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" \
125 "\tUbuntu 14.04 (trusty)\n" \
126 "\tUbuntu 16.04 (xenial)\n" \
marcin3a0793a2017-06-30 03:51:28127 "\tUbuntu 17.04 (zesty)\n" \
marcin38933dd2017-10-30 00:05:52128 "\tUbuntu 17.10 (artful)\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
dnj6a8491d12015-05-26 21:08:12146chromeos_dev_list="libbluetooth-dev libxkbcommon-dev realpath"
[email protected]fdc6bf52010-06-07 22:01:57147
[email protected]b61f6882013-11-14 20:41:41148# Packages needed for development
thomasanderson20032a5c2017-03-02 00:28:20149dev_list="\
150 bison
151 cdbs
152 curl
Tom Anderson8bfb0b02018-02-17 00:44:15153 dbus-x11
thomasanderson20032a5c2017-03-02 00:28:20154 dpkg-dev
155 elfutils
156 devscripts
157 fakeroot
158 flex
159 fonts-ipafont
thomasanderson20032a5c2017-03-02 00:28:20160 g++
161 git-core
162 git-svn
163 gperf
Tim Brown06ee43a2018-02-08 18:42:12164 libappindicator-dev
165 libappindicator3-dev
thomasanderson20032a5c2017-03-02 00:28:20166 libasound2-dev
167 libbrlapi-dev
168 libav-tools
169 libbz2-dev
170 libcairo2-dev
171 libcap-dev
172 libcups2-dev
173 libcurl4-gnutls-dev
174 libdrm-dev
175 libelf-dev
176 libffi-dev
thomasanderson20032a5c2017-03-02 00:28:20177 libglib2.0-dev
178 libglu1-mesa-dev
179 libgnome-keyring-dev
180 libgtk2.0-dev
181 libgtk-3-dev
182 libkrb5-dev
183 libnspr4-dev
184 libnss3-dev
185 libpam0g-dev
186 libpci-dev
187 libpulse-dev
188 libsctp-dev
189 libspeechd-dev
190 libsqlite3-dev
191 libssl-dev
192 libudev-dev
193 libwww-perl
194 libxslt1-dev
195 libxss-dev
196 libxt-dev
197 libxtst-dev
Andrew Grievee41aeae2017-08-21 20:53:21198 locales
thomasanderson20032a5c2017-03-02 00:28:20199 openbox
200 patch
201 perl
202 pkg-config
203 python
204 python-cherrypy3
205 python-crypto
206 python-dev
207 python-numpy
208 python-opencv
209 python-openssl
210 python-psutil
211 python-yaml
212 rpm
213 ruby
214 subversion
thomasanderson20032a5c2017-03-02 00:28:20215 wdiff
Tom Andersond79de41d2017-08-08 00:23:23216 x11-utils
thomasanderson20032a5c2017-03-02 00:28:20217 xcompmgr
218 zip
219 $chromeos_dev_list
220"
[email protected]fdc6bf52010-06-07 22:01:57221
[email protected]f16aabf2012-08-15 21:00:14222# 64-bit systems need a minimum set of 32-bit compat packages for the pre-built
[email protected]f8ceadb2014-08-18 12:30:23223# NaCl binaries.
ki.stfu0a79d6992015-09-17 07:27:12224if file -L /sbin/init | grep -q 'ELF 64-bit'; then
[email protected]d93d68b12012-10-15 06:39:53225 dev_list="${dev_list} libc6-i386 lib32gcc1 lib32stdc++6"
[email protected]f16aabf2012-08-15 21:00:14226fi
227
[email protected]fdc6bf52010-06-07 22:01:57228# Run-time libraries required by chromeos only
[email protected]ba48c4ca2013-10-25 16:11:46229chromeos_lib_list="libpulse0 libbz2-1.0"
[email protected]e041ed12009-03-10 16:43:01230
231# Full list of required run-time libraries
thomasanderson20032a5c2017-03-02 00:28:20232lib_list="\
Tim Brown06ee43a2018-02-08 18:42:12233 libappindicator1
234 libappindicator3-1
235 libasound2
thomasanderson20032a5c2017-03-02 00:28:20236 libatk1.0-0
237 libc6
thomasanderson20032a5c2017-03-02 00:28:20238 libcairo2
239 libcap2
240 libcups2
241 libexpat1
242 libffi6
243 libfontconfig1
244 libfreetype6
245 libglib2.0-0
246 libgnome-keyring0
247 libgtk2.0-0
248 libgtk-3-0
249 libpam0g
250 libpango1.0-0
251 libpci3
252 libpcre3
253 libpixman-1-0
254 libspeechd2
255 libstdc++6
256 libsqlite3-0
257 libx11-6
258 libx11-xcb1
259 libxau6
260 libxcb1
261 libxcomposite1
262 libxcursor1
263 libxdamage1
264 libxdmcp6
265 libxext6
266 libxfixes3
267 libxi6
268 libxinerama1
269 libxrandr2
270 libxrender1
271 libxtst6
272 zlib1g
273 $chromeos_lib_list
274"
[email protected]e041ed12009-03-10 16:43:01275
276# Debugging symbols for all of the run-time libraries
thomasanderson20032a5c2017-03-02 00:28:20277dbg_list="\
thomasanderson20032a5c2017-03-02 00:28:20278 libc6-dbg
thomasanderson20032a5c2017-03-02 00:28:20279 libffi6-dbg
thomasanderson20032a5c2017-03-02 00:28:20280 libgtk2.0-0-dbg
thomasanderson20032a5c2017-03-02 00:28:20281 libpcre3-dbg
282 libpixman-1-0-dbg
283 libsqlite3-0-dbg
thomasanderson20032a5c2017-03-02 00:28:20284 libxau6-dbg
285 libxcb1-dbg
286 libxcomposite1-dbg
thomasanderson20032a5c2017-03-02 00:28:20287 libxdmcp6-dbg
288 libxext6-dbg
thomasanderson20032a5c2017-03-02 00:28:20289 libxinerama1-dbg
thomasanderson20032a5c2017-03-02 00:28:20290 zlib1g-dbg
291"
lfgad917d12015-03-17 23:28:00292
Tom Anderson17d6cdd2017-11-28 04:13:25293if package_exists libstdc++6-6-dbg; then
294 dbg_list="${dbg_list} libstdc++6-6-dbg"
295elif package_exists libstdc++6-4.9-dbg; then
lfgad917d12015-03-17 23:28:00296 dbg_list="${dbg_list} libstdc++6-4.9-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25297else
298 dbg_list="${dbg_list} libstdc++6-4.8-dbg"
299fi
300if package_exists libgtk-3-0-dbgsym; then
Tom Anderson1ce9314f2018-02-21 21:04:28301 dbg_list="${dbg_list} libgtk-3-0-dbgsym"
Tom Anderson17d6cdd2017-11-28 04:13:25302elif package_exists libgtk-3-0-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28303 dbg_list="${dbg_list} libgtk-3-0-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25304fi
305if package_exists libatk1.0-0-dbgsym; then
Tom Anderson1ce9314f2018-02-21 21:04:28306 dbg_list="${dbg_list} libatk1.0-0-dbgsym"
Tom Anderson17d6cdd2017-11-28 04:13:25307elif package_exists libatk1.0-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28308 dbg_list="${dbg_list} libatk1.0-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25309fi
310if package_exists libcairo2-dbgsym; then
Tom Anderson1ce9314f2018-02-21 21:04:28311 dbg_list="${dbg_list} libcairo2-dbgsym"
Tom Anderson17d6cdd2017-11-28 04:13:25312elif package_exists libcairo2-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28313 dbg_list="${dbg_list} libcairo2-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25314fi
315if package_exists libfontconfig1-dbgsym; then
Tom Anderson1ce9314f2018-02-21 21:04:28316 dbg_list="${dbg_list} libfontconfig1-dbgsym"
Tom Anderson17d6cdd2017-11-28 04:13:25317else
Tom Anderson1ce9314f2018-02-21 21:04:28318 dbg_list="${dbg_list} libfontconfig1-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25319fi
320if package_exists libxdamage1-dbgsym; then
Tom Anderson1ce9314f2018-02-21 21:04:28321 dbg_list="${dbg_list} libxdamage1-dbgsym"
Tom Anderson17d6cdd2017-11-28 04:13:25322elif package_exists libxdamage1-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28323 dbg_list="${dbg_list} libxdamage1-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25324fi
325if package_exists libpango1.0-dev-dbgsym; then
Tom Anderson1ce9314f2018-02-21 21:04:28326 dbg_list="${dbg_list} libpango1.0-dev-dbgsym"
Tom Anderson17d6cdd2017-11-28 04:13:25327elif package_exists libpango1.0-0-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28328 dbg_list="${dbg_list} libpango1.0-0-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25329fi
330if package_exists libx11-6-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28331 dbg_list="${dbg_list} libx11-6-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25332fi
333if package_exists libx11-xcb1-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28334 dbg_list="${dbg_list} libx11-xcb1-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25335fi
336if package_exists libxfixes3-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28337 dbg_list="${dbg_list} libxfixes3-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25338fi
339if package_exists libxi6-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28340 dbg_list="${dbg_list} libxi6-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25341fi
342if package_exists libxrandr2-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28343 dbg_list="${dbg_list} libxrandr2-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25344fi
345if package_exists libxrender1-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28346 dbg_list="${dbg_list} libxrender1-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25347fi
348if package_exists libxtst6-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28349 dbg_list="${dbg_list} libxtst6-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25350fi
351if package_exists libglib2.0-0-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28352 dbg_list="${dbg_list} libglib2.0-0-dbg"
Tom Anderson17d6cdd2017-11-28 04:13:25353fi
354if package_exists libxcursor1-dbg; then
Tom Anderson1ce9314f2018-02-21 21:04:28355 dbg_list="${dbg_list} libxcursor1-dbg"
lfgad917d12015-03-17 23:28:00356fi
[email protected]e041ed12009-03-10 16:43:01357
johnme49bb458a2014-11-27 15:45:31358# 32-bit libraries needed e.g. to compile V8 snapshot for Android or armhf
Tanin Na Nakorn6cbe32e52017-05-30 19:37:04359lib32_list="linux-libc-dev:i386 libpci3:i386"
johnme49bb458a2014-11-27 15:45:31360
[email protected]3f85dac32013-10-29 02:38:46361# arm cross toolchain packages needed to build chrome on armhf
thomasanderson4e3d30fe2016-12-07 18:58:34362EM_REPO="deb http://emdebian.org/tools/debian/ jessie main"
363EM_SOURCE=$(cat <<EOF
364# Repo added by Chromium $0
365${EM_REPO}
366# deb-src http://emdebian.org/tools/debian/ jessie main
367EOF
368)
369EM_ARCHIVE_KEY_FINGER="084C6C6F39159EDB67969AA87DE089671804772E"
370GPP_ARM_PACKAGE="g++-arm-linux-gnueabihf"
thomasandersondfefc6c02017-05-04 01:29:11371case $distro_codename in
kjellander95504ae2017-03-30 12:30:31372 jessie)
thomasanderson4e3d30fe2016-12-07 18:58:34373 eval $(apt-config shell APT_SOURCESDIR 'Dir::Etc::sourceparts/d')
374 CROSSTOOLS_LIST="${APT_SOURCESDIR}/crosstools.list"
375 arm_list="libc6-dev:armhf
376 linux-libc-dev:armhf"
377 if test "$do_inst_arm" = "1"; then
378 if $(dpkg-query -W ${GPP_ARM_PACKAGE} &>/dev/null); then
379 arm_list+=" ${GPP_ARM_PACKAGE}"
380 else
381 echo "The Debian Cross-toolchains repository is necessary to"
382 echo "cross-compile Chromium for arm."
383 echo -n "Do you want me to add it for you (y/N) "
384 if yes_no 1; then
385 gpg --keyserver pgp.mit.edu --recv-keys ${EM_ARCHIVE_KEY_FINGER}
386 gpg -a --export ${EM_ARCHIVE_KEY_FINGER} | sudo apt-key add -
387 if ! grep "^${EM_REPO}" "${CROSSTOOLS_LIST}" &>/dev/null; then
388 echo "${EM_SOURCE}" | sudo tee -a "${CROSSTOOLS_LIST}" >/dev/null
389 fi
390 arm_list+=" ${GPP_ARM_PACKAGE}"
391 fi
392 fi
393 fi
394 ;;
thomasandersondfefc6c02017-05-04 01:29:11395 # All necessary ARM packages are available on the default repos on
396 # Debian 9 and later.
kjellander95504ae2017-03-30 12:30:31397 *)
Tom Anderson81e7f1792017-11-11 03:56:33398 arm_list="libc6-dev-armhf-cross
thomasanderson4e3d30fe2016-12-07 18:58:34399 linux-libc-dev-armhf-cross
400 ${GPP_ARM_PACKAGE}"
401 ;;
402esac
[email protected]31a605532011-08-23 22:27:35403
sbcb5d4ded2015-04-01 17:49:03404# Work around for dependency issue Ubuntu/Trusty: http://crbug.com/435056
thomasandersondfefc6c02017-05-04 01:29:11405case $distro_codename in
friedmanbf8b90a2016-04-21 01:15:48406 trusty)
407 arm_list+=" g++-4.8-multilib-arm-linux-gnueabihf
408 gcc-4.8-multilib-arm-linux-gnueabihf"
409 ;;
marcin38933dd2017-10-30 00:05:52410 xenial|zesty|artful)
krasineef3d4b2016-04-22 00:52:18411 arm_list+=" g++-5-multilib-arm-linux-gnueabihf
412 gcc-5-multilib-arm-linux-gnueabihf
413 gcc-arm-linux-gnueabihf"
414 ;;
friedmanbf8b90a2016-04-21 01:15:48415esac
sbcb5d4ded2015-04-01 17:49:03416
[email protected]713eac62014-06-02 23:10:03417# Packages to build NaCl, its toolchains, and its ports.
Brad Nelson5e59c2c2014-09-06 06:18:45418naclports_list="ant autoconf bison cmake gawk intltool xutils-dev xsltproc"
thomasanderson20032a5c2017-03-02 00:28:20419nacl_list="\
420 g++-mingw-w64-i686
421 lib32z1-dev
422 libasound2:i386
423 libcap2:i386
424 libelf-dev:i386
425 libfontconfig1:i386
thomasanderson20032a5c2017-03-02 00:28:20426 libglib2.0-0:i386
427 libgpm2:i386
428 libgtk2.0-0:i386
429 libgtk-3-0:i386
430 libncurses5:i386
431 lib32ncurses5-dev
432 libnss3:i386
433 libpango1.0-0:i386
thomasandersondfefc6c02017-05-04 01:29:11434 libssl-dev:i386
thomasanderson20032a5c2017-03-02 00:28:20435 libtinfo-dev
436 libtinfo-dev:i386
437 libtool
438 libxcomposite1:i386
439 libxcursor1:i386
440 libxdamage1:i386
441 libxi6:i386
442 libxrandr2:i386
443 libxss1:i386
444 libxtst6:i386
445 texinfo
446 xvfb
447 ${naclports_list}
448"
[email protected]419a9a62014-06-19 18:26:18449
Tom Anderson0524b2b72017-12-11 20:39:18450if package_exists libssl1.1; then
451 nacl_list="${nacl_list} libssl1.1:i386"
452elif package_exists libssl1.0.2; then
thomasandersondfefc6c02017-05-04 01:29:11453 nacl_list="${nacl_list} libssl1.0.2:i386"
Tom Anderson0524b2b72017-12-11 20:39:18454else
455 nacl_list="${nacl_list} libssl1.0.0:i386"
thomasandersondfefc6c02017-05-04 01:29:11456fi
457
torne8a6eb692015-11-05 12:43:08458# Find the proper version of packages that depend on mesa. Only one -lts variant
459# of mesa can be installed and everything that depends on it must match.
460
461# Query for the name and status of all mesa LTS variants, filter for only
462# installed packages, extract just the name, and eliminate duplicates (there can
463# be more than one with the same name in the case of multiarch). Expand into an
464# array.
465mesa_packages=($(dpkg-query -Wf'${package} ${status}\n' \
torne12cd9f6c2016-02-24 18:52:23466 libgl1-mesa-glx-lts-\* 2>/dev/null | \
torne8a6eb692015-11-05 12:43:08467 grep " ok installed" | cut -d " " -f 1 | sort -u))
468if [ "${#mesa_packages[@]}" -eq 0 ]; then
469 mesa_variant=""
470elif [ "${#mesa_packages[@]}" -eq 1 ]; then
471 # Strip the base package name and leave just "-lts-whatever"
472 mesa_variant="${mesa_packages[0]#libgl1-mesa-glx}"
473else
474 echo "ERROR: unable to determine which libgl1-mesa-glx variant is installed."
475 exit 1
476fi
[email protected]3a4bd5d2014-06-25 23:55:04477dev_list="${dev_list} libgbm-dev${mesa_variant}
vabrf1e8b17f2015-03-17 10:56:37478 libgles2-mesa-dev${mesa_variant} libgl1-mesa-dev${mesa_variant}
479 mesa-common-dev${mesa_variant}"
[email protected]419a9a62014-06-19 18:26:18480nacl_list="${nacl_list} libgl1-mesa-glx${mesa_variant}:i386"
[email protected]565416362014-01-16 21:26:47481
[email protected]757c2962012-03-15 19:05:18482# Some package names have changed over time
Tom Anderson0524b2b72017-12-11 20:39:18483if package_exists libpng16-16; then
marcin73929a72017-01-04 22:04:58484 lib_list="${lib_list} libpng16-16"
Tom Anderson0524b2b72017-12-11 20:39:18485else
486 lib_list="${lib_list} libpng12-0"
marcin73929a72017-01-04 22:04:58487fi
[email protected]4fc00712013-05-29 23:11:20488if package_exists libnspr4-dbg; then
[email protected]1a0f64a2011-05-20 17:53:55489 dbg_list="${dbg_list} libnspr4-dbg libnss3-dbg"
490 lib_list="${lib_list} libnspr4 libnss3"
[email protected]757c2962012-03-15 19:05:18491else
492 dbg_list="${dbg_list} libnspr4-0d-dbg libnss3-1d-dbg"
493 lib_list="${lib_list} libnspr4-0d libnss3-1d"
494fi
[email protected]4fc00712013-05-29 23:11:20495if package_exists libjpeg-dev; then
[email protected]9e895962013-05-21 08:26:42496 dev_list="${dev_list} libjpeg-dev"
[email protected]b11411c2012-03-21 22:09:41497else
[email protected]9e895962013-05-21 08:26:42498 dev_list="${dev_list} libjpeg62-dev"
[email protected]b11411c2012-03-21 22:09:41499fi
[email protected]4fc00712013-05-29 23:11:20500if package_exists libudev1; then
[email protected]9e895962013-05-21 08:26:42501 dev_list="${dev_list} libudev1"
[email protected]ab9e69082014-06-05 15:28:52502 nacl_list="${nacl_list} libudev1:i386"
[email protected]9e895962013-05-21 08:26:42503else
504 dev_list="${dev_list} libudev0"
[email protected]ab9e69082014-06-05 15:28:52505 nacl_list="${nacl_list} libudev0:i386"
[email protected]9e895962013-05-21 08:26:42506fi
[email protected]3ea42912013-09-06 06:23:57507if package_exists libbrlapi0.6; then
508 dev_list="${dev_list} libbrlapi0.6"
509else
510 dev_list="${dev_list} libbrlapi0.5"
511fi
Tom Anderson0524b2b72017-12-11 20:39:18512if package_exists apache2.2-bin; then
halton.huo3e728c42016-01-20 05:12:23513 dev_list="${dev_list} apache2.2-bin"
Tom Anderson0524b2b72017-12-11 20:39:18514else
515 dev_list="${dev_list} apache2-bin"
halton.huo3e728c42016-01-20 05:12:23516fi
vadimsh278ff0662016-05-19 00:06:28517if package_exists xfonts-mathml; then
halton.huo3e728c42016-01-20 05:12:23518 dev_list="${dev_list} xfonts-mathml"
519fi
marcin38933dd2017-10-30 00:05:52520if package_exists php7.1-cgi; then
521 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
thomasandersonb4a2bca2016-12-08 06:46:05527# ttf-mscorefonts-installer is in the Debian contrib repo, which has
528# dependencies on non-free software. Install it only if the user has already
529# enabled contrib.
530if package_exists ttf-mscorefonts-installer; then
531 dev_list="${dev_list} ttf-mscorefonts-installer"
532elif package_exists msttcorefonts; then
533 dev_list="${dev_list} msttcorefonts"
534fi
[email protected]757c2962012-03-15 19:05:18535
[email protected]dc099772013-09-30 22:06:58536# Some packages are only needed if the distribution actually supports
[email protected]757c2962012-03-15 19:05:18537# installing them.
[email protected]4fc00712013-05-29 23:11:20538if package_exists appmenu-gtk; then
[email protected]757c2962012-03-15 19:05:18539 lib_list="$lib_list appmenu-gtk"
[email protected]4da8fad2011-04-11 18:42:42540fi
541
Tom Anderson81e7f1792017-11-11 03:56:33542# Cross-toolchain strip is needed for building the sysroots.
543if package_exists binutils-arm-linux-gnueabihf; then
544 dev_list="${dev_list} binutils-arm-linux-gnueabihf"
545fi
546if package_exists binutils-aarch64-linux-gnu; then
547 dev_list="${dev_list} binutils-aarch64-linux-gnu"
548fi
549if package_exists binutils-mipsel-linux-gnu; then
550 dev_list="${dev_list} binutils-mipsel-linux-gnu"
551fi
552if package_exists binutils-mips64el-linux-gnuabi64; then
553 dev_list="${dev_list} binutils-mips64el-linux-gnuabi64"
554fi
555
johnme49bb458a2014-11-27 15:45:31556# When cross building for arm/Android on 64-bit systems the host binaries
557# that are part of v8 need to be compiled with -m32 which means
558# that basic multilib support is needed.
ki.stfu0a79d6992015-09-17 07:27:12559if file -L /sbin/init | grep -q 'ELF 64-bit'; then
johnme49bb458a2014-11-27 15:45:31560 # gcc-multilib conflicts with the arm cross compiler (at least in trusty) but
561 # g++-X.Y-multilib gives us the 32-bit support that we need. Find out the
562 # appropriate value of X and Y by seeing what version the current
563 # distribution's g++-multilib package depends on.
564 multilib_package=$(apt-cache depends g++-multilib --important | \
565 grep -E --color=never --only-matching '\bg\+\+-[0-9.]+-multilib\b')
566 lib32_list="$lib32_list $multilib_package"
567fi
568
[email protected]ba48c4ca2013-10-25 16:11:46569if test "$do_inst_syms" = "" && test 0 -eq ${do_quick_check-0}
[email protected]1eae2bfb2010-01-26 18:17:53570then
571 echo "This script installs all tools and libraries needed to build Chromium."
572 echo ""
573 echo "For most of the libraries, it can also install debugging symbols, which"
574 echo "will allow you to debug code in the system libraries. Most developers"
575 echo "won't need these symbols."
576 echo -n "Do you want me to install them for you (y/N) "
577 if yes_no 1; then
578 do_inst_syms=1
579 fi
580fi
581if test "$do_inst_syms" = "1"; then
[email protected]ba48c4ca2013-10-25 16:11:46582 echo "Including debugging symbols."
[email protected]8ada8c52009-03-10 21:53:08583else
[email protected]ba48c4ca2013-10-25 16:11:46584 echo "Skipping debugging symbols."
[email protected]8ada8c52009-03-10 21:53:08585 dbg_list=
586fi
587
johnme49bb458a2014-11-27 15:45:31588if test "$do_inst_lib32" = "1" ; then
589 echo "Including 32-bit libraries for ARM/Android."
590else
591 echo "Skipping 32-bit libraries for ARM/Android."
592 lib32_list=
[email protected]9f28a9cf2012-12-17 23:31:40593fi
594
[email protected]ba48c4ca2013-10-25 16:11:46595if test "$do_inst_arm" = "1" ; then
[email protected]ba48c4ca2013-10-25 16:11:46596 echo "Including ARM cross toolchain."
[email protected]f2826b6a2012-11-15 01:06:26597else
[email protected]ba48c4ca2013-10-25 16:11:46598 echo "Skipping ARM cross toolchain."
[email protected]f2826b6a2012-11-15 01:06:26599 arm_list=
600fi
601
[email protected]565416362014-01-16 21:26:47602if test "$do_inst_nacl" = "1"; then
[email protected]713eac62014-06-02 23:10:03603 echo "Including NaCl, NaCl toolchain, NaCl ports dependencies."
[email protected]565416362014-01-16 21:26:47604else
[email protected]713eac62014-06-02 23:10:03605 echo "Skipping NaCl, NaCl toolchain, NaCl ports dependencies."
[email protected]565416362014-01-16 21:26:47606 nacl_list=
607fi
608
johnme4bd10302015-01-06 11:25:52609# The `sort -r -s -t: -k2` sorts all the :i386 packages to the front, to avoid
610# confusing dpkg-query (crbug.com/446172).
[email protected]565416362014-01-16 21:26:47611packages="$(
johnme49bb458a2014-11-27 15:45:31612 echo "${dev_list} ${lib_list} ${dbg_list} ${lib32_list} ${arm_list}"\
johnme4bd10302015-01-06 11:25:52613 "${nacl_list}" | tr " " "\n" | sort -u | sort -r -s -t: -k2 | tr "\n" " "
[email protected]565416362014-01-16 21:26:47614)"
[email protected]ba48c4ca2013-10-25 16:11:46615
616if [ 1 -eq "${do_quick_check-0}" ] ; then
thomasanderson73b3a4412016-11-18 23:16:07617 if ! missing_packages="$(dpkg-query -W -f ' ' ${packages} 2>&1)"; then
618 # Distinguish between packages that actually aren't available to the
619 # system (i.e. not in any repo) and packages that just aren't known to
620 # dpkg (i.e. managed by apt).
621 missing_packages="$(echo "${missing_packages}" | awk '{print $NF}')"
622 not_installed=""
623 unknown=""
624 for p in ${missing_packages}; do
625 if apt-cache show ${p} > /dev/null 2>&1; then
626 not_installed="${p}\n${not_installed}"
627 else
628 unknown="${p}\n${unknown}"
[email protected]ba48c4ca2013-10-25 16:11:46629 fi
thomasanderson73b3a4412016-11-18 23:16:07630 done
631 if [ -n "${not_installed}" ]; then
[email protected]ba48c4ca2013-10-25 16:11:46632 echo "WARNING: The following packages are not installed:"
thomasanderson73b3a4412016-11-18 23:16:07633 echo -e "${not_installed}" | sed -e "s/^/ /"
634 fi
635 if [ -n "${unknown}" ]; then
636 echo "WARNING: The following packages are unknown to your system"
637 echo "(maybe missing a repo or need to 'sudo apt-get update'):"
638 echo -e "${unknown}" | sed -e "s/^/ /"
[email protected]ba48c4ca2013-10-25 16:11:46639 fi
640 exit 1
641 fi
642 exit 0
643fi
644
johnme49bb458a2014-11-27 15:45:31645if test "$do_inst_lib32" = "1" || test "$do_inst_nacl" = "1"; then
thomasanderson05c40292017-03-28 19:28:45646 sudo dpkg --add-architecture i386
johnme49bb458a2014-11-27 15:45:31647fi
sbc42564092015-04-01 01:01:28648sudo apt-get update
[email protected]e041ed12009-03-10 16:43:01649
650# We initially run "apt-get" with the --reinstall option and parse its output.
651# This way, we can find all the packages that need to be newly installed
652# without accidentally promoting any packages from "auto" to "manual".
653# We then re-run "apt-get" with just the list of missing packages.
654echo "Finding missing packages..."
[email protected]757c2962012-03-15 19:05:18655# Intentionally leaving $packages unquoted so it's more readable.
[email protected]b6e064522009-08-10 18:47:51656echo "Packages required: " $packages
657echo
[email protected]79a9d2962009-08-06 21:10:58658new_list_cmd="sudo apt-get install --reinstall $(echo $packages)"
[email protected]c3d8b152013-05-10 10:10:03659if new_list="$(yes n | LANGUAGE=en LANG=C $new_list_cmd)"; then
[email protected]b6e064522009-08-10 18:47:51660 # We probably never hit this following line.
thakis3e861de2016-06-14 14:24:01661 echo "No missing packages, and the packages are up to date."
[email protected]b62f11e72010-05-03 17:20:45662elif [ $? -eq 1 ]; then
[email protected]79a9d2962009-08-06 21:10:58663 # We expect apt-get to have exit status of 1.
[email protected]757c2962012-03-15 19:05:18664 # This indicates that we cancelled the install with "yes n|".
[email protected]b6e064522009-08-10 18:47:51665 new_list=$(echo "$new_list" |
[email protected]79a9d2962009-08-06 21:10:58666 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d')
[email protected]b6e064522009-08-10 18:47:51667 new_list=$(echo "$new_list" | sed 's/ *$//')
668 if [ -z "$new_list" ] ; then
thakis3e861de2016-06-14 14:24:01669 echo "No missing packages, and the packages are up to date."
[email protected]b6e064522009-08-10 18:47:51670 else
671 echo "Installing missing packages: $new_list."
[email protected]e2544ed42012-04-23 04:48:31672 sudo apt-get install ${do_quietly-} ${new_list}
[email protected]b6e064522009-08-10 18:47:51673 fi
674 echo
[email protected]79a9d2962009-08-06 21:10:58675else
676 # An apt-get exit status of 100 indicates that a real error has occurred.
[email protected]e041ed12009-03-10 16:43:01677
[email protected]79a9d2962009-08-06 21:10:58678 # I am intentionally leaving out the '"'s around new_list_cmd,
679 # as this makes it easier to cut and paste the output
[email protected]79a9d2962009-08-06 21:10:58680 echo "The following command failed: " ${new_list_cmd}
681 echo
682 echo "It produces the following output:"
683 yes n | $new_list_cmd || true
684 echo
685 echo "You will have to install the above packages yourself."
686 echo
687 exit 100
688fi
[email protected]e041ed12009-03-10 16:43:01689
[email protected]d96cc3472013-09-19 00:53:30690# Install the Chrome OS default fonts. This must go after running
691# apt-get, since install-chromeos-fonts depends on curl.
692if test "$do_inst_chromeos_fonts" != "0"; then
693 echo
694 echo "Installing Chrome OS fonts."
695 dir=`echo $0 | sed -r -e 's/\/[^/]+$//'`
696 if ! sudo $dir/linux/install-chromeos-fonts.py; then
697 echo "ERROR: The installation of the Chrome OS default fonts failed."
698 if [ `stat -f -c %T $dir` == "nfs" ]; then
699 echo "The reason is that your repo is installed on a remote file system."
700 else
701 echo "This is expected if your repo is installed on a remote file system."
702 fi
703 echo "It is recommended to install your repo on a local file system."
704 echo "You can skip the installation of the Chrome OS default founts with"
705 echo "the command line option: --no-chromeos-fonts."
706 exit 1
707 fi
708else
709 echo "Skipping installation of Chrome OS fonts."
710fi
711
thomasanderson5ef5c3d2016-12-08 01:59:19712echo "Installing locales."
713CHROMIUM_LOCALES="da_DK.UTF-8 fr_FR.UTF-8 he_IL.UTF-8 zh_TW.UTF-8"
714LOCALE_GEN=/etc/locale.gen
715if [ -e ${LOCALE_GEN} ]; then
716 OLD_LOCALE_GEN="$(cat /etc/locale.gen)"
717 for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do
718 sudo sed -i "s/^# ${CHROMIUM_LOCALE}/${CHROMIUM_LOCALE}/" ${LOCALE_GEN}
719 done
720 # Regenerating locales can take a while, so only do it if we need to.
721 if (echo "${OLD_LOCALE_GEN}" | cmp -s ${LOCALE_GEN}); then
722 echo "Locales already up-to-date."
723 else
724 sudo locale-gen
725 fi
726else
727 for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do
728 sudo locale-gen ${CHROMIUM_LOCALE}
729 done
730fi