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

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

Issue 40603004: Add 'quick-check' option to install-build-deps.sh (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review update Created 7 years, 2 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 | tools/diagnose-me.py » ('j') | 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 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 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() { 11 usage() {
12 echo "Usage: $0 [--options]" 12 echo "Usage: $0 [--options]"
13 echo "Options:" 13 echo "Options:"
14 echo "--[no-]syms: enable or disable installation of debugging symbols" 14 echo "--[no-]syms: enable or disable installation of debugging symbols"
15 echo "--[no-]lib32: enable or disable installation of 32 bit libraries" 15 echo "--[no-]lib32: enable or disable installation of 32 bit libraries"
16 echo "--[no-]arm: enable or disable installation of arm cross toolchain" 16 echo "--[no-]arm: enable or disable installation of arm cross toolchain"
17 echo "--[no-]chromeos-fonts: enable or disable installation of Chrome OS"\ 17 echo "--[no-]chromeos-fonts: enable or disable installation of Chrome OS"\
18 "fonts" 18 "fonts"
19 echo "--no-prompt: silently select standard options/defaults" 19 echo "--no-prompt: silently select standard options/defaults"
20 echo "--quick-check: quickly try to determine if dependencies are installed"
21 echo " (this avoids interactive prompts and sudo commands,"
22 echo " so might not be 100% accurate)"
23 echo "--unsupported: attempt installation even on unsupported systems"
20 echo "Script will prompt interactively if options not given." 24 echo "Script will prompt interactively if options not given."
21 exit 1 25 exit 1
22 } 26 }
23 27
24 # Checks whether a particular package is available in the repos. 28 # Checks whether a particular package is available in the repos.
25 # USAGE: $ package_exists <package name> 29 # USAGE: $ package_exists <package name>
26 package_exists() { 30 package_exists() {
27 apt-cache pkgnames | grep -x "$1" > /dev/null 2>&1 31 apt-cache pkgnames | grep -x "$1" > /dev/null 2>&1
28 } 32 }
29 33
30 while test "$1" != "" 34 while test "$1" != ""
31 do 35 do
32 case "$1" in 36 case "$1" in
33 --syms) do_inst_syms=1;; 37 --syms) do_inst_syms=1;;
34 --no-syms) do_inst_syms=0;; 38 --no-syms) do_inst_syms=0;;
35 --lib32) do_inst_lib32=1;; 39 --lib32) do_inst_lib32=1;;
36 --no-lib32) do_inst_lib32=0;; 40 --no-lib32) do_inst_lib32=0;;
37 --arm) do_inst_arm=1;; 41 --arm) do_inst_arm=1;;
38 --no-arm) do_inst_arm=0;; 42 --no-arm) do_inst_arm=0;;
39 --chromeos-fonts) do_inst_chromeos_fonts=1;; 43 --chromeos-fonts) do_inst_chromeos_fonts=1;;
40 --no-chromeos-fonts) do_inst_chromeos_fonts=0;; 44 --no-chromeos-fonts) do_inst_chromeos_fonts=0;;
41 --no-prompt) do_default=1 45 --no-prompt) do_default=1
42 do_quietly="-qq --assume-yes" 46 do_quietly="-qq --assume-yes"
43 ;; 47 ;;
48 --quick-check) do_quick_check=1;;
44 --unsupported) do_unsupported=1;; 49 --unsupported) do_unsupported=1;;
45 *) usage;; 50 *) usage;;
46 esac 51 esac
47 shift 52 shift
48 done 53 done
49 54
50 ubuntu_versions="12\.04|12\.10|13\.04" 55 ubuntu_versions="12\.04|12\.10|13\.04"
51 ubuntu_codenames="precise|quantal|raring" 56 ubuntu_codenames="precise|quantal|raring"
52 ubuntu_issue="Ubuntu ($ubuntu_versions|$ubuntu_codenames)" 57 ubuntu_issue="Ubuntu ($ubuntu_versions|$ubuntu_codenames)"
53 # GCEL is an Ubuntu-derived VM image used on Google Compute Engine; /etc/issue 58 # GCEL is an Ubuntu-derived VM image used on Google Compute Engine; /etc/issue
54 # doesn't contain a version number so just trust that the user knows what 59 # doesn't contain a version number so just trust that the user knows what
55 # they're doing. 60 # they're doing.
56 gcel_issue="^GCEL" 61 gcel_issue="^GCEL"
57 62
58 if [ 0 -eq "${do_unsupported-0}" ] ; then 63 if [ 0 -eq "${do_unsupported-0}" ] && [ 0 -eq "${do_quick_check-0}" ] ; then
59 if ! egrep -q "($ubuntu_issue|$gcel_issue)" /etc/issue; then 64 if ! egrep -q "($ubuntu_issue|$gcel_issue)" /etc/issue; then
60 echo "ERROR: Only Ubuntu 12.04 (precise) through 13.04 (raring) are"\ 65 echo "ERROR: Only Ubuntu 12.04 (precise) through 13.04 (raring) are"\
61 "currently supported" >&2 66 "currently supported" >&2
62 exit 1 67 exit 1
63 fi 68 fi
64 69
65 if ! uname -m | egrep -q "i686|x86_64"; then 70 if ! uname -m | egrep -q "i686|x86_64"; then
66 echo "Only x86 architectures are currently supported" >&2 71 echo "Only x86 architectures are currently supported" >&2
67 exit 72 exit
68 fi 73 fi
69 fi 74 fi
70 75
71 if [ "x$(id -u)" != x0 ]; then 76 if [ "x$(id -u)" != x0 ] && [ 0 -eq "${do_quick_check-0}" ]; then
72 echo "Running as non-root user." 77 echo "Running as non-root user."
73 echo "You might have to enter your password one or more times for 'sudo'." 78 echo "You might have to enter your password one or more times for 'sudo'."
74 echo 79 echo
75 fi 80 fi
76 81
77 # Packages needed for chromeos only 82 # Packages needed for chromeos only
78 chromeos_dev_list="libbluetooth-dev libbrlapi-dev" 83 chromeos_dev_list="libbluetooth-dev"
79 84
80 # Packages need for development 85 # Packages need for development
81 dev_list="apache2.2-bin bison curl elfutils fakeroot flex g++ gperf 86 dev_list="apache2.2-bin bison curl elfutils fakeroot flex g++ gperf
82 language-pack-fr libapache2-mod-php5 libasound2-dev libbrlapi-dev 87 language-pack-fr libapache2-mod-php5 libasound2-dev libbrlapi-dev
83 libbz2-dev libcairo2-dev libcups2-dev libcurl4-gnutls-dev libelf-dev 88 libbz2-dev libcairo2-dev libcups2-dev libcurl4-gnutls-dev libelf-dev
84 libgconf2-dev libgl1-mesa-dev libglib2.0-dev libglu1-mesa-dev 89 libgconf2-dev libgl1-mesa-dev libglib2.0-dev libglu1-mesa-dev
85 libgnome-keyring-dev libgtk2.0-dev libkrb5-dev libnspr4-dev 90 libgnome-keyring-dev libgtk2.0-dev libkrb5-dev libnspr4-dev
86 libnss3-dev libpam0g-dev libpci-dev libpulse-dev libsctp-dev 91 libnss3-dev libpam0g-dev libpci-dev libpulse-dev libsctp-dev
87 libspeechd-dev libsqlite3-dev libssl-dev libudev-dev libwww-perl 92 libspeechd-dev libsqlite3-dev libssl-dev libudev-dev libwww-perl
88 libxslt1-dev libxss-dev libxt-dev libxtst-dev mesa-common-dev 93 libxslt1-dev libxss-dev libxt-dev libxtst-dev mesa-common-dev
89 openbox patch perl php5-cgi pkg-config python python-cherrypy3 94 openbox patch perl php5-cgi pkg-config python python-cherrypy3
90 python-dev python-psutil rpm ruby subversion ttf-dejavu-core 95 python-dev python-psutil rpm ruby subversion ttf-dejavu-core
91 ttf-indic-fonts ttf-kochi-gothic ttf-kochi-mincho ttf-thai-tlwg 96 ttf-indic-fonts ttf-kochi-gothic ttf-kochi-mincho ttf-thai-tlwg
92 wdiff git-core libdrm-dev 97 wdiff git-core libdrm-dev
93 $chromeos_dev_list" 98 $chromeos_dev_list"
94 99
95 # 64-bit systems need a minimum set of 32-bit compat packages for the pre-built 100 # 64-bit systems need a minimum set of 32-bit compat packages for the pre-built
96 # NaCl binaries. These are always needed, regardless of whether or not we want 101 # NaCl binaries. These are always needed, regardless of whether or not we want
97 # the full 32-bit "cross-compile" support (--lib32). 102 # the full 32-bit "cross-compile" support (--lib32).
98 if [ "$(uname -m)" = "x86_64" ]; then 103 if [ "$(uname -m)" = "x86_64" ]; then
99 dev_list="${dev_list} libc6-i386 lib32gcc1 lib32stdc++6" 104 dev_list="${dev_list} libc6-i386 lib32gcc1 lib32stdc++6"
100 fi 105 fi
101 106
102 # Run-time libraries required by chromeos only 107 # Run-time libraries required by chromeos only
103 chromeos_lib_list="libpulse0 libbz2-1.0 libcurl4-gnutls-dev" 108 chromeos_lib_list="libpulse0 libbz2-1.0"
104 109
105 # Full list of required run-time libraries 110 # Full list of required run-time libraries
106 lib_list="libatk1.0-0 libc6 libasound2 libcairo2 libcups2 libexpat1 111 lib_list="libatk1.0-0 libc6 libasound2 libcairo2 libcups2 libexpat1
107 libfontconfig1 libfreetype6 libglib2.0-0 libgnome-keyring0 112 libfontconfig1 libfreetype6 libglib2.0-0 libgnome-keyring0
108 libgtk2.0-0 libpam0g libpango1.0-0 libpci3 libpcre3 libpixman-1-0 113 libgtk2.0-0 libpam0g libpango1.0-0 libpci3 libpcre3 libpixman-1-0
109 libpng12-0 libspeechd2 libstdc++6 libsqlite3-0 libx11-6 114 libpng12-0 libspeechd2 libstdc++6 libsqlite3-0 libx11-6
110 libxau6 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxdmcp6 115 libxau6 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxdmcp6
111 libxext6 libxfixes3 libxi6 libxinerama1 libxrandr2 libxrender1 116 libxext6 libxfixes3 libxi6 libxinerama1 libxrandr2 libxrender1
112 libxtst6 zlib1g $chromeos_lib_list" 117 libxtst6 zlib1g $chromeos_lib_list"
113 118
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 exit 1 201 exit 1
197 ;; 202 ;;
198 *) # The user pressed an unrecognized key. As we are not echoing 203 *) # The user pressed an unrecognized key. As we are not echoing
199 # any incorrect user input, alert the user by ringing the bell. 204 # any incorrect user input, alert the user by ringing the bell.
200 (tput bel) 2>/dev/null 205 (tput bel) 2>/dev/null
201 ;; 206 ;;
202 esac 207 esac
203 done 208 done
204 } 209 }
205 210
206 if test "$do_inst_syms" = "" 211 if test "$do_inst_syms" = "" && test 0 -eq ${do_quick_check-0}
207 then 212 then
208 echo "This script installs all tools and libraries needed to build Chromium." 213 echo "This script installs all tools and libraries needed to build Chromium."
209 echo "" 214 echo ""
210 echo "For most of the libraries, it can also install debugging symbols, which" 215 echo "For most of the libraries, it can also install debugging symbols, which"
211 echo "will allow you to debug code in the system libraries. Most developers" 216 echo "will allow you to debug code in the system libraries. Most developers"
212 echo "won't need these symbols." 217 echo "won't need these symbols."
213 echo -n "Do you want me to install them for you (y/N) " 218 echo -n "Do you want me to install them for you (y/N) "
214 if yes_no 1; then 219 if yes_no 1; then
215 do_inst_syms=1 220 do_inst_syms=1
216 fi 221 fi
217 fi 222 fi
218 if test "$do_inst_syms" = "1"; then 223 if test "$do_inst_syms" = "1"; then
219 echo "Installing debugging symbols." 224 echo "Including debugging symbols."
220 else 225 else
221 echo "Skipping installation of debugging symbols." 226 echo "Skipping debugging symbols."
222 dbg_list= 227 dbg_list=
223 fi 228 fi
224 229
225 # When cross building for arm on 64-bit systems the host binaries 230 # When cross building for arm on 64-bit systems the host binaries
226 # that are part of v8 need to be compiled with -m32 which means 231 # that are part of v8 need to be compiled with -m32 which means
227 # that basic multilib support is needed. 232 # that basic multilib support is needed.
228 if [ "$(uname -m)" = "x86_64" ]; then 233 if [ "$(uname -m)" = "x86_64" ]; then
229 arm_list="$arm_list g++-multilib" 234 arm_list="$arm_list g++-multilib"
230 fi 235 fi
231 236
232 if test "$do_inst_arm" = "1"; then 237 if test "$do_inst_arm" = "1" ; then
233 . /etc/lsb-release 238 . /etc/lsb-release
234 if test "$DISTRIB_CODENAME" != "precise"; then 239 if ! [ "${DISTRIB_CODENAME}" = "precise" -o \
240 1 -eq "${do_unsupported-0}" ]; then
235 echo "ERROR: Installing the ARM cross toolchain is only available on" \ 241 echo "ERROR: Installing the ARM cross toolchain is only available on" \
236 "Ubuntu precise." >&2 242 "Ubuntu precise." >&2
237 exit 1 243 exit 1
238 fi 244 fi
239 echo "Installing ARM cross toolchain." 245 echo "Including ARM cross toolchain."
240 else 246 else
241 echo "Skipping installation of ARM cross toolchain." 247 echo "Skipping ARM cross toolchain."
242 arm_list= 248 arm_list=
243 fi 249 fi
244 250
251 packages="$(echo "${dev_list} ${lib_list} ${dbg_list} ${arm_list}" | \
252 tr " " "\n" | sort -u | tr "\n" " ")"
253
254 if [ 1 -eq "${do_quick_check-0}" ] ; then
255 failed_check="$(dpkg-query -W -f '${PackageSpec}:${Status}\n' \
256 ${packages} 2>&1 | grep -v "ok installed" || :)"
257 if [ -n "${failed_check}" ]; then
258 echo
259 nomatch="$(echo "${failed_check}" | \
260 sed -e "s/^No packages found matching \(.*\).$/\1/;t;d")"
261 missing="$(echo "${failed_check}" | \
262 sed -e "/^No packages found matching/d;s/^\(.*\):.*$/\1/")"
263 if [ "$nomatch" ]; then
264 # Distinguish between packages that actually aren't available to the
265 # system (i.e. not in any repo) and packages that just aren't known to
266 # dpkg (i.e. managed by apt).
267 unknown=""
268 for p in ${nomatch}; do
269 if apt-cache show ${p} > /dev/null 2>&1; then
270 missing="${p}\n${missing}"
271 else
272 unknown="${p}\n${unknown}"
273 fi
274 done
275 if [ -n "${unknown}" ]; then
276 echo "WARNING: The following packages are unknown to your system"
277 echo "(maybe missing a repo or need to 'sudo apt-get update'):"
278 echo -e "${unknown}" | sed -e "s/^/ /"
279 fi
280 fi
281 if [ -n "${missing}" ]; then
282 echo "WARNING: The following packages are not installed:"
283 echo -e "${missing}" | sed -e "s/^/ /"
284 fi
285 exit 1
286 fi
287 exit 0
288 fi
289
245 sudo apt-get update 290 sudo apt-get update
246 291
247 # We initially run "apt-get" with the --reinstall option and parse its output. 292 # We initially run "apt-get" with the --reinstall option and parse its output.
248 # This way, we can find all the packages that need to be newly installed 293 # This way, we can find all the packages that need to be newly installed
249 # without accidentally promoting any packages from "auto" to "manual". 294 # without accidentally promoting any packages from "auto" to "manual".
250 # We then re-run "apt-get" with just the list of missing packages. 295 # We then re-run "apt-get" with just the list of missing packages.
251 echo "Finding missing packages..." 296 echo "Finding missing packages..."
252 packages="${dev_list} ${lib_list} ${dbg_list} ${arm_list}"
253 # Intentionally leaving $packages unquoted so it's more readable. 297 # Intentionally leaving $packages unquoted so it's more readable.
254 echo "Packages required: " $packages 298 echo "Packages required: " $packages
255 echo 299 echo
256 new_list_cmd="sudo apt-get install --reinstall $(echo $packages)" 300 new_list_cmd="sudo apt-get install --reinstall $(echo $packages)"
257 if new_list="$(yes n | LANGUAGE=en LANG=C $new_list_cmd)"; then 301 if new_list="$(yes n | LANGUAGE=en LANG=C $new_list_cmd)"; then
258 # We probably never hit this following line. 302 # We probably never hit this following line.
259 echo "No missing packages, and the packages are up-to-date." 303 echo "No missing packages, and the packages are up-to-date."
260 elif [ $? -eq 1 ]; then 304 elif [ $? -eq 1 ]; then
261 # We expect apt-get to have exit status of 1. 305 # We expect apt-get to have exit status of 1.
262 # This indicates that we cancelled the install with "yes n|". 306 # This indicates that we cancelled the install with "yes n|".
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 sed -e 's/[.]so[.][0-9].*/.so/' | 556 sed -e 's/[.]so[.][0-9].*/.so/' |
513 sort -u); do 557 sort -u); do
514 [ "x${i##*/}" = "xld-linux.so" ] && continue 558 [ "x${i##*/}" = "xld-linux.so" ] && continue
515 [ -r "$i" ] && continue 559 [ -r "$i" ] && continue
516 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | 560 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' |
517 sort -n | tail -n 1)" 561 sort -n | tail -n 1)"
518 [ -r "$i.$j" ] || continue 562 [ -r "$i.$j" ] || continue
519 sudo ln -s "${i##*/}.$j" "$i" 563 sudo ln -s "${i##*/}.$j" "$i"
520 done 564 done
521 fi 565 fi
OLDNEW
« no previous file with comments | « no previous file | tools/diagnose-me.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698