Modify buildscripts to configure php.ini
This commit is contained in:
parent
b34d5bdb8c
commit
7a3d6983cd
|
@ -123,7 +123,12 @@ class BuildDriver(object):
|
||||||
"""
|
"""
|
||||||
work_dir = os.path.dirname(os.path.realpath(__file__))
|
work_dir = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
if self.source_path is None:
|
get_source = False if self.source_path is None else True
|
||||||
|
if self.repo is None or self.branch is None:
|
||||||
|
# If GitHub repo or branch is None, get the source locally
|
||||||
|
get_source = True
|
||||||
|
|
||||||
|
if not get_source:
|
||||||
# This will download from the specified branch on GitHub repo and copy the source
|
# This will download from the specified branch on GitHub repo and copy the source
|
||||||
self.util.download_msphpsql_source(repo, branch)
|
self.util.download_msphpsql_source(repo, branch)
|
||||||
else:
|
else:
|
||||||
|
@ -165,6 +170,7 @@ class BuildDriver(object):
|
||||||
self.util.copy_binary(ext_dir, dest_drivers, self.util.driver, '.dll')
|
self.util.copy_binary(ext_dir, dest_drivers, self.util.driver, '.dll')
|
||||||
self.util.copy_binary(ext_dir, dest_symbols, self.util.driver, '.pdb')
|
self.util.copy_binary(ext_dir, dest_symbols, self.util.driver, '.pdb')
|
||||||
|
|
||||||
|
return ext_dir
|
||||||
|
|
||||||
def build(self):
|
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.
|
||||||
|
@ -186,7 +192,7 @@ class BuildDriver(object):
|
||||||
logfile = self.util.get_logfile_name()
|
logfile = self.util.get_logfile_name()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.build_extensions(root_dir, logfile)
|
ext_dir = self.build_extensions(root_dir, logfile)
|
||||||
print('Build Completed')
|
print('Build Completed')
|
||||||
except:
|
except:
|
||||||
print('Something went wrong, launching log file', logfile)
|
print('Something went wrong, launching log file', logfile)
|
||||||
|
@ -194,7 +200,7 @@ class BuildDriver(object):
|
||||||
if not self.testing:
|
if not self.testing:
|
||||||
os.startfile(os.path.join(root_dir, 'php-sdk', logfile))
|
os.startfile(os.path.join(root_dir, 'php-sdk', logfile))
|
||||||
os.chdir(work_dir)
|
os.chdir(work_dir)
|
||||||
break
|
exit(1)
|
||||||
|
|
||||||
if not self.testing:
|
if not self.testing:
|
||||||
choice = input("Rebuild using the same configuration(yes) or quit (no) [yes/no]: ")
|
choice = input("Rebuild using the same configuration(yes) or quit (no) [yes/no]: ")
|
||||||
|
@ -277,6 +283,8 @@ if __name__ == '__main__':
|
||||||
repo = 'Microsoft'
|
repo = 'Microsoft'
|
||||||
if branch == '':
|
if branch == '':
|
||||||
branch = 'dev'
|
branch = 'dev'
|
||||||
|
else:
|
||||||
|
repo = branch = None
|
||||||
|
|
||||||
arch_version = arch_version.lower()
|
arch_version = arch_version.lower()
|
||||||
arch = 'x64' if arch_version == 'yes' or arch_version == 'y' or arch_version == '' else 'x86'
|
arch = 'x64' if arch_version == 'yes' or arch_version == 'y' or arch_version == '' else 'x86'
|
||||||
|
|
|
@ -445,21 +445,42 @@ class BuildUtil(object):
|
||||||
else:
|
else:
|
||||||
binary = self.driver_name(driver, suffix)
|
binary = self.driver_name(driver, suffix)
|
||||||
shutil.copy2(os.path.join(from_dir, binary), dest_dir)
|
shutil.copy2(os.path.join(from_dir, binary), dest_dir)
|
||||||
|
if suffix == '.dll':
|
||||||
|
php_ini_file = os.path.join(from_dir, 'php.ini')
|
||||||
|
with open(php_ini_file, 'a') as php_ini:
|
||||||
|
php_ini.write('extension=' + binary + '\n');
|
||||||
|
|
||||||
def copy_binaries(self, sdk_dir, copy_to_ext):
|
def copy_binaries(self, sdk_dir, copy_to_ext):
|
||||||
"""Copy the sqlsrv and/or pdo_sqlsrv binaries, including the pdb files,
|
"""Copy the sqlsrv and/or pdo_sqlsrv binaries, including the pdb files,
|
||||||
to the right place, depending on *copy_to_ext*. The default is to
|
to the right place, depending on *copy_to_ext*. The default is to
|
||||||
copy them to the 'ext' folder.
|
copy them to the 'ext' folder.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Get php.ini file from php.ini-production
|
||||||
build_dir = self.build_abs_path(sdk_dir)
|
build_dir = self.build_abs_path(sdk_dir)
|
||||||
|
php_ini_file = os.path.join(build_dir, 'php.ini')
|
||||||
|
print('Setting up php ini file', php_ini_file)
|
||||||
|
|
||||||
|
# Copy php.ini-production file to php.ini
|
||||||
|
phpsrc = self.phpsrc_root(sdk_dir)
|
||||||
|
shutil.copy(os.path.join(phpsrc, 'php.ini-production'), php_ini_file)
|
||||||
|
|
||||||
|
# Copy run-tests.php as well
|
||||||
|
phpsrc = self.phpsrc_root(sdk_dir)
|
||||||
|
shutil.copy(os.path.join(phpsrc, 'run-tests.php'), build_dir)
|
||||||
|
|
||||||
print('Copying the binaries from', build_dir)
|
print('Copying the binaries from', build_dir)
|
||||||
if copy_to_ext:
|
if copy_to_ext:
|
||||||
dest_dir = os.path.join(build_dir, 'ext')
|
dest_dir = os.path.join(build_dir, 'ext')
|
||||||
|
ext_dir_line = 'extension_dir=ext\\'
|
||||||
else:
|
else:
|
||||||
|
ext_dir_line = 'extension_dir=.\\'
|
||||||
# Simply make a copy of the binaries in sdk_dir
|
# Simply make a copy of the binaries in sdk_dir
|
||||||
dest_dir = sdk_dir
|
dest_dir = sdk_dir
|
||||||
|
|
||||||
print('Destination:', dest_dir)
|
print('Destination:', dest_dir)
|
||||||
|
with open(php_ini_file, 'a') as php_ini:
|
||||||
|
php_ini.write(ext_dir_line + '\n')
|
||||||
|
|
||||||
# Now copy the binaries
|
# Now copy the binaries
|
||||||
if self.driver == 'all':
|
if self.driver == 'all':
|
||||||
|
|
Loading…
Reference in a new issue