2 # Script to install (if they do not exist) the Android SDK library (ie. Android JDK)
5 import os, subprocess, struct
6 import urllib2, urlparse
12 target_os = env.get('TARGET_OS')
13 src_dir = env.get('SRC_DIR')
15 SConscript(src_dir + '/build_common/tools/UnpackAll.py')
16 SConscript(src_dir + '/build_common/external_libs.scons')
19 if target_os == 'android':
20 android_home = env.get('ANDROID_HOME')
22 print 'Creating ANDROID_HOME for Android SDK'
24 androidlib_dir = src_dir + '/extlibs/android/sdk/android-sdk_r24.2'
26 if not os.path.exists(androidlib_dir):
27 from sys import platform as _platform
28 if _platform == "linux" or _platform == "linux2":
29 androidlib_zip_file = src_dir + '/extlibs/android/android-sdk_r24.2-linux.tgz'
30 androidlib_url = 'http://dl.google.com/android/android-sdk_r24.2-linux.tgz'
31 elif _platform == "darwin":
32 androidlib_zip_file = src_dir + '/extlibs/android/android-sdk_r24.2-macosx.zip'
33 androidlib_url = 'http://dl.google.com/android/android-sdk_r24.2-macosx.zip'
34 elif _platform == "win32":
35 androidlib_zip_file = src_dir + '/extlibs/android/android-sdk_r24.2-windows.zip'
36 androidlib_url = 'http://dl.google.com/android/android-sdk_r24.2-windows.zip'
38 # If the zip file is not already present, download it
39 if not os.path.exists(androidlib_zip_file):
40 androidlib_zip = env.Download(androidlib_zip_file, androidlib_url)
42 androidlib_zip = androidlib_zip_file
45 print 'Unzipping android lib...'
46 env.UnpackAll(androidlib_dir, androidlib_zip)
47 print 'Unzipping android lib complete'
49 # Remove downloaded file
50 # os.remove(androidlib_zip_file)
52 androidlib_dir = env.get('ANDROID_HOME')
54 # Set the ANDROID_HOME
55 env.Replace(ANDROID_HOME = androidlib_dir)
56 print 'ANDROID_HOME = ' + env.get('ANDROID_HOME')