blob: cf873811131633b68525736780ac0dcc3e0b8ff6 [file] [log] [blame]
[email protected]c4fabbc32012-03-07 02:22:181#!/bin/bash -e
[email protected]9f95fb92011-10-06 18:19:302
[email protected]2a89cd92012-02-18 01:58:433# Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]9f95fb92011-10-06 18:19:304# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
lisandropaeae0b72015-02-10 21:39:317# Script to install everything needed to build chromium on android, including
8# items requiring sudo privileges.
[email protected]c4fabbc32012-03-07 02:22:189# See http://code.google.com/p/chromium/wiki/AndroidBuildInstructions
[email protected]9f95fb92011-10-06 18:19:3010
[email protected]4ba8681e2012-03-14 07:23:3011# This script installs the sun-java6 packages (bin, jre and jdk). Sun requires
12# a license agreement, so upon installation it will prompt the user. To get
13# past the curses-based dialog press TAB <ret> TAB <ret> to agree.
[email protected]9f95fb92011-10-06 18:19:3014
navabi654f3952015-01-20 23:43:0715args="$@"
16if test "$1" = "--skip-sdk-packages"; then
17 skip_inst_sdk_packages=1
18 args="${@:2}"
19else
20 skip_inst_sdk_packages=0
21fi
22
[email protected]c4fabbc32012-03-07 02:22:1823if ! uname -m | egrep -q "i686|x86_64"; then
24 echo "Only x86 architectures are currently supported" >&2
25 exit
26fi
[email protected]9f95fb92011-10-06 18:19:3027
[email protected]9e5f7282014-04-03 21:40:1928# Install first the default Linux build deps.
29"$(dirname "${BASH_SOURCE[0]}")/install-build-deps.sh" \
navabi654f3952015-01-20 23:43:0730 --no-syms --lib32 --no-arm --no-chromeos-fonts --no-nacl --no-prompt "${args}"
johnme49bb458a2014-11-27 15:45:3131
32lsb_release=$(lsb_release --codename --short)
[email protected]c4fabbc32012-03-07 02:22:1833
[email protected]4ba8681e2012-03-14 07:23:3034# The temporary directory used to store output of update-java-alternatives
[email protected]9f95fb92011-10-06 18:19:3035TEMPDIR=$(mktemp -d)
36cleanup() {
37 local status=${?}
38 trap - EXIT
39 rm -rf "${TEMPDIR}"
40 exit ${status}
41}
42trap cleanup EXIT
43
[email protected]4ba8681e2012-03-14 07:23:3044# Fix deps
45sudo apt-get -f install
[email protected]9f95fb92011-10-06 18:19:3046
[email protected]959a0f5c2012-06-22 23:58:5847# Install deps
[email protected]457088f22012-09-26 21:47:0748# This step differs depending on what Ubuntu release we are running
49# on since the package names are different, and Sun's Java must
50# be installed manually on late-model versions.
[email protected]9f95fb92011-10-06 18:19:3051
[email protected]758d77082014-01-08 00:05:1952# common
[email protected]5b97a1c2014-08-12 23:40:5753sudo apt-get -y install lighttpd python-pexpect xvfb x11-utils
[email protected]9f95fb92011-10-06 18:19:3054
johnme49bb458a2014-11-27 15:45:3155# Some binaries in the Android SDK require 32-bit libraries on the host.
56# See https://developer.android.com/sdk/installing/index.html?pkg=tools
57if [[ $lsb_release == "precise" ]]; then
58 sudo apt-get -y install ia32-libs
59else
60 sudo apt-get -y install libncurses5:i386 libstdc++6:i386 zlib1g:i386
61fi
[email protected]36cd20a2014-08-19 20:10:0662
[email protected]be8234b2014-05-28 00:20:2663sudo apt-get -y install ant
[email protected]457088f22012-09-26 21:47:0764
[email protected]850c0092014-05-23 09:42:3765# Install openjdk and openjre 7 stuff
66sudo apt-get -y install openjdk-7-jre openjdk-7-jdk
[email protected]457088f22012-09-26 21:47:0767
[email protected]850c0092014-05-23 09:42:3768# Switch version of Java to openjdk 7.
69# Some Java plugins (e.g. for firefox, mozilla) are not required to build, and
70# thus are treated only as warnings. Any errors in updating java alternatives
71# which are not '*-javaplugin.so' will cause errors and stop the script from
72# completing successfully.
73if ! sudo update-java-alternatives -s java-1.7.0-openjdk-amd64 \
74 >& "${TEMPDIR}"/update-java-alternatives.out
75then
76 # Check that there are the expected javaplugin.so errors for the update
77 if grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out >& \
78 /dev/null
[email protected]4ba8681e2012-03-14 07:23:3079 then
[email protected]850c0092014-05-23 09:42:3780 # Print as warnings all the javaplugin.so errors
81 echo 'WARNING: java-6-sun has no alternatives for the following plugins:'
82 grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out
83 fi
84 # Check if there are any errors that are not javaplugin.so
85 if grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out \
86 >& /dev/null
87 then
88 # If there are non-javaplugin.so errors, treat as errors and exit
89 echo 'ERRORS: Failed to update alternatives for java-6-sun:'
90 grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out
91 exit 1
[email protected]4ba8681e2012-03-14 07:23:3092 fi
93fi
94
lisandropaeae0b72015-02-10 21:39:3195# Install SDK packages for android
navabi654f3952015-01-20 23:43:0796if test "$skip_inst_sdk_packages" != 1; then
lisandropaeae0b72015-02-10 21:39:3197 "$(dirname "${BASH_SOURCE[0]}")/install-android-sdks.sh"
navabi654f3952015-01-20 23:43:0798fi
navabicc789e82015-01-09 20:06:5699
[email protected]c4fabbc32012-03-07 02:22:18100echo "install-build-deps-android.sh complete."