patch the makefile before make (remove -lacl from FPM_EXTRA_LIBS)

This commit is contained in:
Marc Henderkes
2025-03-10 11:25:38 +01:00
parent 4e32ff47df
commit be3d68cebe
3 changed files with 22 additions and 3 deletions

View File

@@ -299,6 +299,11 @@ abstract class LibraryBase
return false;
}
public function patchBeforeMake(): bool
{
return false;
}
/**
* Build this library.
*

View File

@@ -5,14 +5,23 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\builder\linux\library\LinuxLibraryBase;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
trait libacl
{
public function patchBeforeConfigure(): bool
/**
* @throws FileSystemException
*/
public function patchBeforeMake(): bool
{
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/sapi/fpm/config.m4', '[AS_VAR_APPEND([FPM_EXTRA_LIBS],', ',');
$file_path = SOURCE_PATH . '/php-src/Makefile';
$file_content = FileSystem::readFile($file_path);
if (!preg_match('/FPM_EXTRA_LIBS =(.*)-lacl/', $file_content)) {
return false;
}
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/Makefile', '/FPM_EXTRA_LIBS =(.*)-lacl ?(.*)/', 'FPM_EXTRA_LIBS =$1$2');
return true;
}