patch libacl WIP

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

View File

@ -294,6 +294,11 @@ abstract class LibraryBase
// do something before pack, default do nothing. overwrite this method to do something (e.g. modify pkg-config file) // do something before pack, default do nothing. overwrite this method to do something (e.g. modify pkg-config file)
} }
public function patchBeforeConfigure(): bool
{
return false;
}
/** /**
* Build this library. * Build this library.
* *

View File

@ -4,19 +4,29 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\builder\linux\library\LinuxLibraryBase;
use SPC\exception\RuntimeException; use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
trait libacl trait libacl
{ {
public function patchBeforeConfigure(): bool
{
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/sapi/fpm/config.m4', '[AS_VAR_APPEND([FPM_EXTRA_LIBS],', ',');
return true;
}
/** /**
* @throws RuntimeException * @throws RuntimeException
*/ */
protected function build(): void protected function build(): void
{ {
$cflags = PHP_OS_FAMILY !== 'Linux' ? '-Wimplicit-function-declaration -Wno-int-conversion' : '';
$ldflags = !($this instanceof LinuxLibraryBase) ? '' : '--static';
shell()->cd($this->source_dir) shell()->cd($this->source_dir)
->setEnv([ ->setEnv([
'CFLAGS' => trim('-I' . BUILD_INCLUDE_PATH . ' ' . $this->getLibExtraCFlags()), 'CFLAGS' => trim('-I' . BUILD_INCLUDE_PATH . ' ' . $this->getLibExtraCFlags() . ' ' . $cflags),
'LDFLAGS' => trim('-L' . BUILD_LIB_PATH . ' ' . $this->getLibExtraLdFlags()), 'LDFLAGS' => trim('-L' . BUILD_LIB_PATH . ' ' . $this->getLibExtraLdFlags() . ' ' . $ldflags),
'LIBS' => $this->getLibExtraLibs(), 'LIBS' => $this->getLibExtraLibs(),
]) ])
->execWithEnv('./autogen.sh') ->execWithEnv('./autogen.sh')

View File

@ -85,6 +85,11 @@ class SourcePatcher
logger()->info('Extension [' . $ext->getName() . '] patched before configure'); logger()->info('Extension [' . $ext->getName() . '] patched before configure');
} }
} }
foreach ($builder->getLibs() as $lib) {
if ($lib->patchBeforeConfigure() === true) {
logger()->info('Library [' . $lib->getName() . '] patched before configure');
}
}
// patch capstone // patch capstone
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/have_capstone="yes"/', 'have_capstone="no"'); FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/have_capstone="yes"/', 'have_capstone="no"');
if ($builder instanceof LinuxBuilder && $builder->libc === 'glibc') { if ($builder instanceof LinuxBuilder && $builder->libc === 'glibc') {