Home | History | Annotate | Download | only in tools
      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 # dev-platform-expand-all.sh
     18 #
     19 # Call dev-platform-expand.sh for all API levels.
     20 #
     21 
     22 . `dirname $0`/prebuilt-common.sh
     23 PROGDIR=$(dirname $0)
     24 
     25 # We take by default stuff from $NDK/../development/ndk
     26 SRCDIR="$(cd $ANDROID_NDK_ROOT/../development/ndk/platforms && pwd)"
     27 register_var_option "--src-dir=<path>" SRCDIR "Source for compressed platforms"
     28 
     29 # The default destination directory is a temporary one
     30 DSTDIR=/tmp/ndk-$USER/platforms
     31 register_var_option "--dst-dir=<path>" DSTDIR "Destination directory"
     32 
     33 # Default architecture, note we can have several ones here
     34 ARCHS=$(find_ndk_unknown_archs)
     35 ARCHS="$DEFAULT_ARCHS $ARCHS"
     36 register_var_option "--arch=<name>" ARCHS "List of target architectures"
     37 
     38 PROGRAM_PARAMETERS=""
     39 
     40 PROGRAM_DESCRIPTION=\
     41 "Call dev-platform-expand.sh for all API levels."
     42 
     43 extract_parameters "$@"
     44 
     45 # Check source directory
     46 if [ ! -d "$SRCDIR" ] ; then
     47     echo "ERROR: Source directory doesn't exist: $SRCDIR"
     48     exit 1
     49 fi
     50 if [ ! -d "$SRCDIR/android-3" ]; then
     51     echo "ERROR: Source directory doesn't seem to be valid: $SRCDIR"
     52     exit 1
     53 fi
     54 log "Using source directory: $SRCDIR"
     55 log "Using destination directory: $DSTDIR"
     56 log "Using architectures: $ARCHS"
     57 
     58 for PLATFORM in $API_LEVELS; do
     59     dump "Expanding files for android-$PLATFORM"
     60     $PROGDIR/dev-platform-expand.sh --platform=$PLATFORM --src-dir=$SRCDIR --dst-dir=$DSTDIR --arch=$(spaces_to_commas $ARCHS)
     61     fail_panic "Could not expand android-$PLATFORM files!"
     62 done
     63 
     64 log "Done! See $DSTDIR"
     65 exit 0
     66