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