Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: build/install-build-deps.sh

Issue 43043: Prompt the user before performing particularly expensive operations.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 if ! egrep -q "Ubuntu 8.04|Ubuntu 8.10" /etc/issue; then 7 if ! egrep -q "Ubuntu 8.04|Ubuntu 8.10" /etc/issue; then
8 echo "Only Ubuntu 8.04 and 8.10 are currently supported" >&2 8 echo "Only Ubuntu 8.04 and 8.10 are currently supported" >&2
9 exit 1 9 exit 1
10 fi 10 fi
11 11
12 if ! uname -m | egrep -q "i686|x86_64"; then 12 if ! uname -m | egrep -q "i686|x86_64"; then
13 echo "Only x86 architectures are currently supported" >&2 13 echo "Only x86 architectures are currently supported" >&2
14 exit 14 exit
15 fi 15 fi
16 16
17 if [ "x$(id -u)" != x0 ]; then 17 if [ "x$(id -u)" != x0 ]; then
18 echo "Running as non-root user." 18 echo "Running as non-root user."
19 echo "You might have to enter your password one or more times for 'sudo'." 19 echo "You might have to enter your password one or more times for 'sudo'."
20 echo
20 fi 21 fi
21 22
22 # Packages need for development 23 # Packages need for development
23 dev_list="subversion pkg-config python perl g++ g++-multilib bison flex gperf 24 dev_list="subversion pkg-config python perl g++ g++-multilib bison flex gperf
24 libnss3-dev libglib2.0-dev libgtk2.0-dev libnspr4-dev libsqlite3-dev 25 libnss3-dev libglib2.0-dev libgtk2.0-dev libnspr4-dev libsqlite3-dev
25 wdiff lighttpd php5-cgi msttcorefonts sun-java6-fonts" 26 wdiff lighttpd php5-cgi msttcorefonts sun-java6-fonts"
26 27
27 # Full list of required run-time libraries 28 # Full list of required run-time libraries
28 lib_list="libatk1.0-0 libc6 libcairo2 libexpat1 libfontconfig1 libfreetype6 29 lib_list="libatk1.0-0 libc6 libcairo2 libexpat1 libfontconfig1 libfreetype6
29 libglib2.0-0 libgtk2.0-0 libnspr4-0d libnss3-1d libpango1.0-0 30 libglib2.0-0 libgtk2.0-0 libnspr4-0d libnss3-1d libpango1.0-0
30 libpcre3 libpixman-1-0 libpng12-0 libstdc++6 libsqlite3-0 libx11-6 31 libpcre3 libpixman-1-0 libpng12-0 libstdc++6 libsqlite3-0 libx11-6
31 libxau6 libxcb-xlib0 libxcb1 libxcomposite1 libxcursor1 libxdamage1 32 libxau6 libxcb-xlib0 libxcb1 libxcomposite1 libxcursor1 libxdamage1
32 libxdmcp6 libxext6 libxfixes3 libxi6 libxinerama1 libxrandr2 33 libxdmcp6 libxext6 libxfixes3 libxi6 libxinerama1 libxrandr2
33 libxrender1 zlib1g" 34 libxrender1 zlib1g"
34 35
35 # Debugging symbols for all of the run-time libraries 36 # Debugging symbols for all of the run-time libraries
36 dbg_list="libatk1.0-dbg libc6-dbg libcairo2-dbg libfontconfig1-dbg 37 dbg_list="libatk1.0-dbg libc6-dbg libcairo2-dbg libfontconfig1-dbg
37 libglib2.0-0-dbg libgtk2.0-0-dbg libnspr4-0d-dbg libnss3-1d-dbg 38 libglib2.0-0-dbg libgtk2.0-0-dbg libnspr4-0d-dbg libnss3-1d-dbg
38 libpango1.0-0-dbg libpcre3-dbg libpixman-1-0-dbg libx11-6-dbg 39 libpango1.0-0-dbg libpcre3-dbg libpixman-1-0-dbg libx11-6-dbg
39 libxau6-dbg libxcb-xlib0-dbg libxcb1-dbg libxcomposite1-dbg 40 libxau6-dbg libxcb-xlib0-dbg libxcb1-dbg libxcomposite1-dbg
40 libxcursor1-dbg libxdamage1-dbg libxdmcp6-dbg libxext6-dbg 41 libxcursor1-dbg libxdamage1-dbg libxdmcp6-dbg libxext6-dbg
41 libxfixes3-dbg libxi6-dbg libxinerama1-dbg libxrandr2-dbg 42 libxfixes3-dbg libxi6-dbg libxinerama1-dbg libxrandr2-dbg
42 libxrender1-dbg zlib1g-dbg" 43 libxrender1-dbg zlib1g-dbg"
43 44
44 # Standard 32bit compatibility libraries 45 # Standard 32bit compatibility libraries
45 cmp_list="ia32-libs lib32stdc++6 lib32z1 lib32z1-dev libc6-dev-i386 libc6-i386" 46 cmp_list="ia32-libs lib32stdc++6 lib32z1 lib32z1-dev libc6-dev-i386 libc6-i386"
46 47
47 echo "Updating list of available packages..." 48 # Waits for the user to press 'Y' or 'N'. Either uppercase of lowercase is
49 # accepted. Returns 0 for 'Y' and 1 for 'N'. If an optional parameter has
50 # been provided to yes_no(), the function also accepts RETURN as a user input.
51 # The parameter specifies the exit code that should be returned in that case.
52 # The function will echo the user's selection followed by a newline character.
53 # Users can abort the function by pressing CTRL-C. This will call "exit 1".
54 yes_no() {
55 local c
56 while :; do
57 c="$(trap 'stty echo -iuclc icanon 2>/dev/null' EXIT INT TERM QUIT
58 stty -echo iuclc -icanon 2>/dev/null
59 dd count=1 bs=1 2>/dev/null | od -An -tx1)"
60 case "$c" in
61 " 0a") if [ -n "$1" ]; then
62 [ $1 -eq 0 ] && echo "Y" || echo "N"
63 return $1
64 fi
65 ;;
66 " 79") echo "Y"
67 return 0
68 ;;
69 " 6e") echo "N"
70 return 1
71 ;;
72 "") echo "Aborted" >&2
73 exit 1
74 ;;
75 *) # The user pressed an unrecognized key. As we are not echoing
76 # any incorrect user input, alert the user by ringing the bell.
77 (tput bel) 2>/dev/null
78 ;;
79 esac
80 done
81 }
82
83 echo "This script installs all required libraries for building Chromium."
84 echo "For most of the libraries, it can also install debugging symbols, which"
85 echo "will allow you to debug code in the system libraries. Most developers"
86 echo "won't need these symbols."
87 echo -n "Do you want me to install them for you (y/N) "
88 if yes_no 1; then
89 echo "Installing debugging symbols."
90 else
91 echo "Skipping installation of debugging symbols."
92 dbg_list=
93 fi
94
48 sudo apt-get update 95 sudo apt-get update
49 96
50 # We initially run "apt-get" with the --reinstall option and parse its output. 97 # We initially run "apt-get" with the --reinstall option and parse its output.
51 # This way, we can find all the packages that need to be newly installed 98 # This way, we can find all the packages that need to be newly installed
52 # without accidentally promoting any packages from "auto" to "manual". 99 # without accidentally promoting any packages from "auto" to "manual".
53 # We then re-run "apt-get" with just the list of missing packages. 100 # We then re-run "apt-get" with just the list of missing packages.
54 echo "Finding missing packages..." 101 echo "Finding missing packages..."
55 new_list="$(yes n | 102 new_list="$(yes n |
56 sudo apt-get install --reinstall \ 103 sudo apt-get install --reinstall \
57 ${pkg_list} ${lib_list} ${dbg_list} \ 104 ${pkg_list} ${lib_list} ${dbg_list} \
58 $([ "$(uname -m)" = x86_64 ] && echo ${cmp_list}) \ 105 $([ "$(uname -m)" = x86_64 ] && echo ${cmp_list}) \
59 2>/dev/null | 106 2>/dev/null |
60 sed -e 's/^ //;t;d')" 107 sed -e 's/^ //;t;d')"
61 108
62 echo "Installing missing packages..." 109 echo "Installing missing packages..."
63 sudo apt-get install ${new_list} 110 sudo apt-get install ${new_list}
64 111
65 # Install 32bit backwards compatibility support for 64bit systems 112 # Install 32bit backwards compatibility support for 64bit systems
66 if [ "$(uname -m)" = x86_64 ]; then 113 if [ "$(uname -m)" = x86_64 ]; then
67 echo "Installing 32bit libraries that are not already provided by the system" 114 echo "Installing 32bit libraries that are not already provided by the system"
115 echo
116 echo "While we only need to install a relatively small number of library"
117 echo "files, we temporarily need to download a lot of large *.deb packages"
118 echo "that contain these files. We will create new *.deb packages that"
119 echo "include just the 32bit libraries. These files will then be found on"
120 echo "your system in places like /lib32, /usr/lib32, /usr/lib/debug/lib32,"
121 echo "/usr/lib/debug/usr/lib32. If you ever need to uninstall these files,"
122 echo "look for packages named *-ia32.deb."
123 echo "Do you want me to download all packages needed to build new 32bit"
124 echo -n "package files (Y/n) "
125 if ! yes_no 0; then
126 echo "Exiting without installing any 32bit libraries."
127 exit 0
128 fi
68 tmp=/tmp/install-32bit.$$ 129 tmp=/tmp/install-32bit.$$
69 trap 'rm -rf "${tmp}"' EXIT INT TERM QUIT 130 trap 'rm -rf "${tmp}"' EXIT INT TERM QUIT
70 mkdir -p "${tmp}/apt/lists/partial" "${tmp}/cache" "${tmp}/partial" 131 mkdir -p "${tmp}/apt/lists/partial" "${tmp}/cache" "${tmp}/partial"
71 touch "${tmp}/status" 132 touch "${tmp}/status"
72 133
73 [ -r /etc/apt/apt.conf ] && cp /etc/apt/apt.conf "${tmp}/apt/" 134 [ -r /etc/apt/apt.conf ] && cp /etc/apt/apt.conf "${tmp}/apt/"
74 cat >>"${tmp}/apt/apt.conf" <<-EOF 135 cat >>"${tmp}/apt/apt.conf" <<-EOF
75 Apt::Architecture "i386"; 136 Apt::Architecture "i386";
76 Dir::Cache "${tmp}/cache"; 137 Dir::Cache "${tmp}/cache";
77 Dir::Cache::Archives "${tmp}/"; 138 Dir::Cache::Archives "${tmp}/";
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 sed -e 's/[.]so[.][0-9].*/.so/' | 237 sed -e 's/[.]so[.][0-9].*/.so/' |
177 sort -u); do 238 sort -u); do
178 [ "x${i##*/}" = "xld-linux.so" ] && continue 239 [ "x${i##*/}" = "xld-linux.so" ] && continue
179 [ -r "$i" ] && continue 240 [ -r "$i" ] && continue
180 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | 241 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' |
181 sort -n | tail -n 1)" 242 sort -n | tail -n 1)"
182 [ -r "$i.$j" ] || continue 243 [ -r "$i.$j" ] || continue
183 sudo ln -s "${i##*/}.$j" "$i" 244 sudo ln -s "${i##*/}.$j" "$i"
184 done 245 done
185 fi 246 fi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698