41 lines
1.1 KiB
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
2025-03-10 10:25:35 +01:00
use SPC\store\FileSystem;
2025-06-09 19:32:31 +08:00
use SPC\util\executor\UnixAutoconfExecutor;
trait libacl
{
/**
* @throws FileSystemException
*/
public function patchBeforeMake(): bool
2025-03-10 10:25:35 +01:00
{
$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');
2025-03-10 10:25:35 +01:00
return true;
}
/**
* @throws RuntimeException
*/
protected function build(): void
{
2025-06-09 19:32:31 +08:00
UnixAutoconfExecutor::create($this)
->exec('libtoolize --force --copy')
->exec('./autogen.sh || autoreconf -if')
2025-06-09 19:32:31 +08:00
->configure('--disable-nls', '--disable-tests')
->make();
$this->patchPkgconfPrefix(['libacl.pc'], PKGCONF_PATCH_PREFIX);
}
}