1#!/bin/sh 2# 3# Copyright (C) 2010 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 18# Rebuild all prebuilts. This requires that you have a toolchain source tree 19# 20 21. `dirname $0`/prebuilt-common.sh 22PROGDIR=`dirname $0` 23 24NDK_DIR=$ANDROID_NDK_ROOT 25register_var_option "--ndk-dir=<path>" NDK_DIR "Put binaries into NDK install directory" 26 27BUILD_DIR=/tmp/ndk-$USER/build 28register_var_option "--build-dir=<path>" BUILD_DIR "Specify temporary build directory" 29 30ARCHS=$DEFAULT_ARCHS 31register_var_option "--arch=<arch>" ARCHS "Specify target architectures" 32 33SYSTEMS=$HOST_TAG32 34if [ "$HOST_TAG32" = "linux-x86" ]; then 35 SYSTEMS=$SYSTEMS",windows" 36fi 37CUSTOM_SYSTEMS= 38register_option "--systems=<list>" do_SYSTEMS "Specify host systems" 39do_SYSTEMS () { CUSTOM_SYSTEMS=true; SYSTEMS=$1; } 40 41RELEASE=`date +%Y%m%d` 42PACKAGE_DIR=/tmp/ndk-$USER/prebuilt-$RELEASE 43register_var_option "--package-dir=<path>" PACKAGE_DIR "Put prebuilt tarballs into <path>." 44 45DARWIN_SSH= 46if [ "$HOST_OS" = "linux" ] ; then 47register_var_option "--darwin-ssh=<hostname>" DARWIN_SSH "Specify Darwin hostname for remote build." 48fi 49 50register_try64_option 51 52PROGRAM_PARAMETERS="<toolchain-src-dir>" 53PROGRAM_DESCRIPTION=\ 54"This script is used to rebuild all host and target prebuilts from scratch. 55You will need to give the path of a toolchain source directory, one which 56is typically created with the download-toolchain-sources.sh script. 57 58Unless you use the --ndk-dir option, all binaries will be installed to the 59current NDK directory. 60 61All prebuilts will then be archived into tarball that will be stored into a 62specific 'package directory'. Unless you use the --package-dir option, this 63will be: $PACKAGE_DIR 64 65Please read docs/DEV-SCRIPTS-USAGE.TXT for more usage information about this 66script. 67" 68 69extract_parameters "$@" 70 71SRC_DIR="$PARAMETERS" 72check_toolchain_src_dir "$SRC_DIR" 73 74if [ "$DARWIN_SSH" -a -z "$CUSTOM_SYSTEMS" ]; then 75 SYSTEMS=$SYSTEMS",darwin-x86" 76fi 77 78FLAGS= 79if [ "$VERBOSE" = "yes" ]; then 80 FLAGS=$FLAGS" --verbose" 81fi 82if [ "$VERBOSE2" = "yes" ]; then 83 FLAGS=$FLAGS" --verbose" 84fi 85FLAGS=$FLAGS" --ndk-dir=$NDK_DIR" 86FLAGS=$FLAGS" --package-dir=$PACKAGE_DIR" 87FLAGS=$FLAGS" --arch=$(spaces_to_commas $ARCHS)" 88 89HOST_FLAGS=$FLAGS" --systems=$(spaces_to_commas $SYSTEMS)" 90if [ "$TRY64" = "yes" ]; then 91 HOST_FLAG=$HOST_FLAGS" --try-64" 92fi 93if [ "$DARWIN_SSH" ]; then 94 HOST_FLAGS=$HOST_FLAGS" --darwin-ssh=$DARWIN_SSH" 95fi 96 97$PROGDIR/build-host-prebuilts.sh $HOST_FLAGS "$SRC_DIR" 98fail_panic "Could not build host prebuilts!" 99 100TARGET_FLAGS=$FLAGS 101 102$PROGDIR/build-target-prebuilts.sh $TARGET_FLAGS "$SRC_DIR" 103fail_panic "Could not build target prebuilts!" 104 105echo "Done, see $PACKAGE_DIR:" 106ls -l $PACKAGE_DIR 107 108exit 0 109