chromium-src-build/install-build-deps-android.sh

79 строки
2.2 KiB
Bash
Исходник Обычный вид История

#!/bin/bash
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Script to install everything needed to build chromium on android, including
# items requiring sudo privileges.
# See https://www.chromium.org/developers/how-tos/android-build-instructions
args="$@"
if ! uname -m | egrep -q "i686|x86_64"; then
echo "Only x86 architectures are currently supported" >&2
exit
fi
# Exit if any commands fail.
set -e
lsb_release=$(lsb_release --codename --short)
# Install first the default Linux build deps.
"$(dirname "${BASH_SOURCE[0]}")/install-build-deps.sh" \
--no-syms --lib32 --no-arm --no-chromeos-fonts --no-nacl --no-prompt "${args}"
Fix g++-multilib conflict between install-build-deps scripts Currently install-build-deps-android.sh installs g++-multilib which conflicts with packages installed by install-build-deps.sh (since gcc-multilib contains a /usr/include/asm symlink and the crosscompiler packagers don't want you to accidentally include the wrong architecture's asm headers). The g++-multilib package was wrongly commented as being required for Android SDK; it turns out these requirements have changed, so I updated the libraries required for the Android SDK based on their docs. g++-4.8-multilib is however still (likely) needed, alongside linux-libc-dev:i386, for compiling the V8 snapshot. So I've consolidated those deps, and the logic for selecting them, under the --lib32 flag of install-build-deps (to avoid duplicating the code in both). I updated the `if (trusty) install g++-4.8-multilib` logic so it chooses the right version of the multilib automatically, rather than hardcoding the version needed for trusty (which will break in utopic or beyond). Finally I removed the `sudo apt-get update` in install-build-deps-android which is redundant now that we call install-build-deps which already does that. And I added `sudo dpkg --add-architecture i386` which seems to have been missing from these scripts. BUG=435056 Review URL: https://codereview.chromium.org/740963002 Cr-Original-Commit-Position: refs/heads/master@{#305991} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 49bb458a54a0e959f91ef612c79fad89e7d65c91
2014-11-27 18:45:31 +03:00
# Fix deps
sudo apt-get -f install
# common
sudo apt-get -y install lib32z1 lighttpd python-pexpect xvfb x11-utils
Fix g++-multilib conflict between install-build-deps scripts Currently install-build-deps-android.sh installs g++-multilib which conflicts with packages installed by install-build-deps.sh (since gcc-multilib contains a /usr/include/asm symlink and the crosscompiler packagers don't want you to accidentally include the wrong architecture's asm headers). The g++-multilib package was wrongly commented as being required for Android SDK; it turns out these requirements have changed, so I updated the libraries required for the Android SDK based on their docs. g++-4.8-multilib is however still (likely) needed, alongside linux-libc-dev:i386, for compiling the V8 snapshot. So I've consolidated those deps, and the logic for selecting them, under the --lib32 flag of install-build-deps (to avoid duplicating the code in both). I updated the `if (trusty) install g++-4.8-multilib` logic so it chooses the right version of the multilib automatically, rather than hardcoding the version needed for trusty (which will break in utopic or beyond). Finally I removed the `sudo apt-get update` in install-build-deps-android which is redundant now that we call install-build-deps which already does that. And I added `sudo dpkg --add-architecture i386` which seems to have been missing from these scripts. BUG=435056 Review URL: https://codereview.chromium.org/740963002 Cr-Original-Commit-Position: refs/heads/master@{#305991} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 49bb458a54a0e959f91ef612c79fad89e7d65c91
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
sudo apt-get -y install libncurses5:i386 libstdc++6:i386 zlib1g:i386
# Required by //components/cronet/tools/generate_javadoc.py
# TODO(375324): Stop requiring ANT.
sudo apt-get -y install ant
# Required for apk-patch-size-estimator
sudo apt-get -y install bsdiff
# 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
fi
echo "install-build-deps-android.sh complete."