37 lines
1005 B
PHP
Raw Normal View History

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\exception\FileSystemException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('gettext')]
class gettext extends Extension
{
/**
* @throws FileSystemException
2024-02-16 23:04:58 +08:00
*/
public function patchBeforeBuildconf(): bool
{
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/gettext/config.m4', 'AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB', 'AC_CHECK_LIB(intl');
return true;
}
/**
2024-02-16 01:28:10 +08:00
* @throws WrongUsageException
2024-02-16 23:04:58 +08:00
* @throws FileSystemException
2024-02-16 01:28:10 +08:00
*/
public function patchBeforeConfigure(): bool
{
$frameworks = $this->builder instanceof MacOSBuilder ? ' ' . $this->builder->getFrameworks(true) . ' ' : '';
2024-02-16 23:04:58 +08:00
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/configure', '-lintl', $this->getLibFilesString() . $frameworks);
2024-02-16 01:28:10 +08:00
return true;
}
}