blob: 9c3692c7d127df6de7ec1d15669f0e2f5e6bd260 [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="$@"
dgnebe5d99c2015-11-06 15:28:5116
17# TODO(dgn) remove this this argument from calls (http://crbug.com/541727)
navabi654f3952015-01-20 23:43:0718if test "$1" = "--skip-sdk-packages"; then
navabi654f3952015-01-20 23:43:0719 args="${@:2}"
navabi654f3952015-01-20 23:43:0720fi
21
[email protected]c4fabbc32012-03-07 02:22:1822if ! uname -m | egrep -q "i686|x86_64"; then
23 echo "Only x86 architectures are currently supported" >&2
24 exit
25fi
[email protected]9f95fb92011-10-06 18:19:3026
[email protected]9e5f7282014-04-03 21:40:1927# Install first the default Linux build deps.
28"$(dirname "${BASH_SOURCE[0]}")/install-build-deps.sh" \
navabi654f3952015-01-20 23:43:0729 --no-syms --lib32 --no-arm --no-chromeos-fonts --no-nacl --no-prompt "${args}"
johnme49bb458a2014-11-27 15:45:3130
31lsb_release=$(lsb_release --codename --short)
[email protected]c4fabbc32012-03-07 02:22:1832
[email protected]4ba8681e2012-03-14 07:23:3033# The temporary directory used to store output of update-java-alternatives
[email protected]9f95fb92011-10-06 18:19:3034TEMPDIR=$(mktemp -d)
35cleanup() {
36 local status=${?}
37 trap - EXIT
38 rm -rf "${TEMPDIR}"
39 exit ${status}
40}
41trap cleanup EXIT
42
[email protected]4ba8681e2012-03-14 07:23:3043# Fix deps
44sudo apt-get -f install
[email protected]9f95fb92011-10-06 18:19:3045
[email protected]959a0f5c2012-06-22 23:58:5846# Install deps
[email protected]457088f22012-09-26 21:47:0747# This step differs depending on what Ubuntu release we are running
48# on since the package names are different, and Sun's Java must
49# be installed manually on late-model versions.
[email protected]9f95fb92011-10-06 18:19:3050
[email protected]758d77082014-01-08 00:05:1951# common
[email protected]5b97a1c2014-08-12 23:40:5752sudo apt-get -y install lighttpd python-pexpect xvfb x11-utils
[email protected]9f95fb92011-10-06 18:19:3053
johnme49bb458a2014-11-27 15:45:3154# Some binaries in the Android SDK require 32-bit libraries on the host.
55# See https://developer.android.com/sdk/installing/index.html?pkg=tools
56if [[ $lsb_release == "precise" ]]; then
57 sudo apt-get -y install ia32-libs
58else
59 sudo apt-get -y install libncurses5:i386 libstdc++6:i386 zlib1g:i386
60fi
[email protected]36cd20a2014-08-19 20:10:0661
[email protected]be8234b2014-05-28 00:20:2662sudo apt-get -y install ant
[email protected]457088f22012-09-26 21:47:0763
[email protected]850c0092014-05-23 09:42:3764# Install openjdk and openjre 7 stuff
65sudo apt-get -y install openjdk-7-jre openjdk-7-jdk
[email protected]457088f22012-09-26 21:47:0766
[email protected]850c0092014-05-23 09:42:3767# Switch version of Java to openjdk 7.
68# Some Java plugins (e.g. for firefox, mozilla) are not required to build, and
69# thus are treated only as warnings. Any errors in updating java alternatives
70# which are not '*-javaplugin.so' will cause errors and stop the script from
71# completing successfully.
72if ! sudo update-java-alternatives -s java-1.7.0-openjdk-amd64 \
73 >& "${TEMPDIR}"/update-java-alternatives.out
74then
75 # Check that there are the expected javaplugin.so errors for the update
76 if grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out >& \
77 /dev/null
[email protected]4ba8681e2012-03-14 07:23:3078 then
[email protected]850c0092014-05-23 09:42:3779 # Print as warnings all the javaplugin.so errors
80 echo 'WARNING: java-6-sun has no alternatives for the following plugins:'
81 grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out
82 fi
83 # Check if there are any errors that are not javaplugin.so
84 if grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out \
85 >& /dev/null
86 then
87 # If there are non-javaplugin.so errors, treat as errors and exit
88 echo 'ERRORS: Failed to update alternatives for java-6-sun:'
89 grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out
90 exit 1
[email protected]4ba8681e2012-03-14 07:23:3091 fi
92fi
93
[email protected]c4fabbc32012-03-07 02:22:1894echo "install-build-deps-android.sh complete."