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 |
17 if [ "x$(id -u)" != x0 ]; then | 70 if [ "x$(id -u)" != x0 ]; then |
18 echo "Running as non-root user." | 71 echo "Running as non-root user." |
19 echo "You might have to enter your password one or more times for 'sudo'." | 72 echo "You might have to enter your password one or more times for 'sudo'." |
20 echo | 73 echo |
21 fi | 74 fi |
22 | 75 |
23 # Packages need for development | 76 # Packages need for development |
24 dev_list="bison fakeroot flex g++ g++-multilib gperf libasound2-dev | 77 dev_list="bison fakeroot flex g++ g++-multilib gperf libasound2-dev |
25 libcairo2-dev libgconf2-dev libglib2.0-dev libgtk2.0-dev libnspr4-dev | 78 libcairo2-dev libgconf2-dev libglib2.0-dev libgtk2.0-dev libnspr4-dev |
26 libnss3-dev libsqlite3-dev lighttpd msttcorefonts perl php5-cgi | 79 libnss3-dev libsqlite3-dev lighttpd msttcorefonts perl php5-cgi |
27 pkg-config python subversion sun-java6-fonts wdiff" | 80 pkg-config python subversion wdiff" |
28 | 81 |
29 # Full list of required run-time libraries | 82 # Full list of required run-time libraries |
30 lib_list="libatk1.0-0 libc6 libasound2 libcairo2 libexpat1 libfontconfig1 | 83 lib_list="libatk1.0-0 libc6 libasound2 libcairo2 libexpat1 libfontconfig1 |
31 libfreetype6 libglib2.0-0 libgtk2.0-0 libnspr4-0d libnss3-1d | 84 libfreetype6 libglib2.0-0 libgtk2.0-0 libnspr4-0d libnss3-1d |
32 libpango1.0-0 libpcre3 libpixman-1-0 libpng12-0 libstdc++6 | 85 libpango1.0-0 libpcre3 libpixman-1-0 libpng12-0 libstdc++6 |
33 libsqlite3-0 libx11-6 libxau6 libxcb-xlib0 libxcb1 libxcomposite1 | 86 libsqlite3-0 libx11-6 libxau6 libxcb1 libxcomposite1 |
34 libxcursor1 libxdamage1 libxdmcp6 libxext6 libxfixes3 libxi6 | 87 libxcursor1 libxdamage1 libxdmcp6 libxext6 libxfixes3 libxi6 |
35 libxinerama1 libxrandr2 libxrender1 zlib1g" | 88 libxinerama1 libxrandr2 libxrender1 zlib1g" |
36 | 89 |
37 # Debugging symbols for all of the run-time libraries | 90 # Debugging symbols for all of the run-time libraries |
38 dbg_list="libatk1.0-dbg libc6-dbg libcairo2-dbg libfontconfig1-dbg | 91 dbg_list="libatk1.0-dbg libc6-dbg libcairo2-dbg libfontconfig1-dbg |
39 libglib2.0-0-dbg libgtk2.0-0-dbg libnspr4-0d-dbg libnss3-1d-dbg | 92 libglib2.0-0-dbg libgtk2.0-0-dbg libnspr4-0d-dbg libnss3-1d-dbg |
40 libpango1.0-0-dbg libpcre3-dbg libpixman-1-0-dbg libx11-6-dbg | 93 libpango1.0-0-dbg libpcre3-dbg libpixman-1-0-dbg libx11-6-dbg |
41 libxau6-dbg libxcb-xlib0-dbg libxcb1-dbg libxcomposite1-dbg | 94 libxau6-dbg libxcb1-dbg libxcomposite1-dbg |
42 libxcursor1-dbg libxdamage1-dbg libxdmcp6-dbg libxext6-dbg | 95 libxcursor1-dbg libxdamage1-dbg libxdmcp6-dbg libxext6-dbg |
43 libxfixes3-dbg libxi6-dbg libxinerama1-dbg libxrandr2-dbg | 96 libxfixes3-dbg libxi6-dbg libxinerama1-dbg libxrandr2-dbg |
44 libxrender1-dbg zlib1g-dbg" | 97 libxrender1-dbg zlib1g-dbg" |
45 | 98 |
46 # Standard 32bit compatibility libraries | 99 # Standard 32bit compatibility libraries |
47 cmp_list="ia32-libs lib32readline-dev lib32stdc++6 lib32z1 lib32z1-dev | 100 cmp_list="ia32-libs lib32readline-dev lib32stdc++6 lib32z1 lib32z1-dev |
48 libc6-dev-i386 libc6-i386" | 101 libc6-dev-i386 libc6-i386" |
49 | 102 |
50 # Waits for the user to press 'Y' or 'N'. Either uppercase of lowercase is | 103 # Waits for the user to press 'Y' or 'N'. Either uppercase of lowercase is |
51 # accepted. Returns 0 for 'Y' and 1 for 'N'. If an optional parameter has | 104 # accepted. Returns 0 for 'Y' and 1 for 'N'. If an optional parameter has |
(...skipping 23 matching lines...) Expand all 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 | |
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 # but though Ubuntu toyed with shipping it, they haven't yet. | |
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) " | |
agl
2009/06/10 15:44:12
echo "WARNING: this is replace your system wide li
| |
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 |