diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 43e0a5e8..81f8cac9 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -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; + } } diff --git a/src/SPC/builder/extension/sockets.php b/src/SPC/builder/extension/sockets.php new file mode 100644 index 00000000..a0901415 --- /dev/null +++ b/src/SPC/builder/extension/sockets.php @@ -0,0 +1,21 @@ +execWithEnv( './configure ' . - '--enable-static --disable-shared ' . + '--enable-static --disable-shared --with-pic ' . '--prefix=' ) ->execWithEnv('make clean') diff --git a/src/SPC/command/BuildPHPCommand.php b/src/SPC/command/BuildPHPCommand.php index 49067b0b..8226b045 100644 --- a/src/SPC/command/BuildPHPCommand.php +++ b/src/SPC/command/BuildPHPCommand.php @@ -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)) { diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index b5de166f..24ba666c 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -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 *