Add separated patchedBeforeWindowsConfigure

This commit is contained in:
crazywhalecc 2025-08-01 01:28:56 +08:00
parent e1c9240698
commit 07d66ade85
5 changed files with 22 additions and 5 deletions

View File

@ -183,6 +183,14 @@ class Extension
return false;
}
/**
* Patch code before ./configure.bat for Windows
*/
public function patchBeforeWindowsConfigure(): bool
{
return false;
}
/**
* Patch code before make
* If you need to patch some code, overwrite this

View File

@ -288,6 +288,16 @@ abstract class LibraryBase
return false;
}
/**
* Patch code before windows configure.bat
* If you need to patch some code, overwrite this
* return true if you patched something, false if not
*/
public function patchBeforeWindowsConfigure(): bool
{
return false;
}
/**
* Patch code before make
* If you need to patch some code, overwrite this

View File

@ -20,9 +20,6 @@ class bz2 extends Extension
*/
public function patchBeforeConfigure(): bool
{
if (!is_unix()) {
return false;
}
$frameworks = $this->builder instanceof MacOSBuilder ? ' ' . $this->builder->getFrameworks(true) . ' ' : '';
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/-lbz2/', $this->getLibFilesString() . $frameworks);
return true;

View File

@ -24,7 +24,7 @@ class sqlsrv extends Extension
return false;
}
public function patchBeforeConfigure(): bool
public function patchBeforeWindowsConfigure(): bool
{
if ($this->pdo_sqlsrv_patched) {
// revert pdo_sqlsrv patch

View File

@ -7,6 +7,7 @@ namespace SPC\store;
use SPC\builder\BuilderBase;
use SPC\builder\linux\SystemUtil;
use SPC\builder\unix\UnixBuilderBase;
use SPC\builder\windows\WindowsBuilder;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
@ -87,7 +88,8 @@ class SourcePatcher
public static function patchBeforeConfigure(BuilderBase $builder): void
{
foreach ($builder->getExts() as $ext) {
if ($ext->patchBeforeConfigure() === true) {
$patch = $builder instanceof WindowsBuilder ? $ext->patchBeforeWindowsConfigure() : $ext->patchBeforeConfigure();
if ($patch === true) {
logger()->info("Extension [{$ext->getName()}] patched before configure");
}
}