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