From 2e13be2a7aded02e93f802ab58d9619fb3e28030 Mon Sep 17 00:00:00 2001 From: henderkes Date: Tue, 21 Oct 2025 13:54:34 +0200 Subject: [PATCH] prevent libedit from building strlcat/strlcpy, no idea why their soure code doesn't prevent this correctly itself --- src/SPC/builder/unix/library/libedit.php | 17 ++++++++++++++--- src/SPC/store/SourcePatcher.php | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/SPC/builder/unix/library/libedit.php b/src/SPC/builder/unix/library/libedit.php index e436ee8b..39e14bf7 100644 --- a/src/SPC/builder/unix/library/libedit.php +++ b/src/SPC/builder/unix/library/libedit.php @@ -4,16 +4,27 @@ declare(strict_types=1); namespace SPC\builder\unix\library; +use SPC\store\FileSystem; use SPC\util\executor\UnixAutoconfExecutor; trait libedit { protected function build(): void { - UnixAutoconfExecutor::create($this) + $make = UnixAutoconfExecutor::create($this) ->appendEnv(['CFLAGS' => '-D__STDC_ISO_10646__=201103L']) - ->configure() - ->make(); + ->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(); $this->patchPkgconfPrefix(['libedit.pc']); } } diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index c08204f5..c7738e92 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -44,7 +44,7 @@ class SourcePatcher } foreach ($builder->getLibs() as $lib) { 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