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