blob: 15fea8517ed9c559fd2a211c2830db3352e889bc [file] [log] [blame]
agrieve8638ef82017-03-08 15:44:311#!/bin/bash
[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.
mostynbdf175a82016-02-08 23:27:209# See https://www.chromium.org/developers/how-tos/android-build-instructions
[email protected]9f95fb92011-10-06 18:19:3010
navabi654f3952015-01-20 23:43:0711args="$@"
dgnebe5d99c2015-11-06 15:28:5112
[email protected]c4fabbc32012-03-07 02:22:1813if ! uname -m | egrep -q "i686|x86_64"; then
14 echo "Only x86 architectures are currently supported" >&2
15 exit
16fi
[email protected]9f95fb92011-10-06 18:19:3017
agrieve8638ef82017-03-08 15:44:3118# Exit if any commands fail.
19set -e
friedman3f67f4a2016-04-28 00:32:2620
agrieve8638ef82017-03-08 15:44:3121lsb_release=$(lsb_release --codename --short)
friedman3f67f4a2016-04-28 00:32:2622
[email protected]9e5f7282014-04-03 21:40:1923# Install first the default Linux build deps.
24"$(dirname "${BASH_SOURCE[0]}")/install-build-deps.sh" \
navabi654f3952015-01-20 23:43:0725 --no-syms --lib32 --no-arm --no-chromeos-fonts --no-nacl --no-prompt "${args}"
johnme49bb458a2014-11-27 15:45:3126
[email protected]4ba8681e2012-03-14 07:23:3027# Fix deps
28sudo apt-get -f install
[email protected]9f95fb92011-10-06 18:19:3029
[email protected]758d77082014-01-08 00:05:1930# common
thomasanderson98888af2016-12-08 06:58:5031sudo apt-get -y install lib32z1 lighttpd python-pexpect xvfb x11-utils
[email protected]9f95fb92011-10-06 18:19:3032
johnme49bb458a2014-11-27 15:45:3133# Some binaries in the Android SDK require 32-bit libraries on the host.
34# See https://developer.android.com/sdk/installing/index.html?pkg=tools
sbcbc51e8772017-04-07 16:20:2035sudo apt-get -y install libncurses5:i386 libstdc++6:i386 zlib1g:i386
[email protected]36cd20a2014-08-19 20:10:0636
estevenson4c456252017-03-01 15:21:4437# Required for apk-patch-size-estimator
38sudo apt-get -y install bsdiff
39
agrieve8638ef82017-03-08 15:44:3140# Do our own error handling for java.
41set +e
[email protected]457088f22012-09-26 21:47:0742
agrieve8638ef82017-03-08 15:44:3143function IsJava8() {
44 # Arg is either "java" or "javac"
45 $1 -version 2>&1 | grep -q '1\.8'
46}
47
48if ! (IsJava8 java && IsJava8 javac); then
49 sudo apt-get -y install openjdk-8-jre openjdk-8-jdk
50fi
51
52# There can be several reasons why java8 is not default despite being installed.
53# Just show an error and exit.
54if ! (IsJava8 java && IsJava8 javac); then
55 echo
56 echo "Automatic java installation failed."
57 echo '`java -version` reports:'
58 java -version
59 echo
60 echo '`javac -version` reports:'
61 javac -version
62 echo
63 echo "Please ensure that JDK 8 is installed and resolves first in your PATH."
64 echo -n '`which java` reports: '
65 which java
66 echo -n '`which javac` reports: '
67 which javac
68 echo
69 echo "You might also try running:"
70 echo " sudo update-java-alternatives -s java-1.8.0-openjdk-amd64"
71 exit 1
[email protected]4ba8681e2012-03-14 07:23:3072fi
73
[email protected]c4fabbc32012-03-07 02:22:1874echo "install-build-deps-android.sh complete."