• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2#
3# Copyright (C) 2011 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#      http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17# Rebuild all target-specific prebuilts
18#
19
20PROGDIR=$(dirname $0)
21. $PROGDIR/prebuilt-common.sh
22
23NDK_DIR=$ANDROID_NDK_ROOT
24register_var_option "--ndk-dir=<path>" NDK_DIR "NDK installation directory"
25
26ARCHS=$DEFAULT_ARCHS
27register_var_option "--arch=<list>" ARCHS "List of target archs to build for"
28
29PACKAGE_DIR=
30register_var_option "--package-dir=<path>" PACKAGE_DIR "Package toolchain into this directory"
31
32register_jobs_option
33
34PROGRAM_PARAMETERS="<toolchain-src-dir>"
35PROGRAM_DESCRIPTION=\
36"This script can be used to rebuild all the target NDK prebuilts at once.
37You need to give it the path to the toolchain source directory, as
38downloaded by the 'download-toolchain-sources.sh' dev-script."
39
40extract_parameters "$@"
41
42# Check toolchain source path
43SRC_DIR="$PARAMETERS"
44check_toolchain_src_dir "$SRC_DIR"
45
46# Now we can do the build
47BUILDTOOLS=$ANDROID_NDK_ROOT/build/tools
48
49dump "Building platforms and samples..."
50PACKAGE_FLAGS=
51if [ "$PACKAGE_DIR" ]; then
52    PACKAGE_FLAGS="--package-dir=$PACKAGE_DIR"
53fi
54
55run $BUILDTOOLS/gen-platforms.sh --samples --fast-copy --dst-dir=$NDK_DIR --ndk-dir=$NDK_DIR --arch=$(spaces_to_commas $ARCHS) $PACKAGE_FLAGS
56fail_panic "Could not generate platforms and samples directores!"
57
58ARCHS=$(commas_to_spaces $ARCHS)
59
60FLAGS=
61if [ "$VERBOSE" = "yes" ]; then
62    FLAGS=$FLAGS" --verbose"
63fi
64if [ "$VERBOSE2" = "yes" ]; then
65    FLAGS=$FLAGS" --verbose"
66fi
67if [ "$PACKAGE_DIR" ]; then
68    mkdir -p "$PACKAGE_DIR"
69    fail_panic "Could not create package directory: $PACKAGE_DIR"
70    FLAGS=$FLAGS" --package-dir=\"$PACKAGE_DIR\""
71fi
72FLAGS=$FLAGS" -j$NUM_JOBS"
73
74# First, gdbserver
75for ARCH in $ARCHS; do
76    GDB_TOOLCHAINS=$(get_default_toolchain_name_for_arch $ARCH)
77    for GDB_TOOLCHAIN in $GDB_TOOLCHAINS; do
78        dump "Building $GDB_TOOLCHAIN gdbserver binaries..."
79        run $BUILDTOOLS/build-gdbserver.sh "$SRC_DIR" "$NDK_DIR" "$GDB_TOOLCHAIN" $FLAGS
80        fail_panic "Could not build $GDB_TOOLCHAIN gdb-server!"
81    done
82done
83
84FLAGS=$FLAGS" --ndk-dir=\"$NDK_DIR\""
85ABIS=$(convert_archs_to_abis $ARCHS)
86
87FLAGS=$FLAGS" --abis=$ABIS"
88dump "Building $ABIS gabi++ binaries..."
89run $BUILDTOOLS/build-gabi++.sh $FLAGS
90fail_panic "Could not build gabi++!"
91
92dump "Building $ABIS stlport binaries..."
93run $BUILDTOOLS/build-stlport.sh $FLAGS
94fail_panic "Could not build stlport!"
95
96dump "Building $ABIS gnustl binaries..."
97run $BUILDTOOLS/build-gnu-libstdc++.sh $FLAGS "$SRC_DIR"
98fail_panic "Could not build gnustl!"
99
100if [ "$PACKAGE_DIR" ]; then
101    dump "Done, see $PACKAGE_DIR"
102else
103    dump "Done"
104fi
105
106exit 0
107