mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
use source extract hook for pdo_sqlsrv
This commit is contained in:
parent
1d5aec037b
commit
b2182b4fe1
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('pdo_sqlsrv')]
|
||||
class pdo_sqlsrv extends Extension
|
||||
{
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
if (!file_exists($this->source_dir . '/config.m4') && is_dir($this->source_dir . '/source/pdo_sqlsrv')) {
|
||||
FileSystem::moveFileOrDir($this->source_dir . '/LICENSE', $this->source_dir . '/source/pdo_sqlsrv/LICENSE');
|
||||
FileSystem::moveFileOrDir($this->source_dir . '/source/shared', $this->source_dir . '/source/pdo_sqlsrv/shared');
|
||||
FileSystem::moveFileOrDir($this->source_dir . '/source/pdo_sqlsrv', SOURCE_PATH . '/pdo_sqlsrv');
|
||||
FileSystem::removeDir($this->source_dir);
|
||||
FileSystem::moveFileOrDir(SOURCE_PATH . '/pdo_sqlsrv', $this->source_dir);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -25,6 +25,7 @@ class SourcePatcher
|
||||
FileSystem::addSourceExtractHook('php-src', [__CLASS__, 'patchFfiCentos7FixO3strncmp']);
|
||||
FileSystem::addSourceExtractHook('sqlsrv', [__CLASS__, 'patchSQLSRVWin32']);
|
||||
FileSystem::addSourceExtractHook('pdo_sqlsrv', [__CLASS__, 'patchSQLSRVWin32']);
|
||||
FileSystem::addSourceExtractHook('pdo_sqlsrv', [__CLASS__, 'patchSQLSRVPhp85']);
|
||||
FileSystem::addSourceExtractHook('yaml', [__CLASS__, 'patchYamlWin32']);
|
||||
FileSystem::addSourceExtractHook('libyaml', [__CLASS__, 'patchLibYaml']);
|
||||
FileSystem::addSourceExtractHook('php-src', [__CLASS__, 'patchImapLicense']);
|
||||
@ -432,6 +433,23 @@ class SourcePatcher
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix the compilation issue of pdo_sqlsrv with php 8.5
|
||||
*/
|
||||
public static function patchSQLSRVPhp85(): bool
|
||||
{
|
||||
$source_dir = SOURCE_PATH . '/php-src/ext/pdo_sqlsrv';
|
||||
if (!file_exists($source_dir . '/config.m4') && is_dir($source_dir . '/source/pdo_sqlsrv')) {
|
||||
FileSystem::moveFileOrDir($source_dir . '/LICENSE', $source_dir . '/source/pdo_sqlsrv/LICENSE');
|
||||
FileSystem::moveFileOrDir($source_dir . '/source/shared', $source_dir . '/source/pdo_sqlsrv/shared');
|
||||
FileSystem::moveFileOrDir($source_dir . '/source/pdo_sqlsrv', SOURCE_PATH . '/pdo_sqlsrv');
|
||||
FileSystem::removeDir($source_dir);
|
||||
FileSystem::moveFileOrDir(SOURCE_PATH . '/pdo_sqlsrv', $source_dir);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function patchYamlWin32(): bool
|
||||
{
|
||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/yaml/config.w32', "lib.substr(lib.length - 6, 6) == '_a.lib'", "lib.substr(lib.length - 6, 6) == '_a.lib' || 'yes' == 'yes'");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user