mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-09 09:55:37 +08:00
Add pdo_sqlsrv, libyaml patches from v2
This commit is contained in:
@@ -12,10 +12,8 @@ ext-calendar:
|
|||||||
ext-com_dotnet:
|
ext-com_dotnet:
|
||||||
type: php-extension
|
type: php-extension
|
||||||
php-extension:
|
php-extension:
|
||||||
support:
|
os:
|
||||||
Linux: 'no'
|
- Windows
|
||||||
Darwin: 'no'
|
|
||||||
BSD: 'no'
|
|
||||||
arg-type@windows: '--enable-com-dotnet=yes'
|
arg-type@windows: '--enable-com-dotnet=yes'
|
||||||
ext-ctype:
|
ext-ctype:
|
||||||
type: php-extension
|
type: php-extension
|
||||||
|
|||||||
39
src/Package/Extension/pdo_sqlsrv.php
Normal file
39
src/Package/Extension/pdo_sqlsrv.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Package\Extension;
|
||||||
|
|
||||||
|
use Package\Target\php;
|
||||||
|
use StaticPHP\Attribute\Package\BeforeStage;
|
||||||
|
use StaticPHP\Attribute\Package\Extension;
|
||||||
|
use StaticPHP\Attribute\PatchDescription;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
|
#[Extension('pdo_sqlsrv')]
|
||||||
|
class pdo_sqlsrv
|
||||||
|
{
|
||||||
|
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-pdo_sqlsrv')]
|
||||||
|
#[PatchDescription('Remove /sdl flag from pdo_sqlsrv config.w32 to prevent strict SDL check compilation failures')]
|
||||||
|
public function patchBeforeBuildconfForWindows(): void
|
||||||
|
{
|
||||||
|
// Fix the compilation issue of pdo_sqlsrv on Windows (/sdl check is too strict and will cause Zend compilation to fail)
|
||||||
|
if (file_exists(SOURCE_PATH . '/php-src/ext/pdo_sqlsrv/config.w32')) {
|
||||||
|
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/pdo_sqlsrv/config.w32', '/sdl', '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-pdo_sqlsrv')]
|
||||||
|
#[PatchDescription('Fix pdo_sqlsrv directory structure for PHP 8.5+ (source layout changed)')]
|
||||||
|
public function patchDirectoryStructureForPhp85(): void
|
||||||
|
{
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
28
src/Package/Extension/yaml.php
Normal file
28
src/Package/Extension/yaml.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Package\Extension;
|
||||||
|
|
||||||
|
use Package\Target\php;
|
||||||
|
use StaticPHP\Attribute\Package\BeforeStage;
|
||||||
|
use StaticPHP\Attribute\Package\Extension;
|
||||||
|
use StaticPHP\Attribute\PatchDescription;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
|
#[Extension('yaml')]
|
||||||
|
class yaml
|
||||||
|
{
|
||||||
|
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-yaml')]
|
||||||
|
#[PatchDescription('Fix yaml config.w32 to always link against static libyaml on Windows')]
|
||||||
|
public function patchBeforeBuildconfForWindows(): void
|
||||||
|
{
|
||||||
|
// Force static libyaml linkage: config.w32 normally only picks libs ending in '_a.lib',
|
||||||
|
// but libyaml may not follow that naming convention, so we add 'yes' == 'yes' to always match.
|
||||||
|
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'"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user