| OLD | NEW |
| 1 #!/bin/bash -e | 1 #!/bin/bash -e |
| 2 | 2 |
| 3 # Script to install everything needed to build chromium (well, ideally, anyway) | 3 # Script to install everything needed to build chromium (well, ideally, anyway) |
| 4 # See http://code.google.com/p/chromium/wiki/LinuxBuildInstructions | 4 # See http://code.google.com/p/chromium/wiki/LinuxBuildInstructions |
| 5 # and http://code.google.com/p/chromium/wiki/LinuxBuild64Bit | 5 # and http://code.google.com/p/chromium/wiki/LinuxBuild64Bit |
| 6 | 6 |
| 7 install_gold() { |
| 8 # Gold is optional; it's a faster replacement for ld, |
| 9 # and makes life on 2GB machines much more pleasant. |
| 10 |
| 11 BINUTILS=binutils-2.19.1 |
| 12 BINUTILS_URL=http://ftp.gnu.org/gnu/binutils/$BINUTILS.tar.bz2 |
| 13 BINUTILS_SHA1=88c91e36cde93433e4c4c2b2e3417777aad84526 |
| 14 |
| 15 test -f $BINUTILS.tar.bz2 || wget $BINUTILS_URL |
| 16 if `sha1sum $BINUTILS.tar.bz2` != $BINUTILS_SHA1 |
| 17 then |
| 18 echo Bad sha1sum for $BINUTILS.tar.bz2 |
| 19 exit 1 |
| 20 fi |
| 21 cat > binutils-fix.patch <<__EOF__ |
| 22 --- binutils-2.19.1/gold/reduced_debug_output.h.orig 2009-05-10 14:44:52.0000
00000 -0700 |
| 23 +++ binutils-2.19.1/gold/reduced_debug_output.h 2009-05-10 14:46:51.000000000 -0
700 |
| 24 @@ -64,7 +64,7 @@ |
| 25 void |
| 26 failed(std::string reason) |
| 27 { |
| 28 - gold_warning(reason.c_str()); |
| 29 + gold_warning("%s", reason.c_str()); |
| 30 failed_ = true; |
| 31 } |
| 32 |
| 33 @@ -110,7 +110,7 @@ |
| 34 void |
| 35 failed(std::string reason) |
| 36 { |
| 37 - gold_warning(reason.c_str()); |
| 38 + gold_warning("%s", reason.c_str()); |
| 39 this->failed_ = true; |
| 40 } |
| 41 |
| 42 __EOF__ |
| 43 |
| 44 tar -xjvf $BINUTILS.tar.bz2 |
| 45 cd $BINUTILS |
| 46 patch -p1 < ../binutils-fix.patch |
| 47 ./configure --prefix=/usr/local/gold --enable-gold |
| 48 make -j3 |
| 49 sudo make install |
| 50 |
| 51 # Still need to figure out graceful way of pointing gyp to use |
| 52 # /usr/local/gold/bin/ld without requiring him to set environment |
| 53 # variables. That will go into bootstrap-linux.sh when it's ready. |
| 54 echo "Installing gold as /usr/bin/ld." |
| 55 echo "To uninstall, do 'cd /usr/bin; sudo rm ld; sudo mv ld.orig ld'" |
| 56 test -f /usr/bin/ld && sudo mv /usr/bin/ld /usr/bin/ld.orig |
| 57 sudo ln -s /usr/local/gold/bin/ld /usr/bin/ld |
| 58 } |
| 59 |
| 7 if ! egrep -q "Ubuntu 8.04|Ubuntu 8.10|Ubuntu 9.04" /etc/issue; then | 60 if ! egrep -q "Ubuntu 8.04|Ubuntu 8.10|Ubuntu 9.04" /etc/issue; then |
| 8 echo "Only Ubuntu 8.04, 8.10, and 9.04 are currently supported" >&2 | 61 echo "Only Ubuntu 8.04, 8.10, and 9.04 are currently supported" >&2 |
| 9 exit 1 | 62 exit 1 |
| 10 fi | 63 fi |
| 11 | 64 |
| 12 if ! uname -m | egrep -q "i686|x86_64"; then | 65 if ! uname -m | egrep -q "i686|x86_64"; then |
| 13 echo "Only x86 architectures are currently supported" >&2 | 66 echo "Only x86 architectures are currently supported" >&2 |
| 14 exit | 67 exit |
| 15 fi | 68 fi |
| 16 | 69 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 exit 1 | 128 exit 1 |
| 76 ;; | 129 ;; |
| 77 *) # The user pressed an unrecognized key. As we are not echoing | 130 *) # The user pressed an unrecognized key. As we are not echoing |
| 78 # any incorrect user input, alert the user by ringing the bell. | 131 # any incorrect user input, alert the user by ringing the bell. |
| 79 (tput bel) 2>/dev/null | 132 (tput bel) 2>/dev/null |
| 80 ;; | 133 ;; |
| 81 esac | 134 esac |
| 82 done | 135 done |
| 83 } | 136 } |
| 84 | 137 |
| 85 echo "This script installs all required libraries for building Chromium." | 138 echo "This script installs all tools and libraries needed to build Chromium." |
| 139 echo "" |
| 86 echo "For most of the libraries, it can also install debugging symbols, which" | 140 echo "For most of the libraries, it can also install debugging symbols, which" |
| 87 echo "will allow you to debug code in the system libraries. Most developers" | 141 echo "will allow you to debug code in the system libraries. Most developers" |
| 88 echo "won't need these symbols." | 142 echo "won't need these symbols." |
| 89 echo -n "Do you want me to install them for you (y/N) " | 143 echo -n "Do you want me to install them for you (y/N) " |
| 90 if yes_no 1; then | 144 if yes_no 1; then |
| 91 echo "Installing debugging symbols." | 145 echo "Installing debugging symbols." |
| 92 else | 146 else |
| 93 echo "Skipping installation of debugging symbols." | 147 echo "Skipping installation of debugging symbols." |
| 94 dbg_list= | 148 dbg_list= |
| 95 fi | 149 fi |
| 96 | 150 |
| 97 sudo apt-get update | 151 sudo apt-get update |
| 98 | 152 |
| 99 # We initially run "apt-get" with the --reinstall option and parse its output. | 153 # We initially run "apt-get" with the --reinstall option and parse its output. |
| 100 # This way, we can find all the packages that need to be newly installed | 154 # This way, we can find all the packages that need to be newly installed |
| 101 # without accidentally promoting any packages from "auto" to "manual". | 155 # without accidentally promoting any packages from "auto" to "manual". |
| 102 # We then re-run "apt-get" with just the list of missing packages. | 156 # We then re-run "apt-get" with just the list of missing packages. |
| 103 echo "Finding missing packages..." | 157 echo "Finding missing packages..." |
| 104 new_list="$(yes n | | 158 new_list="$(yes n | |
| 105 LANG=C sudo apt-get install --reinstall \ | 159 LANG=C sudo apt-get install --reinstall \ |
| 106 ${dev_list} ${lib_list} ${dbg_list} \ | 160 ${dev_list} ${lib_list} ${dbg_list} \ |
| 107 $([ "$(uname -m)" = x86_64 ] && echo ${cmp_list}) \ | 161 $([ "$(uname -m)" = x86_64 ] && echo ${cmp_list}) \ |
| 108 2>/dev/null | | 162 2>/dev/null | |
| 109 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t
;d')" | 163 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t
;d')" |
| 110 | 164 |
| 111 echo "Installing missing packages..." | 165 echo "Installing missing packages..." |
| 112 sudo apt-get install ${new_list} | 166 sudo apt-get install ${new_list} |
| 113 | 167 |
| 168 # Some operating systems already ship gold |
| 169 # (on Debian, you can probably do "apt-get install binutils-gold" to get it) |
| 170 # Ubuntu toyed with that, but it doesn't seem to be in any version I've tried. |
| 171 # So just install from source if it isn't the default linker. |
| 172 |
| 173 case `ld --version` in |
| 174 *gold*) ;; |
| 175 * ) |
| 176 # FIXME: avoid installing as /usr/bin/ld |
| 177 echo -n "Install gold from binutils-2.19.1 as ld? It's 5x faster (y/N) " |
| 178 if yes_no 1; then |
| 179 echo "Building binutils." |
| 180 install_gold || exit 99 |
| 181 else |
| 182 echo "Not installing gold." |
| 183 fi |
| 184 esac |
| 185 |
| 114 # Install 32bit backwards compatibility support for 64bit systems | 186 # Install 32bit backwards compatibility support for 64bit systems |
| 115 if [ "$(uname -m)" = x86_64 ]; then | 187 if [ "$(uname -m)" = x86_64 ]; then |
| 116 echo "Installing 32bit libraries that are not already provided by the system" | 188 echo "Installing 32bit libraries that are not already provided by the system" |
| 117 echo | 189 echo |
| 118 echo "While we only need to install a relatively small number of library" | 190 echo "While we only need to install a relatively small number of library" |
| 119 echo "files, we temporarily need to download a lot of large *.deb packages" | 191 echo "files, we temporarily need to download a lot of large *.deb packages" |
| 120 echo "that contain these files. We will create new *.deb packages that" | 192 echo "that contain these files. We will create new *.deb packages that" |
| 121 echo "include just the 32bit libraries. These files will then be found on" | 193 echo "include just the 32bit libraries. These files will then be found on" |
| 122 echo "your system in places like /lib32, /usr/lib32, /usr/lib/debug/lib32," | 194 echo "your system in places like /lib32, /usr/lib32, /usr/lib/debug/lib32," |
| 123 echo "/usr/lib/debug/usr/lib32. If you ever need to uninstall these files," | 195 echo "/usr/lib/debug/usr/lib32. If you ever need to uninstall these files," |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 sed -e 's/[.]so[.][0-9].*/.so/' | | 311 sed -e 's/[.]so[.][0-9].*/.so/' | |
| 240 sort -u); do | 312 sort -u); do |
| 241 [ "x${i##*/}" = "xld-linux.so" ] && continue | 313 [ "x${i##*/}" = "xld-linux.so" ] && continue |
| 242 [ -r "$i" ] && continue | 314 [ -r "$i" ] && continue |
| 243 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | | 315 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | |
| 244 sort -n | tail -n 1)" | 316 sort -n | tail -n 1)" |
| 245 [ -r "$i.$j" ] || continue | 317 [ -r "$i.$j" ] || continue |
| 246 sudo ln -s "${i##*/}.$j" "$i" | 318 sudo ln -s "${i##*/}.$j" "$i" |
| 247 done | 319 done |
| 248 fi | 320 fi |
| OLD | NEW |