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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 packages="${dev_list} ${lib_list} ${dbg_list} | 171 packages="${dev_list} ${lib_list} ${dbg_list} |
172 $([ "$(uname -m)" = x86_64 ] && echo ${cmp_list})" | 172 $([ "$(uname -m)" = "x86_64" ] && echo ${cmp_list})" |
173 echo "Packages required: $packages" | 173 # Intentially leaving $packages unquoted so it's more readable. |
| 174 echo "Packages required: " $packages |
| 175 echo |
174 new_list_cmd="sudo apt-get install --reinstall $(echo $packages)" | 176 new_list_cmd="sudo apt-get install --reinstall $(echo $packages)" |
175 if new_list="$(yes n | LANG=C $new_list_cmd)" | 177 if new_list="$(yes n | LANG=C $new_list_cmd)" |
176 then | 178 then |
| 179 # We probably never hit this following line. |
177 echo "No missing packages, and the packages are up-to-date." | 180 echo "No missing packages, and the packages are up-to-date." |
178 elif [ $? -eq 1 ] | 181 elif [ $? -eq 1 ] |
179 then | 182 then |
180 # We expect apt-get to have exit status of 1. | 183 # We expect apt-get to have exit status of 1. |
181 # This indicates that we canceled the install with "yes n|". | 184 # This indicates that we canceled the install with "yes n|". |
182 new_list=$(echo $new_list | | 185 new_list=$(echo "$new_list" | |
183 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d') | 186 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d') |
184 echo "Installing missing packages: $new_list." | 187 new_list=$(echo "$new_list" | sed 's/ *$//') |
185 sudo apt-get install ${new_list} | 188 if [ -z "$new_list" ] ; then |
| 189 echo "No missing packages, and the packages are up-to-date." |
| 190 else |
| 191 echo "Installing missing packages: $new_list." |
| 192 sudo apt-get install ${new_list} |
| 193 fi |
| 194 echo |
186 else | 195 else |
187 # An apt-get exit status of 100 indicates that a real error has occurred. | 196 # An apt-get exit status of 100 indicates that a real error has occurred. |
188 | 197 |
189 # I am intentionally leaving out the '"'s around new_list_cmd, | 198 # I am intentionally leaving out the '"'s around new_list_cmd, |
190 # as this makes it easier to cut and paste the output | 199 # as this makes it easier to cut and paste the output |
191 echo | |
192 echo "The following command failed: " ${new_list_cmd} | 200 echo "The following command failed: " ${new_list_cmd} |
193 echo | 201 echo |
194 echo "It produces the following output:" | 202 echo "It produces the following output:" |
195 yes n | $new_list_cmd || true | 203 yes n | $new_list_cmd || true |
196 echo | 204 echo |
197 echo "You will have to install the above packages yourself." | 205 echo "You will have to install the above packages yourself." |
198 echo | 206 echo |
199 exit 100 | 207 exit 100 |
200 fi | 208 fi |
201 | 209 |
(...skipping 11 matching lines...) Expand all Loading... |
213 echo -n "REPLACE SYSTEM LINKER ld with gold and back up ld as ld.orig? (y/N) " | 221 echo -n "REPLACE SYSTEM LINKER ld with gold and back up ld as ld.orig? (y/N) " |
214 if yes_no 1; then | 222 if yes_no 1; then |
215 echo "Building binutils." | 223 echo "Building binutils." |
216 install_gold || exit 99 | 224 install_gold || exit 99 |
217 else | 225 else |
218 echo "Not installing gold." | 226 echo "Not installing gold." |
219 fi | 227 fi |
220 esac | 228 esac |
221 | 229 |
222 # Install 32bit backwards compatibility support for 64bit systems | 230 # Install 32bit backwards compatibility support for 64bit systems |
223 if [ "$(uname -m)" = x86_64 ]; then | 231 if [ "$(uname -m)" = "x86_64" ]; then |
224 echo "Installing 32bit libraries that are not already provided by the system" | 232 echo "Installing 32bit libraries that are not already provided by the system" |
225 echo | 233 echo |
226 echo "While we only need to install a relatively small number of library" | 234 echo "While we only need to install a relatively small number of library" |
227 echo "files, we temporarily need to download a lot of large *.deb packages" | 235 echo "files, we temporarily need to download a lot of large *.deb packages" |
228 echo "that contain these files. We will create new *.deb packages that" | 236 echo "that contain these files. We will create new *.deb packages that" |
229 echo "include just the 32bit libraries. These files will then be found on" | 237 echo "include just the 32bit libraries. These files will then be found on" |
230 echo "your system in places like /lib32, /usr/lib32, /usr/lib/debug/lib32," | 238 echo "your system in places like /lib32, /usr/lib32, /usr/lib/debug/lib32," |
231 echo "/usr/lib/debug/usr/lib32. If you ever need to uninstall these files," | 239 echo "/usr/lib/debug/usr/lib32. If you ever need to uninstall these files," |
232 echo "look for packages named *-ia32.deb." | 240 echo "look for packages named *-ia32.deb." |
233 echo "Do you want me to download all packages needed to build new 32bit" | 241 echo "Do you want me to download all packages needed to build new 32bit" |
234 echo -n "package files (Y/n) " | 242 echo -n "package files (Y/n) " |
235 if ! yes_no 0; then | 243 if ! yes_no 0; then |
236 echo "Exiting without installing any 32bit libraries." | 244 echo "Exiting without installing any 32bit libraries." |
237 exit 0 | 245 exit 0 |
238 fi | 246 fi |
239 tmp=/tmp/install-32bit.$$ | 247 tmp=/tmp/install-32bit.$$ |
240 trap 'rm -rf "${tmp}"' EXIT INT TERM QUIT | 248 trap 'rm -rf "${tmp}"' EXIT INT TERM QUIT |
241 mkdir -p "${tmp}/apt/lists/partial" "${tmp}/cache" "${tmp}/partial" | 249 mkdir -p "${tmp}/apt/lists/partial" "${tmp}/cache" "${tmp}/partial" |
242 touch "${tmp}/status" | 250 touch "${tmp}/status" |
243 | 251 |
244 [ -r /etc/apt/apt.conf ] && cp /etc/apt/apt.conf "${tmp}/apt/" | 252 [ -r /etc/apt/apt.conf ] && cp /etc/apt/apt.conf "${tmp}/apt/" |
245 cat >>"${tmp}/apt/apt.conf" <<-EOF | 253 cat >>"${tmp}/apt/apt.conf" <<EOF |
246 Apt::Architecture "i386"; | 254 Apt::Architecture "i386"; |
247 Dir::Cache "${tmp}/cache"; | 255 Dir::Cache "${tmp}/cache"; |
248 Dir::Cache::Archives "${tmp}/"; | 256 Dir::Cache::Archives "${tmp}/"; |
249 Dir::State::Lists "${tmp}/apt/lists/"; | 257 Dir::State::Lists "${tmp}/apt/lists/"; |
250 Dir::State::status "${tmp}/status"; | 258 Dir::State::status "${tmp}/status"; |
251 EOF | 259 EOF |
252 | 260 |
253 # Download 32bit packages | 261 # Download 32bit packages |
254 echo "Computing list of available 32bit packages..." | 262 echo "Computing list of available 32bit packages..." |
255 apt-get -c="${tmp}/apt/apt.conf" update | 263 apt-get -c="${tmp}/apt/apt.conf" update |
256 | 264 |
257 echo "Downloading available 32bit packages..." | 265 echo "Downloading available 32bit packages..." |
258 apt-get -c="${tmp}/apt/apt.conf" \ | 266 apt-get -c="${tmp}/apt/apt.conf" \ |
259 --yes --download-only --force-yes --reinstall install \ | 267 --yes --download-only --force-yes --reinstall install \ |
260 ${lib_list} ${dbg_list} | 268 ${lib_list} ${dbg_list} |
261 | 269 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 sed -e 's/[.]so[.][0-9].*/.so/' | | 355 sed -e 's/[.]so[.][0-9].*/.so/' | |
348 sort -u); do | 356 sort -u); do |
349 [ "x${i##*/}" = "xld-linux.so" ] && continue | 357 [ "x${i##*/}" = "xld-linux.so" ] && continue |
350 [ -r "$i" ] && continue | 358 [ -r "$i" ] && continue |
351 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | | 359 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | |
352 sort -n | tail -n 1)" | 360 sort -n | tail -n 1)" |
353 [ -r "$i.$j" ] || continue | 361 [ -r "$i.$j" ] || continue |
354 sudo ln -s "${i##*/}.$j" "$i" | 362 sudo ln -s "${i##*/}.$j" "$i" |
355 done | 363 done |
356 fi | 364 fi |
OLD | NEW |