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. |
| 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 |
|
Evan Martin
2011/09/07 17:19:21
Will this do the right thing if the above tests do
Lei Zhang
2011/09/08 00:59:25
The line above is slightly wrong, but in any case,
| |
| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 fi | 242 fi |
| 246 | 243 |
| 247 # Some operating systems already ship gold (on recent Debian and | 244 # Some operating systems already ship gold (on recent Debian and |
| 248 # Ubuntu you can do "apt-get install binutils-gold" to get it), but | 245 # Ubuntu you can do "apt-get install binutils-gold" to get it), but |
| 249 # older releases didn't. Additionally, gold 2.20 (included in Ubuntu | 246 # older releases didn't. Additionally, gold 2.20 (included in Ubuntu |
| 250 # Lucid) makes binaries that just segfault, and 2.20.1 does not support | 247 # Lucid) makes binaries that just segfault, and 2.20.1 does not support |
| 251 # --map-whole-files. | 248 # --map-whole-files. |
| 252 # So install from source if we don't have a good version. | 249 # So install from source if we don't have a good version. |
| 253 | 250 |
| 254 case `ld --version` in | 251 case `ld --version` in |
| 252 *gold*2.2[1-9].*) | |
| 253 echo "*** Warning ***" | |
| 254 echo "If the default linker is gold, linking may fail for:" | |
| 255 echo "the Linux kernel, kernel modules, Valgrind, and Wine." | |
| 256 echo "If you previously installed gold as the default linker," | |
| 257 echo "you can restore the original linker by running:" | |
| 258 echo "'cd /usr/bin; sudo rm ld; sudo mv ld.orig ld'" | |
| 259 echo | |
|
Evan Martin
2011/09/07 17:19:21
Why not offer to restore it here? I worry that te
Lei Zhang
2011/09/08 00:59:25
Done.
| |
| 260 ;; | |
| 261 esac | |
| 262 | |
| 263 case `/usr/local/gold/bin/ld --version` in | |
| 255 *gold*2.2[1-9].*) ;; | 264 *gold*2.2[1-9].*) ;; |
| 256 * ) | 265 * ) |
| 257 if test "$do_inst_gold" = "" | 266 if test "$do_inst_gold" = "" |
| 258 then | 267 then |
| 259 echo "Gold is a new linker that links Chrome 5x faster than ld." | 268 echo "Gold is a new linker that links Chrome 5x faster than GNU ld." |
| 260 echo "Don't use it if you need to link other apps (e.g. valgrind, wine)" | 269 echo -n "*** To use the gold linker, " |
| 261 echo -n "REPLACE SYSTEM LINKER ld with gold and back up ld? (y/N) " | 270 echo "you must pass -B/usr/local/gold/bin/ to g++ ***" |
| 271 echo -n "Install the gold linker? (y/N) " | |
| 262 if yes_no 1; then | 272 if yes_no 1; then |
| 263 do_inst_gold=1 | 273 do_inst_gold=1 |
| 264 fi | 274 fi |
| 265 fi | 275 fi |
| 266 if test "$do_inst_gold" = "1" | 276 if test "$do_inst_gold" = "1" |
| 267 then | 277 then |
| 268 # If the system provides a good version of gold, just install it. | 278 # If the system provides a good version of gold, just install it. |
| 269 if apt-cache show binutils-gold | grep -Eq 'Version: 2.2[1-9].*'; then | 279 if apt-cache show binutils-gold | grep -Eq 'Version: 2.2[1-9].*'; then |
| 270 echo "Installing binutils-gold. Backing up ld as ld.single." | 280 echo "Installing binutils-gold. Backing up ld as ld.single." |
| 271 sudo apt-get install binutils-gold | 281 sudo apt-get install binutils-gold |
| 272 else | 282 else |
| 273 # FIXME: avoid installing as /usr/bin/ld | 283 echo "Building binutils with gold..." |
| 274 echo "Building binutils. Backing up ld as ld.orig." | |
| 275 install_gold || exit 99 | 284 install_gold || exit 99 |
| 276 fi | 285 fi |
| 277 else | 286 else |
| 278 echo "Not installing gold." | 287 echo "Not installing gold." |
| 279 fi | 288 fi |
| 280 esac | 289 esac |
| 281 | 290 |
| 282 # Install 32bit backwards compatibility support for 64bit systems | 291 # Install 32bit backwards compatibility support for 64bit systems |
| 283 if [ "$(uname -m)" = "x86_64" ]; then | 292 if [ "$(uname -m)" = "x86_64" ]; then |
| 284 if test "$do_inst_lib32" = "" | 293 if test "$do_inst_lib32" = "" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 456 sed -e 's/[.]so[.][0-9].*/.so/' | | 465 sed -e 's/[.]so[.][0-9].*/.so/' | |
| 457 sort -u); do | 466 sort -u); do |
| 458 [ "x${i##*/}" = "xld-linux.so" ] && continue | 467 [ "x${i##*/}" = "xld-linux.so" ] && continue |
| 459 [ -r "$i" ] && continue | 468 [ -r "$i" ] && continue |
| 460 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | | 469 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | |
| 461 sort -n | tail -n 1)" | 470 sort -n | tail -n 1)" |
| 462 [ -r "$i.$j" ] || continue | 471 [ -r "$i.$j" ] || continue |
| 463 sudo ln -s "${i##*/}.$j" "$i" | 472 sudo ln -s "${i##*/}.$j" "$i" |
| 464 done | 473 done |
| 465 fi | 474 fi |
| OLD | NEW |