OLD | NEW |
1 #!/bin/bash -e | 1 #!/bin/bash -e |
2 | 2 |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Script to install everything needed to build chromium on android that | 7 # Script to install everything needed to build chromium on android that |
8 # requires sudo privileges. | 8 # requires sudo privileges. |
9 # See http://code.google.com/p/chromium/wiki/AndroidBuildInstructions | 9 # See http://code.google.com/p/chromium/wiki/AndroidBuildInstructions |
10 | 10 |
11 # This script installs the sun-java6 packages (bin, jre and jdk). Sun requires | 11 # 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 | 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. | 13 # past the curses-based dialog press TAB <ret> TAB <ret> to agree. |
14 | 14 |
| 15 args="$@" |
| 16 if test "$1" = "--skip-sdk-packages"; then |
| 17 skip_inst_sdk_packages=1 |
| 18 args="${@:2}" |
| 19 else |
| 20 skip_inst_sdk_packages=0 |
| 21 fi |
| 22 |
15 if ! uname -m | egrep -q "i686|x86_64"; then | 23 if ! uname -m | egrep -q "i686|x86_64"; then |
16 echo "Only x86 architectures are currently supported" >&2 | 24 echo "Only x86 architectures are currently supported" >&2 |
17 exit | 25 exit |
18 fi | 26 fi |
19 | 27 |
20 # Install first the default Linux build deps. | 28 # Install first the default Linux build deps. |
21 "$(dirname "${BASH_SOURCE[0]}")/install-build-deps.sh" \ | 29 "$(dirname "${BASH_SOURCE[0]}")/install-build-deps.sh" \ |
22 --no-syms --lib32 --no-arm --no-chromeos-fonts --no-nacl --no-prompt "$@" | 30 --no-syms --lib32 --no-arm --no-chromeos-fonts --no-nacl --no-prompt "${args}" |
23 | 31 |
24 lsb_release=$(lsb_release --codename --short) | 32 lsb_release=$(lsb_release --codename --short) |
25 | 33 |
26 # The temporary directory used to store output of update-java-alternatives | 34 # The temporary directory used to store output of update-java-alternatives |
27 TEMPDIR=$(mktemp -d) | 35 TEMPDIR=$(mktemp -d) |
28 cleanup() { | 36 cleanup() { |
29 local status=${?} | 37 local status=${?} |
30 trap - EXIT | 38 trap - EXIT |
31 rm -rf "${TEMPDIR}" | 39 rm -rf "${TEMPDIR}" |
32 exit ${status} | 40 exit ${status} |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 if grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out \ | 85 if grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out \ |
78 >& /dev/null | 86 >& /dev/null |
79 then | 87 then |
80 # If there are non-javaplugin.so errors, treat as errors and exit | 88 # If there are non-javaplugin.so errors, treat as errors and exit |
81 echo 'ERRORS: Failed to update alternatives for java-6-sun:' | 89 echo 'ERRORS: Failed to update alternatives for java-6-sun:' |
82 grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out | 90 grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out |
83 exit 1 | 91 exit 1 |
84 fi | 92 fi |
85 fi | 93 fi |
86 | 94 |
87 # Get the SDK extras packages to install from the DEPS file 'sdkextras' hook. | 95 if test "$skip_inst_sdk_packages" != 1; then |
88 packages="$(python -c 'execfile("./get_sdk_extras_packages.py")')" | 96 echo 'checking for sdk packages install' |
89 for package in "${packages}"; do | 97 # Get the SDK extras packages to install from the DEPS file 'sdkextras' hook. |
90 package_num=$(../third_party/android_tools/sdk/tools/android list sdk | \ | 98 packages="$(python -c 'execfile("./get_sdk_extras_packages.py")')" |
91 grep -i "$package," | \ | 99 # Use absolute path to call 'android' so script can be run from any directory. |
92 awk '/^[ ]*[0-9]*- / {gsub("-",""); print $1}') | 100 cwd=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) |
93 if [[ -n ${package_num} ]]; then | 101 for package in "${packages}"; do |
94 ../third_party/android_tools/sdk/tools/android update sdk --no-ui --filter \ | 102 pkg_id=$(${cwd}/../third_party/android_tools/sdk/tools/android list sdk | \ |
95 ${package_num} | 103 grep -i "$package," | \ |
96 fi | 104 awk '/^[ ]*[0-9]*- / {gsub("-",""); print $1}') |
97 done | 105 if [[ -n ${pkg_id} ]]; then |
| 106 ${cwd}/../third_party/android_tools/sdk/tools/android update sdk --no-ui \ |
| 107 --filter ${pkg_id} |
| 108 fi |
| 109 done |
| 110 fi |
98 | 111 |
99 echo "install-build-deps-android.sh complete." | 112 echo "install-build-deps-android.sh complete." |
OLD | NEW |