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