[email protected] | e041ed1 | 2009-03-10 16:43:01 | [diff] [blame] | 1 | #!/bin/bash -e |
| 2 | |
[email protected] | aac39c9 | 2012-02-08 18:39:53 | [diff] [blame] | 3 | # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | e46cdae | 2009-08-25 20:59:27 | [diff] [blame] | 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
| 6 | |
[email protected] | cf1df40 | 2008-10-31 21:45:30 | [diff] [blame] | 7 | # Script to install everything needed to build chromium (well, ideally, anyway) |
Tom Anderson | 9f5be079 | 2019-12-19 20:54:32 | [diff] [blame] | 8 | # See https://chromium.googlesource.com/chromium/src/+/master/docs/linux/build_instructions.md |
[email protected] | cf1df40 | 2008-10-31 21:45:30 | [diff] [blame] | 9 | |
[email protected] | 1eae2bfb | 2010-01-26 18:17:53 | [diff] [blame] | 10 | usage() { |
| 11 | echo "Usage: $0 [--options]" |
| 12 | echo "Options:" |
| 13 | echo "--[no-]syms: enable or disable installation of debugging symbols" |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 14 | echo "--lib32: enable installation of 32-bit libraries, e.g. for V8 snapshot" |
[email protected] | f2826b6a | 2012-11-15 01:06:26 | [diff] [blame] | 15 | echo "--[no-]arm: enable or disable installation of arm cross toolchain" |
[email protected] | bd29cdd | 2013-02-22 03:49:20 | [diff] [blame] | 16 | echo "--[no-]chromeos-fonts: enable or disable installation of Chrome OS"\ |
| 17 | "fonts" |
[email protected] | 56541636 | 2014-01-16 21:26:47 | [diff] [blame] | 18 | echo "--[no-]nacl: enable or disable installation of prerequisites for"\ |
| 19 | "building standalone NaCl and all its toolchains" |
Tom Anderson | e9883cd | 2018-06-20 00:32:21 | [diff] [blame] | 20 | echo "--[no-]backwards-compatible: enable or disable installation of packages |
| 21 | that are no longer currently needed and have been removed from this |
| 22 | script. Useful for bisection." |
[email protected] | e2544ed4 | 2012-04-23 04:48:31 | [diff] [blame] | 23 | echo "--no-prompt: silently select standard options/defaults" |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 24 | echo "--quick-check: quickly try to determine if dependencies are installed" |
| 25 | echo " (this avoids interactive prompts and sudo commands," |
| 26 | echo " so might not be 100% accurate)" |
| 27 | echo "--unsupported: attempt installation even on unsupported systems" |
[email protected] | 1eae2bfb | 2010-01-26 18:17:53 | [diff] [blame] | 28 | echo "Script will prompt interactively if options not given." |
| 29 | exit 1 |
| 30 | } |
| 31 | |
Elliott Friedman | 91f373e | 2019-04-16 18:27:17 | [diff] [blame] | 32 | # Build list of apt packages in dpkg --get-selections format. |
| 33 | build_apt_package_list() { |
| 34 | echo "Building apt package list." >&2 |
| 35 | apt-cache dumpavail | \ |
| 36 | python -c '\ |
Raul Tambre | 9e24293b | 2019-05-12 06:11:07 | [diff] [blame] | 37 | from __future__ import print_function; \ |
Elliott Friedman | 91f373e | 2019-04-16 18:27:17 | [diff] [blame] | 38 | import re,sys; \ |
| 39 | o = sys.stdin.read(); \ |
| 40 | p = {"i386": ":i386"}; \ |
| 41 | f = re.M | re.S; \ |
| 42 | r = re.compile(r"^Package: (.+?)$.+?^Architecture: (.+?)$", f); \ |
| 43 | m = ["%s%s" % (x, p.get(y, "")) for x, y in re.findall(r, o)]; \ |
Raul Tambre | 9e24293b | 2019-05-12 06:11:07 | [diff] [blame] | 44 | print("\n".join(m))' |
Elliott Friedman | 91f373e | 2019-04-16 18:27:17 | [diff] [blame] | 45 | } |
| 46 | |
[email protected] | 4fc0071 | 2013-05-29 23:11:20 | [diff] [blame] | 47 | # Checks whether a particular package is available in the repos. |
Elliott Friedman | 91f373e | 2019-04-16 18:27:17 | [diff] [blame] | 48 | # Uses pre-formatted ${apt_package_list}. |
[email protected] | 4fc0071 | 2013-05-29 23:11:20 | [diff] [blame] | 49 | # USAGE: $ package_exists <package name> |
| 50 | package_exists() { |
Elliott Friedman | 91f373e | 2019-04-16 18:27:17 | [diff] [blame] | 51 | if [ -z "${apt_package_list}" ]; then |
| 52 | echo "Call build_apt_package_list() prior to calling package_exists()" >&2 |
| 53 | apt_package_list=$(build_apt_package_list) |
| 54 | fi |
Lei Zhang | cd966ec | 2020-08-25 18:18:14 | [diff] [blame] | 55 | # `grep` takes a regex string, so the +'s in package names, e.g. "libstdc++", |
| 56 | # need to be escaped. |
Tom Anderson | 17d6cdd | 2017-11-28 04:13:25 | [diff] [blame] | 57 | local escaped="$(echo $1 | sed 's/[\~\+\.\:-]/\\&/g')" |
Elliott Friedman | 91f373e | 2019-04-16 18:27:17 | [diff] [blame] | 58 | [ ! -z "$(grep "^${escaped}$" <<< "${apt_package_list}")" ] |
[email protected] | 4fc0071 | 2013-05-29 23:11:20 | [diff] [blame] | 59 | } |
| 60 | |
[email protected] | fbeddf2 | 2014-01-17 23:59:01 | [diff] [blame] | 61 | # These default to on because (some) bots need them and it keeps things |
| 62 | # simple for the bot setup if all bots just run the script in its default |
| 63 | # mode. Developers who don't want stuff they don't need installed on their |
| 64 | # own workstations can pass --no-arm --no-nacl when running the script. |
| 65 | do_inst_arm=1 |
| 66 | do_inst_nacl=1 |
| 67 | |
Tom Anderson | 8e0a484e | 2018-06-14 22:47:02 | [diff] [blame] | 68 | while [ "$1" != "" ] |
[email protected] | 1eae2bfb | 2010-01-26 18:17:53 | [diff] [blame] | 69 | do |
| 70 | case "$1" in |
Tom Anderson | e9883cd | 2018-06-20 00:32:21 | [diff] [blame] | 71 | --syms) do_inst_syms=1;; |
| 72 | --no-syms) do_inst_syms=0;; |
| 73 | --lib32) do_inst_lib32=1;; |
| 74 | --arm) do_inst_arm=1;; |
| 75 | --no-arm) do_inst_arm=0;; |
| 76 | --chromeos-fonts) do_inst_chromeos_fonts=1;; |
| 77 | --no-chromeos-fonts) do_inst_chromeos_fonts=0;; |
| 78 | --nacl) do_inst_nacl=1;; |
| 79 | --no-nacl) do_inst_nacl=0;; |
| 80 | --backwards-compatible) do_inst_backwards_compatible=1;; |
| 81 | --no-backwards-compatible) do_inst_backwards_compatible=0;; |
| 82 | --add-cross-tool-repo) add_cross_tool_repo=1;; |
| 83 | --no-prompt) do_default=1 |
| 84 | do_quietly="-qq --assume-yes" |
[email protected] | e2544ed4 | 2012-04-23 04:48:31 | [diff] [blame] | 85 | ;; |
Tom Anderson | e9883cd | 2018-06-20 00:32:21 | [diff] [blame] | 86 | --quick-check) do_quick_check=1;; |
| 87 | --unsupported) do_unsupported=1;; |
[email protected] | 1eae2bfb | 2010-01-26 18:17:53 | [diff] [blame] | 88 | *) usage;; |
| 89 | esac |
| 90 | shift |
| 91 | done |
| 92 | |
Tom Anderson | 8e0a484e | 2018-06-14 22:47:02 | [diff] [blame] | 93 | if [ "$do_inst_arm" = "1" ]; then |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 94 | do_inst_lib32=1 |
| 95 | fi |
| 96 | |
[email protected] | 0febc9b | 2014-05-22 20:07:19 | [diff] [blame] | 97 | # Check for lsb_release command in $PATH |
| 98 | if ! which lsb_release > /dev/null; then |
| 99 | echo "ERROR: lsb_release not found in \$PATH" >&2 |
Junichi Uekawa | 05b8e272 | 2020-06-12 06:18:44 | [diff] [blame] | 100 | echo "try: sudo apt-get install lsb-release" >&2 |
[email protected] | 0febc9b | 2014-05-22 20:07:19 | [diff] [blame] | 101 | exit 1; |
| 102 | fi |
[email protected] | f2826b6a | 2012-11-15 01:06:26 | [diff] [blame] | 103 | |
thomasanderson | dfefc6c0 | 2017-05-04 01:29:11 | [diff] [blame] | 104 | distro_codename=$(lsb_release --codename --short) |
| 105 | distro_id=$(lsb_release --id --short) |
Chisoon Jeong | 244004b | 2020-04-26 02:54:50 | [diff] [blame] | 106 | supported_codenames="(trusty|xenial|bionic|disco|eoan|focal)" |
thomasanderson | dfefc6c0 | 2017-05-04 01:29:11 | [diff] [blame] | 107 | supported_ids="(Debian)" |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 108 | if [ 0 -eq "${do_unsupported-0}" ] && [ 0 -eq "${do_quick_check-0}" ] ; then |
thomasanderson | dfefc6c0 | 2017-05-04 01:29:11 | [diff] [blame] | 109 | if [[ ! $distro_codename =~ $supported_codenames && |
| 110 | ! $distro_id =~ $supported_ids ]]; then |
thomasanderson | 05c4029 | 2017-03-28 19:28:45 | [diff] [blame] | 111 | echo -e "ERROR: The only supported distros are\n" \ |
Marcin WiÄ…cek | 73d9ec5 | 2019-04-24 21:40:17 | [diff] [blame] | 112 | "\tUbuntu 14.04 LTS (trusty with EoL April 2022)\n" \ |
| 113 | "\tUbuntu 16.04 LTS (xenial with EoL April 2024)\n" \ |
| 114 | "\tUbuntu 18.04 LTS (bionic with EoL April 2028)\n" \ |
Chisoon Jeong | 244004b | 2020-04-26 02:54:50 | [diff] [blame] | 115 | "\tUbuntu 20.04 LTS (focal with Eol April 2030)\n" \ |
Marcin WiÄ…cek | 73d9ec5 | 2019-04-24 21:40:17 | [diff] [blame] | 116 | "\tUbuntu 19.04 (disco)\n" \ |
Marcin | 8dd4550a | 2019-11-21 08:42:36 | [diff] [blame] | 117 | "\tUbuntu 19.10 (eoan)\n" \ |
thomasanderson | dfefc6c0 | 2017-05-04 01:29:11 | [diff] [blame] | 118 | "\tDebian 8 (jessie) or later" >&2 |
anthonyvd | 2ae919e5 | 2016-11-21 19:47:12 | [diff] [blame] | 119 | exit 1 |
[email protected] | fe63a02 | 2013-01-15 22:11:47 | [diff] [blame] | 120 | fi |
[email protected] | cf1df40 | 2008-10-31 21:45:30 | [diff] [blame] | 121 | |
[email protected] | fe63a02 | 2013-01-15 22:11:47 | [diff] [blame] | 122 | if ! uname -m | egrep -q "i686|x86_64"; then |
anthonyvd | 2ae919e5 | 2016-11-21 19:47:12 | [diff] [blame] | 123 | echo "Only x86 architectures are currently supported" >&2 |
[email protected] | fe63a02 | 2013-01-15 22:11:47 | [diff] [blame] | 124 | exit |
| 125 | fi |
[email protected] | e041ed1 | 2009-03-10 16:43:01 | [diff] [blame] | 126 | fi |
| 127 | |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 128 | if [ "x$(id -u)" != x0 ] && [ 0 -eq "${do_quick_check-0}" ]; then |
[email protected] | e041ed1 | 2009-03-10 16:43:01 | [diff] [blame] | 129 | echo "Running as non-root user." |
| 130 | echo "You might have to enter your password one or more times for 'sudo'." |
[email protected] | 8ada8c5 | 2009-03-10 21:53:08 | [diff] [blame] | 131 | echo |
[email protected] | e041ed1 | 2009-03-10 16:43:01 | [diff] [blame] | 132 | fi |
| 133 | |
Ilya Sherman | 08edcfeb | 2020-05-13 17:18:24 | [diff] [blame] | 134 | if [ 0 -eq "${do_quick_check-0}" ] ; then |
| 135 | if [ "$do_inst_lib32" = "1" ] || [ "$do_inst_nacl" = "1" ]; then |
| 136 | sudo dpkg --add-architecture i386 |
| 137 | fi |
| 138 | sudo apt-get update |
Elliott Friedman | 91f373e | 2019-04-16 18:27:17 | [diff] [blame] | 139 | fi |
Elliott Friedman | 91f373e | 2019-04-16 18:27:17 | [diff] [blame] | 140 | |
| 141 | # Populate ${apt_package_list} for package_exists() parsing. |
| 142 | apt_package_list=$(build_apt_package_list) |
| 143 | |
[email protected] | fdc6bf5 | 2010-06-07 22:01:57 | [diff] [blame] | 144 | # Packages needed for chromeos only |
Tom Anderson | 6b2b2ad5 | 2018-02-22 23:28:14 | [diff] [blame] | 145 | chromeos_dev_list="libbluetooth-dev libxkbcommon-dev" |
| 146 | |
| 147 | if package_exists realpath; then |
| 148 | chromeos_dev_list="${chromeos_dev_list} realpath" |
| 149 | fi |
[email protected] | fdc6bf5 | 2010-06-07 22:01:57 | [diff] [blame] | 150 | |
[email protected] | b61f688 | 2013-11-14 20:41:41 | [diff] [blame] | 151 | # Packages needed for development |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 152 | dev_list="\ |
Tom Anderson | 2b8a836 | 2018-08-01 17:41:34 | [diff] [blame] | 153 | binutils |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 154 | bison |
George Burgess IV | 3d20a81 | 2018-05-10 22:24:17 | [diff] [blame] | 155 | bzip2 |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 156 | cdbs |
| 157 | curl |
Tom Anderson | 8bfb0b0 | 2018-02-17 00:44:15 | [diff] [blame] | 158 | dbus-x11 |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 159 | dpkg-dev |
| 160 | elfutils |
| 161 | devscripts |
| 162 | fakeroot |
| 163 | flex |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 164 | git-core |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 165 | gperf |
Tim Brown | 06ee43a | 2018-02-08 18:42:12 | [diff] [blame] | 166 | libappindicator3-dev |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 167 | libasound2-dev |
Tom Anderson | 1320001 | 2018-09-10 22:29:02 | [diff] [blame] | 168 | libatspi2.0-dev |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 169 | libbrlapi-dev |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 170 | libbz2-dev |
| 171 | libcairo2-dev |
| 172 | libcap-dev |
Daniel Bratell | 8cc92d37 | 2019-03-12 16:42:06 | [diff] [blame] | 173 | libc6-dev |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 174 | libcups2-dev |
| 175 | libcurl4-gnutls-dev |
| 176 | libdrm-dev |
| 177 | libelf-dev |
Tom Anderson | 25a7c92 | 2019-12-17 20:09:44 | [diff] [blame] | 178 | libevdev-dev |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 179 | libffi-dev |
Tom Anderson | d4ea252 | 2018-03-01 20:34:38 | [diff] [blame] | 180 | libgbm-dev |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 181 | libglib2.0-dev |
| 182 | libglu1-mesa-dev |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 183 | libgtk-3-dev |
| 184 | libkrb5-dev |
| 185 | libnspr4-dev |
| 186 | libnss3-dev |
| 187 | libpam0g-dev |
| 188 | libpci-dev |
| 189 | libpulse-dev |
| 190 | libsctp-dev |
| 191 | libspeechd-dev |
| 192 | libsqlite3-dev |
| 193 | libssl-dev |
| 194 | libudev-dev |
| 195 | libwww-perl |
| 196 | libxslt1-dev |
| 197 | libxss-dev |
| 198 | libxt-dev |
| 199 | libxtst-dev |
Andrew Grieve | e41aeae | 2017-08-21 20:53:21 | [diff] [blame] | 200 | locales |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 201 | openbox |
Nico Weber | a9fa6a7 | 2018-02-23 18:26:02 | [diff] [blame] | 202 | p7zip |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 203 | patch |
| 204 | perl |
| 205 | pkg-config |
| 206 | python |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 207 | python-crypto |
| 208 | python-dev |
| 209 | python-numpy |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 210 | python-openssl |
| 211 | python-psutil |
| 212 | python-yaml |
| 213 | rpm |
| 214 | ruby |
| 215 | subversion |
Daniel Bratell | bec626a | 2018-06-26 17:40:52 | [diff] [blame] | 216 | uuid-dev |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 217 | wdiff |
Tom Anderson | d79de41d | 2017-08-08 00:23:23 | [diff] [blame] | 218 | x11-utils |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 219 | xcompmgr |
George Burgess IV | 3d20a81 | 2018-05-10 22:24:17 | [diff] [blame] | 220 | xz-utils |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 221 | zip |
| 222 | $chromeos_dev_list |
| 223 | " |
[email protected] | fdc6bf5 | 2010-06-07 22:01:57 | [diff] [blame] | 224 | |
[email protected] | f16aabf | 2012-08-15 21:00:14 | [diff] [blame] | 225 | # 64-bit systems need a minimum set of 32-bit compat packages for the pre-built |
[email protected] | f8ceadb | 2014-08-18 12:30:23 | [diff] [blame] | 226 | # NaCl binaries. |
ki.stfu | 0a79d699 | 2015-09-17 07:27:12 | [diff] [blame] | 227 | if file -L /sbin/init | grep -q 'ELF 64-bit'; then |
Lei Zhang | 3ec3c173 | 2020-08-25 17:29:25 | [diff] [blame] | 228 | dev_list="${dev_list} libc6-i386 lib32stdc++6" |
| 229 | |
| 230 | # lib32gcc-s1 used to be called lib32gcc1 in older distros. |
| 231 | if package_exists lib32gcc-s1; then |
| 232 | dev_list="${dev_list} lib32gcc-s1" |
| 233 | elif package_exists lib32gcc1; then |
| 234 | dev_list="${dev_list} lib32gcc1" |
| 235 | fi |
[email protected] | f16aabf | 2012-08-15 21:00:14 | [diff] [blame] | 236 | fi |
| 237 | |
[email protected] | fdc6bf5 | 2010-06-07 22:01:57 | [diff] [blame] | 238 | # Run-time libraries required by chromeos only |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 239 | chromeos_lib_list="libpulse0 libbz2-1.0" |
[email protected] | e041ed1 | 2009-03-10 16:43:01 | [diff] [blame] | 240 | |
Yves Gerey | e1fe0df | 2018-06-08 08:01:47 | [diff] [blame] | 241 | # List of required run-time libraries |
| 242 | common_lib_list="\ |
Tim Brown | 06ee43a | 2018-02-08 18:42:12 | [diff] [blame] | 243 | libappindicator3-1 |
| 244 | libasound2 |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 245 | libatk1.0-0 |
Tom Anderson | 1320001 | 2018-09-10 22:29:02 | [diff] [blame] | 246 | libatspi2.0-0 |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 247 | libc6 |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 248 | libcairo2 |
| 249 | libcap2 |
| 250 | libcups2 |
Tom Anderson | 25a7c92 | 2019-12-17 20:09:44 | [diff] [blame] | 251 | libdrm2 |
| 252 | libevdev2 |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 253 | libexpat1 |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 254 | libfontconfig1 |
| 255 | libfreetype6 |
Tom Anderson | 25a7c92 | 2019-12-17 20:09:44 | [diff] [blame] | 256 | libgbm1 |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 257 | libglib2.0-0 |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 258 | libgtk-3-0 |
| 259 | libpam0g |
Sami Kyostila | 3c28652 | 2020-08-11 11:09:43 | [diff] [blame] | 260 | libpango-1.0-0 |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 261 | libpci3 |
| 262 | libpcre3 |
| 263 | libpixman-1-0 |
| 264 | libspeechd2 |
| 265 | libstdc++6 |
| 266 | libsqlite3-0 |
Tom Anderson | f8a0c66 | 2018-06-14 23:54:14 | [diff] [blame] | 267 | libuuid1 |
Scott Violet | dd7e237 | 2018-04-12 01:11:26 | [diff] [blame] | 268 | libwayland-egl1-mesa |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 269 | libx11-6 |
| 270 | libx11-xcb1 |
| 271 | libxau6 |
| 272 | libxcb1 |
| 273 | libxcomposite1 |
| 274 | libxcursor1 |
| 275 | libxdamage1 |
| 276 | libxdmcp6 |
| 277 | libxext6 |
| 278 | libxfixes3 |
| 279 | libxi6 |
| 280 | libxinerama1 |
| 281 | libxrandr2 |
| 282 | libxrender1 |
| 283 | libxtst6 |
| 284 | zlib1g |
Yves Gerey | e1fe0df | 2018-06-08 08:01:47 | [diff] [blame] | 285 | " |
| 286 | |
Chisoon Jeong | 244004b | 2020-04-26 02:54:50 | [diff] [blame] | 287 | if package_exists libffi7; then |
| 288 | common_lib_list="${common_lib_list} libffi7" |
| 289 | elif package_exists libffi6; then |
| 290 | common_lib_list="${common_lib_list} libffi6" |
| 291 | fi |
| 292 | |
Yves Gerey | e1fe0df | 2018-06-08 08:01:47 | [diff] [blame] | 293 | # Full list of required run-time libraries |
| 294 | lib_list="\ |
| 295 | $common_lib_list |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 296 | $chromeos_lib_list |
| 297 | " |
[email protected] | e041ed1 | 2009-03-10 16:43:01 | [diff] [blame] | 298 | |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 299 | # 32-bit libraries needed e.g. to compile V8 snapshot for Android or armhf |
Tanin Na Nakorn | 6cbe32e5 | 2017-05-30 19:37:04 | [diff] [blame] | 300 | lib32_list="linux-libc-dev:i386 libpci3:i386" |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 301 | |
Tom Anderson | dd47ad3 | 2018-03-21 19:30:19 | [diff] [blame] | 302 | # 32-bit libraries needed for a 32-bit build |
| 303 | lib32_list="$lib32_list libx11-xcb1:i386" |
| 304 | |
Tom Anderson | e9883cd | 2018-06-20 00:32:21 | [diff] [blame] | 305 | # Packages that have been removed from this script. Regardless of configuration |
| 306 | # or options passed to this script, whenever a package is removed, it should be |
| 307 | # added here. |
| 308 | backwards_compatible_list="\ |
| 309 | 7za |
| 310 | fonts-indic |
| 311 | fonts-ipafont |
| 312 | fonts-stix |
| 313 | fonts-thai-tlwg |
| 314 | fonts-tlwg-garuda |
Nico Weber | 255521f | 2019-08-21 18:07:22 | [diff] [blame] | 315 | g++ |
| 316 | git-svn |
Tom Anderson | e9883cd | 2018-06-20 00:32:21 | [diff] [blame] | 317 | language-pack-da |
| 318 | language-pack-fr |
| 319 | language-pack-he |
| 320 | language-pack-zh-hant |
Tom Anderson | 287339e | 2018-08-22 21:52:02 | [diff] [blame] | 321 | libappindicator-dev |
| 322 | libappindicator1 |
Tom Anderson | e9883cd | 2018-06-20 00:32:21 | [diff] [blame] | 323 | libdconf-dev |
Tom Anderson | e9883cd | 2018-06-20 00:32:21 | [diff] [blame] | 324 | libdconf1 |
| 325 | libdconf1:i386 |
| 326 | libexif-dev |
| 327 | libexif12 |
| 328 | libexif12:i386 |
| 329 | libgbm-dev |
| 330 | libgconf-2-4:i386 |
| 331 | libgconf2-dev |
| 332 | libgl1-mesa-dev |
| 333 | libgl1-mesa-glx:i386 |
| 334 | libgles2-mesa-dev |
Tom Anderson | 99ffaae | 2018-11-29 00:08:31 | [diff] [blame] | 335 | libgtk-3-0:i386 |
Tom Anderson | 287339e | 2018-08-22 21:52:02 | [diff] [blame] | 336 | libgtk2.0-0 |
| 337 | libgtk2.0-0:i386 |
| 338 | libgtk2.0-dev |
Tom Anderson | e9883cd | 2018-06-20 00:32:21 | [diff] [blame] | 339 | mesa-common-dev |
| 340 | msttcorefonts |
| 341 | ttf-dejavu-core |
| 342 | ttf-indic-fonts |
| 343 | ttf-kochi-gothic |
| 344 | ttf-kochi-mincho |
| 345 | ttf-mscorefonts-installer |
| 346 | xfonts-mathml |
| 347 | " |
| 348 | case $distro_codename in |
| 349 | trusty) |
| 350 | backwards_compatible_list+=" \ |
| 351 | libgbm-dev-lts-trusty |
| 352 | libgl1-mesa-dev-lts-trusty |
| 353 | libgl1-mesa-glx-lts-trusty:i386 |
| 354 | libgles2-mesa-dev-lts-trusty |
| 355 | mesa-common-dev-lts-trusty" |
| 356 | ;; |
| 357 | xenial) |
| 358 | backwards_compatible_list+=" \ |
| 359 | libgbm-dev-lts-xenial |
| 360 | libgl1-mesa-dev-lts-xenial |
| 361 | libgl1-mesa-glx-lts-xenial:i386 |
| 362 | libgles2-mesa-dev-lts-xenial |
| 363 | mesa-common-dev-lts-xenial" |
| 364 | ;; |
| 365 | esac |
| 366 | |
[email protected] | 3f85dac3 | 2013-10-29 02:38:46 | [diff] [blame] | 367 | # arm cross toolchain packages needed to build chrome on armhf |
thomasanderson | 4e3d30fe | 2016-12-07 18:58:34 | [diff] [blame] | 368 | EM_REPO="deb http://emdebian.org/tools/debian/ jessie main" |
| 369 | EM_SOURCE=$(cat <<EOF |
| 370 | # Repo added by Chromium $0 |
| 371 | ${EM_REPO} |
| 372 | # deb-src http://emdebian.org/tools/debian/ jessie main |
| 373 | EOF |
| 374 | ) |
| 375 | EM_ARCHIVE_KEY_FINGER="084C6C6F39159EDB67969AA87DE089671804772E" |
| 376 | GPP_ARM_PACKAGE="g++-arm-linux-gnueabihf" |
thomasanderson | dfefc6c0 | 2017-05-04 01:29:11 | [diff] [blame] | 377 | case $distro_codename in |
kjellander | 95504ae | 2017-03-30 12:30:31 | [diff] [blame] | 378 | jessie) |
thomasanderson | 4e3d30fe | 2016-12-07 18:58:34 | [diff] [blame] | 379 | eval $(apt-config shell APT_SOURCESDIR 'Dir::Etc::sourceparts/d') |
| 380 | CROSSTOOLS_LIST="${APT_SOURCESDIR}/crosstools.list" |
| 381 | arm_list="libc6-dev:armhf |
| 382 | linux-libc-dev:armhf" |
Tom Anderson | 8e0a484e | 2018-06-14 22:47:02 | [diff] [blame] | 383 | if [ "$do_inst_arm" = "1" ]; then |
thomasanderson | 4e3d30fe | 2016-12-07 18:58:34 | [diff] [blame] | 384 | if $(dpkg-query -W ${GPP_ARM_PACKAGE} &>/dev/null); then |
| 385 | arm_list+=" ${GPP_ARM_PACKAGE}" |
| 386 | else |
Tom Anderson | 8e0a484e | 2018-06-14 22:47:02 | [diff] [blame] | 387 | if [ "${add_cross_tool_repo}" = "1" ]; then |
thomasanderson | 4e3d30fe | 2016-12-07 18:58:34 | [diff] [blame] | 388 | gpg --keyserver pgp.mit.edu --recv-keys ${EM_ARCHIVE_KEY_FINGER} |
| 389 | gpg -a --export ${EM_ARCHIVE_KEY_FINGER} | sudo apt-key add - |
| 390 | if ! grep "^${EM_REPO}" "${CROSSTOOLS_LIST}" &>/dev/null; then |
| 391 | echo "${EM_SOURCE}" | sudo tee -a "${CROSSTOOLS_LIST}" >/dev/null |
| 392 | fi |
| 393 | arm_list+=" ${GPP_ARM_PACKAGE}" |
Tom Anderson | 8e0a484e | 2018-06-14 22:47:02 | [diff] [blame] | 394 | else |
| 395 | echo "The Debian Cross-toolchains repository is necessary to" |
| 396 | echo "cross-compile Chromium for arm." |
| 397 | echo "Rerun with --add-deb-cross-tool-repo to have it added for you." |
thomasanderson | 4e3d30fe | 2016-12-07 18:58:34 | [diff] [blame] | 398 | fi |
| 399 | fi |
| 400 | fi |
| 401 | ;; |
thomasanderson | dfefc6c0 | 2017-05-04 01:29:11 | [diff] [blame] | 402 | # All necessary ARM packages are available on the default repos on |
| 403 | # Debian 9 and later. |
kjellander | 95504ae | 2017-03-30 12:30:31 | [diff] [blame] | 404 | *) |
Tom Anderson | 81e7f179 | 2017-11-11 03:56:33 | [diff] [blame] | 405 | arm_list="libc6-dev-armhf-cross |
thomasanderson | 4e3d30fe | 2016-12-07 18:58:34 | [diff] [blame] | 406 | linux-libc-dev-armhf-cross |
| 407 | ${GPP_ARM_PACKAGE}" |
| 408 | ;; |
| 409 | esac |
[email protected] | 31a60553 | 2011-08-23 22:27:35 | [diff] [blame] | 410 | |
sbc | b5d4ded | 2015-04-01 17:49:03 | [diff] [blame] | 411 | # Work around for dependency issue Ubuntu/Trusty: http://crbug.com/435056 |
thomasanderson | dfefc6c0 | 2017-05-04 01:29:11 | [diff] [blame] | 412 | case $distro_codename in |
friedman | bf8b90a | 2016-04-21 01:15:48 | [diff] [blame] | 413 | trusty) |
| 414 | arm_list+=" g++-4.8-multilib-arm-linux-gnueabihf |
| 415 | gcc-4.8-multilib-arm-linux-gnueabihf" |
| 416 | ;; |
Marcin WiÄ…cek | 73d9ec5 | 2019-04-24 21:40:17 | [diff] [blame] | 417 | xenial|bionic) |
krasin | eef3d4b | 2016-04-22 00:52:18 | [diff] [blame] | 418 | arm_list+=" g++-5-multilib-arm-linux-gnueabihf |
| 419 | gcc-5-multilib-arm-linux-gnueabihf |
| 420 | gcc-arm-linux-gnueabihf" |
| 421 | ;; |
Marcin | 8dd4550a | 2019-11-21 08:42:36 | [diff] [blame] | 422 | disco|eoan) |
Marcin WiÄ…cek | 73d9ec5 | 2019-04-24 21:40:17 | [diff] [blame] | 423 | arm_list+=" g++-9-multilib-arm-linux-gnueabihf |
| 424 | gcc-9-multilib-arm-linux-gnueabihf |
| 425 | gcc-arm-linux-gnueabihf" |
| 426 | ;; |
Chisoon Jeong | 244004b | 2020-04-26 02:54:50 | [diff] [blame] | 427 | focal) |
| 428 | arm_list+=" g++-10-multilib-arm-linux-gnueabihf |
| 429 | gcc-10-multilib-arm-linux-gnueabihf |
| 430 | gcc-arm-linux-gnueabihf" |
| 431 | ;; |
friedman | bf8b90a | 2016-04-21 01:15:48 | [diff] [blame] | 432 | esac |
sbc | b5d4ded | 2015-04-01 17:49:03 | [diff] [blame] | 433 | |
[email protected] | 713eac6 | 2014-06-02 23:10:03 | [diff] [blame] | 434 | # Packages to build NaCl, its toolchains, and its ports. |
Brad Nelson | 5e59c2c | 2014-09-06 06:18:45 | [diff] [blame] | 435 | naclports_list="ant autoconf bison cmake gawk intltool xutils-dev xsltproc" |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 436 | nacl_list="\ |
| 437 | g++-mingw-w64-i686 |
| 438 | lib32z1-dev |
| 439 | libasound2:i386 |
| 440 | libcap2:i386 |
| 441 | libelf-dev:i386 |
| 442 | libfontconfig1:i386 |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 443 | libglib2.0-0:i386 |
| 444 | libgpm2:i386 |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 445 | libncurses5:i386 |
| 446 | lib32ncurses5-dev |
| 447 | libnss3:i386 |
Sami Kyostila | 3c28652 | 2020-08-11 11:09:43 | [diff] [blame] | 448 | libpango-1.0-0:i386 |
thomasanderson | dfefc6c0 | 2017-05-04 01:29:11 | [diff] [blame] | 449 | libssl-dev:i386 |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 450 | libtinfo-dev |
| 451 | libtinfo-dev:i386 |
| 452 | libtool |
Tom Anderson | f8a0c66 | 2018-06-14 23:54:14 | [diff] [blame] | 453 | libuuid1:i386 |
thomasanderson | 20032a5c | 2017-03-02 00:28:20 | [diff] [blame] | 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] | 419a9a6 | 2014-06-19 18:26:18 | [diff] [blame] | 465 | |
Marcin | 8dd4550a | 2019-11-21 08:42:36 | [diff] [blame] | 466 | # Some package names have changed over time |
Tom Anderson | 0524b2b7 | 2017-12-11 20:39:18 | [diff] [blame] | 467 | if package_exists libssl1.1; then |
| 468 | nacl_list="${nacl_list} libssl1.1:i386" |
| 469 | elif package_exists libssl1.0.2; then |
thomasanderson | dfefc6c0 | 2017-05-04 01:29:11 | [diff] [blame] | 470 | nacl_list="${nacl_list} libssl1.0.2:i386" |
Tom Anderson | 0524b2b7 | 2017-12-11 20:39:18 | [diff] [blame] | 471 | else |
| 472 | nacl_list="${nacl_list} libssl1.0.0:i386" |
thomasanderson | dfefc6c0 | 2017-05-04 01:29:11 | [diff] [blame] | 473 | fi |
kouhei | 64a8dce | 2020-08-26 06:07:06 | [diff] [blame] | 474 | if package_exists libtinfo5; then |
| 475 | nacl_list="${nacl_list} libtinfo5" |
| 476 | fi |
Tom Anderson | 0524b2b7 | 2017-12-11 20:39:18 | [diff] [blame] | 477 | if package_exists libpng16-16; then |
marcin | 73929a7 | 2017-01-04 22:04:58 | [diff] [blame] | 478 | lib_list="${lib_list} libpng16-16" |
Tom Anderson | 0524b2b7 | 2017-12-11 20:39:18 | [diff] [blame] | 479 | else |
| 480 | lib_list="${lib_list} libpng12-0" |
marcin | 73929a7 | 2017-01-04 22:04:58 | [diff] [blame] | 481 | fi |
Tom Anderson | 96a2efc | 2018-06-14 01:12:14 | [diff] [blame] | 482 | if package_exists libnspr4; then |
[email protected] | 1a0f64a | 2011-05-20 17:53:55 | [diff] [blame] | 483 | lib_list="${lib_list} libnspr4 libnss3" |
[email protected] | 757c296 | 2012-03-15 19:05:18 | [diff] [blame] | 484 | else |
[email protected] | 757c296 | 2012-03-15 19:05:18 | [diff] [blame] | 485 | lib_list="${lib_list} libnspr4-0d libnss3-1d" |
| 486 | fi |
[email protected] | 4fc0071 | 2013-05-29 23:11:20 | [diff] [blame] | 487 | if package_exists libjpeg-dev; then |
[email protected] | 9e89596 | 2013-05-21 08:26:42 | [diff] [blame] | 488 | dev_list="${dev_list} libjpeg-dev" |
[email protected] | b11411c | 2012-03-21 22:09:41 | [diff] [blame] | 489 | else |
[email protected] | 9e89596 | 2013-05-21 08:26:42 | [diff] [blame] | 490 | dev_list="${dev_list} libjpeg62-dev" |
[email protected] | b11411c | 2012-03-21 22:09:41 | [diff] [blame] | 491 | fi |
[email protected] | 4fc0071 | 2013-05-29 23:11:20 | [diff] [blame] | 492 | if package_exists libudev1; then |
[email protected] | 9e89596 | 2013-05-21 08:26:42 | [diff] [blame] | 493 | dev_list="${dev_list} libudev1" |
[email protected] | ab9e6908 | 2014-06-05 15:28:52 | [diff] [blame] | 494 | nacl_list="${nacl_list} libudev1:i386" |
[email protected] | 9e89596 | 2013-05-21 08:26:42 | [diff] [blame] | 495 | else |
| 496 | dev_list="${dev_list} libudev0" |
[email protected] | ab9e6908 | 2014-06-05 15:28:52 | [diff] [blame] | 497 | nacl_list="${nacl_list} libudev0:i386" |
[email protected] | 9e89596 | 2013-05-21 08:26:42 | [diff] [blame] | 498 | fi |
Sean McAllister | b611f44 | 2020-02-18 22:46:47 | [diff] [blame] | 499 | if package_exists libbrlapi0.7; then |
| 500 | dev_list="${dev_list} libbrlapi0.7" |
| 501 | elif package_exists libbrlapi0.6; then |
[email protected] | 3ea4291 | 2013-09-06 06:23:57 | [diff] [blame] | 502 | dev_list="${dev_list} libbrlapi0.6" |
| 503 | else |
| 504 | dev_list="${dev_list} libbrlapi0.5" |
| 505 | fi |
Tom Anderson | 0524b2b7 | 2017-12-11 20:39:18 | [diff] [blame] | 506 | if package_exists apache2.2-bin; then |
halton.huo | 3e728c4 | 2016-01-20 05:12:23 | [diff] [blame] | 507 | dev_list="${dev_list} apache2.2-bin" |
Tom Anderson | 0524b2b7 | 2017-12-11 20:39:18 | [diff] [blame] | 508 | else |
| 509 | dev_list="${dev_list} apache2-bin" |
halton.huo | 3e728c4 | 2016-01-20 05:12:23 | [diff] [blame] | 510 | fi |
Marcin Wiacek | d7577c3 | 2018-04-30 19:12:51 | [diff] [blame] | 511 | if package_exists libav-tools; then |
| 512 | dev_list="${dev_list} libav-tools" |
| 513 | fi |
Chisoon Jeong | 244004b | 2020-04-26 02:54:50 | [diff] [blame] | 514 | if package_exists php7.4-cgi; then |
| 515 | dev_list="${dev_list} php7.4-cgi libapache2-mod-php7.4" |
| 516 | elif package_exists php7.3-cgi; then |
Marcin | 8dd4550a | 2019-11-21 08:42:36 | [diff] [blame] | 517 | dev_list="${dev_list} php7.3-cgi libapache2-mod-php7.3" |
| 518 | elif package_exists php7.2-cgi; then |
Marcin Wiacek | d7577c3 | 2018-04-30 19:12:51 | [diff] [blame] | 519 | dev_list="${dev_list} php7.2-cgi libapache2-mod-php7.2" |
| 520 | elif package_exists php7.1-cgi; then |
marcin | 38933dd | 2017-10-30 00:05:52 | [diff] [blame] | 521 | dev_list="${dev_list} php7.1-cgi libapache2-mod-php7.1" |
| 522 | elif package_exists php7.0-cgi; then |
vadimsh | 278ff066 | 2016-05-19 00:06:28 | [diff] [blame] | 523 | dev_list="${dev_list} php7.0-cgi libapache2-mod-php7.0" |
krasin | eef3d4b | 2016-04-22 00:52:18 | [diff] [blame] | 524 | else |
vadimsh | 278ff066 | 2016-05-19 00:06:28 | [diff] [blame] | 525 | dev_list="${dev_list} php5-cgi libapache2-mod-php5" |
krasin | eef3d4b | 2016-04-22 00:52:18 | [diff] [blame] | 526 | fi |
[email protected] | 757c296 | 2012-03-15 19:05:18 | [diff] [blame] | 527 | |
[email protected] | dc09977 | 2013-09-30 22:06:58 | [diff] [blame] | 528 | # Some packages are only needed if the distribution actually supports |
[email protected] | 757c296 | 2012-03-15 19:05:18 | [diff] [blame] | 529 | # installing them. |
[email protected] | 4fc0071 | 2013-05-29 23:11:20 | [diff] [blame] | 530 | if package_exists appmenu-gtk; then |
[email protected] | 757c296 | 2012-03-15 19:05:18 | [diff] [blame] | 531 | lib_list="$lib_list appmenu-gtk" |
[email protected] | 4da8fad | 2011-04-11 18:42:42 | [diff] [blame] | 532 | fi |
Marcin | 8dd4550a | 2019-11-21 08:42:36 | [diff] [blame] | 533 | if package_exists libgnome-keyring0; then |
| 534 | lib_list="${lib_list} libgnome-keyring0" |
| 535 | fi |
| 536 | if package_exists libgnome-keyring-dev; then |
| 537 | lib_list="${lib_list} libgnome-keyring-dev" |
| 538 | fi |
Tom Anderson | 25a7c92 | 2019-12-17 20:09:44 | [diff] [blame] | 539 | if package_exists libvulkan-dev; then |
Tom Anderson | d5173731 | 2019-12-23 19:24:14 | [diff] [blame] | 540 | dev_list="${dev_list} libvulkan-dev" |
Tom Anderson | 25a7c92 | 2019-12-17 20:09:44 | [diff] [blame] | 541 | fi |
| 542 | if package_exists libvulkan1; then |
Tom Anderson | d5173731 | 2019-12-23 19:24:14 | [diff] [blame] | 543 | lib_list="${lib_list} libvulkan1" |
| 544 | fi |
| 545 | if package_exists libinput10; then |
| 546 | lib_list="${lib_list} libinput10" |
| 547 | fi |
| 548 | if package_exists libinput-dev; then |
Tom Anderson | e1fc6aa4 | 2020-02-22 01:38:36 | [diff] [blame] | 549 | dev_list="${dev_list} libinput-dev" |
| 550 | fi |
| 551 | if package_exists snapcraft; then |
| 552 | dev_list="${dev_list} snapcraft" |
Tom Anderson | 25a7c92 | 2019-12-17 20:09:44 | [diff] [blame] | 553 | fi |
[email protected] | 4da8fad | 2011-04-11 18:42:42 | [diff] [blame] | 554 | |
Tom Anderson | 81e7f179 | 2017-11-11 03:56:33 | [diff] [blame] | 555 | # Cross-toolchain strip is needed for building the sysroots. |
| 556 | if package_exists binutils-arm-linux-gnueabihf; then |
| 557 | dev_list="${dev_list} binutils-arm-linux-gnueabihf" |
| 558 | fi |
| 559 | if package_exists binutils-aarch64-linux-gnu; then |
| 560 | dev_list="${dev_list} binutils-aarch64-linux-gnu" |
| 561 | fi |
| 562 | if package_exists binutils-mipsel-linux-gnu; then |
| 563 | dev_list="${dev_list} binutils-mipsel-linux-gnu" |
| 564 | fi |
| 565 | if package_exists binutils-mips64el-linux-gnuabi64; then |
| 566 | dev_list="${dev_list} binutils-mips64el-linux-gnuabi64" |
| 567 | fi |
| 568 | |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 569 | # When cross building for arm/Android on 64-bit systems the host binaries |
| 570 | # that are part of v8 need to be compiled with -m32 which means |
| 571 | # that basic multilib support is needed. |
ki.stfu | 0a79d699 | 2015-09-17 07:27:12 | [diff] [blame] | 572 | if file -L /sbin/init | grep -q 'ELF 64-bit'; then |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 573 | # gcc-multilib conflicts with the arm cross compiler (at least in trusty) but |
| 574 | # g++-X.Y-multilib gives us the 32-bit support that we need. Find out the |
| 575 | # appropriate value of X and Y by seeing what version the current |
| 576 | # distribution's g++-multilib package depends on. |
| 577 | multilib_package=$(apt-cache depends g++-multilib --important | \ |
| 578 | grep -E --color=never --only-matching '\bg\+\+-[0-9.]+-multilib\b') |
| 579 | lib32_list="$lib32_list $multilib_package" |
| 580 | fi |
| 581 | |
Tom Anderson | 8e0a484e | 2018-06-14 22:47:02 | [diff] [blame] | 582 | if [ "$do_inst_syms" = "1" ]; then |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 583 | echo "Including debugging symbols." |
Tom Anderson | 8206da9a | 2018-06-12 01:49:09 | [diff] [blame] | 584 | |
| 585 | # Debian is in the process of transitioning to automatic debug packages, which |
| 586 | # have the -dbgsym suffix (https://wiki.debian.org/AutomaticDebugPackages). |
| 587 | # Untransitioned packages have the -dbg suffix. And on some systems, neither |
| 588 | # will be available, so exclude the ones that are missing. |
| 589 | dbg_package_name() { |
| 590 | if package_exists "$1-dbgsym"; then |
| 591 | echo "$1-dbgsym" |
| 592 | elif package_exists "$1-dbg"; then |
| 593 | echo "$1-dbg" |
| 594 | fi |
| 595 | } |
| 596 | |
| 597 | for package in "${common_lib_list}"; do |
| 598 | dbg_list="$dbg_list $(dbg_package_name ${package})" |
| 599 | done |
| 600 | |
| 601 | # Debugging symbols packages not following common naming scheme |
Tom Anderson | 8e0a484e | 2018-06-14 22:47:02 | [diff] [blame] | 602 | if [ "$(dbg_package_name libstdc++6)" == "" ]; then |
| 603 | if package_exists libstdc++6-8-dbg; then |
| 604 | dbg_list="${dbg_list} libstdc++6-8-dbg" |
| 605 | elif package_exists libstdc++6-7-dbg; then |
| 606 | dbg_list="${dbg_list} libstdc++6-7-dbg" |
| 607 | elif package_exists libstdc++6-6-dbg; then |
Tom Anderson | 8206da9a | 2018-06-12 01:49:09 | [diff] [blame] | 608 | dbg_list="${dbg_list} libstdc++6-6-dbg" |
Tom Anderson | 8e0a484e | 2018-06-14 22:47:02 | [diff] [blame] | 609 | elif package_exists libstdc++6-5-dbg; then |
| 610 | dbg_list="${dbg_list} libstdc++6-5-dbg" |
Tom Anderson | 8206da9a | 2018-06-12 01:49:09 | [diff] [blame] | 611 | elif package_exists libstdc++6-4.9-dbg; then |
| 612 | dbg_list="${dbg_list} libstdc++6-4.9-dbg" |
Tom Anderson | 8e0a484e | 2018-06-14 22:47:02 | [diff] [blame] | 613 | elif package_exists libstdc++6-4.8-dbg; then |
Tom Anderson | 8206da9a | 2018-06-12 01:49:09 | [diff] [blame] | 614 | dbg_list="${dbg_list} libstdc++6-4.8-dbg" |
Tom Anderson | 8e0a484e | 2018-06-14 22:47:02 | [diff] [blame] | 615 | elif package_exists libstdc++6-4.7-dbg; then |
| 616 | dbg_list="${dbg_list} libstdc++6-4.7-dbg" |
Tom Anderson | e9883cd | 2018-06-20 00:32:21 | [diff] [blame] | 617 | elif package_exists libstdc++6-4.6-dbg; then |
| 618 | dbg_list="${dbg_list} libstdc++6-4.6-dbg" |
Tom Anderson | 8206da9a | 2018-06-12 01:49:09 | [diff] [blame] | 619 | fi |
| 620 | fi |
Tom Anderson | 8e0a484e | 2018-06-14 22:47:02 | [diff] [blame] | 621 | if [ "$(dbg_package_name libatk1.0-0)" == "" ]; then |
Tom Anderson | 8206da9a | 2018-06-12 01:49:09 | [diff] [blame] | 622 | dbg_list="$dbg_list $(dbg_package_name libatk1.0)" |
| 623 | fi |
Sami Kyostila | 3c28652 | 2020-08-11 11:09:43 | [diff] [blame] | 624 | if [ "$(dbg_package_name libpango-1.0-0)" == "" ]; then |
Tom Anderson | 8206da9a | 2018-06-12 01:49:09 | [diff] [blame] | 625 | dbg_list="$dbg_list $(dbg_package_name libpango1.0-dev)" |
| 626 | fi |
[email protected] | 8ada8c5 | 2009-03-10 21:53:08 | [diff] [blame] | 627 | else |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 628 | echo "Skipping debugging symbols." |
[email protected] | 8ada8c5 | 2009-03-10 21:53:08 | [diff] [blame] | 629 | dbg_list= |
| 630 | fi |
| 631 | |
Tom Anderson | 8e0a484e | 2018-06-14 22:47:02 | [diff] [blame] | 632 | if [ "$do_inst_lib32" = "1" ]; then |
Tom Anderson | dd47ad3 | 2018-03-21 19:30:19 | [diff] [blame] | 633 | echo "Including 32-bit libraries." |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 634 | else |
Tom Anderson | dd47ad3 | 2018-03-21 19:30:19 | [diff] [blame] | 635 | echo "Skipping 32-bit libraries." |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 636 | lib32_list= |
[email protected] | 9f28a9cf | 2012-12-17 23:31:40 | [diff] [blame] | 637 | fi |
| 638 | |
Tom Anderson | 8e0a484e | 2018-06-14 22:47:02 | [diff] [blame] | 639 | if [ "$do_inst_arm" = "1" ]; then |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 640 | echo "Including ARM cross toolchain." |
[email protected] | f2826b6a | 2012-11-15 01:06:26 | [diff] [blame] | 641 | else |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 642 | echo "Skipping ARM cross toolchain." |
[email protected] | f2826b6a | 2012-11-15 01:06:26 | [diff] [blame] | 643 | arm_list= |
| 644 | fi |
| 645 | |
Tom Anderson | 8e0a484e | 2018-06-14 22:47:02 | [diff] [blame] | 646 | if [ "$do_inst_nacl" = "1" ]; then |
[email protected] | 713eac6 | 2014-06-02 23:10:03 | [diff] [blame] | 647 | echo "Including NaCl, NaCl toolchain, NaCl ports dependencies." |
[email protected] | 56541636 | 2014-01-16 21:26:47 | [diff] [blame] | 648 | else |
[email protected] | 713eac6 | 2014-06-02 23:10:03 | [diff] [blame] | 649 | echo "Skipping NaCl, NaCl toolchain, NaCl ports dependencies." |
[email protected] | 56541636 | 2014-01-16 21:26:47 | [diff] [blame] | 650 | nacl_list= |
| 651 | fi |
| 652 | |
Tom Anderson | e9883cd | 2018-06-20 00:32:21 | [diff] [blame] | 653 | filtered_backwards_compatible_list= |
| 654 | if [ "$do_inst_backwards_compatible" = "1" ]; then |
| 655 | echo "Including backwards compatible packages." |
| 656 | for package in ${backwards_compatible_list}; do |
| 657 | if package_exists ${package}; then |
| 658 | filtered_backwards_compatible_list+=" ${package}" |
| 659 | fi |
| 660 | done |
| 661 | fi |
| 662 | |
johnme | 4bd1030 | 2015-01-06 11:25:52 | [diff] [blame] | 663 | # The `sort -r -s -t: -k2` sorts all the :i386 packages to the front, to avoid |
| 664 | # confusing dpkg-query (crbug.com/446172). |
[email protected] | 56541636 | 2014-01-16 21:26:47 | [diff] [blame] | 665 | packages="$( |
Tom Anderson | e9883cd | 2018-06-20 00:32:21 | [diff] [blame] | 666 | echo "${dev_list} ${lib_list} ${dbg_list} ${lib32_list} ${arm_list}" \ |
| 667 | "${nacl_list}" ${filtered_backwards_compatible_list} | tr " " "\n" | \ |
| 668 | sort -u | sort -r -s -t: -k2 | tr "\n" " " |
[email protected] | 56541636 | 2014-01-16 21:26:47 | [diff] [blame] | 669 | )" |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 670 | |
| 671 | if [ 1 -eq "${do_quick_check-0}" ] ; then |
thomasanderson | 73b3a441 | 2016-11-18 23:16:07 | [diff] [blame] | 672 | if ! missing_packages="$(dpkg-query -W -f ' ' ${packages} 2>&1)"; then |
| 673 | # Distinguish between packages that actually aren't available to the |
| 674 | # system (i.e. not in any repo) and packages that just aren't known to |
| 675 | # dpkg (i.e. managed by apt). |
| 676 | missing_packages="$(echo "${missing_packages}" | awk '{print $NF}')" |
| 677 | not_installed="" |
| 678 | unknown="" |
| 679 | for p in ${missing_packages}; do |
| 680 | if apt-cache show ${p} > /dev/null 2>&1; then |
| 681 | not_installed="${p}\n${not_installed}" |
| 682 | else |
| 683 | unknown="${p}\n${unknown}" |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 684 | fi |
thomasanderson | 73b3a441 | 2016-11-18 23:16:07 | [diff] [blame] | 685 | done |
| 686 | if [ -n "${not_installed}" ]; then |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 687 | echo "WARNING: The following packages are not installed:" |
thomasanderson | 73b3a441 | 2016-11-18 23:16:07 | [diff] [blame] | 688 | echo -e "${not_installed}" | sed -e "s/^/ /" |
| 689 | fi |
| 690 | if [ -n "${unknown}" ]; then |
| 691 | echo "WARNING: The following packages are unknown to your system" |
| 692 | echo "(maybe missing a repo or need to 'sudo apt-get update'):" |
| 693 | echo -e "${unknown}" | sed -e "s/^/ /" |
[email protected] | ba48c4ca | 2013-10-25 16:11:46 | [diff] [blame] | 694 | fi |
| 695 | exit 1 |
| 696 | fi |
| 697 | exit 0 |
| 698 | fi |
| 699 | |
[email protected] | e041ed1 | 2009-03-10 16:43:01 | [diff] [blame] | 700 | echo "Finding missing packages..." |
[email protected] | 757c296 | 2012-03-15 19:05:18 | [diff] [blame] | 701 | # Intentionally leaving $packages unquoted so it's more readable. |
[email protected] | b6e06452 | 2009-08-10 18:47:51 | [diff] [blame] | 702 | echo "Packages required: " $packages |
| 703 | echo |
Daniel Bratell | 8cc92d37 | 2019-03-12 16:42:06 | [diff] [blame] | 704 | query_cmd="apt-get --just-print install $(echo $packages)" |
| 705 | if cmd_output="$(LANGUAGE=en LANG=C $query_cmd)"; then |
| 706 | new_list=$(echo "$cmd_output" | |
| 707 | sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d' | |
| 708 | sed 's/ *$//') |
| 709 | upgrade_list=$(echo "$cmd_output" | |
| 710 | sed -e '1,/The following packages will be upgraded:/d;s/^ //;t;d' | |
| 711 | sed 's/ *$//') |
| 712 | if [ -z "$new_list" ] && [ -z "$upgrade_list" ]; then |
thakis | 3e861de | 2016-06-14 14:24:01 | [diff] [blame] | 713 | echo "No missing packages, and the packages are up to date." |
[email protected] | b6e06452 | 2009-08-10 18:47:51 | [diff] [blame] | 714 | else |
Daniel Bratell | 8cc92d37 | 2019-03-12 16:42:06 | [diff] [blame] | 715 | echo "Installing and upgrading packages: $new_list $upgrade_list." |
| 716 | sudo apt-get install ${do_quietly-} ${new_list} ${upgrade_list} |
[email protected] | b6e06452 | 2009-08-10 18:47:51 | [diff] [blame] | 717 | fi |
| 718 | echo |
[email protected] | 79a9d296 | 2009-08-06 21:10:58 | [diff] [blame] | 719 | else |
| 720 | # An apt-get exit status of 100 indicates that a real error has occurred. |
[email protected] | e041ed1 | 2009-03-10 16:43:01 | [diff] [blame] | 721 | |
Daniel Bratell | 8cc92d37 | 2019-03-12 16:42:06 | [diff] [blame] | 722 | # I am intentionally leaving out the '"'s around query_cmd, |
[email protected] | 79a9d296 | 2009-08-06 21:10:58 | [diff] [blame] | 723 | # as this makes it easier to cut and paste the output |
Daniel Bratell | 8cc92d37 | 2019-03-12 16:42:06 | [diff] [blame] | 724 | echo "The following command failed: " ${query_cmd} |
[email protected] | 79a9d296 | 2009-08-06 21:10:58 | [diff] [blame] | 725 | echo |
Daniel Bratell | 8cc92d37 | 2019-03-12 16:42:06 | [diff] [blame] | 726 | echo "It produced the following output:" |
| 727 | echo "$cmd_output" |
[email protected] | 79a9d296 | 2009-08-06 21:10:58 | [diff] [blame] | 728 | echo |
| 729 | echo "You will have to install the above packages yourself." |
| 730 | echo |
| 731 | exit 100 |
| 732 | fi |
[email protected] | e041ed1 | 2009-03-10 16:43:01 | [diff] [blame] | 733 | |
[email protected] | d96cc347 | 2013-09-19 00:53:30 | [diff] [blame] | 734 | # Install the Chrome OS default fonts. This must go after running |
| 735 | # apt-get, since install-chromeos-fonts depends on curl. |
Tom Anderson | 8e0a484e | 2018-06-14 22:47:02 | [diff] [blame] | 736 | if [ "$do_inst_chromeos_fonts" != "0" ]; then |
[email protected] | d96cc347 | 2013-09-19 00:53:30 | [diff] [blame] | 737 | echo |
| 738 | echo "Installing Chrome OS fonts." |
| 739 | dir=`echo $0 | sed -r -e 's/\/[^/]+$//'` |
| 740 | if ! sudo $dir/linux/install-chromeos-fonts.py; then |
| 741 | echo "ERROR: The installation of the Chrome OS default fonts failed." |
| 742 | if [ `stat -f -c %T $dir` == "nfs" ]; then |
| 743 | echo "The reason is that your repo is installed on a remote file system." |
| 744 | else |
| 745 | echo "This is expected if your repo is installed on a remote file system." |
| 746 | fi |
| 747 | echo "It is recommended to install your repo on a local file system." |
| 748 | echo "You can skip the installation of the Chrome OS default founts with" |
| 749 | echo "the command line option: --no-chromeos-fonts." |
| 750 | exit 1 |
| 751 | fi |
| 752 | else |
| 753 | echo "Skipping installation of Chrome OS fonts." |
| 754 | fi |
| 755 | |
thomasanderson | 5ef5c3d | 2016-12-08 01:59:19 | [diff] [blame] | 756 | echo "Installing locales." |
| 757 | CHROMIUM_LOCALES="da_DK.UTF-8 fr_FR.UTF-8 he_IL.UTF-8 zh_TW.UTF-8" |
| 758 | LOCALE_GEN=/etc/locale.gen |
| 759 | if [ -e ${LOCALE_GEN} ]; then |
| 760 | OLD_LOCALE_GEN="$(cat /etc/locale.gen)" |
| 761 | for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do |
| 762 | sudo sed -i "s/^# ${CHROMIUM_LOCALE}/${CHROMIUM_LOCALE}/" ${LOCALE_GEN} |
| 763 | done |
| 764 | # Regenerating locales can take a while, so only do it if we need to. |
| 765 | if (echo "${OLD_LOCALE_GEN}" | cmp -s ${LOCALE_GEN}); then |
| 766 | echo "Locales already up-to-date." |
| 767 | else |
| 768 | sudo locale-gen |
| 769 | fi |
| 770 | else |
| 771 | for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do |
| 772 | sudo locale-gen ${CHROMIUM_LOCALE} |
| 773 | done |
| 774 | fi |