mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 05:14:52 +08:00
28 lines
688 B
PHP
28 lines
688 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace SPC\builder\extension;
|
|
|
|
use SPC\builder\Extension;
|
|
use SPC\builder\macos\MacOSBuilder;
|
|
use SPC\util\CustomExt;
|
|
|
|
#[CustomExt('iconv')]
|
|
class iconv extends Extension
|
|
{
|
|
public function patchBeforeConfigure(): bool
|
|
{
|
|
// macOS need to link iconv dynamically, we add it to extra-libs
|
|
if (!$this->builder instanceof MacOSBuilder) {
|
|
return false;
|
|
}
|
|
$extra_libs = $this->builder->getOption('extra-libs', '');
|
|
if (!str_contains($extra_libs, '-liconv')) {
|
|
$extra_libs .= ' -liconv';
|
|
}
|
|
$this->builder->setOption('extra-libs', $extra_libs);
|
|
return true;
|
|
}
|
|
}
|