prevent libedit from building strlcat/strlcpy, no idea why their soure code doesn't prevent this correctly itself

This commit is contained in:
henderkes 2025-10-21 13:54:34 +02:00
parent 41fb29eba4
commit 2e13be2a7a
2 changed files with 15 additions and 4 deletions

View File

@ -4,16 +4,27 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\store\FileSystem;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
trait libedit trait libedit
{ {
protected function build(): void protected function build(): void
{ {
UnixAutoconfExecutor::create($this) $make = UnixAutoconfExecutor::create($this)
->appendEnv(['CFLAGS' => '-D__STDC_ISO_10646__=201103L']) ->appendEnv(['CFLAGS' => '-D__STDC_ISO_10646__=201103L'])
->configure() ->configure();
->make();
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();
$this->patchPkgconfPrefix(['libedit.pc']); $this->patchPkgconfPrefix(['libedit.pc']);
} }
} }

View File

@ -44,7 +44,7 @@ class SourcePatcher
} }
foreach ($builder->getLibs() as $lib) { foreach ($builder->getLibs() as $lib) {
if ($lib->patchBeforeBuildconf() === true) { if ($lib->patchBeforeBuildconf() === true) {
logger()->info("Library [{$lib->getName()}]patched before buildconf"); logger()->info("Library [{$lib->getName()}] patched before buildconf");
} }
} }
// patch windows php 8.1 bug // patch windows php 8.1 bug