blob: ca59745014348ed75616ced5af47039d0cdf78c0 [file] [log] [blame]
[email protected]e041ed12009-03-10 16:43:011#!/bin/bash -e
2
[email protected]aac39c92012-02-08 18:39:533# Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]e46cdae2009-08-25 20:59:274# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
[email protected]cf1df402008-10-31 21:45:307# Script to install everything needed to build chromium (well, ideally, anyway)
[email protected]592ea8ca2008-11-03 19:47:368# See http://code.google.com/p/chromium/wiki/LinuxBuildInstructions
9# and http://code.google.com/p/chromium/wiki/LinuxBuild64Bit
[email protected]cf1df402008-10-31 21:45:3010
[email protected]1eae2bfb2010-01-26 18:17:5311usage() {
12 echo "Usage: $0 [--options]"
13 echo "Options:"
14 echo "--[no-]syms: enable or disable installation of debugging symbols"
[email protected]1eae2bfb2010-01-26 18:17:5315 echo "--[no-]lib32: enable or disable installation of 32 bit libraries"
[email protected]f2826b6a2012-11-15 01:06:2616 echo "--[no-]arm: enable or disable installation of arm cross toolchain"
[email protected]bd29cdd2013-02-22 03:49:2017 echo "--[no-]chromeos-fonts: enable or disable installation of Chrome OS"\
18 "fonts"
[email protected]565416362014-01-16 21:26:4719 echo "--[no-]nacl: enable or disable installation of prerequisites for"\
20 "building standalone NaCl and all its toolchains"
[email protected]e2544ed42012-04-23 04:48:3121 echo "--no-prompt: silently select standard options/defaults"
[email protected]ba48c4ca2013-10-25 16:11:4622 echo "--quick-check: quickly try to determine if dependencies are installed"
23 echo " (this avoids interactive prompts and sudo commands,"
24 echo " so might not be 100% accurate)"
25 echo "--unsupported: attempt installation even on unsupported systems"
[email protected]1eae2bfb2010-01-26 18:17:5326 echo "Script will prompt interactively if options not given."
27 exit 1
28}
29
[email protected]4fc00712013-05-29 23:11:2030# Checks whether a particular package is available in the repos.
31# USAGE: $ package_exists <package name>
32package_exists() {
33 apt-cache pkgnames | grep -x "$1" > /dev/null 2>&1
34}
35
[email protected]fbeddf22014-01-17 23:59:0136# These default to on because (some) bots need them and it keeps things
37# simple for the bot setup if all bots just run the script in its default
38# mode. Developers who don't want stuff they don't need installed on their
39# own workstations can pass --no-arm --no-nacl when running the script.
40do_inst_arm=1
41do_inst_nacl=1
42
[email protected]1eae2bfb2010-01-26 18:17:5343while test "$1" != ""
44do
45 case "$1" in
[email protected]ce774642011-09-12 23:21:3946 --syms) do_inst_syms=1;;
47 --no-syms) do_inst_syms=0;;
[email protected]ce774642011-09-12 23:21:3948 --lib32) do_inst_lib32=1;;
49 --no-lib32) do_inst_lib32=0;;
[email protected]f2826b6a2012-11-15 01:06:2650 --arm) do_inst_arm=1;;
51 --no-arm) do_inst_arm=0;;
[email protected]bd29cdd2013-02-22 03:49:2052 --chromeos-fonts) do_inst_chromeos_fonts=1;;
53 --no-chromeos-fonts) do_inst_chromeos_fonts=0;;
[email protected]565416362014-01-16 21:26:4754 --nacl) do_inst_nacl=1;;
55 --no-nacl) do_inst_nacl=0;;
[email protected]e2544ed42012-04-23 04:48:3156 --no-prompt) do_default=1
57 do_quietly="-qq --assume-yes"
58 ;;
[email protected]ba48c4ca2013-10-25 16:11:4659 --quick-check) do_quick_check=1;;
[email protected]fe63a022013-01-15 22:11:4760 --unsupported) do_unsupported=1;;
[email protected]1eae2bfb2010-01-26 18:17:5361 *) usage;;
62 esac
63 shift
64done
65
[email protected]0febc9b2014-05-22 20:07:1966# Check for lsb_release command in $PATH
67if ! which lsb_release > /dev/null; then
68 echo "ERROR: lsb_release not found in \$PATH" >&2
69 exit 1;
70fi
[email protected]f2826b6a2012-11-15 01:06:2671
[email protected]0febc9b2014-05-22 20:07:1972lsb_release=$(lsb_release --codename --short)
73ubuntu_codenames="(precise|quantal|raring|saucy|trusty)"
[email protected]ba48c4ca2013-10-25 16:11:4674if [ 0 -eq "${do_unsupported-0}" ] && [ 0 -eq "${do_quick_check-0}" ] ; then
[email protected]0febc9b2014-05-22 20:07:1975 if [[ ! $lsb_release =~ $ubuntu_codenames ]]; then
[email protected]a2984e22014-05-22 00:48:1276 echo "ERROR: Only Ubuntu 12.04 (precise) through 14.04 (trusty) are"\
[email protected]fe63a022013-01-15 22:11:4777 "currently supported" >&2
78 exit 1
79 fi
[email protected]cf1df402008-10-31 21:45:3080
[email protected]fe63a022013-01-15 22:11:4781 if ! uname -m | egrep -q "i686|x86_64"; then
82 echo "Only x86 architectures are currently supported" >&2
83 exit
84 fi
[email protected]e041ed12009-03-10 16:43:0185fi
86
[email protected]ba48c4ca2013-10-25 16:11:4687if [ "x$(id -u)" != x0 ] && [ 0 -eq "${do_quick_check-0}" ]; then
[email protected]e041ed12009-03-10 16:43:0188 echo "Running as non-root user."
89 echo "You might have to enter your password one or more times for 'sudo'."
[email protected]8ada8c52009-03-10 21:53:0890 echo
[email protected]e041ed12009-03-10 16:43:0191fi
92
[email protected]fdc6bf52010-06-07 22:01:5793# Packages needed for chromeos only
[email protected]ba48c4ca2013-10-25 16:11:4694chromeos_dev_list="libbluetooth-dev"
[email protected]fdc6bf52010-06-07 22:01:5795
[email protected]b61f6882013-11-14 20:41:4196# Packages needed for development
[email protected]ff94468c2014-04-30 23:07:0497dev_list="apache2.2-bin bison curl dpkg-dev elfutils devscripts fakeroot flex
[email protected]4b11e042014-04-03 21:49:1998 fonts-thai-tlwg g++ git-core gperf language-pack-da language-pack-fr
99 language-pack-he language-pack-zh-hant libapache2-mod-php5
[email protected]36659e02014-06-27 02:27:14100 libasound2-dev libbrlapi-dev libav-tools libbz2-dev libcairo2-dev
101 libcap-dev libcups2-dev libcurl4-gnutls-dev libdrm-dev libelf-dev
102 libexif-dev libgconf2-dev libgl1-mesa-dev libglib2.0-dev
103 libglu1-mesa-dev libgnome-keyring-dev libgtk2.0-dev libkrb5-dev
104 libnspr4-dev libnss3-dev libpam0g-dev libpci-dev libpulse-dev
105 libsctp-dev libspeechd-dev libsqlite3-dev libssl-dev libudev-dev
106 libwww-perl libxslt1-dev libxss-dev libxt-dev libxtst-dev
107 mesa-common-dev openbox patch perl php5-cgi pkg-config python
108 python-cherrypy3 python-dev python-psutil rpm ruby subversion
109 ttf-dejavu-core ttf-indic-fonts ttf-kochi-gothic ttf-kochi-mincho
110 wdiff xfonts-mathml zip $chromeos_dev_list"
[email protected]fdc6bf52010-06-07 22:01:57111
[email protected]f16aabf2012-08-15 21:00:14112# 64-bit systems need a minimum set of 32-bit compat packages for the pre-built
[email protected]d93d68b12012-10-15 06:39:53113# NaCl binaries. These are always needed, regardless of whether or not we want
[email protected]f16aabf2012-08-15 21:00:14114# the full 32-bit "cross-compile" support (--lib32).
[email protected]9161abe2013-10-31 15:15:49115if file /sbin/init | grep -q 'ELF 64-bit'; then
[email protected]d93d68b12012-10-15 06:39:53116 dev_list="${dev_list} libc6-i386 lib32gcc1 lib32stdc++6"
[email protected]f16aabf2012-08-15 21:00:14117fi
118
[email protected]fdc6bf52010-06-07 22:01:57119# Run-time libraries required by chromeos only
[email protected]ba48c4ca2013-10-25 16:11:46120chromeos_lib_list="libpulse0 libbz2-1.0"
[email protected]e041ed12009-03-10 16:43:01121
122# Full list of required run-time libraries
[email protected]d8f52322013-10-29 05:50:38123lib_list="libatk1.0-0 libc6 libasound2 libcairo2 libcap2 libcups2 libexpat1
[email protected]e8796012014-03-14 05:56:17124 libexif12 libfontconfig1 libfreetype6 libglib2.0-0 libgnome-keyring0
[email protected]ca3a1d262012-10-30 22:33:20125 libgtk2.0-0 libpam0g libpango1.0-0 libpci3 libpcre3 libpixman-1-0
[email protected]9e895962013-05-21 08:26:42126 libpng12-0 libspeechd2 libstdc++6 libsqlite3-0 libx11-6
[email protected]8190b882012-12-05 19:40:34127 libxau6 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxdmcp6
128 libxext6 libxfixes3 libxi6 libxinerama1 libxrandr2 libxrender1
129 libxtst6 zlib1g $chromeos_lib_list"
[email protected]e041ed12009-03-10 16:43:01130
131# Debugging symbols for all of the run-time libraries
[email protected]6ffd19f352012-10-23 02:00:41132dbg_list="libatk1.0-dbg libc6-dbg libcairo2-dbg libfontconfig1-dbg
133 libglib2.0-0-dbg libgtk2.0-0-dbg libpango1.0-0-dbg libpcre3-dbg
134 libpixman-1-0-dbg libsqlite3-0-dbg libx11-6-dbg libxau6-dbg
135 libxcb1-dbg libxcomposite1-dbg libxcursor1-dbg libxdamage1-dbg
136 libxdmcp6-dbg libxext6-dbg libxfixes3-dbg libxi6-dbg libxinerama1-dbg
[email protected]362196232013-11-10 00:43:40137 libxrandr2-dbg libxrender1-dbg libxtst6-dbg zlib1g-dbg
138 libstdc++6-4.6-dbg"
[email protected]e041ed12009-03-10 16:43:01139
[email protected]3f85dac32013-10-29 02:38:46140# arm cross toolchain packages needed to build chrome on armhf
[email protected]a2984e22014-05-22 00:48:12141arm_list="libc6-dev-armhf-cross
142 linux-libc-dev-armhf-cross
143 g++-arm-linux-gnueabihf"
[email protected]31a605532011-08-23 22:27:35144
[email protected]713eac62014-06-02 23:10:03145# Packages to build NaCl, its toolchains, and its ports.
[email protected]5203a352014-06-19 16:17:50146nacl_list="autoconf bison cmake g++-mingw-w64-i686 gawk lib32z1-dev
147 libasound2:i386 libcap2:i386 libelf-dev:i386 libexif12:i386
[email protected]419a9a62014-06-19 18:26:18148 libfontconfig1:i386 libgconf-2-4:i386 libglib2.0-0:i386 libgpm2:i386
[email protected]a14d76e2014-07-23 02:25:08149 libgtk2.0-0:i386 libncurses5:i386 lib32ncurses5-dev
150 libnss3:i386 libpango1.0-0:i386
[email protected]419a9a62014-06-19 18:26:18151 libssl0.9.8:i386 libtinfo-dev libtinfo-dev:i386 libtool
152 libxcomposite1:i386 libxcursor1:i386 libxdamage1:i386 libxi6:i386
153 libxrandr2:i386 libxss1:i386 libxtst6:i386 texinfo xvfb"
154
155# Find the proper version of libgbm-dev. We can't just install libgbm-dev as
156# it depends on mesa, and only one version of mesa can exists on the system.
157# Hence we must match the same version or this entire script will fail.
158mesa_variant=""
159for variant in "-lts-quantal" "-lts-raring" "-lts-saucy"; do
160 if $(dpkg-query -Wf'${Status}' libgl1-mesa-glx${variant} | \
161 grep -q " ok installed"); then
162 mesa_variant="${variant}"
163 fi
164done
[email protected]3a4bd5d2014-06-25 23:55:04165dev_list="${dev_list} libgbm-dev${mesa_variant}
166 libgles2-mesa-dev${mesa_variant}"
[email protected]419a9a62014-06-19 18:26:18167nacl_list="${nacl_list} libgl1-mesa-glx${mesa_variant}:i386"
[email protected]565416362014-01-16 21:26:47168
[email protected]757c2962012-03-15 19:05:18169# Some package names have changed over time
[email protected]4fc00712013-05-29 23:11:20170if package_exists ttf-mscorefonts-installer; then
[email protected]757c2962012-03-15 19:05:18171 dev_list="${dev_list} ttf-mscorefonts-installer"
[email protected]b11411c2012-03-21 22:09:41172else
173 dev_list="${dev_list} msttcorefonts"
[email protected]757c2962012-03-15 19:05:18174fi
[email protected]4fc00712013-05-29 23:11:20175if package_exists libnspr4-dbg; then
[email protected]1a0f64a2011-05-20 17:53:55176 dbg_list="${dbg_list} libnspr4-dbg libnss3-dbg"
177 lib_list="${lib_list} libnspr4 libnss3"
[email protected]757c2962012-03-15 19:05:18178else
179 dbg_list="${dbg_list} libnspr4-0d-dbg libnss3-1d-dbg"
180 lib_list="${lib_list} libnspr4-0d libnss3-1d"
181fi
[email protected]4fc00712013-05-29 23:11:20182if package_exists libjpeg-dev; then
[email protected]9e895962013-05-21 08:26:42183 dev_list="${dev_list} libjpeg-dev"
[email protected]b11411c2012-03-21 22:09:41184else
[email protected]9e895962013-05-21 08:26:42185 dev_list="${dev_list} libjpeg62-dev"
[email protected]b11411c2012-03-21 22:09:41186fi
[email protected]4fc00712013-05-29 23:11:20187if package_exists libudev1; then
[email protected]9e895962013-05-21 08:26:42188 dev_list="${dev_list} libudev1"
[email protected]ab9e69082014-06-05 15:28:52189 nacl_list="${nacl_list} libudev1:i386"
[email protected]9e895962013-05-21 08:26:42190else
191 dev_list="${dev_list} libudev0"
[email protected]ab9e69082014-06-05 15:28:52192 nacl_list="${nacl_list} libudev0:i386"
[email protected]9e895962013-05-21 08:26:42193fi
[email protected]3ea42912013-09-06 06:23:57194if package_exists libbrlapi0.6; then
195 dev_list="${dev_list} libbrlapi0.6"
196else
197 dev_list="${dev_list} libbrlapi0.5"
198fi
[email protected]9e895962013-05-21 08:26:42199
[email protected]757c2962012-03-15 19:05:18200
[email protected]dc099772013-09-30 22:06:58201# Some packages are only needed if the distribution actually supports
[email protected]757c2962012-03-15 19:05:18202# installing them.
[email protected]4fc00712013-05-29 23:11:20203if package_exists appmenu-gtk; then
[email protected]757c2962012-03-15 19:05:18204 lib_list="$lib_list appmenu-gtk"
[email protected]4da8fad2011-04-11 18:42:42205fi
206
[email protected]8ada8c52009-03-10 21:53:08207# Waits for the user to press 'Y' or 'N'. Either uppercase of lowercase is
208# accepted. Returns 0 for 'Y' and 1 for 'N'. If an optional parameter has
209# been provided to yes_no(), the function also accepts RETURN as a user input.
210# The parameter specifies the exit code that should be returned in that case.
211# The function will echo the user's selection followed by a newline character.
212# Users can abort the function by pressing CTRL-C. This will call "exit 1".
213yes_no() {
[email protected]e2544ed42012-04-23 04:48:31214 if [ 0 -ne "${do_default-0}" ] ; then
[email protected]dc099772013-09-30 22:06:58215 [ $1 -eq 0 ] && echo "Y" || echo "N"
[email protected]e2544ed42012-04-23 04:48:31216 return $1
217 fi
[email protected]8ada8c52009-03-10 21:53:08218 local c
219 while :; do
220 c="$(trap 'stty echo -iuclc icanon 2>/dev/null' EXIT INT TERM QUIT
221 stty -echo iuclc -icanon 2>/dev/null
222 dd count=1 bs=1 2>/dev/null | od -An -tx1)"
223 case "$c" in
224 " 0a") if [ -n "$1" ]; then
225 [ $1 -eq 0 ] && echo "Y" || echo "N"
226 return $1
227 fi
228 ;;
229 " 79") echo "Y"
230 return 0
231 ;;
232 " 6e") echo "N"
233 return 1
234 ;;
235 "") echo "Aborted" >&2
236 exit 1
237 ;;
238 *) # The user pressed an unrecognized key. As we are not echoing
239 # any incorrect user input, alert the user by ringing the bell.
240 (tput bel) 2>/dev/null
241 ;;
242 esac
243 done
244}
245
[email protected]ba48c4ca2013-10-25 16:11:46246if test "$do_inst_syms" = "" && test 0 -eq ${do_quick_check-0}
[email protected]1eae2bfb2010-01-26 18:17:53247then
248 echo "This script installs all tools and libraries needed to build Chromium."
249 echo ""
250 echo "For most of the libraries, it can also install debugging symbols, which"
251 echo "will allow you to debug code in the system libraries. Most developers"
252 echo "won't need these symbols."
253 echo -n "Do you want me to install them for you (y/N) "
254 if yes_no 1; then
255 do_inst_syms=1
256 fi
257fi
258if test "$do_inst_syms" = "1"; then
[email protected]ba48c4ca2013-10-25 16:11:46259 echo "Including debugging symbols."
[email protected]8ada8c52009-03-10 21:53:08260else
[email protected]ba48c4ca2013-10-25 16:11:46261 echo "Skipping debugging symbols."
[email protected]8ada8c52009-03-10 21:53:08262 dbg_list=
263fi
264
[email protected]9f28a9cf2012-12-17 23:31:40265# When cross building for arm on 64-bit systems the host binaries
266# that are part of v8 need to be compiled with -m32 which means
267# that basic multilib support is needed.
[email protected]9161abe2013-10-31 15:15:49268if file /sbin/init | grep -q 'ELF 64-bit'; then
[email protected]0febc9b2014-05-22 20:07:19269 if [ "$lsb_release" = "trusty" ]; then
[email protected]a2984e22014-05-22 00:48:12270 # gcc-multilib conflicts with the arm cross compiler in trusty but
271 # g++-4.8-multilib gives us the 32-bit support that we need.
272 arm_list="$arm_list g++-4.8-multilib"
273 else
274 arm_list="$arm_list g++-multilib"
275 fi
[email protected]9f28a9cf2012-12-17 23:31:40276fi
277
[email protected]ba48c4ca2013-10-25 16:11:46278if test "$do_inst_arm" = "1" ; then
[email protected]ba48c4ca2013-10-25 16:11:46279 echo "Including ARM cross toolchain."
[email protected]f2826b6a2012-11-15 01:06:26280else
[email protected]ba48c4ca2013-10-25 16:11:46281 echo "Skipping ARM cross toolchain."
[email protected]f2826b6a2012-11-15 01:06:26282 arm_list=
283fi
284
[email protected]565416362014-01-16 21:26:47285if test "$do_inst_nacl" = "1"; then
[email protected]713eac62014-06-02 23:10:03286 echo "Including NaCl, NaCl toolchain, NaCl ports dependencies."
[email protected]565416362014-01-16 21:26:47287else
[email protected]713eac62014-06-02 23:10:03288 echo "Skipping NaCl, NaCl toolchain, NaCl ports dependencies."
[email protected]565416362014-01-16 21:26:47289 nacl_list=
290fi
291
292packages="$(
293 echo "${dev_list} ${lib_list} ${dbg_list} ${arm_list} ${nacl_list}" |
294 tr " " "\n" | sort -u | tr "\n" " "
295)"
[email protected]ba48c4ca2013-10-25 16:11:46296
297if [ 1 -eq "${do_quick_check-0}" ] ; then
298 failed_check="$(dpkg-query -W -f '${PackageSpec}:${Status}\n' \
299 ${packages} 2>&1 | grep -v "ok installed" || :)"
300 if [ -n "${failed_check}" ]; then
301 echo
302 nomatch="$(echo "${failed_check}" | \
303 sed -e "s/^No packages found matching \(.*\).$/\1/;t;d")"
304 missing="$(echo "${failed_check}" | \
305 sed -e "/^No packages found matching/d;s/^\(.*\):.*$/\1/")"
306 if [ "$nomatch" ]; then
307 # Distinguish between packages that actually aren't available to the
308 # system (i.e. not in any repo) and packages that just aren't known to
309 # dpkg (i.e. managed by apt).
310 unknown=""
311 for p in ${nomatch}; do
312 if apt-cache show ${p} > /dev/null 2>&1; then
313 missing="${p}\n${missing}"
314 else
315 unknown="${p}\n${unknown}"
316 fi
317 done
318 if [ -n "${unknown}" ]; then
319 echo "WARNING: The following packages are unknown to your system"
320 echo "(maybe missing a repo or need to 'sudo apt-get update'):"
321 echo -e "${unknown}" | sed -e "s/^/ /"
322 fi
323 fi
324 if [ -n "${missing}" ]; then
325 echo "WARNING: The following packages are not installed:"
326 echo -e "${missing}" | sed -e "s/^/ /"
327 fi
328 exit 1
329 fi
330 exit 0
331fi
332
[email protected]e041ed12009-03-10 16:43:01333sudo apt-get update
334
335# We initially run "apt-get" with the --reinstall option and parse its output.
336# This way, we can find all the packages that need to be newly installed
337# without accidentally promoting any packages from "auto" to "manual".
338# We then re-run "apt-get" with just the list of missing packages.
339echo "Finding missing packages..."
[email protected]757c2962012-03-15 19:05:18340# Intentionally leaving $packages unquoted so it's more readable.
[email protected]b6e064522009-08-10 18:47:51341echo "Packages required: " $packages
342echo
[email protected]79a9d2962009-08-06 21:10:58343new_list_cmd="sudo apt-get install --reinstall $(echo $packages)"
[email protected]c3d8b152013-05-10 10:10:03344if new_list="$(yes n | LANGUAGE=en LANG=C $new_list_cmd)"; then
[email protected]b6e064522009-08-10 18:47:51345 # We probably never hit this following line.
[email protected]79a9d2962009-08-06 21:10:58346 echo "No missing packages, and the packages are up-to-date."
[email protected]b62f11e72010-05-03 17:20:45347elif [ $? -eq 1 ]; then
[email protected]79a9d2962009-08-06 21:10:58348 # We expect apt-get to have exit status of 1.
[email protected]757c2962012-03-15 19:05:18349 # This indicates that we cancelled the install with "yes n|".
[email protected]b6e064522009-08-10 18:47:51350 new_list=$(echo "$new_list" |
[email protected]79a9d2962009-08-06 21:10:58351 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d')
[email protected]b6e064522009-08-10 18:47:51352 new_list=$(echo "$new_list" | sed 's/ *$//')
353 if [ -z "$new_list" ] ; then
354 echo "No missing packages, and the packages are up-to-date."
355 else
356 echo "Installing missing packages: $new_list."
[email protected]e2544ed42012-04-23 04:48:31357 sudo apt-get install ${do_quietly-} ${new_list}
[email protected]b6e064522009-08-10 18:47:51358 fi
359 echo
[email protected]79a9d2962009-08-06 21:10:58360else
361 # An apt-get exit status of 100 indicates that a real error has occurred.
[email protected]e041ed12009-03-10 16:43:01362
[email protected]79a9d2962009-08-06 21:10:58363 # I am intentionally leaving out the '"'s around new_list_cmd,
364 # as this makes it easier to cut and paste the output
[email protected]79a9d2962009-08-06 21:10:58365 echo "The following command failed: " ${new_list_cmd}
366 echo
367 echo "It produces the following output:"
368 yes n | $new_list_cmd || true
369 echo
370 echo "You will have to install the above packages yourself."
371 echo
372 exit 100
373fi
[email protected]e041ed12009-03-10 16:43:01374
[email protected]d96cc3472013-09-19 00:53:30375# Install the Chrome OS default fonts. This must go after running
376# apt-get, since install-chromeos-fonts depends on curl.
377if test "$do_inst_chromeos_fonts" != "0"; then
378 echo
379 echo "Installing Chrome OS fonts."
380 dir=`echo $0 | sed -r -e 's/\/[^/]+$//'`
381 if ! sudo $dir/linux/install-chromeos-fonts.py; then
382 echo "ERROR: The installation of the Chrome OS default fonts failed."
383 if [ `stat -f -c %T $dir` == "nfs" ]; then
384 echo "The reason is that your repo is installed on a remote file system."
385 else
386 echo "This is expected if your repo is installed on a remote file system."
387 fi
388 echo "It is recommended to install your repo on a local file system."
389 echo "You can skip the installation of the Chrome OS default founts with"
390 echo "the command line option: --no-chromeos-fonts."
391 exit 1
392 fi
393else
394 echo "Skipping installation of Chrome OS fonts."
395fi
396
[email protected]713eac62014-06-02 23:10:03397if test "$do_inst_nacl" = "1"; then
398 echo "Installing symbolic links for NaCl."
399 if [ ! -r /usr/lib/i386-linux-gnu/libcrypto.so ]; then
400 sudo ln -fs libcrypto.so.0.9.8 /usr/lib/i386-linux-gnu/libcrypto.so
401 fi
402 if [ ! -r /usr/lib/i386-linux-gnu/libssl.so ]; then
403 sudo ln -fs libssl.so.0.9.8 /usr/lib/i386-linux-gnu/libssl.so
404 fi
405else
406 echo "Skipping symbolic links for NaCl."
407fi
408
[email protected]e041ed12009-03-10 16:43:01409# Install 32bit backwards compatibility support for 64bit systems
[email protected]9161abe2013-10-31 15:15:49410if file /sbin/init | grep -q 'ELF 64-bit'; then
[email protected]1eae2bfb2010-01-26 18:17:53411 if test "$do_inst_lib32" != "1"
412 then
[email protected]4a242bea2012-11-07 19:31:52413 echo "NOTE: If you were expecting the option to install 32bit libs,"
414 echo "please run with the --lib32 flag."
415 echo
416 echo "Installation complete."
[email protected]8ada8c52009-03-10 21:53:08417 exit 0
[email protected]f3b3ba7b2013-04-24 00:11:27418 else
419 # This conditional statement has been added to deprecate and eventually
420 # remove support for 32bit libraries on 64bit systems. But for the time
421 # being, we still have to support a few legacy systems (e.g. bots), where
422 # this feature is needed.
423 # We only even give the user the option to install these libraries, if
424 # they explicitly requested doing so by setting the --lib32 command line
425 # flag.
426 # And even then, we interactively ask them one more time whether they are
427 # absolutely sure.
428 # In order for that to work, we must reset the ${do_inst_lib32} variable.
429 # There are other ways to achieve the same goal. But resetting the
430 # variable is the best way to document the intended behavior -- and to
431 # allow us to gradually deprecate and then remove the obsolete code.
[email protected]dc099772013-09-30 22:06:58432 if test "${do_default-0}" -ne 1; then
433 do_inst_lib32=
434 fi
[email protected]8ada8c52009-03-10 21:53:08435 fi
[email protected]b62f11e72010-05-03 17:20:45436
[email protected]4a242bea2012-11-07 19:31:52437 echo "WARNING"
[email protected]e76a3632012-03-15 20:56:27438 echo
[email protected]4a242bea2012-11-07 19:31:52439 echo "We no longer recommend that you use this script to install"
440 echo "32bit libraries on a 64bit system. Instead, consider using the"
441 echo "install-chroot.sh script to help you set up a 32bit environment"
442 echo "for building and testing 32bit versions of Chrome."
443 echo
444 echo "The code for installing 32bit libraries on a 64bit system is"
445 echo "unmaintained and might not work with modern versions of Ubuntu"
446 echo "or Debian."
[email protected]dc099772013-09-30 22:06:58447 if test "$do_inst_lib32" != "" ; then
448 echo
449 echo -n "Are you sure you want to proceed (y/N) "
450 if yes_no 1; then
451 do_inst_lib32=1
452 fi
[email protected]4a242bea2012-11-07 19:31:52453 fi
454 if test "$do_inst_lib32" != "1"
[email protected]796c3522012-11-07 22:56:35455 then
[email protected]4a242bea2012-11-07 19:31:52456 exit 0
457 fi
[email protected]e76a3632012-03-15 20:56:27458
[email protected]b62f11e72010-05-03 17:20:45459 # Standard 32bit compatibility libraries
460 echo "First, installing the limited existing 32-bit support..."
[email protected]7cf14b372011-12-08 18:32:52461 cmp_list="ia32-libs lib32asound2-dev lib32stdc++6 lib32z1
[email protected]b62f11e72010-05-03 17:20:45462 lib32z1-dev libc6-dev-i386 libc6-i386 g++-multilib"
[email protected]7cf14b372011-12-08 18:32:52463 if [ -n "`apt-cache search lib32readline-gplv2-dev 2>/dev/null`" ]; then
464 cmp_list="${cmp_list} lib32readline-gplv2-dev"
465 else
466 cmp_list="${cmp_list} lib32readline5-dev"
467 fi
[email protected]221569d32012-05-20 04:55:48468 sudo apt-get install ${do_quietly-} $cmp_list
[email protected]b62f11e72010-05-03 17:20:45469
[email protected]e041ed12009-03-10 16:43:01470 tmp=/tmp/install-32bit.$$
471 trap 'rm -rf "${tmp}"' EXIT INT TERM QUIT
472 mkdir -p "${tmp}/apt/lists/partial" "${tmp}/cache" "${tmp}/partial"
473 touch "${tmp}/status"
474
475 [ -r /etc/apt/apt.conf ] && cp /etc/apt/apt.conf "${tmp}/apt/"
[email protected]b6e064522009-08-10 18:47:51476 cat >>"${tmp}/apt/apt.conf" <<EOF
[email protected]79a9d2962009-08-06 21:10:58477 Apt::Architecture "i386";
478 Dir::Cache "${tmp}/cache";
479 Dir::Cache::Archives "${tmp}/";
480 Dir::State::Lists "${tmp}/apt/lists/";
481 Dir::State::status "${tmp}/status";
[email protected]b6e064522009-08-10 18:47:51482EOF
[email protected]1bf2ac972009-06-30 23:57:48483
[email protected]e041ed12009-03-10 16:43:01484 # Download 32bit packages
485 echo "Computing list of available 32bit packages..."
[email protected]a81e44e12010-05-17 21:16:53486 sudo apt-get -c="${tmp}/apt/apt.conf" update
[email protected]e041ed12009-03-10 16:43:01487
488 echo "Downloading available 32bit packages..."
[email protected]a81e44e12010-05-17 21:16:53489 sudo apt-get -c="${tmp}/apt/apt.conf" \
490 --yes --download-only --force-yes --reinstall install \
[email protected]e041ed12009-03-10 16:43:01491 ${lib_list} ${dbg_list}
492
493 # Open packages, remove everything that is not a library, move the
494 # library to a lib32 directory and package everything as a *.deb file.
495 echo "Repackaging and installing 32bit packages for use on 64bit systems..."
496 for i in ${lib_list} ${dbg_list}; do
497 orig="$(echo "${tmp}/${i}"_*_i386.deb)"
498 compat="$(echo "${orig}" |
499 sed -e 's,\(_[^_/]*_\)i386\(.deb\),-ia32\1amd64\2,')"
500 rm -rf "${tmp}/staging"
501 msg="$(fakeroot -u sh -exc '
502 # Unpack 32bit Debian archive
503 umask 022
504 mkdir -p "'"${tmp}"'/staging/dpkg/DEBIAN"
505 cd "'"${tmp}"'/staging"
506 ar x "'${orig}'"
[email protected]55d1d7532013-03-19 03:06:45507 tar Cfx dpkg data.tar*
[email protected]e041ed12009-03-10 16:43:01508 tar zCfx dpkg/DEBIAN control.tar.gz
509
[email protected]34799f9d2010-07-08 17:51:33510 # Create a posix extended regular expression fragment that will
511 # recognize the includes which have changed. Should be rare,
512 # will almost always be empty.
513 includes=`sed -n -e "s/^[0-9a-z]* //g" \
514 -e "\,usr/include/,p" dpkg/DEBIAN/md5sums |
515 xargs -n 1 -I FILE /bin/sh -c \
516 "cmp -s dpkg/FILE /FILE || echo FILE" |
517 tr "\n" "|" |
518 sed -e "s,|$,,"`
[email protected]e041ed12009-03-10 16:43:01519
[email protected]34799f9d2010-07-08 17:51:33520 # If empty, set it to not match anything.
521 test -z "$includes" && includes="^//"
522
523 # Turn the conflicts into an extended RE for removal from the
524 # Provides line.
525 conflicts=`sed -n -e "/Conflicts/s/Conflicts: *//;T;s/, */|/g;p" \
526 dpkg/DEBIAN/control`
527
528 # Rename package, change architecture, remove conflicts and dependencies
529 sed -r -i \
530 -e "/Package/s/$/-ia32/" \
531 -e "/Architecture/s/:.*$/: amd64/" \
532 -e "/Depends/s/:.*/: ia32-libs/" \
533 -e "/Provides/s/($conflicts)(, *)?//g;T1;s/, *$//;:1" \
534 -e "/Recommends/d" \
535 -e "/Conflicts/d" \
536 dpkg/DEBIAN/control
537
538 # Only keep files that live in "lib" directories or the includes
539 # that have changed.
540 sed -r -i \
541 -e "/\/lib64\//d" -e "/\/.?bin\//d" \
542 -e "\,$includes,s,[ /]include/,&32/,g;s,include/32/,include32/,g" \
543 -e "s, lib/, lib32/,g" \
544 -e "s,/lib/,/lib32/,g" \
545 -e "t;d" \
546 -e "\,^/usr/lib32/debug\(.*/lib32\),s,^/usr/lib32/debug,/usr/lib/debug," \
547 dpkg/DEBIAN/md5sums
[email protected]e041ed12009-03-10 16:43:01548
549 # Re-run ldconfig after installation/removal
550 { echo "#!/bin/sh"; echo "[ \"x\$1\" = xconfigure ]&&ldconfig||:"; } \
551 >dpkg/DEBIAN/postinst
552 { echo "#!/bin/sh"; echo "[ \"x\$1\" = xremove ]&&ldconfig||:"; } \
553 >dpkg/DEBIAN/postrm
554 chmod 755 dpkg/DEBIAN/postinst dpkg/DEBIAN/postrm
555
556 # Remove any other control files
557 find dpkg/DEBIAN -mindepth 1 "(" -name control -o -name md5sums -o \
558 -name postinst -o -name postrm ")" -o -print |
559 xargs -r rm -rf
560
[email protected]34799f9d2010-07-08 17:51:33561 # Remove any files/dirs that live outside of "lib" directories,
562 # or are not in our list of changed includes.
563 find dpkg -mindepth 1 -regextype posix-extended \
564 "(" -name DEBIAN -o -name lib -o -regex "dpkg/($includes)" ")" \
565 -prune -o -print | tac |
566 xargs -r -n 1 sh -c "rm \$0 2>/dev/null || rmdir \$0 2>/dev/null || : "
[email protected]e041ed12009-03-10 16:43:01567 find dpkg -name lib64 -o -name bin -o -name "?bin" |
568 tac | xargs -r rm -rf
569
[email protected]34799f9d2010-07-08 17:51:33570 # Remove any symbolic links that were broken by the above steps.
571 find -L dpkg -type l -print | tac | xargs -r rm -rf
572
[email protected]e041ed12009-03-10 16:43:01573 # Rename lib to lib32, but keep debug symbols in /usr/lib/debug/usr/lib32
574 # That is where gdb looks for them.
575 find dpkg -type d -o -path "*/lib/*" -print |
576 xargs -r -n 1 sh -c "
577 i=\$(echo \"\${0}\" |
578 sed -e s,/lib/,/lib32/,g \
579 -e s,/usr/lib32/debug\\\\\(.*/lib32\\\\\),/usr/lib/debug\\\\1,);
580 mkdir -p \"\${i%/*}\";
581 mv \"\${0}\" \"\${i}\""
582
[email protected]34799f9d2010-07-08 17:51:33583 # Rename include to include32.
584 [ -d "dpkg/usr/include" ] && mv "dpkg/usr/include" "dpkg/usr/include32"
585
[email protected]e041ed12009-03-10 16:43:01586 # Prune any empty directories
587 find dpkg -type d | tac | xargs -r -n 1 rmdir 2>/dev/null || :
588
589 # Create our own Debian package
590 cd ..
591 dpkg --build staging/dpkg .' 2>&1)"
592 compat="$(eval echo $(echo "${compat}" |
593 sed -e 's,_[^_/]*_amd64.deb,_*_amd64.deb,'))"
594 [ -r "${compat}" ] || {
595 echo "${msg}" >&2
596 echo "Failed to build new Debian archive!" >&2
597 exit 1
598 }
599
600 msg="$(sudo dpkg -i "${compat}" 2>&1)" && {
601 echo "Installed ${compat##*/}"
602 } || {
603 # echo "${msg}" >&2
604 echo "Skipped ${compat##*/}"
605 }
606 done
607
608 # Add symbolic links for developing 32bit code
609 echo "Adding missing symbolic links, enabling 32bit code development..."
610 for i in $(find /lib32 /usr/lib32 -maxdepth 1 -name \*.so.\* |
611 sed -e 's/[.]so[.][0-9].*/.so/' |
612 sort -u); do
613 [ "x${i##*/}" = "xld-linux.so" ] && continue
614 [ -r "$i" ] && continue
615 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' |
616 sort -n | tail -n 1)"
617 [ -r "$i.$j" ] || continue
618 sudo ln -s "${i##*/}.$j" "$i"
619 done
620fi