From 4bc30b0b6fd542dcfaa2a62f6fb7345ecbee7eb5 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 7 Sep 2025 10:57:44 +0800 Subject: [PATCH 1/4] Add php-src/config.log for SPCException --- src/SPC/ConsoleApplication.php | 2 +- src/SPC/builder/linux/LinuxBuilder.php | 7 +++---- src/SPC/builder/macos/MacOSBuilder.php | 7 +++---- src/SPC/builder/unix/UnixBuilderBase.php | 17 +++++++++++++++++ 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/SPC/ConsoleApplication.php b/src/SPC/ConsoleApplication.php index c60ca4b0..023b541e 100644 --- a/src/SPC/ConsoleApplication.php +++ b/src/SPC/ConsoleApplication.php @@ -34,7 +34,7 @@ use Symfony\Component\Console\Application; */ final class ConsoleApplication extends Application { - public const string VERSION = '2.7.3'; + public const string VERSION = '2.7.4'; public function __construct() { diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index c4eb2b05..3525ffb7 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -103,9 +103,8 @@ class LinuxBuilder extends UnixBuilderBase ); } - shell()->cd(SOURCE_PATH . '/php-src') - ->exec( - $php_configure_env . ' ' . + $this->seekPhpSrcLogFileOnException(fn () => shell()->cd(SOURCE_PATH . '/php-src')->exec( + $php_configure_env . ' ' . getenv('SPC_CMD_PREFIX_PHP_CONFIGURE') . ' ' . ($enableCli ? '--enable-cli ' : '--disable-cli ') . ($enableFpm ? '--enable-fpm ' . ($this->getLib('libacl') !== null ? '--with-fpm-acl ' : '') : '--disable-fpm ') . @@ -118,7 +117,7 @@ class LinuxBuilder extends UnixBuilderBase $zts . $maxExecutionTimers . $this->makeStaticExtensionArgs() . ' ' - ); + )); $this->emitPatchPoint('before-php-make'); SourcePatcher::patchBeforeMake($this); diff --git a/src/SPC/builder/macos/MacOSBuilder.php b/src/SPC/builder/macos/MacOSBuilder.php index 13a978d3..20a2ed13 100644 --- a/src/SPC/builder/macos/MacOSBuilder.php +++ b/src/SPC/builder/macos/MacOSBuilder.php @@ -118,9 +118,8 @@ class MacOSBuilder extends UnixBuilderBase } $embed_type = getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') ?: 'static'; - shell()->cd(SOURCE_PATH . '/php-src') - ->exec( - getenv('SPC_CMD_PREFIX_PHP_CONFIGURE') . ' ' . + $this->seekPhpSrcLogFileOnException(fn () => shell()->cd(SOURCE_PATH . '/php-src')->exec( + getenv('SPC_CMD_PREFIX_PHP_CONFIGURE') . ' ' . ($enableCli ? '--enable-cli ' : '--disable-cli ') . ($enableFpm ? '--enable-fpm ' : '--disable-fpm ') . ($enableEmbed ? "--enable-embed={$embed_type} " : '--disable-embed ') . @@ -132,7 +131,7 @@ class MacOSBuilder extends UnixBuilderBase $zts . $this->makeStaticExtensionArgs() . ' ' . $envs_build_php - ); + )); $this->emitPatchPoint('before-php-make'); SourcePatcher::patchBeforeMake($this); diff --git a/src/SPC/builder/unix/UnixBuilderBase.php b/src/SPC/builder/unix/UnixBuilderBase.php index 5309636f..88ee20aa 100644 --- a/src/SPC/builder/unix/UnixBuilderBase.php +++ b/src/SPC/builder/unix/UnixBuilderBase.php @@ -6,6 +6,7 @@ namespace SPC\builder\unix; use SPC\builder\BuilderBase; use SPC\builder\linux\SystemUtil as LinuxSystemUtil; +use SPC\exception\SPCException; use SPC\exception\SPCInternalException; use SPC\exception\ValidationException; use SPC\exception\WrongUsageException; @@ -338,4 +339,20 @@ abstract class UnixBuilderBase extends BuilderBase } } } + + /** + * Seek php-src/config.log when building PHP, add it to exception. + */ + protected function seekPhpSrcLogFileOnException(callable $callback): void + { + try { + $callback(); + } catch (SPCException $e) { + if (file_exists(SOURCE_PATH . '/php-src/config.log')) { + $e->addExtraLogFile('php-src config.log', 'php-src.config.log'); + copy(SOURCE_PATH . '/php-src/config.log', SPC_LOGS_DIR . '/php-src.config.log'); + } + throw $e; + } + } } From 882ae07debc920ecd700441875d3d8de7f43cb15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abi=20=D8=A3=D8=A8?= Date: Sun, 7 Sep 2025 19:37:38 +0700 Subject: [PATCH 2/4] libxml2 arg typo --- src/SPC/builder/unix/library/libxml2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/libxml2.php b/src/SPC/builder/unix/library/libxml2.php index 87fbab10..0b7d0bb0 100644 --- a/src/SPC/builder/unix/library/libxml2.php +++ b/src/SPC/builder/unix/library/libxml2.php @@ -30,7 +30,7 @@ trait libxml2 ); if ($this instanceof LinuxLibraryBase) { - $cmake->addConfigureArgs('-DIconv_IS_BUILD_IN=OFF'); + $cmake->addConfigureArgs('-DIconv_IS_BUILT_IN=OFF'); } $cmake->build(); From 8dd0512335f5b2d089f5e45bfc7abcf6d118e9cc Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 9 Sep 2025 19:31:40 +0800 Subject: [PATCH 3/4] Fix macOS lib-depends --- config/lib.json | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/config/lib.json b/config/lib.json index bda0baad..c48d2d7a 100644 --- a/config/lib.json +++ b/config/lib.json @@ -5,21 +5,23 @@ "php": { "type": "root", "source": "php-src", - "lib-depends": [ + "lib-depends-linux": [ "lib-base", "micro" ], + "lib-depends-macos": [ + "lib-base", + "micro", + "libxml2" + ], "lib-suggests-linux": [ "libacl", "brotli", "watcher" ], - "lib-suggests-unix": [ + "lib-suggests-macos": [ "brotli", "watcher" - ], - "lib-depends-macos": [ - "libxml2" ] }, "micro": { From e35d6c2651e7ae38d2333e2e3f1d9bfa9e8bc720 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 9 Sep 2025 19:35:02 +0800 Subject: [PATCH 4/4] Oh, we also support windows here --- config/lib.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/lib.json b/config/lib.json index c48d2d7a..cbb5f77e 100644 --- a/config/lib.json +++ b/config/lib.json @@ -5,7 +5,7 @@ "php": { "type": "root", "source": "php-src", - "lib-depends-linux": [ + "lib-depends": [ "lib-base", "micro" ],