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 |
11 usage() { | |
12 echo "Usage: $0 [--options]" | |
13 echo "Options:" | |
14 echo "--[no-]syms: enable or disable installation of debugging symbols" | |
15 echo "--[no-]gold: enable or disable installation of gold linker" | |
16 echo "--[no-]lib32: enable or disable installation of 32 bit libraries" | |
17 echo "Script will prompt interactively if options not given." | |
18 exit 1 | |
19 } | |
20 | |
21 while test "$1" != "" | |
22 do | |
23 case "$1" in | |
24 --syms) do_inst_syms=1;; | |
25 --no-syms) do_inst_syms=0;; | |
26 --gold) do_inst_gold=1;; | |
27 --no-gold) do_inst_gold=0;; | |
28 --lib32) do_inst_lib32=1;; | |
29 --no-lib32) do_inst_lib32=0;; | |
30 *) usage;; | |
31 esac | |
32 shift | |
33 done | |
34 | |
11 install_gold() { | 35 install_gold() { |
12 # Gold is optional; it's a faster replacement for ld, | 36 # Gold is optional; it's a faster replacement for ld, |
13 # and makes life on 2GB machines much more pleasant. | 37 # and makes life on 2GB machines much more pleasant. |
14 | 38 |
15 # First make sure root can access this directory, as that's tripped up some fo lks. | 39 # First make sure root can access this directory, as that's tripped up some fo lks. |
16 if sudo touch xyz.$$ | 40 if sudo touch xyz.$$ |
17 then | 41 then |
18 sudo rm xyz.$$ | 42 sudo rm xyz.$$ |
19 else | 43 else |
20 echo root cannot write to the current directory, not installing gold | 44 echo root cannot write to the current directory, not installing gold |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 exit 1 | 189 exit 1 |
166 ;; | 190 ;; |
167 *) # The user pressed an unrecognized key. As we are not echoing | 191 *) # The user pressed an unrecognized key. As we are not echoing |
168 # any incorrect user input, alert the user by ringing the bell. | 192 # any incorrect user input, alert the user by ringing the bell. |
169 (tput bel) 2>/dev/null | 193 (tput bel) 2>/dev/null |
170 ;; | 194 ;; |
171 esac | 195 esac |
172 done | 196 done |
173 } | 197 } |
174 | 198 |
175 echo "This script installs all tools and libraries needed to build Chromium." | 199 if test "$do_inst_syms" = "" |
176 echo "" | 200 then |
177 echo "For most of the libraries, it can also install debugging symbols, which" | 201 echo "This script installs all tools and libraries needed to build Chromium." |
178 echo "will allow you to debug code in the system libraries. Most developers" | 202 echo "" |
179 echo "won't need these symbols." | 203 echo "For most of the libraries, it can also install debugging symbols, which" |
180 echo -n "Do you want me to install them for you (y/N) " | 204 echo "will allow you to debug code in the system libraries. Most developers" |
181 if yes_no 1; then | 205 echo "won't need these symbols." |
206 echo -n "Do you want me to install them for you (y/N) " | |
207 if yes_no 1; then | |
208 do_inst_syms=1 | |
209 fi | |
210 fi | |
211 if test "$do_inst_syms" = "1"; then | |
182 echo "Installing debugging symbols." | 212 echo "Installing debugging symbols." |
183 else | 213 else |
184 echo "Skipping installation of debugging symbols." | 214 echo "Skipping installation of debugging symbols." |
185 dbg_list= | 215 dbg_list= |
186 fi | 216 fi |
187 | 217 |
188 sudo apt-get update | 218 sudo apt-get update |
189 | 219 |
190 # We initially run "apt-get" with the --reinstall option and parse its output. | 220 # We initially run "apt-get" with the --reinstall option and parse its output. |
191 # This way, we can find all the packages that need to be newly installed | 221 # This way, we can find all the packages that need to be newly installed |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 fi | 264 fi |
235 | 265 |
236 # Some operating systems already ship gold | 266 # Some operating systems already ship gold |
237 # (on Debian, you can probably do "apt-get install binutils-gold" to get it), | 267 # (on Debian, you can probably do "apt-get install binutils-gold" to get it), |
238 # but though Ubuntu toyed with shipping it, they haven't yet. | 268 # but though Ubuntu toyed with shipping it, they haven't yet. |
239 # So just install from source if it isn't the default linker. | 269 # So just install from source if it isn't the default linker. |
240 | 270 |
241 case `ld --version` in | 271 case `ld --version` in |
242 *gold*2.2*) ;; | 272 *gold*2.2*) ;; |
243 * ) | 273 * ) |
244 echo "Gold is a new linker that links Chrome 5x faster than ld." | 274 if test "$do_inst_gold" = "" |
245 echo "Don't use it if you need to link other apps (e.g. valgrind, wine)" | 275 then |
246 echo -n "REPLACE SYSTEM LINKER ld with gold and back up ld? (y/N) " | 276 echo "Gold is a new linker that links Chrome 5x faster than ld." |
247 if yes_no 1; then | 277 echo "Don't use it if you need to link other apps (e.g. valgrind, wine)" |
278 echo -n "REPLACE SYSTEM LINKER ld with gold and back up ld? (y/N) " | |
279 if yes_no 1; then | |
280 do_inst_gold=1 | |
281 fi | |
282 fi | |
283 if test "$do_inst_gold" = "1" | |
284 then | |
248 # If the system provides gold, just install it. | 285 # If the system provides gold, just install it. |
249 if apt-cache show binutils-gold >/dev/null; then | 286 if apt-cache show binutils-gold >/dev/null; then |
250 echo "Installing binutils-gold. Backing up ld as ld.single." | 287 echo "Installing binutils-gold. Backing up ld as ld.single." |
251 sudo apt-get install binutils-gold | 288 sudo apt-get install binutils-gold |
252 else | 289 else |
253 # FIXME: avoid installing as /usr/bin/ld | 290 # FIXME: avoid installing as /usr/bin/ld |
254 echo "Building binutils. Backing up ld as ld.orig." | 291 echo "Building binutils. Backing up ld as ld.orig." |
255 install_gold || exit 99 | 292 install_gold || exit 99 |
256 fi | 293 fi |
257 else | 294 else |
258 echo "Not installing gold." | 295 echo "Not installing gold." |
259 fi | 296 fi |
260 esac | 297 esac |
261 | 298 |
262 # Install 32bit backwards compatibility support for 64bit systems | 299 # Install 32bit backwards compatibility support for 64bit systems |
263 if [ "$(uname -m)" = "x86_64" ]; then | 300 if [ "$(uname -m)" = "x86_64" ]; then |
264 echo "Installing 32bit libraries that are not already provided by the system" | 301 if test "$do_inst_lib32" = "" |
265 echo | 302 then |
266 echo "While we only need to install a relatively small number of library" | 303 echo "Installing 32bit libraries that are not already provided by the system " |
M-A Ruel
2010/01/26 18:15:42
Horror! 81 cols!
| |
267 echo "files, we temporarily need to download a lot of large *.deb packages" | 304 echo |
268 echo "that contain these files. We will create new *.deb packages that" | 305 echo "While we only need to install a relatively small number of library" |
269 echo "include just the 32bit libraries. These files will then be found on" | 306 echo "files, we temporarily need to download a lot of large *.deb packages" |
270 echo "your system in places like /lib32, /usr/lib32, /usr/lib/debug/lib32," | 307 echo "that contain these files. We will create new *.deb packages that" |
271 echo "/usr/lib/debug/usr/lib32. If you ever need to uninstall these files," | 308 echo "include just the 32bit libraries. These files will then be found on" |
272 echo "look for packages named *-ia32.deb." | 309 echo "your system in places like /lib32, /usr/lib32, /usr/lib/debug/lib32," |
273 echo "Do you want me to download all packages needed to build new 32bit" | 310 echo "/usr/lib/debug/usr/lib32. If you ever need to uninstall these files," |
274 echo -n "package files (Y/n) " | 311 echo "look for packages named *-ia32.deb." |
275 if ! yes_no 0; then | 312 echo "Do you want me to download all packages needed to build new 32bit" |
313 echo -n "package files (Y/n) " | |
314 if ! yes_no 0; then | |
315 do_inst_lib32=1 | |
316 fi | |
317 fi | |
318 if test "$do_inst_lib32" != "1" | |
319 then | |
276 echo "Exiting without installing any 32bit libraries." | 320 echo "Exiting without installing any 32bit libraries." |
277 exit 0 | 321 exit 0 |
278 fi | 322 fi |
279 tmp=/tmp/install-32bit.$$ | 323 tmp=/tmp/install-32bit.$$ |
280 trap 'rm -rf "${tmp}"' EXIT INT TERM QUIT | 324 trap 'rm -rf "${tmp}"' EXIT INT TERM QUIT |
281 mkdir -p "${tmp}/apt/lists/partial" "${tmp}/cache" "${tmp}/partial" | 325 mkdir -p "${tmp}/apt/lists/partial" "${tmp}/cache" "${tmp}/partial" |
282 touch "${tmp}/status" | 326 touch "${tmp}/status" |
283 | 327 |
284 [ -r /etc/apt/apt.conf ] && cp /etc/apt/apt.conf "${tmp}/apt/" | 328 [ -r /etc/apt/apt.conf ] && cp /etc/apt/apt.conf "${tmp}/apt/" |
285 cat >>"${tmp}/apt/apt.conf" <<EOF | 329 cat >>"${tmp}/apt/apt.conf" <<EOF |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
387 sed -e 's/[.]so[.][0-9].*/.so/' | | 431 sed -e 's/[.]so[.][0-9].*/.so/' | |
388 sort -u); do | 432 sort -u); do |
389 [ "x${i##*/}" = "xld-linux.so" ] && continue | 433 [ "x${i##*/}" = "xld-linux.so" ] && continue |
390 [ -r "$i" ] && continue | 434 [ -r "$i" ] && continue |
391 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | | 435 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | |
392 sort -n | tail -n 1)" | 436 sort -n | tail -n 1)" |
393 [ -r "$i.$j" ] || continue | 437 [ -r "$i.$j" ] || continue |
394 sudo ln -s "${i##*/}.$j" "$i" | 438 sudo ln -s "${i##*/}.$j" "$i" |
395 done | 439 done |
396 fi | 440 fi |
OLD | NEW |