2025-10-08 08:16:54 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\unix\library;
|
|
|
|
|
|
2025-10-21 13:54:34 +02:00
|
|
|
use SPC\store\FileSystem;
|
2025-10-08 08:16:54 +02:00
|
|
|
use SPC\util\executor\UnixAutoconfExecutor;
|
|
|
|
|
|
|
|
|
|
trait libedit
|
|
|
|
|
{
|
|
|
|
|
protected function build(): void
|
|
|
|
|
{
|
2025-10-21 13:54:34 +02:00
|
|
|
$make = UnixAutoconfExecutor::create($this)
|
2025-10-08 09:26:20 +02:00
|
|
|
->appendEnv(['CFLAGS' => '-D__STDC_ISO_10646__=201103L'])
|
2025-10-21 13:54:34 +02:00
|
|
|
->configure();
|
|
|
|
|
|
|
|
|
|
foreach (['strlcpy', 'strlcat', 'fgetln'] as $symbol) {
|
|
|
|
|
$usymbol = strtoupper($symbol);
|
|
|
|
|
FileSystem::replaceFileLineContainsString(
|
|
|
|
|
$this->source_dir . '/config.h',
|
|
|
|
|
"/* #undef HAVE_{$usymbol} */",
|
|
|
|
|
"/* #undef HAVE_{$usymbol} */\n#define {$symbol} libedit_{$symbol}"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$make->make();
|
2025-10-08 08:16:54 +02:00
|
|
|
$this->patchPkgconfPrefix(['libedit.pc']);
|
|
|
|
|
}
|
|
|
|
|
}
|