sockets doesn't install header?!

This commit is contained in:
henderkes 2025-05-17 22:40:30 +07:00
parent 05e9129a66
commit c1e91e1ccb
5 changed files with 44 additions and 2 deletions

View File

@ -423,4 +423,14 @@ class Extension
return $deps;
}
/**
* Patch code before shared extension ./configure
* If you need to patch some code, overwrite this
* return true if you patched something, false if not
*/
public function patchBeforeSharedBuild(): bool
{
return false;
}
}

View File

@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\util\CustomExt;
#[CustomExt('sockets')]
class sockets extends Extension
{
public function patchBeforeConfigure(): bool
{
if (file_exists(BUILD_INCLUDE_PATH . 'php/ext/sockets/php_sockets.h')) {
return false;
}
copy(SOURCE_PATH . '/php-src/ext/sockets/php_sockets.h', BUILD_INCLUDE_PATH . 'php/ext/sockets/php_sockets.h');
return true;
}
}

View File

@ -23,7 +23,7 @@ trait gmp
])
->execWithEnv(
'./configure ' .
'--enable-static --disable-shared ' .
'--enable-static --disable-shared --with-pic ' .
'--prefix='
)
->execWithEnv('make clean')

View File

@ -208,7 +208,9 @@ class BuildPHPCommand extends BuildCommand
SourcePatcher::patchSPCVersionToPHP($this->getApplication()->getVersion());
// start to build
$builder->buildPHP($rule);
// $builder->buildPHP($rule);
SourcePatcher::patchBeforeSharedBuild($builder);
// build dynamic extensions if needed
if (!empty($shared_extensions)) {

View File

@ -78,6 +78,15 @@ class SourcePatcher
}
}
public static function patchBeforeSharedBuild(BuilderBase $builder): void
{
foreach ($builder->getExts() as $ext) {
if ($ext->patchBeforeSharedBuild() === true) {
logger()->info('Extension [' . $ext->getName() . '] patched before shared build');
}
}
}
/**
* Source patcher runner before configure
*