From c1e91e1ccb56c552d632bc76351fea1338861e1e Mon Sep 17 00:00:00 2001 From: henderkes Date: Sat, 17 May 2025 22:40:30 +0700 Subject: [PATCH] sockets doesn't install header?! --- src/SPC/builder/Extension.php | 10 ++++++++++ src/SPC/builder/extension/sockets.php | 21 +++++++++++++++++++++ src/SPC/builder/unix/library/gmp.php | 2 +- src/SPC/command/BuildPHPCommand.php | 4 +++- src/SPC/store/SourcePatcher.php | 9 +++++++++ 5 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 src/SPC/builder/extension/sockets.php 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 *