2017-03-08 18:44:31 +03:00
|
|
|
#!/bin/bash
|
2011-10-06 22:19:30 +04:00
|
|
|
|
2012-02-18 05:58:43 +04:00
|
|
|
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
2011-10-06 22:19:30 +04:00
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
2015-02-11 00:39:31 +03:00
|
|
|
# Script to install everything needed to build chromium on android, including
|
|
|
|
# items requiring sudo privileges.
|
2016-02-09 02:27:20 +03:00
|
|
|
# See https://www.chromium.org/developers/how-tos/android-build-instructions
|
2012-03-07 06:22:18 +04:00
|
|
|
|
2015-01-21 02:43:07 +03:00
|
|
|
args="$@"
|
2015-11-06 18:28:51 +03:00
|
|
|
|
2012-03-07 06:22:18 +04:00
|
|
|
if ! uname -m | egrep -q "i686|x86_64"; then
|
|
|
|
echo "Only x86 architectures are currently supported" >&2
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2017-03-08 18:44:31 +03:00
|
|
|
# Exit if any commands fail.
|
|
|
|
set -e
|
2016-04-28 03:32:26 +03:00
|
|
|
|
2017-03-08 18:44:31 +03:00
|
|
|
lsb_release=$(lsb_release --codename --short)
|
2016-04-28 03:32:26 +03:00
|
|
|
|
2014-04-04 01:40:19 +04:00
|
|
|
# Install first the default Linux build deps.
|
|
|
|
"$(dirname "${BASH_SOURCE[0]}")/install-build-deps.sh" \
|
2015-01-21 02:43:07 +03:00
|
|
|
--no-syms --lib32 --no-arm --no-chromeos-fonts --no-nacl --no-prompt "${args}"
|
2014-11-27 18:45:31 +03:00
|
|
|
|
2012-03-14 11:23:30 +04:00
|
|
|
# Fix deps
|
|
|
|
sudo apt-get -f install
|
2011-10-06 22:19:30 +04:00
|
|
|
|
2014-01-08 04:05:19 +04:00
|
|
|
# common
|
2016-12-08 09:58:50 +03:00
|
|
|
sudo apt-get -y install lib32z1 lighttpd python-pexpect xvfb x11-utils
|
2012-09-27 01:47:07 +04:00
|
|
|
|
2014-11-27 18:45:31 +03:00
|
|
|
# Some binaries in the Android SDK require 32-bit libraries on the host.
|
|
|
|
# See https://developer.android.com/sdk/installing/index.html?pkg=tools
|
2017-04-07 19:20:20 +03:00
|
|
|
sudo apt-get -y install libncurses5:i386 libstdc++6:i386 zlib1g:i386
|
2014-08-20 00:10:06 +04:00
|
|
|
|
2017-03-08 18:44:31 +03:00
|
|
|
# Required by //components/cronet/tools/generate_javadoc.py
|
|
|
|
# TODO(375324): Stop requiring ANT.
|
2014-05-28 04:20:26 +04:00
|
|
|
sudo apt-get -y install ant
|
2014-05-23 13:42:37 +04:00
|
|
|
|
2017-03-01 18:21:44 +03:00
|
|
|
# Required for apk-patch-size-estimator
|
|
|
|
sudo apt-get -y install bsdiff
|
|
|
|
|
2017-03-08 18:44:31 +03:00
|
|
|
# Do our own error handling for java.
|
|
|
|
set +e
|
|
|
|
|
|
|
|
function IsJava8() {
|
|
|
|
# Arg is either "java" or "javac"
|
|
|
|
$1 -version 2>&1 | grep -q '1\.8'
|
|
|
|
}
|
|
|
|
|
|
|
|
if ! (IsJava8 java && IsJava8 javac); then
|
|
|
|
sudo apt-get -y install openjdk-8-jre openjdk-8-jdk
|
|
|
|
fi
|
|
|
|
|
|
|
|
# There can be several reasons why java8 is not default despite being installed.
|
|
|
|
# Just show an error and exit.
|
|
|
|
if ! (IsJava8 java && IsJava8 javac); then
|
|
|
|
echo
|
|
|
|
echo "Automatic java installation failed."
|
|
|
|
echo '`java -version` reports:'
|
|
|
|
java -version
|
|
|
|
echo
|
|
|
|
echo '`javac -version` reports:'
|
|
|
|
javac -version
|
|
|
|
echo
|
|
|
|
echo "Please ensure that JDK 8 is installed and resolves first in your PATH."
|
|
|
|
echo -n '`which java` reports: '
|
|
|
|
which java
|
|
|
|
echo -n '`which javac` reports: '
|
|
|
|
which javac
|
|
|
|
echo
|
|
|
|
echo "You might also try running:"
|
|
|
|
echo " sudo update-java-alternatives -s java-1.8.0-openjdk-amd64"
|
|
|
|
exit 1
|
2012-03-14 11:23:30 +04:00
|
|
|
fi
|
|
|
|
|
2012-03-07 06:22:18 +04:00
|
|
|
echo "install-build-deps-android.sh complete."
|