1# Default values used by several dev-scripts.
2#
3
4# Current list of platform levels we support
5#
6# Note: levels 6 and 7 are omitted since they have the same native
7# APIs as level 5. Same for levels 10, 11 and 12
8#
9API_LEVELS="3 4 5 8 9 12 13 14 15 16 17 18 19 21"
10
11FIRST_API64_LEVEL=21
12
13LATEST_API_LEVEL=21
14
15# Default ABIs for the target prebuilt binaries.
16PREBUILT_ABIS="armeabi armeabi-v7a x86 mips armeabi-v7a-hard arm64-v8a x86_64 mips64"
17
18# Location of the STLport sources, relative to the NDK root directory
19STLPORT_SUBDIR=sources/cxx-stl/stlport
20
21# Location of the GAbi++ sources, relative to the NDK root directory
22GABIXX_SUBDIR=sources/cxx-stl/gabi++
23
24# Location of the GNU libstdc++ headers and libraries, relative to the NDK
25# root directory.
26GNUSTL_SUBDIR=sources/cxx-stl/gnu-libstdc++
27
28# Location of the LLVM libc++ headers and libraries, relative to the NDK
29# root directory.
30LIBCXX_SUBDIR=sources/cxx-stl/llvm-libc++
31
32# Location of the LLVM libc++abi headers, relative to the NDK # root directory.
33LIBCXXABI_SUBDIR=sources/cxx-stl/llvm-libc++abi/libcxxabi
34
35# Location of the gccunwind sources, relative to the NDK root directory
36GCCUNWIND_SUBDIR=sources/android/gccunwind
37
38# Location of the support sources for libc++, relative to the NDK root directory
39SUPPORT_SUBDIR=sources/android/support
40
41# The date to use when downloading toolchain sources from AOSP servers
42# Leave it empty for tip of tree.
43TOOLCHAIN_GIT_DATE=now
44
45# The space-separated list of all GCC versions we support in this NDK
46DEFAULT_GCC_VERSION_LIST="4.9"
47
48DEFAULT_GCC32_VERSION=4.9
49DEFAULT_GCC64_VERSION=4.9
50FIRST_GCC32_VERSION=4.9
51FIRST_GCC64_VERSION=4.9
52DEFAULT_LLVM_GCC32_VERSION=4.9
53DEFAULT_LLVM_GCC64_VERSION=4.9
54
55DEFAULT_BINUTILS_VERSION=2.25
56DEFAULT_GDB_VERSION=7.10
57DEFAULT_MPFR_VERSION=3.1.1
58DEFAULT_GMP_VERSION=5.0.5
59DEFAULT_MPC_VERSION=1.0.1
60DEFAULT_CLOOG_VERSION=0.18.0
61DEFAULT_ISL_VERSION=0.11.1
62DEFAULT_PPL_VERSION=1.0
63DEFAULT_PYTHON_VERSION=2.7.5
64DEFAULT_PERL_VERSION=5.16.2
65
66# Default platform to build target binaries against.
67DEFAULT_PLATFORM=android-9
68
69# The list of default CPU architectures we support
70DEFAULT_ARCHS="arm x86 mips arm64 x86_64 mips64"
71
72# Default toolchain names and prefix
73#
74# This is used by get_default_toolchain_name_for_arch and get_default_toolchain_prefix_for_arch
75# defined below
76DEFAULT_ARCH_TOOLCHAIN_NAME_arm=arm-linux-androideabi
77DEFAULT_ARCH_TOOLCHAIN_PREFIX_arm=arm-linux-androideabi
78
79DEFAULT_ARCH_TOOLCHAIN_NAME_arm64=aarch64-linux-android
80DEFAULT_ARCH_TOOLCHAIN_PREFIX_arm64=aarch64-linux-android
81
82DEFAULT_ARCH_TOOLCHAIN_NAME_x86=x86
83DEFAULT_ARCH_TOOLCHAIN_PREFIX_x86=i686-linux-android
84
85DEFAULT_ARCH_TOOLCHAIN_NAME_x86_64=x86_64
86DEFAULT_ARCH_TOOLCHAIN_PREFIX_x86_64=x86_64-linux-android
87
88DEFAULT_ARCH_TOOLCHAIN_NAME_mips=mipsel-linux-android
89DEFAULT_ARCH_TOOLCHAIN_PREFIX_mips=mipsel-linux-android
90
91DEFAULT_ARCH_TOOLCHAIN_NAME_mips64=mips64el-linux-android
92DEFAULT_ARCH_TOOLCHAIN_PREFIX_mips64=mips64el-linux-android
93
94# The build number of clang used to build pieces of the NDK (like platforms).
95DEFAULT_LLVM_VERSION="2455903"
96
97# The default URL to download the LLVM tar archive
98DEFAULT_LLVM_URL="http://llvm.org/releases"
99
100# The list of default host NDK systems we support
101DEFAULT_SYSTEMS="linux-x86 windows darwin-x86"
102
103# The default issue tracker URL
104DEFAULT_ISSUE_TRACKER_URL="http://source.android.com/source/report-bugs.html"
105
106# Return the default gcc version for a given architecture
107# $1: Architecture name (e.g. 'arm')
108# Out: default arch-specific gcc version
109get_default_gcc_version_for_arch ()
110{
111    case $1 in
112       *64) echo $DEFAULT_GCC64_VERSION ;;
113       *) echo $DEFAULT_GCC32_VERSION ;;
114    esac
115}
116
117# Return the first gcc version for a given architecture
118# $1: Architecture name (e.g. 'arm')
119# Out: default arch-specific gcc version
120get_first_gcc_version_for_arch ()
121{
122    case $1 in
123       *64) echo $FIRST_GCC64_VERSION ;;
124       *) echo $FIRST_GCC32_VERSION ;;
125    esac
126}
127
128# Return default NDK ABI for a given architecture name
129# $1: Architecture name
130# Out: ABI name
131get_default_abi_for_arch ()
132{
133    local RET
134    case $1 in
135        arm)
136            RET="armeabi"
137            ;;
138        arm64)
139            RET="arm64-v8a"
140            ;;
141        x86|x86_64|mips|mips64)
142            RET="$1"
143            ;;
144        mips32r6)
145            RET="mips"
146            ;;
147        *)
148            2> echo "ERROR: Unsupported architecture name: $1, use one of: arm arm64 x86 x86_64 mips mips64"
149            exit 1
150            ;;
151    esac
152    echo "$RET"
153}
154
155
156# Retrieve the list of default ABIs supported by a given architecture
157# $1: Architecture name
158# Out: space-separated list of ABI names
159get_default_abis_for_arch ()
160{
161    local RET
162    case $1 in
163        arm)
164            RET="armeabi armeabi-v7a armeabi-v7a-hard"
165            ;;
166        arm64)
167            RET="arm64-v8a"
168            ;;
169        x86|x86_64|mips|mips32r6|mips64)
170            RET="$1"
171            ;;
172        *)
173            2> echo "ERROR: Unsupported architecture name: $1, use one of: arm arm64 x86 x86_64 mips mips64"
174            exit 1
175            ;;
176    esac
177    echo "$RET"
178}
179
180# Return toolchain name for given architecture and GCC version
181# $1: Architecture name (e.g. 'arm')
182# $2: optional, GCC version (e.g. '4.8')
183# Out: default arch-specific toolchain name (e.g. 'arm-linux-androideabi-$GCC_VERSION')
184# Return empty for unknown arch
185get_toolchain_name_for_arch ()
186{
187    if [ ! -z "$2" ] ; then
188        eval echo \"\${DEFAULT_ARCH_TOOLCHAIN_NAME_$1}-$2\"
189    else
190        eval echo \"\${DEFAULT_ARCH_TOOLCHAIN_NAME_$1}\"
191    fi
192}
193
194# Return the default toolchain name for a given architecture
195# $1: Architecture name (e.g. 'arm')
196# Out: default arch-specific toolchain name (e.g. 'arm-linux-androideabi-$GCCVER')
197# Return empty for unknown arch
198get_default_toolchain_name_for_arch ()
199{
200    local GCCVER=$(get_default_gcc_version_for_arch $1)
201    eval echo \"\${DEFAULT_ARCH_TOOLCHAIN_NAME_$1}-$GCCVER\"
202}
203
204# Return the default toolchain program prefix for a given architecture
205# $1: Architecture name
206# Out: default arch-specific toolchain prefix (e.g. arm-linux-androideabi)
207# Return empty for unknown arch
208get_default_toolchain_prefix_for_arch ()
209{
210    eval echo "\$DEFAULT_ARCH_TOOLCHAIN_PREFIX_$1"
211}
212
213# Get the list of all toolchain names for a given architecture
214# $1: architecture (e.g. 'arm')
215# $2: comma separated versions (optional)
216# Out: list of toolchain names for this arch (e.g. arm-linux-androideabi-4.8 arm-linux-androideabi-4.9)
217# Return empty for unknown arch
218get_toolchain_name_list_for_arch ()
219{
220    local PREFIX VERSION RET ADD FIRST_GCC_VERSION VERSIONS
221    PREFIX=$(eval echo \"\$DEFAULT_ARCH_TOOLCHAIN_NAME_$1\")
222    if [ -z "$PREFIX" ]; then
223        return 0
224    fi
225    RET=""
226    FIRST_GCC_VERSION=$(get_first_gcc_version_for_arch $1)
227    ADD=""
228    VERSIONS=$(commas_to_spaces $2)
229    if [ -z "$VERSIONS" ]; then
230        VERSIONS=$DEFAULT_GCC_VERSION_LIST
231    else
232        ADD="yes" # include everything we passed explicitly
233    fi
234    for VERSION in $VERSIONS; do
235        if [ -z "$ADD" -a "$VERSION" = "$FIRST_GCC_VERSION" ]; then
236            ADD="yes"
237        fi
238        if [ -z "$ADD" ]; then
239            continue
240        fi
241        RET=$RET" $PREFIX-$VERSION"
242    done
243    RET=${RET## }
244    echo "$RET"
245}
246
247# Return the binutils version to be used by default when
248# building a given version of GCC. This is needed to ensure
249# we use binutils-2.19 when building gcc-4.4.3 for ARM and x86,
250# and later binutils in other cases (mips, or gcc-4.6+).
251#
252# Note that technically, we could use latest binutils for all versions of
253# GCC, however, in NDK r7, we did build GCC 4.4.3 with binutils-2.20.1
254# and this resulted in weird C++ debugging bugs. For NDK r7b and higher,
255# binutils was reverted to 2.19, to ensure at least
256# feature/bug compatibility.
257#
258# $1: toolchain with version number (e.g. 'arm-linux-androideabi-4.8')
259#
260get_default_binutils_version_for_gcc ()
261{
262    echo "$DEFAULT_BINUTILS_VERSION"
263}
264
265# Return the binutils version to be used by default when
266# building a given version of llvm. For llvm-3.4 or later,
267# we use binutils-2.23+ to ensure the LLVMgold.so could be
268# built properly. For llvm-3.3, we use binutils-2.21 as default.
269#
270# $1: toolchain with version numer (e.g. 'llvm-3.3')
271#
272get_default_binutils_version_for_llvm ()
273{
274    echo "$DEFAULT_BINUTILS_VERSION"
275}
276
277# Return the gdb version to be used by default when building a given
278# version of GCC.
279#
280# $1: toolchain with version number (e.g. 'arm-linux-androideabi-4.8')
281#
282get_default_gdb_version_for_gcc ()
283{
284    echo "$DEFAULT_GDB_VERSION"
285}
286
287# Return the gdbserver version to be used by default when building a given
288# version of GCC.
289#
290# $1: toolchain with version number (e.g. 'arm-linux-androideabi-4.8')
291#
292get_default_gdbserver_version_for_gcc ()
293{
294    echo "$DEFAULT_GDB_VERSION"
295}
296