Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/bin/bash -e | 1 #!/bin/bash -e |
| 2 | 2 |
| 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 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 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 test -f $BINUTILS.tar.bz2 || wget $BINUTILS_URL | 53 test -f $BINUTILS.tar.bz2 || wget $BINUTILS_URL |
| 54 if test "`sha1sum $BINUTILS.tar.bz2|cut -d' ' -f1`" != "$BINUTILS_SHA1" | 54 if test "`sha1sum $BINUTILS.tar.bz2|cut -d' ' -f1`" != "$BINUTILS_SHA1" |
| 55 then | 55 then |
| 56 echo Bad sha1sum for $BINUTILS.tar.bz2 | 56 echo Bad sha1sum for $BINUTILS.tar.bz2 |
| 57 exit 1 | 57 exit 1 |
| 58 fi | 58 fi |
| 59 | 59 |
| 60 tar -xjvf $BINUTILS.tar.bz2 | 60 tar -xjvf $BINUTILS.tar.bz2 |
| 61 cd $BINUTILS | 61 cd $BINUTILS |
| 62 ./configure --prefix=/usr/local/gold --enable-gold --enable-threads | 62 ./configure --prefix=/usr/local/gold --enable-gold --enable-threads |
| 63 make maybe-all-binutils maybe-all-gold -j4 | 63 NCPU=`cat /proc/cpuinfo |grep ^processor|wc -l` |
| 64 make maybe-all-binutils maybe-all-gold -j${NCPU} | |
| 64 if sudo make maybe-install-binutils maybe-install-gold | 65 if sudo make maybe-install-binutils maybe-install-gold |
| 65 then | 66 then |
| 66 # Still need to figure out graceful way of pointing gyp to use | 67 # Still need to figure out graceful way of pointing gyp to use |
| 67 # /usr/local/gold/bin/ld without requiring him to set environment | 68 # /usr/local/gold/bin/ld without requiring him to set environment |
| 68 # variables. That will go into bootstrap-linux.sh when it's ready. | 69 # variables. That will go into bootstrap-linux.sh when it's ready. |
|
Evan Martin
2011/07/13 20:37:38
FWIW, there is no bootstrap-linux.sh.
| |
| 69 echo "Installing gold as /usr/bin/ld." | 70 test -f /usr/local/gold/bin/ld && test -f /usr/local/gold/bin/ld.gold && \ |
| 70 echo "To uninstall, do 'cd /usr/bin; sudo rm ld; sudo mv ld.orig ld'" | 71 sudo mv /usr/local/gold/bin/ld.gold /usr/local/gold/bin/ld |
| 71 test -f /usr/bin/ld && test ! -f /usr/bin/ld.orig && \ | |
| 72 sudo mv /usr/bin/ld /usr/bin/ld.orig | |
| 73 sudo strip /usr/local/gold/bin/ld | 72 sudo strip /usr/local/gold/bin/ld |
| 74 sudo ln -fs /usr/local/gold/bin/ld /usr/bin/ld.gold | |
| 75 sudo ln -fs /usr/bin/ld.gold /usr/bin/ld | |
| 76 else | 73 else |
| 77 echo "make install failed, not installing gold" | 74 echo "make install failed, not installing gold" |
| 78 fi | 75 fi |
| 79 } | 76 } |
| 80 | 77 |
| 81 if ! egrep -q \ | 78 if ! egrep -q \ |
| 82 'Ubuntu (10\.04|10\.10|11\.04|lucid|maverick|natty)' \ | 79 'Ubuntu (10\.04|10\.10|11\.04|lucid|maverick|natty)' \ |
| 83 /etc/issue; then | 80 /etc/issue; then |
| 84 echo "Only Ubuntu 10.04 (lucid) through 11.04 (natty) are currently" \ | 81 echo "Only Ubuntu 10.04 (lucid) through 11.04 (natty) are currently" \ |
| 85 "supported" >&2 | 82 "supported" >&2 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 fi | 239 fi |
| 243 | 240 |
| 244 # Some operating systems already ship gold (on recent Debian and | 241 # Some operating systems already ship gold (on recent Debian and |
| 245 # Ubuntu you can do "apt-get install binutils-gold" to get it), but | 242 # Ubuntu you can do "apt-get install binutils-gold" to get it), but |
| 246 # older releases didn't. Additionally, gold 2.20 (included in Ubuntu | 243 # older releases didn't. Additionally, gold 2.20 (included in Ubuntu |
| 247 # Lucid) makes binaries that just segfault, and 2.20.1 does not support | 244 # Lucid) makes binaries that just segfault, and 2.20.1 does not support |
| 248 # --map-whole-files. | 245 # --map-whole-files. |
| 249 # So install from source if we don't have a good version. | 246 # So install from source if we don't have a good version. |
| 250 | 247 |
| 251 case `ld --version` in | 248 case `ld --version` in |
| 249 *gold*2.2[1-9].*) | |
| 250 echo "*** Warning ***" | |
| 251 echo "If the default linker is gold, linking may fail for:" | |
| 252 echo "the Linux kernel, kernel modules, Valgrind, and Wine." | |
| 253 echo "If you previously installed gold as the default linker," | |
| 254 echo "you can restore the original linker by running:" | |
| 255 echo "'cd /usr/bin; sudo rm ld; sudo mv ld.orig ld'" | |
| 256 echo | |
| 257 ;; | |
| 258 esac | |
| 259 | |
| 260 case `/usr/local/gold/bin/ld --version` in | |
| 252 *gold*2.2[1-9].*) ;; | 261 *gold*2.2[1-9].*) ;; |
| 253 * ) | 262 * ) |
| 254 if test "$do_inst_gold" = "" | 263 if test "$do_inst_gold" = "" |
| 255 then | 264 then |
| 256 echo "Gold is a new linker that links Chrome 5x faster than ld." | 265 echo "Gold is a new linker that links Chrome 5x faster than GNU ld." |
| 257 echo "Don't use it if you need to link other apps (e.g. valgrind, wine)" | 266 echo -n "*** To use the gold linker, " |
| 258 echo -n "REPLACE SYSTEM LINKER ld with gold and back up ld? (y/N) " | 267 echo "you must pass -B/usr/local/gold/bin/ to g++ ***" |
| 268 echo -n "Install the gold linker? (y/N) " | |
| 259 if yes_no 1; then | 269 if yes_no 1; then |
| 260 do_inst_gold=1 | 270 do_inst_gold=1 |
| 261 fi | 271 fi |
| 262 fi | 272 fi |
| 263 if test "$do_inst_gold" = "1" | 273 if test "$do_inst_gold" = "1" |
| 264 then | 274 then |
| 265 # If the system provides a good version of gold, just install it. | 275 # If the system provides a good version of gold, just install it. |
| 266 if apt-cache show binutils-gold | grep -Eq 'Version: 2.2[1-9].*'; then | 276 if apt-cache show binutils-gold | grep -Eq 'Version: 2.2[1-9].*'; then |
| 267 echo "Installing binutils-gold. Backing up ld as ld.single." | 277 echo "Installing binutils-gold. Backing up ld as ld.single." |
| 268 sudo apt-get install binutils-gold | 278 sudo apt-get install binutils-gold |
| 269 else | 279 else |
| 270 # FIXME: avoid installing as /usr/bin/ld | 280 echo "Building binutils with gold..." |
| 271 echo "Building binutils. Backing up ld as ld.orig." | |
| 272 install_gold || exit 99 | 281 install_gold || exit 99 |
| 273 fi | 282 fi |
| 274 else | 283 else |
| 275 echo "Not installing gold." | 284 echo "Not installing gold." |
| 276 fi | 285 fi |
| 277 esac | 286 esac |
| 278 | 287 |
| 279 # Install 32bit backwards compatibility support for 64bit systems | 288 # Install 32bit backwards compatibility support for 64bit systems |
| 280 if [ "$(uname -m)" = "x86_64" ]; then | 289 if [ "$(uname -m)" = "x86_64" ]; then |
| 281 if test "$do_inst_lib32" = "" | 290 if test "$do_inst_lib32" = "" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 453 sed -e 's/[.]so[.][0-9].*/.so/' | | 462 sed -e 's/[.]so[.][0-9].*/.so/' | |
| 454 sort -u); do | 463 sort -u); do |
| 455 [ "x${i##*/}" = "xld-linux.so" ] && continue | 464 [ "x${i##*/}" = "xld-linux.so" ] && continue |
| 456 [ -r "$i" ] && continue | 465 [ -r "$i" ] && continue |
| 457 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | | 466 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | |
| 458 sort -n | tail -n 1)" | 467 sort -n | tail -n 1)" |
| 459 [ -r "$i.$j" ] || continue | 468 [ -r "$i.$j" ] || continue |
| 460 sudo ln -s "${i##*/}.$j" "$i" | 469 sudo ln -s "${i##*/}.$j" "$i" |
| 461 done | 470 done |
| 462 fi | 471 fi |
| OLD | NEW |