dev-defaults.sh 5.16 KB
Newer Older
1 2 3 4 5 6 7 8
# Default values used by several dev-scripts.
#

# Current list of platform levels we support
#
# Note: levels 6 and 7 are omitted since they have the same native
# APIs as level 5. Same for levels 10, 11 and 12
#
9
API_LEVELS="3 4 5 8 9 14"
10 11

# Default ABIs for the target prebuilt binaries.
12
PREBUILT_ABIS="armeabi armeabi-v7a x86 mips"
13 14 15 16 17 18 19 20 21 22 23

# Location of the STLport sources, relative to the NDK root directory
STLPORT_SUBDIR=sources/cxx-stl/stlport

# Location of the GAbi++ sources, relative to the NDK root directory
GABIXX_SUBDIR=sources/cxx-stl/gabi++

# Location of the GNU libstdc++ headers and libraries, relative to the NDK
# root directory.
GNUSTL_SUBDIR=sources/cxx-stl/gnu-libstdc++

24
# The date to use when downloading toolchain sources from AOSP servers
25
# Leave it empty for tip of tree.
26
TOOLCHAIN_GIT_DATE=2012-06-30
27

28
# The space-separated list of all GCC versions we support in this NDK
29
DEFAULT_GCC_VERSION_LIST="4.6 4.4.3"
30 31 32 33 34 35

# The default GCC version for this NDK, i.e. the first item in
# $DEFAULT_GCC_VERSION_LIST
#
DEFAULT_GCC_VERSION=$(echo "$DEFAULT_GCC_VERSION_LIST" | tr ' ' '\n' | head -n 1)

36
DEFAULT_BINUTILS_VERSION=2.21
37
DEFAULT_GDB_VERSION=7.3.x
38
DEFAULT_MPFR_VERSION=2.4.1
39
DEFAULT_GMP_VERSION=5.0.5
40
DEFAULT_MPC_VERSION=0.8.1
41 42 43 44 45

# Default platform to build target binaries against.
DEFAULT_PLATFORM=android-9

# The list of default CPU architectures we support
46
DEFAULT_ARCHS="arm x86 mips"
47 48 49 50 51

# Default toolchain names and prefix
#
# This is used by get_default_toolchain_name_for_arch and get_default_toolchain_prefix_for_arch
# defined below
52
DEFAULT_ARCH_TOOLCHAIN_NAME_arm=arm-linux-androideabi
53 54
DEFAULT_ARCH_TOOLCHAIN_PREFIX_arm=arm-linux-androideabi

55
DEFAULT_ARCH_TOOLCHAIN_NAME_x86=x86
56
DEFAULT_ARCH_TOOLCHAIN_PREFIX_x86=i686-linux-android
57

58 59
DEFAULT_ARCH_TOOLCHAIN_NAME_mips=mipsel-linux-android
DEFAULT_ARCH_TOOLCHAIN_PREFIX_mips=mipsel-linux-android
60

61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
# The list of default host NDK systems we support
DEFAULT_SYSTEMS="linux-x86 windows darwin-x86"

# Return default NDK ABI for a given architecture name
# $1: Architecture name
# Out: ABI name
get_default_abi_for_arch ()
{
    local RET
    case $1 in
        arm)
            RET="armeabi"
            ;;
        x86)
            RET="x86"
            ;;
77 78 79
        mips)
            RET="mips"
            ;;
80
        *)
81
            2> echo "ERROR: Unsupported architecture name: $1, use one of: arm x86 mips"
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
            exit 1
            ;;
    esac
    echo "$RET"
}


# Retrieve the list of default ABIs supported by a given architecture
# $1: Architecture name
# Out: space-separated list of ABI names
get_default_abis_for_arch ()
{
    local RET
    case $1 in
        arm)
            RET="armeabi armeabi-v7a"
            ;;
        x86)
            RET="x86"
            ;;
102 103 104
        mips)
            RET="mips"
            ;;
105
        *)
106
            2> echo "ERROR: Unsupported architecture name: $1, use one of: arm x86 mips"
107 108 109 110 111 112
            exit 1
            ;;
    esac
    echo "$RET"
}

113
# Return toolchain name for given architecture and GCC version
114
# $1: Architecture name (e.g. 'arm')
115
# $2: GCC version (e.g. '4.6ʼ)
116
# Out: default arch-specific toolchain name (e.g. 'arm-linux-androideabi-$GCC_VERSION')
117
# Return empty for unknown arch
118 119 120 121 122 123 124 125 126
get_toolchain_name_for_arch ()
{
    eval echo \"\${DEFAULT_ARCH_TOOLCHAIN_NAME_$1}-$2\"
}

# Return the default toolchain name for a given architecture
# $1: Architecture name (e.g. 'arm')
# Out: default arch-specific toolchain name (e.g. 'arm-linux-androideabi-$DEFAULT_GCC_VERSION')
# Return empty for unknown arch
127 128
get_default_toolchain_name_for_arch ()
{
129
    eval echo \"\${DEFAULT_ARCH_TOOLCHAIN_NAME_$1}-$DEFAULT_GCC_VERSION\"
130 131 132 133 134 135 136 137 138 139 140
}

# Return the default toolchain program prefix for a given architecture
# $1: Architecture name
# Out: default arch-specific toolchain prefix (e.g. arm-linux-androideabi)
# Return empty for unknown arch
get_default_toolchain_prefix_for_arch ()
{
    eval echo "\$DEFAULT_ARCH_TOOLCHAIN_PREFIX_$1"
}

141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
# Get the list of all toolchain names for a given architecture
# $1: architecture (e.g. 'arm')
# Out: list of toolchain names for this arch (e.g. arm-linux-androideabi-4.6 arm-linux-androideabi-4.4.3)
# Return empty for unknown arch
get_toolchain_name_list_for_arch ()
{
    local PREFIX VERSION RET
    PREFIX=$(eval echo \"\$DEFAULT_ARCH_TOOLCHAIN_NAME_$1\")
    if [ -z "$PREFIX" ]; then
        return 0
    fi
    RET=""
    for VERSION in $DEFAULT_GCC_VERSION_LIST; do
        RET=$RET" $PREFIX-$VERSION"
    done
    RET=${RET## }
    echo "$RET"
}
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179

# Return the binutils version to be used by default when
# building a given version of GCC. This is needed to ensure
# we use binutils-2.19 when building gcc-4.4.3 for ARM and x86,
# and binutils-2.21 in other cases (mips, or gcc-4.6).
#
# Note that technically, we could use 2.21 for all versions of
# GCC, however, in NDK r7, we did build GCC 4.4.3 with binutils-2.20.1
# and this resulted in weird C++ debugging bugs. For NDK r7b and higher,
# binutils was reverted to 2.19, to ensure at least
# feature/bug compatibility.
#
# $1: toolchain with version numer (e.g. 'arm-linux-androideabi-4.6')
#
get_default_binutils_version_for_gcc ()
{
    case $1 in
        arm-*-4.4.3|x86-4.4.3|x86-*-4.4.3) echo "2.19";;
        *) echo "$DEFAULT_BINUTILS_VERSION";;
    esac
}