OLD | NEW |
1 #!/bin/bash -e | 1 #!/bin/bash -e |
2 | 2 |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Script to install everything needed to build chromium (well, ideally, anyway) | 7 # Script to install everything needed to build chromium (well, ideally, anyway) |
8 # See http://code.google.com/p/chromium/wiki/LinuxBuildInstructions | 8 # See http://code.google.com/p/chromium/wiki/LinuxBuildInstructions |
9 # and http://code.google.com/p/chromium/wiki/LinuxBuild64Bit | 9 # and http://code.google.com/p/chromium/wiki/LinuxBuild64Bit |
10 | 10 |
11 usage() { | 11 usage() { |
12 echo "Usage: $0 [--options]" | 12 echo "Usage: $0 [--options]" |
13 echo "Options:" | 13 echo "Options:" |
14 echo "--[no-]syms: enable or disable installation of debugging symbols" | 14 echo "--[no-]syms: enable or disable installation of debugging symbols" |
| 15 echo "--lib32: enable installation of 32-bit libraries, e.g. for V8 snapshot" |
15 echo "--[no-]arm: enable or disable installation of arm cross toolchain" | 16 echo "--[no-]arm: enable or disable installation of arm cross toolchain" |
16 echo "--[no-]chromeos-fonts: enable or disable installation of Chrome OS"\ | 17 echo "--[no-]chromeos-fonts: enable or disable installation of Chrome OS"\ |
17 "fonts" | 18 "fonts" |
18 echo "--[no-]nacl: enable or disable installation of prerequisites for"\ | 19 echo "--[no-]nacl: enable or disable installation of prerequisites for"\ |
19 "building standalone NaCl and all its toolchains" | 20 "building standalone NaCl and all its toolchains" |
20 echo "--no-prompt: silently select standard options/defaults" | 21 echo "--no-prompt: silently select standard options/defaults" |
21 echo "--quick-check: quickly try to determine if dependencies are installed" | 22 echo "--quick-check: quickly try to determine if dependencies are installed" |
22 echo " (this avoids interactive prompts and sudo commands," | 23 echo " (this avoids interactive prompts and sudo commands," |
23 echo " so might not be 100% accurate)" | 24 echo " so might not be 100% accurate)" |
24 echo "--unsupported: attempt installation even on unsupported systems" | 25 echo "--unsupported: attempt installation even on unsupported systems" |
(...skipping 12 matching lines...) Expand all Loading... |
37 # mode. Developers who don't want stuff they don't need installed on their | 38 # mode. Developers who don't want stuff they don't need installed on their |
38 # own workstations can pass --no-arm --no-nacl when running the script. | 39 # own workstations can pass --no-arm --no-nacl when running the script. |
39 do_inst_arm=1 | 40 do_inst_arm=1 |
40 do_inst_nacl=1 | 41 do_inst_nacl=1 |
41 | 42 |
42 while test "$1" != "" | 43 while test "$1" != "" |
43 do | 44 do |
44 case "$1" in | 45 case "$1" in |
45 --syms) do_inst_syms=1;; | 46 --syms) do_inst_syms=1;; |
46 --no-syms) do_inst_syms=0;; | 47 --no-syms) do_inst_syms=0;; |
47 # TODO(phajdan.jr): Remove the lib32 flags when nothing else refers to them. | |
48 --lib32) do_inst_lib32=1;; | 48 --lib32) do_inst_lib32=1;; |
49 --no-lib32) do_inst_lib32=0;; | |
50 --arm) do_inst_arm=1;; | 49 --arm) do_inst_arm=1;; |
51 --no-arm) do_inst_arm=0;; | 50 --no-arm) do_inst_arm=0;; |
52 --chromeos-fonts) do_inst_chromeos_fonts=1;; | 51 --chromeos-fonts) do_inst_chromeos_fonts=1;; |
53 --no-chromeos-fonts) do_inst_chromeos_fonts=0;; | 52 --no-chromeos-fonts) do_inst_chromeos_fonts=0;; |
54 --nacl) do_inst_nacl=1;; | 53 --nacl) do_inst_nacl=1;; |
55 --no-nacl) do_inst_nacl=0;; | 54 --no-nacl) do_inst_nacl=0;; |
56 --no-prompt) do_default=1 | 55 --no-prompt) do_default=1 |
57 do_quietly="-qq --assume-yes" | 56 do_quietly="-qq --assume-yes" |
58 ;; | 57 ;; |
59 --quick-check) do_quick_check=1;; | 58 --quick-check) do_quick_check=1;; |
60 --unsupported) do_unsupported=1;; | 59 --unsupported) do_unsupported=1;; |
61 *) usage;; | 60 *) usage;; |
62 esac | 61 esac |
63 shift | 62 shift |
64 done | 63 done |
65 | 64 |
| 65 if test "$do_inst_arm" = "1"; then |
| 66 do_inst_lib32=1 |
| 67 fi |
| 68 |
66 # Check for lsb_release command in $PATH | 69 # Check for lsb_release command in $PATH |
67 if ! which lsb_release > /dev/null; then | 70 if ! which lsb_release > /dev/null; then |
68 echo "ERROR: lsb_release not found in \$PATH" >&2 | 71 echo "ERROR: lsb_release not found in \$PATH" >&2 |
69 exit 1; | 72 exit 1; |
70 fi | 73 fi |
71 | 74 |
72 lsb_release=$(lsb_release --codename --short) | 75 lsb_release=$(lsb_release --codename --short) |
73 ubuntu_codenames="(precise|quantal|raring|saucy|trusty)" | 76 ubuntu_codenames="(precise|quantal|raring|saucy|trusty)" |
74 if [ 0 -eq "${do_unsupported-0}" ] && [ 0 -eq "${do_quick_check-0}" ] ; then | 77 if [ 0 -eq "${do_unsupported-0}" ] && [ 0 -eq "${do_quick_check-0}" ] ; then |
75 if [[ ! $lsb_release =~ $ubuntu_codenames ]]; then | 78 if [[ ! $lsb_release =~ $ubuntu_codenames ]]; then |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 133 |
131 # Debugging symbols for all of the run-time libraries | 134 # Debugging symbols for all of the run-time libraries |
132 dbg_list="libatk1.0-dbg libc6-dbg libcairo2-dbg libfontconfig1-dbg | 135 dbg_list="libatk1.0-dbg libc6-dbg libcairo2-dbg libfontconfig1-dbg |
133 libglib2.0-0-dbg libgtk2.0-0-dbg libpango1.0-0-dbg libpcre3-dbg | 136 libglib2.0-0-dbg libgtk2.0-0-dbg libpango1.0-0-dbg libpcre3-dbg |
134 libpixman-1-0-dbg libsqlite3-0-dbg libx11-6-dbg libxau6-dbg | 137 libpixman-1-0-dbg libsqlite3-0-dbg libx11-6-dbg libxau6-dbg |
135 libxcb1-dbg libxcomposite1-dbg libxcursor1-dbg libxdamage1-dbg | 138 libxcb1-dbg libxcomposite1-dbg libxcursor1-dbg libxdamage1-dbg |
136 libxdmcp6-dbg libxext6-dbg libxfixes3-dbg libxi6-dbg libxinerama1-dbg | 139 libxdmcp6-dbg libxext6-dbg libxfixes3-dbg libxi6-dbg libxinerama1-dbg |
137 libxrandr2-dbg libxrender1-dbg libxtst6-dbg zlib1g-dbg | 140 libxrandr2-dbg libxrender1-dbg libxtst6-dbg zlib1g-dbg |
138 libstdc++6-4.6-dbg" | 141 libstdc++6-4.6-dbg" |
139 | 142 |
| 143 # 32-bit libraries needed e.g. to compile V8 snapshot for Android or armhf |
| 144 lib32_list="linux-libc-dev:i386" |
| 145 |
140 # arm cross toolchain packages needed to build chrome on armhf | 146 # arm cross toolchain packages needed to build chrome on armhf |
141 arm_list="libc6-dev-armhf-cross | 147 arm_list="libc6-dev-armhf-cross |
142 linux-libc-dev-armhf-cross | 148 linux-libc-dev-armhf-cross |
143 g++-arm-linux-gnueabihf | 149 g++-arm-linux-gnueabihf" |
144 linux-libc-dev:i386" | |
145 | 150 |
146 # Packages to build NaCl, its toolchains, and its ports. | 151 # Packages to build NaCl, its toolchains, and its ports. |
147 naclports_list="ant autoconf bison cmake gawk intltool xutils-dev xsltproc" | 152 naclports_list="ant autoconf bison cmake gawk intltool xutils-dev xsltproc" |
148 nacl_list="g++-mingw-w64-i686 lib32z1-dev | 153 nacl_list="g++-mingw-w64-i686 lib32z1-dev |
149 libasound2:i386 libcap2:i386 libelf-dev:i386 libexif12:i386 | 154 libasound2:i386 libcap2:i386 libelf-dev:i386 libexif12:i386 |
150 libfontconfig1:i386 libgconf-2-4:i386 libglib2.0-0:i386 libgpm2:i386 | 155 libfontconfig1:i386 libgconf-2-4:i386 libglib2.0-0:i386 libgpm2:i386 |
151 libgtk2.0-0:i386 libncurses5:i386 lib32ncurses5-dev | 156 libgtk2.0-0:i386 libncurses5:i386 lib32ncurses5-dev |
152 libnss3:i386 libpango1.0-0:i386 | 157 libnss3:i386 libpango1.0-0:i386 |
153 libssl0.9.8:i386 libtinfo-dev libtinfo-dev:i386 libtool | 158 libssl0.9.8:i386 libtinfo-dev libtinfo-dev:i386 libtool |
154 libxcomposite1:i386 libxcursor1:i386 libxdamage1:i386 libxi6:i386 | 159 libxcomposite1:i386 libxcursor1:i386 libxdamage1:i386 libxi6:i386 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 dev_list="${dev_list} libbrlapi0.5" | 205 dev_list="${dev_list} libbrlapi0.5" |
201 fi | 206 fi |
202 | 207 |
203 | 208 |
204 # Some packages are only needed if the distribution actually supports | 209 # Some packages are only needed if the distribution actually supports |
205 # installing them. | 210 # installing them. |
206 if package_exists appmenu-gtk; then | 211 if package_exists appmenu-gtk; then |
207 lib_list="$lib_list appmenu-gtk" | 212 lib_list="$lib_list appmenu-gtk" |
208 fi | 213 fi |
209 | 214 |
| 215 # When cross building for arm/Android on 64-bit systems the host binaries |
| 216 # that are part of v8 need to be compiled with -m32 which means |
| 217 # that basic multilib support is needed. |
| 218 if file /sbin/init | grep -q 'ELF 64-bit'; then |
| 219 # gcc-multilib conflicts with the arm cross compiler (at least in trusty) but |
| 220 # g++-X.Y-multilib gives us the 32-bit support that we need. Find out the |
| 221 # appropriate value of X and Y by seeing what version the current |
| 222 # distribution's g++-multilib package depends on. |
| 223 multilib_package=$(apt-cache depends g++-multilib --important | \ |
| 224 grep -E --color=never --only-matching '\bg\+\+-[0-9.]+-multilib\b') |
| 225 lib32_list="$lib32_list $multilib_package" |
| 226 fi |
| 227 |
210 # Waits for the user to press 'Y' or 'N'. Either uppercase of lowercase is | 228 # Waits for the user to press 'Y' or 'N'. Either uppercase of lowercase is |
211 # accepted. Returns 0 for 'Y' and 1 for 'N'. If an optional parameter has | 229 # accepted. Returns 0 for 'Y' and 1 for 'N'. If an optional parameter has |
212 # been provided to yes_no(), the function also accepts RETURN as a user input. | 230 # been provided to yes_no(), the function also accepts RETURN as a user input. |
213 # The parameter specifies the exit code that should be returned in that case. | 231 # The parameter specifies the exit code that should be returned in that case. |
214 # The function will echo the user's selection followed by a newline character. | 232 # The function will echo the user's selection followed by a newline character. |
215 # Users can abort the function by pressing CTRL-C. This will call "exit 1". | 233 # Users can abort the function by pressing CTRL-C. This will call "exit 1". |
216 yes_no() { | 234 yes_no() { |
217 if [ 0 -ne "${do_default-0}" ] ; then | 235 if [ 0 -ne "${do_default-0}" ] ; then |
218 [ $1 -eq 0 ] && echo "Y" || echo "N" | 236 [ $1 -eq 0 ] && echo "Y" || echo "N" |
219 return $1 | 237 return $1 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 do_inst_syms=1 | 276 do_inst_syms=1 |
259 fi | 277 fi |
260 fi | 278 fi |
261 if test "$do_inst_syms" = "1"; then | 279 if test "$do_inst_syms" = "1"; then |
262 echo "Including debugging symbols." | 280 echo "Including debugging symbols." |
263 else | 281 else |
264 echo "Skipping debugging symbols." | 282 echo "Skipping debugging symbols." |
265 dbg_list= | 283 dbg_list= |
266 fi | 284 fi |
267 | 285 |
268 # When cross building for arm on 64-bit systems the host binaries | 286 if test "$do_inst_lib32" = "1" ; then |
269 # that are part of v8 need to be compiled with -m32 which means | 287 echo "Including 32-bit libraries for ARM/Android." |
270 # that basic multilib support is needed. | 288 else |
271 if file /sbin/init | grep -q 'ELF 64-bit'; then | 289 echo "Skipping 32-bit libraries for ARM/Android." |
272 if [ "$lsb_release" = "trusty" ]; then | 290 lib32_list= |
273 # gcc-multilib conflicts with the arm cross compiler in trusty but | |
274 # g++-4.8-multilib gives us the 32-bit support that we need. | |
275 arm_list="$arm_list g++-4.8-multilib" | |
276 else | |
277 arm_list="$arm_list g++-multilib" | |
278 fi | |
279 fi | 291 fi |
280 | 292 |
281 if test "$do_inst_arm" = "1" ; then | 293 if test "$do_inst_arm" = "1" ; then |
282 echo "Including ARM cross toolchain." | 294 echo "Including ARM cross toolchain." |
283 else | 295 else |
284 echo "Skipping ARM cross toolchain." | 296 echo "Skipping ARM cross toolchain." |
285 arm_list= | 297 arm_list= |
286 fi | 298 fi |
287 | 299 |
288 if test "$do_inst_nacl" = "1"; then | 300 if test "$do_inst_nacl" = "1"; then |
289 echo "Including NaCl, NaCl toolchain, NaCl ports dependencies." | 301 echo "Including NaCl, NaCl toolchain, NaCl ports dependencies." |
290 else | 302 else |
291 echo "Skipping NaCl, NaCl toolchain, NaCl ports dependencies." | 303 echo "Skipping NaCl, NaCl toolchain, NaCl ports dependencies." |
292 nacl_list= | 304 nacl_list= |
293 fi | 305 fi |
294 | 306 |
295 packages="$( | 307 packages="$( |
296 echo "${dev_list} ${lib_list} ${dbg_list} ${arm_list} ${nacl_list}" | | 308 echo "${dev_list} ${lib_list} ${dbg_list} ${lib32_list} ${arm_list}"\ |
297 tr " " "\n" | sort -u | tr "\n" " " | 309 "${nacl_list}" | tr " " "\n" | sort -u | tr "\n" " " |
298 )" | 310 )" |
299 | 311 |
300 if [ 1 -eq "${do_quick_check-0}" ] ; then | 312 if [ 1 -eq "${do_quick_check-0}" ] ; then |
301 failed_check="$(dpkg-query -W -f '${PackageSpec}:${Status}\n' \ | 313 failed_check="$(dpkg-query -W -f '${PackageSpec}:${Status}\n' \ |
302 ${packages} 2>&1 | grep -v "ok installed" || :)" | 314 ${packages} 2>&1 | grep -v "ok installed" || :)" |
303 if [ -n "${failed_check}" ]; then | 315 if [ -n "${failed_check}" ]; then |
304 echo | 316 echo |
305 nomatch="$(echo "${failed_check}" | \ | 317 nomatch="$(echo "${failed_check}" | \ |
306 sed -e "s/^No packages found matching \(.*\).$/\1/;t;d")" | 318 sed -e "s/^No packages found matching \(.*\).$/\1/;t;d")" |
307 missing="$(echo "${failed_check}" | \ | 319 missing="$(echo "${failed_check}" | \ |
(...skipping 18 matching lines...) Expand all Loading... |
326 fi | 338 fi |
327 if [ -n "${missing}" ]; then | 339 if [ -n "${missing}" ]; then |
328 echo "WARNING: The following packages are not installed:" | 340 echo "WARNING: The following packages are not installed:" |
329 echo -e "${missing}" | sed -e "s/^/ /" | 341 echo -e "${missing}" | sed -e "s/^/ /" |
330 fi | 342 fi |
331 exit 1 | 343 exit 1 |
332 fi | 344 fi |
333 exit 0 | 345 exit 0 |
334 fi | 346 fi |
335 | 347 |
| 348 if test "$do_inst_lib32" = "1" || test "$do_inst_nacl" = "1"; then |
| 349 if [[ ! $lsb_release =~ (precise|quantal|raring) ]]; then |
| 350 sudo dpkg --add-architecture i386 |
| 351 fi |
| 352 fi |
336 sudo apt-get update | 353 sudo apt-get update |
337 | 354 |
338 # We initially run "apt-get" with the --reinstall option and parse its output. | 355 # We initially run "apt-get" with the --reinstall option and parse its output. |
339 # This way, we can find all the packages that need to be newly installed | 356 # This way, we can find all the packages that need to be newly installed |
340 # without accidentally promoting any packages from "auto" to "manual". | 357 # without accidentally promoting any packages from "auto" to "manual". |
341 # We then re-run "apt-get" with just the list of missing packages. | 358 # We then re-run "apt-get" with just the list of missing packages. |
342 echo "Finding missing packages..." | 359 echo "Finding missing packages..." |
343 # Intentionally leaving $packages unquoted so it's more readable. | 360 # Intentionally leaving $packages unquoted so it's more readable. |
344 echo "Packages required: " $packages | 361 echo "Packages required: " $packages |
345 echo | 362 echo |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 echo "Installing symbolic links for NaCl." | 418 echo "Installing symbolic links for NaCl." |
402 if [ ! -r /usr/lib/i386-linux-gnu/libcrypto.so ]; then | 419 if [ ! -r /usr/lib/i386-linux-gnu/libcrypto.so ]; then |
403 sudo ln -fs libcrypto.so.0.9.8 /usr/lib/i386-linux-gnu/libcrypto.so | 420 sudo ln -fs libcrypto.so.0.9.8 /usr/lib/i386-linux-gnu/libcrypto.so |
404 fi | 421 fi |
405 if [ ! -r /usr/lib/i386-linux-gnu/libssl.so ]; then | 422 if [ ! -r /usr/lib/i386-linux-gnu/libssl.so ]; then |
406 sudo ln -fs libssl.so.0.9.8 /usr/lib/i386-linux-gnu/libssl.so | 423 sudo ln -fs libssl.so.0.9.8 /usr/lib/i386-linux-gnu/libssl.so |
407 fi | 424 fi |
408 else | 425 else |
409 echo "Skipping symbolic links for NaCl." | 426 echo "Skipping symbolic links for NaCl." |
410 fi | 427 fi |
OLD | NEW |