blob: 0261b379a043a15142a070877c923d4bd93346f2 [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
lisandropaeae0b7c2015-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
[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
[email protected]c4fabbc32012-03-07 02:22:1817if ! uname -m | egrep -q "i686|x86_64"; then
18 echo "Only x86 architectures are currently supported" >&2
19 exit
20fi
[email protected]9f95fb92011-10-06 18:19:3021
friedman3f67f4a2016-04-28 00:32:2622lsb_release=$(lsb_release --codename --short)
23
24case $lsb_release in
25 xenial)
26 java_alternative="java-1.8.0-openjdk-amd64"
27 java_pkgs="openjdk-8-jre openjdk-8-jdk"
28 ;;
29 *)
30 java_alternative="java-1.7.0-openjdk-amd64"
31 java_pkgs="openjdk-7-jre openjdk-7-jdk"
32 ;;
33esac
34
[email protected]9e5f7282014-04-03 21:40:1935# Install first the default Linux build deps.
36"$(dirname "${BASH_SOURCE[0]}")/install-build-deps.sh" \
navabi654f3952015-01-20 23:43:0737 --no-syms --lib32 --no-arm --no-chromeos-fonts --no-nacl --no-prompt "${args}"
johnme49bb458a2014-11-27 15:45:3138
[email protected]4ba8681e2012-03-14 07:23:3039# The temporary directory used to store output of update-java-alternatives
[email protected]9f95fb92011-10-06 18:19:3040TEMPDIR=$(mktemp -d)
41cleanup() {
42 local status=${?}
43 trap - EXIT
44 rm -rf "${TEMPDIR}"
45 exit ${status}
46}
47trap cleanup EXIT
48
[email protected]4ba8681e2012-03-14 07:23:3049# Fix deps
50sudo apt-get -f install
[email protected]9f95fb92011-10-06 18:19:3051
[email protected]959a0f5c2012-06-22 23:58:5852# Install deps
[email protected]457088f22012-09-26 21:47:0753# This step differs depending on what Ubuntu release we are running
54# on since the package names are different, and Sun's Java must
55# be installed manually on late-model versions.
[email protected]9f95fb92011-10-06 18:19:3056
[email protected]758d77082014-01-08 00:05:1957# common
thomasanderson98888af2016-12-08 06:58:5058sudo apt-get -y install lib32z1 lighttpd python-pexpect xvfb x11-utils
[email protected]9f95fb92011-10-06 18:19:3059
johnme49bb458a2014-11-27 15:45:3160# Some binaries in the Android SDK require 32-bit libraries on the host.
61# See https://developer.android.com/sdk/installing/index.html?pkg=tools
62if [[ $lsb_release == "precise" ]]; then
63 sudo apt-get -y install ia32-libs
64else
65 sudo apt-get -y install libncurses5:i386 libstdc++6:i386 zlib1g:i386
66fi
[email protected]36cd20a2014-08-19 20:10:0667
[email protected]be8234b2014-05-28 00:20:2668sudo apt-get -y install ant
[email protected]457088f22012-09-26 21:47:0769
friedman3f67f4a2016-04-28 00:32:2670# Install openjdk and openjre stuff
71sudo apt-get -y install $java_pkgs
[email protected]457088f22012-09-26 21:47:0772
[email protected]850c00912014-05-23 09:42:3773# Switch version of Java to openjdk 7.
74# Some Java plugins (e.g. for firefox, mozilla) are not required to build, and
75# thus are treated only as warnings. Any errors in updating java alternatives
76# which are not '*-javaplugin.so' will cause errors and stop the script from
77# completing successfully.
friedman3f67f4a2016-04-28 00:32:2678if ! sudo update-java-alternatives -s $java_alternative \
[email protected]850c00912014-05-23 09:42:3779 >& "${TEMPDIR}"/update-java-alternatives.out
80then
81 # Check that there are the expected javaplugin.so errors for the update
82 if grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out >& \
83 /dev/null
[email protected]4ba8681e2012-03-14 07:23:3084 then
[email protected]850c00912014-05-23 09:42:3785 # Print as warnings all the javaplugin.so errors
86 echo 'WARNING: java-6-sun has no alternatives for the following plugins:'
87 grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out
88 fi
89 # Check if there are any errors that are not javaplugin.so
90 if grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out \
91 >& /dev/null
92 then
93 # If there are non-javaplugin.so errors, treat as errors and exit
94 echo 'ERRORS: Failed to update alternatives for java-6-sun:'
95 grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out
96 exit 1
[email protected]4ba8681e2012-03-14 07:23:3097 fi
98fi
99
[email protected]c4fabbc32012-03-07 02:22:18100echo "install-build-deps-android.sh complete."