2024-02-16 01:28:10 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\extension;
|
|
|
|
|
|
|
|
|
|
use SPC\builder\Extension;
|
|
|
|
|
use SPC\builder\macos\MacOSBuilder;
|
|
|
|
|
use SPC\store\FileSystem;
|
|
|
|
|
use SPC\util\CustomExt;
|
|
|
|
|
|
|
|
|
|
#[CustomExt('gettext')]
|
|
|
|
|
class gettext extends Extension
|
|
|
|
|
{
|
2024-02-16 23:04:58 +08:00
|
|
|
public function patchBeforeBuildconf(): bool
|
|
|
|
|
{
|
2024-02-16 23:28:14 +08:00
|
|
|
if ($this->builder instanceof MacOSBuilder) {
|
|
|
|
|
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/gettext/config.m4', 'AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB', 'AC_CHECK_LIB(intl');
|
|
|
|
|
}
|
2024-02-16 23:04:58 +08:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-16 01:28:10 +08:00
|
|
|
public function patchBeforeConfigure(): bool
|
|
|
|
|
{
|
2024-02-16 23:28:14 +08:00
|
|
|
if ($this->builder instanceof MacOSBuilder) {
|
|
|
|
|
$frameworks = ' ' . $this->builder->getFrameworks(true) . ' ';
|
|
|
|
|
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/configure', '-lintl', $this->getLibFilesString() . $frameworks);
|
|
|
|
|
}
|
2024-02-16 01:28:10 +08:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|