From: Philippe Coval Date: Sat, 23 Jul 2016 05:31:05 +0000 (+0200) Subject: build: Rewrite sqlite SConscript a more portable way X-Git-Tag: 1.3.0~1054^2~41 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff90362afac06f289d12fb917d124c9efff3464b;p=platform%2Fupstream%2Fiotivity.git build: Rewrite sqlite SConscript a more portable way Windows support should be improved. Fixed weird indentation that looked strange when I was investigating if files were present in Tizen builder. Change-Id: I80c9667a502a1115fdfbcd5ecd50b1e799ff5fdb Bug: https://jira.iotivity.org/browse/IOT-820 Origin: https://gerrit.iotivity.org/gerrit/#/c/9641/1/ Signed-off-by: Philippe Coval Reviewed-on: https://gerrit.iotivity.org/gerrit/9653 Tested-by: jenkins-iotivity Reviewed-by: Dave Thaler --- diff --git a/extlibs/sqlite3/SConscript b/extlibs/sqlite3/SConscript index 36cedf3..183f441 100755 --- a/extlibs/sqlite3/SConscript +++ b/extlibs/sqlite3/SConscript @@ -1,5 +1,5 @@ ## -# Script to install (if they do not exist) the SQLite library +# Scons script to install SQLite sources if not present ## import os @@ -12,32 +12,29 @@ target_os = sqlite_env.get('TARGET_OS') src_dir = sqlite_env.get('SRC_DIR') targets_need_sqlite = ['android', 'msys_nt', 'windows'] -sqlite_dir = src_dir + '/extlibs/sqlite3/' -sqlite_build_dir = src_dir + '/extlibs/sqlite3/sqlite-amalgamation-3081101/' +sqlite_dir = src_dir + '/extlibs/sqlite3/' +sqlite_build_dir = src_dir + '/extlibs/sqlite3/sqlite-amalgamation-3081101/' sqlite_zip_file = src_dir + '/extlibs/sqlite3/sqlite-amalgamation-3081101.zip' -sqlite_url = 'https://www.sqlite.org/2015/sqlite-amalgamation-3081101.zip' +sqlite_url = 'https://www.sqlite.org/2015/sqlite-amalgamation-3081101.zip' +sqlite_package= 'sqlite-amalgamation-3081101' +sqlite_url = 'https://www.sqlite.org/2015/' + sqlite_package + '.zip' + +sqlite_dir = os.path.join(src_dir, 'extlibs', 'sqlite3') +sqlite_c = os.path.join(sqlite_dir, 'sqlite3.c') +sqlite_h = os.path.join(sqlite_dir, 'sqlite3.h') +sqlite_tmp_dir = os.path.join(sqlite_dir, sqlite_package) +sqlite_zip_file = sqlite_tmp_dir + '.zip' +sqlite_c_tmp = os.path.join(sqlite_tmp_dir, 'sqlite3.c') +sqlite_h_tmp = os.path.join(sqlite_tmp_dir, 'sqlite3.h') -# Download if target_os in targets_need_sqlite: - if sqlite_env.get('SECURED') == '1': - print '*** Checking for installation of SQLite 3.8.11.1 (extlib/sqlite3) ***' - if not os.path.exists(sqlite_dir + 'sqlite3.c') or not os.path.exists(sqlite_dir + 'sqlite3.h'): - - # If the zip file is not already present, download it - if not os.path.exists(sqlite_zip_file): - sqlite_zip = sqlite_env.Download(sqlite_zip_file, sqlite_url) - else: - sqlite_zip = sqlite_zip_file - - # Unzip the lib - print 'Unzipping SQLite amalgamation src...' - sqlite_env.UnpackAll(sqlite_build_dir, sqlite_zip) - print 'Unzipping SQLite amalgamation src complete' - - # Move requried src and header - os.rename(sqlite_build_dir + 'sqlite3.c', sqlite_dir + 'sqlite3.c') - os.rename(sqlite_build_dir + 'sqlite3.h', sqlite_dir + 'sqlite3.h') - os.remove(sqlite_zip_file) - shutil.rmtree(sqlite_build_dir) - -# Build will be done with provisioning manager module. + print '*** Checking for presence of %s ***' % sqlite_package + os.listdir(sqlite_dir) + if not os.path.exists(sqlite_c) or not os.path.exists(sqlite_h): + if not os.path.exists(sqlite_zip_file): + sqlite_zip_file = sqlite_env.Download(sqlite_zip_file, sqlite_url) + sqlite_env.UnpackAll(sqlite_tmp_dir, sqlite_zip_file) + os.rename(sqlite_c_tmp, sqlite_c) + os.rename(sqlite_h_tmp, sqlite_h) + os.remove(sqlite_zip_file) + shutil.rmtree(sqlite_tmp_dir)