OLD | NEW |
---|---|
1 #!/bin/bash -e | 1 #!/bin/bash -e |
2 | 2 |
3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2009 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 28 matching lines...) Expand all Loading... | |
39 # First make sure root can access this directory, as that's tripped | 39 # First make sure root can access this directory, as that's tripped |
40 # up some folks. | 40 # up some folks. |
41 if sudo touch xyz.$$ | 41 if sudo touch xyz.$$ |
42 then | 42 then |
43 sudo rm xyz.$$ | 43 sudo rm xyz.$$ |
44 else | 44 else |
45 echo root cannot write to the current directory, not installing gold | 45 echo root cannot write to the current directory, not installing gold |
46 return | 46 return |
47 fi | 47 fi |
48 | 48 |
49 BINUTILS=binutils-2.20.1 | 49 BINUTILS=binutils-2.21 |
50 BINUTILS_URL=http://ftp.gnu.org/gnu/binutils/$BINUTILS.tar.bz2 | 50 BINUTILS_URL=http://ftp.gnu.org/gnu/binutils/$BINUTILS.tar.bz2 |
51 BINUTILS_SHA1=fd2ba806e6f3a55cee453cb25c86991b26a75dee | 51 BINUTILS_SHA1=ef93235588eb443e4c4a77f229a8d131bccaecc6 |
52 | 52 |
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 | 62 ./configure --prefix=/usr/local/gold --enable-gold |
Evan Martin
2011/02/23 19:24:20
While we're at it, do you mind checking if --enabl
Lei Zhang
2011/02/23 19:58:15
2.21 has --threads, but it also has this bug: http
| |
63 make maybe-all-binutils maybe-all-gold -j4 | 63 make maybe-all-binutils maybe-all-gold -j4 |
64 if sudo make maybe-install-binutils maybe-install-gold | 64 if sudo make maybe-install-binutils maybe-install-gold |
65 then | 65 then |
66 # Still need to figure out graceful way of pointing gyp to use | 66 # Still need to figure out graceful way of pointing gyp to use |
67 # /usr/local/gold/bin/ld without requiring him to set environment | 67 # /usr/local/gold/bin/ld without requiring him to set environment |
68 # variables. That will go into bootstrap-linux.sh when it's ready. | 68 # variables. That will go into bootstrap-linux.sh when it's ready. |
69 echo "Installing gold as /usr/bin/ld." | 69 echo "Installing gold as /usr/bin/ld." |
70 echo "To uninstall, do 'cd /usr/bin; sudo rm ld; sudo mv ld.orig ld'" | 70 echo "To uninstall, do 'cd /usr/bin; sudo rm ld; sudo mv ld.orig ld'" |
71 test -f /usr/bin/ld && test ! -f /usr/bin/ld.orig && \ | 71 test -f /usr/bin/ld && test ! -f /usr/bin/ld.orig && \ |
72 sudo mv /usr/bin/ld /usr/bin/ld.orig | 72 sudo mv /usr/bin/ld /usr/bin/ld.orig |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
233 yes n | $new_list_cmd || true | 233 yes n | $new_list_cmd || true |
234 echo | 234 echo |
235 echo "You will have to install the above packages yourself." | 235 echo "You will have to install the above packages yourself." |
236 echo | 236 echo |
237 exit 100 | 237 exit 100 |
238 fi | 238 fi |
239 | 239 |
240 # Some operating systems already ship gold (on recent Debian and | 240 # Some operating systems already ship gold (on recent Debian and |
241 # Ubuntu you can do "apt-get install binutils-gold" to get it), but | 241 # Ubuntu you can do "apt-get install binutils-gold" to get it), but |
242 # older releases didn't. Additionally, gold 2.20 (included in Ubuntu | 242 # older releases didn't. Additionally, gold 2.20 (included in Ubuntu |
243 # Lucid) makes binaries that just segfault. | 243 # Lucid) makes binaries that just segfault, and 2.20.1 does not support |
244 # --map-whole-files. | |
244 # So install from source if we don't have a good version. | 245 # So install from source if we don't have a good version. |
245 | 246 |
246 case `ld --version` in | 247 case `ld --version` in |
247 *gold*2.20.1*) ;; | |
248 *gold*2.2[1-9]*) ;; | 248 *gold*2.2[1-9]*) ;; |
Peter Mayo
2011/02/23 15:46:47
Are we not confident enough to be happy with 2.30
Lei Zhang
2011/02/23 19:58:15
Unlike Chrome, it takes binutils roughly a decade
| |
249 * ) | 249 * ) |
250 if test "$do_inst_gold" = "" | 250 if test "$do_inst_gold" = "" |
251 then | 251 then |
252 echo "Gold is a new linker that links Chrome 5x faster than ld." | 252 echo "Gold is a new linker that links Chrome 5x faster than ld." |
253 echo "Don't use it if you need to link other apps (e.g. valgrind, wine)" | 253 echo "Don't use it if you need to link other apps (e.g. valgrind, wine)" |
254 echo -n "REPLACE SYSTEM LINKER ld with gold and back up ld? (y/N) " | 254 echo -n "REPLACE SYSTEM LINKER ld with gold and back up ld? (y/N) " |
255 if yes_no 1; then | 255 if yes_no 1; then |
256 do_inst_gold=1 | 256 do_inst_gold=1 |
257 fi | 257 fi |
258 fi | 258 fi |
259 if test "$do_inst_gold" = "1" | 259 if test "$do_inst_gold" = "1" |
260 then | 260 then |
261 # If the system provides a good version of gold, just install it. | 261 # If the system provides a good version of gold, just install it. |
262 if apt-cache show binutils-gold | grep -Eq 'Version: 2.2(0.1|[1-9]*)'; then | 262 if apt-cache show binutils-gold | grep -Eq 'Version: 2.2[1-9]*'; then |
263 echo "Installing binutils-gold. Backing up ld as ld.single." | 263 echo "Installing binutils-gold. Backing up ld as ld.single." |
264 sudo apt-get install binutils-gold | 264 sudo apt-get install binutils-gold |
265 else | 265 else |
266 # FIXME: avoid installing as /usr/bin/ld | 266 # FIXME: avoid installing as /usr/bin/ld |
267 echo "Building binutils. Backing up ld as ld.orig." | 267 echo "Building binutils. Backing up ld as ld.orig." |
268 install_gold || exit 99 | 268 install_gold || exit 99 |
269 fi | 269 fi |
270 else | 270 else |
271 echo "Not installing gold." | 271 echo "Not installing gold." |
272 fi | 272 fi |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
449 sed -e 's/[.]so[.][0-9].*/.so/' | | 449 sed -e 's/[.]so[.][0-9].*/.so/' | |
450 sort -u); do | 450 sort -u); do |
451 [ "x${i##*/}" = "xld-linux.so" ] && continue | 451 [ "x${i##*/}" = "xld-linux.so" ] && continue |
452 [ -r "$i" ] && continue | 452 [ -r "$i" ] && continue |
453 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | | 453 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | |
454 sort -n | tail -n 1)" | 454 sort -n | tail -n 1)" |
455 [ -r "$i.$j" ] || continue | 455 [ -r "$i.$j" ] || continue |
456 sudo ln -s "${i##*/}.$j" "$i" | 456 sudo ln -s "${i##*/}.$j" "$i" |
457 done | 457 done |
458 fi | 458 fi |
OLD | NEW |