blob: 8077e8eacba1c1b376a0749443f6aa0f8ea0a163 [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
[email protected]c4fabbc32012-03-07 02:22:187# Script to install everything needed to build chromium on android that
8# requires sudo privileges.
9# See http://code.google.com/p/chromium/wiki/AndroidBuildInstructions
[email protected]9f95fb92011-10-06 18:19:3010
[email protected]c4fabbc32012-03-07 02:22:1811DOWNLOAD_URL="http://ftp.us.debian.org/debian/pool/non-free/s/sun-java6"
[email protected]9f95fb92011-10-06 18:19:3012
[email protected]c4fabbc32012-03-07 02:22:1813BIN_FILE_NAME="sun-java6-bin_6.26-0squeeze1_amd64.deb"
14JRE_FILE_NAME="sun-java6-jre_6.26-0squeeze1_all.deb"
15JDK_FILE_NAME="sun-java6-jdk_6.26-0squeeze1_amd64.deb"
[email protected]9f95fb92011-10-06 18:19:3016
[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
[email protected]c4fabbc32012-03-07 02:22:1822if [ "x$(id -u)" != x0 ]; then
23 echo "Running as non-root user."
24 echo "You might have to enter your password one or more times for 'sudo'."
25 echo
26fi
27
28sudo apt-get update
[email protected]9f95fb92011-10-06 18:19:3029
30# The temporary directory used to store the downloaded file.
31TEMPDIR=$(mktemp -d)
32cleanup() {
33 local status=${?}
34 trap - EXIT
35 rm -rf "${TEMPDIR}"
36 exit ${status}
37}
38trap cleanup EXIT
39
40##########################################################
[email protected]c4fabbc32012-03-07 02:22:1841# Download (i.e. wget) and install debian package.
[email protected]9f95fb92011-10-06 18:19:3042# The current directory is changed in this function.
43# Arguments:
[email protected]c4fabbc32012-03-07 02:22:1844# file_name
[email protected]9f95fb92011-10-06 18:19:3045# Returns:
46# None
47##########################################################
[email protected]c4fabbc32012-03-07 02:22:1848install_deb_pkg() {
49 local file_name="${1}"
50 local download_url="${DOWNLOAD_URL}/${file_name}"
[email protected]9f95fb92011-10-06 18:19:3051
52 cd "${TEMPDIR}"
53 wget "${download_url}"
54
[email protected]c4fabbc32012-03-07 02:22:1855 echo "Install ${file_name}"
56 sudo dpkg -i "${file_name}"
[email protected]9f95fb92011-10-06 18:19:3057}
58
[email protected]9f95fb92011-10-06 18:19:3059
[email protected]c4fabbc32012-03-07 02:22:1860# Install ant
61sudo apt-get install python-pexpect ant
[email protected]9f95fb92011-10-06 18:19:3062
[email protected]c4fabbc32012-03-07 02:22:1863# Install sun-java6-bin
64install_deb_pkg "${BIN_FILE_NAME}"
[email protected]9f95fb92011-10-06 18:19:3065
[email protected]c4fabbc32012-03-07 02:22:1866# Install sun-java6-jre
67install_deb_pkg "${JRE_FILE_NAME}"
[email protected]58b0fd672011-11-01 23:25:4768
[email protected]c4fabbc32012-03-07 02:22:1869# Install sun-java6-jdk
70install_deb_pkg "${JDK_FILE_NAME}"
[email protected]9f95fb92011-10-06 18:19:3071
[email protected]c4fabbc32012-03-07 02:22:1872# Switch version of Java to java-6-sun
73sudo update-java-alternatives -s java-6-sun
[email protected]9f95fb92011-10-06 18:19:3074
[email protected]c4fabbc32012-03-07 02:22:1875echo "install-build-deps-android.sh complete."