diff --git a/src/SPC/builder/unix/library/libedit.php b/src/SPC/builder/unix/library/libedit.php index 39e14bf7..f2bcd6e5 100644 --- a/src/SPC/builder/unix/library/libedit.php +++ b/src/SPC/builder/unix/library/libedit.php @@ -9,22 +9,22 @@ use SPC\util\executor\UnixAutoconfExecutor; trait libedit { + public function patchBeforeBuild(): bool + { + FileSystem::replaceFileStr( + $this->source_dir . '/src/sys.h', + '//#define strl', + '#define strl' + ); + return true; + } + protected function build(): void { - $make = UnixAutoconfExecutor::create($this) + UnixAutoconfExecutor::create($this) ->appendEnv(['CFLAGS' => '-D__STDC_ISO_10646__=201103L']) - ->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(); + ->configure() + ->make(); $this->patchPkgconfPrefix(['libedit.pc']); } }