Skip to content

Commit 2e13be2

Browse files
committed
prevent libedit from building strlcat/strlcpy, no idea why their soure code doesn't prevent this correctly itself
1 parent 41fb29e commit 2e13be2

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/SPC/builder/unix/library/libedit.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,27 @@
44

55
namespace SPC\builder\unix\library;
66

7+
use SPC\store\FileSystem;
78
use SPC\util\executor\UnixAutoconfExecutor;
89

910
trait libedit
1011
{
1112
protected function build(): void
1213
{
13-
UnixAutoconfExecutor::create($this)
14+
$make = UnixAutoconfExecutor::create($this)
1415
->appendEnv(['CFLAGS' => '-D__STDC_ISO_10646__=201103L'])
15-
->configure()
16-
->make();
16+
->configure();
17+
18+
foreach (['strlcpy', 'strlcat', 'fgetln'] as $symbol) {
19+
$usymbol = strtoupper($symbol);
20+
FileSystem::replaceFileLineContainsString(
21+
$this->source_dir . '/config.h',
22+
"/* #undef HAVE_{$usymbol} */",
23+
"/* #undef HAVE_{$usymbol} */\n#define {$symbol} libedit_{$symbol}"
24+
);
25+
}
26+
27+
$make->make();
1728
$this->patchPkgconfPrefix(['libedit.pc']);
1829
}
1930
}

src/SPC/store/SourcePatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static function patchBeforeBuildconf(BuilderBase $builder): void
4444
}
4545
foreach ($builder->getLibs() as $lib) {
4646
if ($lib->patchBeforeBuildconf() === true) {
47-
logger()->info("Library [{$lib->getName()}]patched before buildconf");
47+
logger()->info("Library [{$lib->getName()}] patched before buildconf");
4848
}
4949
}
5050
// patch windows php 8.1 bug

0 commit comments

Comments
 (0)