Removed source indexing code from build scripts (#1132)
This commit is contained in:
parent
1aca278245
commit
7e58d1aa92
|
@ -5,7 +5,7 @@
|
||||||
To build extensions for
|
To build extensions for
|
||||||
1. PHP 7.0* or PHP 7.1*
|
1. PHP 7.0* or PHP 7.1*
|
||||||
* install Visual Studio 2015 and make sure C++ tools are enabled.
|
* install Visual Studio 2015 and make sure C++ tools are enabled.
|
||||||
2. PHP 7.2*
|
2. PHP 7.2* or above
|
||||||
* install Visual Studio 2017, including Visual C++ toolset and the Windows SDK components.
|
* install Visual Studio 2017, including Visual C++ toolset and the Windows SDK components.
|
||||||
|
|
||||||
To use the sample build scripts `builddrivers.py` and `buildtools.py`, install Python 3.x and Git for Windows (which comes with Visual Studio 2017). If `git` is unrecognized in a regular command prompt, make sure the environment path is set up correctly.
|
To use the sample build scripts `builddrivers.py` and `buildtools.py`, install Python 3.x and Git for Windows (which comes with Visual Studio 2017). If `git` is unrecognized in a regular command prompt, make sure the environment path is set up correctly.
|
||||||
|
@ -14,7 +14,7 @@ To use the sample build scripts `builddrivers.py` and `buildtools.py`, install P
|
||||||
|
|
||||||
You must first be able to build PHP 7.* without including our PHP extensions. For help with building PHP 7.0* or PHP 7.1* in Windows, see the [official PHP website](https://wiki.php.net/internals/windows/stepbystepbuild). For PHP 7.2 or above, visit [PHP SDK page](https://github.com/OSTC/php-sdk-binary-tools) for new instructions.
|
You must first be able to build PHP 7.* without including our PHP extensions. For help with building PHP 7.0* or PHP 7.1* in Windows, see the [official PHP website](https://wiki.php.net/internals/windows/stepbystepbuild). For PHP 7.2 or above, visit [PHP SDK page](https://github.com/OSTC/php-sdk-binary-tools) for new instructions.
|
||||||
|
|
||||||
The Microsoft Drivers for PHP for SQL Server have been compiled and tested with PHP 7.0.* and 7.1.* using Visual C++ 2015 as well as PHP 7.2.1 using Visual C++ 2017 v15.5.
|
The Microsoft Drivers for PHP for SQL Server have been compiled and tested with PHP 7.0.* and 7.1.* using Visual C++ 2015 as well as PHP 7.2+ using Visual C++ 2017 v15.*.
|
||||||
|
|
||||||
### Manually building from source
|
### Manually building from source
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ The sample build scripts, `builddrivers.py` and `buildtools.py`, can be used to
|
||||||
|
|
||||||
#### Overview
|
#### Overview
|
||||||
|
|
||||||
When asked to provide the PHP version, you should enter values like `7.1.7`. If it's alpha, beta, or RC version, make sure the name you provide matches the PHP tag name without the prefix `php-`. For example, for PHP 7.2 beta 2, the tag name is `php-7.2.0beta2`, so you will enter `7.2.0beta2`. Visit [PHP SRC]( https://github.com/php/php-src) to find the appropriate tag names.
|
When asked to provide the PHP version, you should enter values like `7.3.17`. If it's alpha, beta, or RC version, make sure the name you provide matches the PHP tag name without the prefix `php-`. For example, for PHP 7.4 beta 2, the tag name is `php-7.4.0beta2`, so you will enter `7.4.0beta2`. Visit [PHP SRC]( https://github.com/php/php-src) to find the appropriate tag names.
|
||||||
|
|
||||||
PHP recommends to unzip the PHP SDK into the shortest possible path, preferrably somewhere near the root drive. Therefore, this script will, by default, create a `php-sdk` folder in the C:\ drive, and this `php-sdk` directory tree will remain unless you remove it yourself. For ongoing development, we suggest you keep it around. The build scripts will handle updating the PHP SDK if a new version is available.
|
PHP recommends to unzip the PHP SDK into the shortest possible path, preferrably somewhere near the root drive. Therefore, this script will, by default, create a `php-sdk` folder in the C:\ drive, and this `php-sdk` directory tree will remain unless you remove it yourself. For ongoing development, we suggest you keep it around. The build scripts will handle updating the PHP SDK if a new version is available.
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ PHP recommends to unzip the PHP SDK into the shortest possible path, preferrably
|
||||||
|
|
||||||
3. Interactive mode:
|
3. Interactive mode:
|
||||||
* Type `py builddrivers.py` to start the interactive mode. Use lower cases to answer the following questions:
|
* Type `py builddrivers.py` to start the interactive mode. Use lower cases to answer the following questions:
|
||||||
* PHP Version (e.g. `7.1.7` or `7.2.1`)
|
* PHP Version
|
||||||
* 64-bit?
|
* 64-bit?
|
||||||
* Thread safe?
|
* Thread safe?
|
||||||
* Driver?
|
* Driver?
|
||||||
|
@ -68,8 +68,8 @@ PHP recommends to unzip the PHP SDK into the shortest possible path, preferrably
|
||||||
4. Use Command-line arguments
|
4. Use Command-line arguments
|
||||||
* Type `py builddrivers.py -h` to get a list of options and their descriptions
|
* Type `py builddrivers.py -h` to get a list of options and their descriptions
|
||||||
* For example,
|
* For example,
|
||||||
* `py builddrivers.py --PHPVER=7.2.1 --ARCH=x64 --THREAD=nts --DRIVER=sqlsrv --SOURCE=C:\local\source`
|
* `py builddrivers.py --PHPVER=7.4.5 --ARCH=x64 --THREAD=nts --DRIVER=sqlsrv --SOURCE=C:\local\source`
|
||||||
* `py builddrivers.py --PHPVER=7.1.13 --ARCH=x86 --THREAD=ts --DEBUG`
|
* `py builddrivers.py --PHPVER=7.2.30 --ARCH=x86 --THREAD=ts --DEBUG`
|
||||||
|
|
||||||
5. Based on the given configuration, if the script detects the presence of the PHP source directory, you can choose whether to rebuild, clean or superclean:
|
5. Based on the given configuration, if the script detects the presence of the PHP source directory, you can choose whether to rebuild, clean or superclean:
|
||||||
* `rebuild` to build again using the same configuration (32 bit, thread safe, etc.)
|
* `rebuild` to build again using the same configuration (32 bit, thread safe, etc.)
|
||||||
|
|
|
@ -26,7 +26,6 @@ import os.path
|
||||||
import argparse
|
import argparse
|
||||||
import subprocess
|
import subprocess
|
||||||
from buildtools import BuildUtil
|
from buildtools import BuildUtil
|
||||||
from indexsymbols import *
|
|
||||||
|
|
||||||
class BuildDriver(object):
|
class BuildDriver(object):
|
||||||
"""Build sqlsrv and/or pdo_sqlsrv drivers with PHP source with the following properties:
|
"""Build sqlsrv and/or pdo_sqlsrv drivers with PHP source with the following properties:
|
||||||
|
@ -40,8 +39,6 @@ class BuildDriver(object):
|
||||||
make_clean # a boolean flag - whether make clean is necessary
|
make_clean # a boolean flag - whether make clean is necessary
|
||||||
source_path # path to a local source folder
|
source_path # path to a local source folder
|
||||||
testing # whether the user has turned on testing mode
|
testing # whether the user has turned on testing mode
|
||||||
srctool_path # path to source indexing tools (empty string by default)
|
|
||||||
tag_version # tag version for source indexing (empty string by default)
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, phpver, driver, arch, thread, debug, repo, branch, source, path, testing, no_rename):
|
def __init__(self, phpver, driver, arch, thread, debug, repo, branch, source, path, testing, no_rename):
|
||||||
|
@ -53,8 +50,6 @@ class BuildDriver(object):
|
||||||
self.testing = testing
|
self.testing = testing
|
||||||
self.rebuild = False
|
self.rebuild = False
|
||||||
self.make_clean = False
|
self.make_clean = False
|
||||||
self.srctool_path = ''
|
|
||||||
self.tag_version = ''
|
|
||||||
|
|
||||||
def show_config(self):
|
def show_config(self):
|
||||||
print()
|
print()
|
||||||
|
@ -118,34 +113,6 @@ class BuildDriver(object):
|
||||||
print("The path provided is invalid. Please re-enter.")
|
print("The path provided is invalid. Please re-enter.")
|
||||||
return source
|
return source
|
||||||
|
|
||||||
def index_all_symbols(self, ext_dir, srctool_path, tag_version):
|
|
||||||
"""This takes care of indexing all the symbols
|
|
||||||
|
|
||||||
:param ext_dir: the directory where we can find the built extension(s)
|
|
||||||
:param srctool_path: the path to the tools for source indexing
|
|
||||||
:param tag_version: tag version for source indexing
|
|
||||||
:outcome: all symbols will be source indexed
|
|
||||||
"""
|
|
||||||
work_dir = os.path.dirname(os.path.realpath(__file__))
|
|
||||||
os.chdir(srctool_path)
|
|
||||||
|
|
||||||
if self.util.driver == 'all':
|
|
||||||
driver = 'sqlsrv'
|
|
||||||
pdbfile = os.path.join(ext_dir, self.util.driver_name(driver, '.pdb'))
|
|
||||||
print('Indexing this symbol: ', pdbfile)
|
|
||||||
run_indexing_tools(pdbfile, driver, tag_version)
|
|
||||||
driver = 'pdo_sqlsrv'
|
|
||||||
pdbfile = os.path.join(ext_dir, self.util.driver_name(driver, '.pdb'))
|
|
||||||
print('Indexing this symbol: ', pdbfile)
|
|
||||||
run_indexing_tools(pdbfile, driver, tag_version)
|
|
||||||
else:
|
|
||||||
driver = self.util.driver
|
|
||||||
pdbfile = os.path.join(ext_dir, self.util.driver_name(driver, '.pdb'))
|
|
||||||
print('Indexing this symbol: ', pdbfile)
|
|
||||||
run_indexing_tools(pdbfile, driver, tag_version)
|
|
||||||
|
|
||||||
os.chdir(work_dir)
|
|
||||||
|
|
||||||
def build_extensions(self, root_dir, logfile):
|
def build_extensions(self, root_dir, logfile):
|
||||||
"""This takes care of getting the drivers' source files, building the drivers.
|
"""This takes care of getting the drivers' source files, building the drivers.
|
||||||
If dest_path is defined, the binaries will be copied to the designated destinations.
|
If dest_path is defined, the binaries will be copied to the designated destinations.
|
||||||
|
@ -185,12 +152,6 @@ class BuildDriver(object):
|
||||||
# ext_dir is the directory where we can find the built extension(s)
|
# ext_dir is the directory where we can find the built extension(s)
|
||||||
ext_dir = self.util.build_drivers(self.make_clean, dest, logfile)
|
ext_dir = self.util.build_drivers(self.make_clean, dest, logfile)
|
||||||
|
|
||||||
# Do source indexing only if the tag and tools path are both specified
|
|
||||||
if self.tag_version is not '' and self.srctool_path is not '':
|
|
||||||
print('Source indexing begins...')
|
|
||||||
self.index_all_symbols(ext_dir, self.srctool_path, self.tag_version)
|
|
||||||
print('Source indexing done')
|
|
||||||
|
|
||||||
# Copy the binaries if a destination path is defined
|
# Copy the binaries if a destination path is defined
|
||||||
if self.dest_path is not None:
|
if self.dest_path is not None:
|
||||||
dest_drivers = os.path.join(self.dest_path, self.util.major_version(), self.util.arch)
|
dest_drivers = os.path.join(self.dest_path, self.util.major_version(), self.util.arch)
|
||||||
|
@ -212,12 +173,10 @@ class BuildDriver(object):
|
||||||
|
|
||||||
return ext_dir
|
return ext_dir
|
||||||
|
|
||||||
def build(self, srctool_path, tag_version):
|
def build(self):
|
||||||
"""This is the main entry point of building drivers for PHP.
|
"""This is the main entry point of building drivers for PHP.
|
||||||
For development, this will loop till the user decides to quit.
|
For development, this will loop till the user decides to quit.
|
||||||
|
|
||||||
:param srctool_path: the path to the tools for source indexing
|
|
||||||
:param tag_version: tag version for source indexing
|
|
||||||
"""
|
"""
|
||||||
self.show_config()
|
self.show_config()
|
||||||
|
|
||||||
|
@ -234,10 +193,6 @@ class BuildDriver(object):
|
||||||
|
|
||||||
logfile = self.util.get_logfile_name()
|
logfile = self.util.get_logfile_name()
|
||||||
|
|
||||||
# Save source indexing details
|
|
||||||
self.srctool_path = srctool_path
|
|
||||||
self.tag_version = tag_version
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ext_dir = self.build_extensions(root_dir, logfile)
|
ext_dir = self.build_extensions(root_dir, logfile)
|
||||||
print('Build Completed')
|
print('Build Completed')
|
||||||
|
@ -280,7 +235,7 @@ def validate_input(question, values):
|
||||||
################################### Main Function ###################################
|
################################### Main Function ###################################
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--PHPVER', help="PHP version, e.g. 7.1.*, 7.2.* etc.")
|
parser.add_argument('--PHPVER', help="PHP version, e.g. 7.4.* etc.")
|
||||||
parser.add_argument('--ARCH', choices=['x64', 'x86'])
|
parser.add_argument('--ARCH', choices=['x64', 'x86'])
|
||||||
parser.add_argument('--THREAD', choices=['nts', 'ts'])
|
parser.add_argument('--THREAD', choices=['nts', 'ts'])
|
||||||
parser.add_argument('--DRIVER', default='all', choices=['all', 'sqlsrv', 'pdo_sqlsrv'], help="driver to build (default: all)")
|
parser.add_argument('--DRIVER', default='all', choices=['all', 'sqlsrv', 'pdo_sqlsrv'], help="driver to build (default: all)")
|
||||||
|
@ -291,8 +246,6 @@ if __name__ == '__main__':
|
||||||
parser.add_argument('--TESTING', action='store_true', help="turns on testing mode (default: False)")
|
parser.add_argument('--TESTING', action='store_true', help="turns on testing mode (default: False)")
|
||||||
parser.add_argument('--DESTPATH', default=None, help="an alternative destination for the drivers (default: None)")
|
parser.add_argument('--DESTPATH', default=None, help="an alternative destination for the drivers (default: None)")
|
||||||
parser.add_argument('--NO_RENAME', action='store_true', help="drivers will not be renamed(default: False)")
|
parser.add_argument('--NO_RENAME', action='store_true', help="drivers will not be renamed(default: False)")
|
||||||
parser.add_argument('--SRCIDX_PATH', default='', help="the path to the tools for source indexing (default: '')")
|
|
||||||
parser.add_argument('--TAG_VERSION', default='', help="the tag version for source indexing (default: '')")
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
@ -354,4 +307,5 @@ if __name__ == '__main__':
|
||||||
path,
|
path,
|
||||||
testing,
|
testing,
|
||||||
no_rename)
|
no_rename)
|
||||||
builder.build(args.SRCIDX_PATH, args.TAG_VERSION)
|
|
||||||
|
builder.build()
|
||||||
|
|
|
@ -100,7 +100,7 @@ class BuildUtil(object):
|
||||||
|
|
||||||
def compiler_version(self, sdk_dir):
|
def compiler_version(self, sdk_dir):
|
||||||
"""Return the appropriate compiler version based on PHP version."""
|
"""Return the appropriate compiler version based on PHP version."""
|
||||||
if self.vc is '':
|
if self.vc == '':
|
||||||
VC = 'vc14'
|
VC = 'vc14'
|
||||||
version = self.version_label()
|
version = self.version_label()
|
||||||
if version >= '72': # Compiler version for PHP 7.2 or above
|
if version >= '72': # Compiler version for PHP 7.2 or above
|
||||||
|
|
Loading…
Reference in a new issue