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() { | 7 install_gold() { |
8 # Gold is optional; it's a faster replacement for ld, | 8 # Gold is optional; it's a faster replacement for ld, |
9 # and makes life on 2GB machines much more pleasant. | 9 # and makes life on 2GB machines much more pleasant. |
10 | 10 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 dbg_list= | 161 dbg_list= |
162 fi | 162 fi |
163 | 163 |
164 sudo apt-get update | 164 sudo apt-get update |
165 | 165 |
166 # We initially run "apt-get" with the --reinstall option and parse its output. | 166 # We initially run "apt-get" with the --reinstall option and parse its output. |
167 # This way, we can find all the packages that need to be newly installed | 167 # This way, we can find all the packages that need to be newly installed |
168 # without accidentally promoting any packages from "auto" to "manual". | 168 # without accidentally promoting any packages from "auto" to "manual". |
169 # We then re-run "apt-get" with just the list of missing packages. | 169 # We then re-run "apt-get" with just the list of missing packages. |
170 echo "Finding missing packages..." | 170 echo "Finding missing packages..." |
171 new_list="$(yes n | | 171 packages="${dev_list} ${lib_list} ${dbg_list} |
172 LANG=C sudo apt-get install --reinstall \ | 172 $([ "$(uname -m)" = x86_64 ] && echo ${cmp_list})" |
173 ${dev_list} ${lib_list} ${dbg_list} \ | 173 echo "Packages required: $packages" |
174 $([ "$(uname -m)" = x86_64 ] && echo ${cmp_list}) \ | 174 new_list_cmd="sudo apt-get install --reinstall $(echo $packages)" |
175 | | 175 if new_list="$(yes n | LANG=C $new_list_cmd)" || [ $? -eq 1 ] |
176 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t
;d')" | 176 then |
| 177 # We expect apt-get to have exit status of 1. |
| 178 # This indicates that we canceled the install with "yes n|". |
| 179 new_list=$(echo "$new_list" | |
| 180 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d') |
| 181 echo "Installing missing packages: $new_list." |
| 182 sudo apt-get install ${new_list} |
| 183 else |
| 184 # An apt-get exit status of 100 indicates that a real error has occurred. |
177 | 185 |
178 echo "Installing missing packages..." | 186 # I am intentionally leaving out the '"'s around new_list_cmd, |
179 sudo apt-get install ${new_list} | 187 # as this makes it easier to cut and paste the output |
| 188 echo |
| 189 echo "The following command failed: " ${new_list_cmd} |
| 190 echo |
| 191 echo "It produces the following output:" |
| 192 yes n | $new_list_cmd || true |
| 193 echo |
| 194 echo "You will have to install the above packages yourself." |
| 195 echo |
| 196 exit 100 |
| 197 fi |
180 | 198 |
181 # Some operating systems already ship gold | 199 # Some operating systems already ship gold |
182 # (on Debian, you can probably do "apt-get install binutils-gold" to get it), | 200 # (on Debian, you can probably do "apt-get install binutils-gold" to get it), |
183 # but though Ubuntu toyed with shipping it, they haven't yet. | 201 # but though Ubuntu toyed with shipping it, they haven't yet. |
184 # So just install from source if it isn't the default linker. | 202 # So just install from source if it isn't the default linker. |
185 | 203 |
186 case `ld --version` in | 204 case `ld --version` in |
187 *gold*) ;; | 205 *gold*) ;; |
188 * ) | 206 * ) |
189 # FIXME: avoid installing as /usr/bin/ld | 207 # FIXME: avoid installing as /usr/bin/ld |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 sed -e 's/[.]so[.][0-9].*/.so/' | | 344 sed -e 's/[.]so[.][0-9].*/.so/' | |
327 sort -u); do | 345 sort -u); do |
328 [ "x${i##*/}" = "xld-linux.so" ] && continue | 346 [ "x${i##*/}" = "xld-linux.so" ] && continue |
329 [ -r "$i" ] && continue | 347 [ -r "$i" ] && continue |
330 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | | 348 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | |
331 sort -n | tail -n 1)" | 349 sort -n | tail -n 1)" |
332 [ -r "$i.$j" ] || continue | 350 [ -r "$i.$j" ] || continue |
333 sudo ln -s "${i##*/}.$j" "$i" | 351 sudo ln -s "${i##*/}.$j" "$i" |
334 done | 352 done |
335 fi | 353 fi |
OLD | NEW |