From c65cc25e9f361775eb061404daaab595c168babf Mon Sep 17 00:00:00 2001 From: Jenny Tam Date: Fri, 14 Jun 2019 16:32:17 -0700 Subject: [PATCH 1/7] Replaced uint with size_t --- source/shared/core_sqlsrv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/shared/core_sqlsrv.h b/source/shared/core_sqlsrv.h index 3e134c343..bb7c8d5c3 100644 --- a/source/shared/core_sqlsrv.h +++ b/source/shared/core_sqlsrv.h @@ -2622,7 +2622,7 @@ namespace core { } } - inline void sqlsrv_zend_hash_next_index_insert_mem( _Inout_ sqlsrv_context& ctx, _In_ HashTable* ht, _In_reads_bytes_(data_size) void* data, _In_ uint data_size TSRMLS_DC) + inline void sqlsrv_zend_hash_next_index_insert_mem( _Inout_ sqlsrv_context& ctx, _In_ HashTable* ht, _In_reads_bytes_(data_size) void* data, _In_ size_t data_size TSRMLS_DC) { int zr = (data = ::zend_hash_next_index_insert_mem(ht, data, data_size)) != NULL ? SUCCESS : FAILURE; CHECK_ZEND_ERROR(zr, ctx, SQLSRV_ERROR_ZEND_HASH) { From e409978bbab5477997ddf8fcec18d1451aad423d Mon Sep 17 00:00:00 2001 From: Jenny Tam Date: Mon, 17 Jun 2019 15:14:57 -0700 Subject: [PATCH 2/7] Modified windows build scripts to check for compiler version for 7.4 --- buildscripts/buildtools.py | 50 +++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 11 deletions(-) diff --git a/buildscripts/buildtools.py b/buildscripts/buildtools.py index c1f9df4cd..d79631f33 100644 --- a/buildscripts/buildtools.py +++ b/buildscripts/buildtools.py @@ -42,7 +42,8 @@ def __init__(self, phpver, driver, arch, thread, no_rename, debug_enabled = Fals self.thread = thread.lower() self.no_rename = no_rename self.debug_enabled = debug_enabled - + self.vc = '' + def major_version(self): """Return the major version number based on the PHP version.""" return self.phpver[0:3] @@ -66,17 +67,44 @@ def driver_new_name(self, driver, suffix): version = self.version_label() return 'php_' + driver + '_' + version + '_' + self.thread + suffix - def compiler_version(self): + def determine_compiler(self, sdk_dir, vs_ver): + """Return the appropriate compiler version using vswhere.exe.""" + filename = 'get-vc.bat' + vswhere = os.path.join(sdk_dir, 'php-sdk', 'bin', 'vswhere.exe') + if not os.path.exists(vswhere): + print('Could not find ' + vswhere) + + try: + file = open(filename, 'w') + file.write('@ECHO OFF' + os.linesep) + command = '{0} -version "[{1},{2})" -property installationVersion '.format(vswhere, vs_ver, vs_ver + 1) + file.write(command + ' > temp.txt' + os.linesep) + file.write('SET /p VER== '72': # Compiler version for PHP 7.2 or above - VC = 'vc15' - return VC - - def phpsrc_root(self, sdk_dir): + if self.vc is '': + VC = 'vc14' + version = self.version_label() + if version >= '72': # Compiler version for PHP 7.2 or above + VC = 'vc15' + if version == '74': + # Compiler version for PHP 7.4 or above + # Can be compiled using VS 2017 or VS 2019 + VC = 'vc' + self.determine_compiler(sdk_dir, 15) + self.vc = VC + return self.vc + + def phpsrc_root(self, sdk_dir): """Return the path to the PHP source folder based on *sdk_dir*.""" - vc = self.compiler_version() + vc = self.compiler_version(sdk_dir) return os.path.join(sdk_dir, 'php-sdk', 'phpdev', vc, self.arch, 'php-'+self.phpver+'-src') def build_abs_path(self, sdk_dir): @@ -386,7 +414,7 @@ def build_drivers(self, make_clean = False, dest = None, log_file = None): shutil.move(source_dir, phpSDK) # Invoke phpsdk--.bat - vc = self.compiler_version() + vc = self.compiler_version(sdk_dir) starter_script = 'phpsdk-' + vc + '-' + self.arch + '.bat' print('Running starter script: ', starter_script) os.system(starter_script + ' -t ' + batch_file) From 2d400cc5fb877f6c2fb063b0ed6b02546b661842 Mon Sep 17 00:00:00 2001 From: Jenny Tam Date: Mon, 17 Jun 2019 15:46:37 -0700 Subject: [PATCH 3/7] Check existence before removing old build(s) --- buildscripts/buildtools.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/buildscripts/buildtools.py b/buildscripts/buildtools.py index d79631f33..442d7a43b 100644 --- a/buildscripts/buildtools.py +++ b/buildscripts/buildtools.py @@ -125,6 +125,10 @@ def build_abs_path(self, sdk_dir): def remove_old_builds(self, sdk_dir): """Remove the extensions, e.g. the driver subfolders in php-7.*-src\ext.""" + if not os.path.exists(os.path.join(sdk_dir, 'php-sdk')): + print('No old builds to be removed...') + return + print('Removing old builds...') phpsrc = self.phpsrc_root(sdk_dir) @@ -145,6 +149,10 @@ def remove_prev_build(self, sdk_dir): """Remove all binaries and source code in the Release* or Debug* folders according to the current configuration """ + if not os.path.exists(os.path.join(sdk_dir, 'php-sdk')): + print('No old builds to be removed...') + return + print('Removing previous build...') build_dir = self.build_abs_path(sdk_dir) if not os.path.exists(build_dir): From 2769b2549a7e600d67416c17ebc86fb91c000af4 Mon Sep 17 00:00:00 2001 From: Jenny Tam Date: Mon, 17 Jun 2019 16:27:36 -0700 Subject: [PATCH 4/7] Added more logging info --- buildscripts/buildtools.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/buildscripts/buildtools.py b/buildscripts/buildtools.py index 442d7a43b..4ce6291ae 100644 --- a/buildscripts/buildtools.py +++ b/buildscripts/buildtools.py @@ -70,17 +70,22 @@ def driver_new_name(self, driver, suffix): def determine_compiler(self, sdk_dir, vs_ver): """Return the appropriate compiler version using vswhere.exe.""" filename = 'get-vc.bat' - vswhere = os.path.join(sdk_dir, 'php-sdk', 'bin', 'vswhere.exe') + sdk_bin = os.path.join(sdk_dir, 'php-sdk', 'bin') + vswhere = os.path.join(sdk_bin, 'vswhere.exe') if not os.path.exists(vswhere): print('Could not find ' + vswhere) + exit(1) try: file = open(filename, 'w') file.write('@ECHO OFF' + os.linesep) - command = '{0} -version "[{1},{2})" -property installationVersion '.format(vswhere, vs_ver, vs_ver + 1) + file.write('SET currDir=%CD%' + os.linesep) + file.write('CD ' + sdk_bin + os.linesep) + command = '{0} -version "[{1},{2})" -property installationVersion '.format('vswhere', vs_ver, vs_ver + 1) file.write(command + ' > temp.txt' + os.linesep) file.write('SET /p VER= Date: Mon, 17 Jun 2019 17:07:42 -0700 Subject: [PATCH 5/7] Tried different ways to launch the batch file --- buildscripts/buildtools.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/buildscripts/buildtools.py b/buildscripts/buildtools.py index 4ce6291ae..5d78f6d6d 100644 --- a/buildscripts/buildtools.py +++ b/buildscripts/buildtools.py @@ -81,13 +81,13 @@ def determine_compiler(self, sdk_dir, vs_ver): file.write('@ECHO OFF' + os.linesep) file.write('SET currDir=%CD%' + os.linesep) file.write('CD ' + sdk_bin + os.linesep) - command = '{0} -version "[{1},{2})" -property installationVersion '.format('vswhere', vs_ver, vs_ver + 1) + command = '@CALL {0} -version "[{1},{2})" -property installationVersion '.format('vswhere', vs_ver, vs_ver + 1) file.write(command + ' > temp.txt' + os.linesep) file.write('SET /p VER= Date: Mon, 17 Jun 2019 17:15:16 -0700 Subject: [PATCH 6/7] One more try --- buildscripts/buildtools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildscripts/buildtools.py b/buildscripts/buildtools.py index 5d78f6d6d..ad13400ce 100644 --- a/buildscripts/buildtools.py +++ b/buildscripts/buildtools.py @@ -81,7 +81,7 @@ def determine_compiler(self, sdk_dir, vs_ver): file.write('@ECHO OFF' + os.linesep) file.write('SET currDir=%CD%' + os.linesep) file.write('CD ' + sdk_bin + os.linesep) - command = '@CALL {0} -version "[{1},{2})" -property installationVersion '.format('vswhere', vs_ver, vs_ver + 1) + command = '@CALL {0} -version [{1},{2}) -property installationVersion '.format('vswhere', vs_ver, vs_ver + 1) file.write(command + ' > temp.txt' + os.linesep) file.write('SET /p VER= Date: Mon, 17 Jun 2019 17:20:07 -0700 Subject: [PATCH 7/7] Reverted changes to build scripts --- buildscripts/buildtools.py | 68 ++++++-------------------------------- 1 file changed, 11 insertions(+), 57 deletions(-) diff --git a/buildscripts/buildtools.py b/buildscripts/buildtools.py index ad13400ce..c1f9df4cd 100644 --- a/buildscripts/buildtools.py +++ b/buildscripts/buildtools.py @@ -42,8 +42,7 @@ def __init__(self, phpver, driver, arch, thread, no_rename, debug_enabled = Fals self.thread = thread.lower() self.no_rename = no_rename self.debug_enabled = debug_enabled - self.vc = '' - + def major_version(self): """Return the major version number based on the PHP version.""" return self.phpver[0:3] @@ -67,51 +66,17 @@ def driver_new_name(self, driver, suffix): version = self.version_label() return 'php_' + driver + '_' + version + '_' + self.thread + suffix - def determine_compiler(self, sdk_dir, vs_ver): - """Return the appropriate compiler version using vswhere.exe.""" - filename = 'get-vc.bat' - sdk_bin = os.path.join(sdk_dir, 'php-sdk', 'bin') - vswhere = os.path.join(sdk_bin, 'vswhere.exe') - if not os.path.exists(vswhere): - print('Could not find ' + vswhere) - exit(1) - - try: - file = open(filename, 'w') - file.write('@ECHO OFF' + os.linesep) - file.write('SET currDir=%CD%' + os.linesep) - file.write('CD ' + sdk_bin + os.linesep) - command = '@CALL {0} -version [{1},{2}) -property installationVersion '.format('vswhere', vs_ver, vs_ver + 1) - file.write(command + ' > temp.txt' + os.linesep) - file.write('SET /p VER== '72': # Compiler version for PHP 7.2 or above - VC = 'vc15' - if version == '74': - # Compiler version for PHP 7.4 or above - # Can be compiled using VS 2017 or VS 2019 - print('Checking compiler versions...') - VC = 'vc' + self.determine_compiler(sdk_dir, 15) - self.vc = VC - print('Compiler: ' + self.vc) - return self.vc - - def phpsrc_root(self, sdk_dir): + VC = 'vc14' + version = self.version_label() + if version >= '72': # Compiler version for PHP 7.2 or above + VC = 'vc15' + return VC + + def phpsrc_root(self, sdk_dir): """Return the path to the PHP source folder based on *sdk_dir*.""" - vc = self.compiler_version(sdk_dir) + vc = self.compiler_version() return os.path.join(sdk_dir, 'php-sdk', 'phpdev', vc, self.arch, 'php-'+self.phpver+'-src') def build_abs_path(self, sdk_dir): @@ -132,10 +97,6 @@ def build_abs_path(self, sdk_dir): def remove_old_builds(self, sdk_dir): """Remove the extensions, e.g. the driver subfolders in php-7.*-src\ext.""" - if not os.path.exists(os.path.join(sdk_dir, 'php-sdk')): - print('No old builds to be removed...') - return - print('Removing old builds...') phpsrc = self.phpsrc_root(sdk_dir) @@ -156,10 +117,6 @@ def remove_prev_build(self, sdk_dir): """Remove all binaries and source code in the Release* or Debug* folders according to the current configuration """ - if not os.path.exists(os.path.join(sdk_dir, 'php-sdk')): - print('No old builds to be removed...') - return - print('Removing previous build...') build_dir = self.build_abs_path(sdk_dir) if not os.path.exists(build_dir): @@ -413,16 +370,13 @@ def build_drivers(self, make_clean = False, dest = None, log_file = None): os.system('git clone https://github.com/OSTC/php-sdk-binary-tools.git --branch master --single-branch --depth 1 ' + phpSDK) os.chdir(phpSDK) os.system('git pull ') - print('Done cloning the latest php SDK...') # Move the generated batch file to phpSDK for the php starter script - print('Moving the sdk bath file over...') sdk_batch_file = os.path.join(phpSDK, batch_file) if os.path.exists(sdk_batch_file): os.remove(sdk_batch_file) shutil.move(os.path.join(work_dir, batch_file), phpSDK) - print('Checking if source exists...') sdk_source = os.path.join(phpSDK, 'Source') # Sometimes, for various reasons, the Source folder from previous build # might exist in phpSDK. If so, remove it first @@ -432,7 +386,7 @@ def build_drivers(self, make_clean = False, dest = None, log_file = None): shutil.move(source_dir, phpSDK) # Invoke phpsdk--.bat - vc = self.compiler_version(sdk_dir) + vc = self.compiler_version() starter_script = 'phpsdk-' + vc + '-' + self.arch + '.bat' print('Running starter script: ', starter_script) os.system(starter_script + ' -t ' + batch_file)