From 1272acd07eb75281ab12afd65fa7e3e54c39ce97 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sat, 11 Apr 2026 01:00:30 +0800 Subject: [PATCH 1/2] Fix bcmath with c23 bug --- src/SPC/store/SourcePatcher.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index 7ce2d2002..a263d0f53 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -125,6 +125,15 @@ public static function patchBeforeConfigure(BuilderBase $builder): void FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/have_capstone="yes"/', 'have_capstone="no"'); } + // PHP 8.2 and below: bcmath libbcmath uses K&R style C function + if (is_unix() && $builder->getPHPVersionID() < 80300) { + FileSystem::replaceFileStr( + SOURCE_PATH . '/php-src/configure', + "for ac_arg in '' -std=gnu23", + "for ac_arg in ''" + ); + } + if (file_exists(SOURCE_PATH . '/php-src/configure.ac.bak')) { // restore configure.ac FileSystem::restoreBackupFile(SOURCE_PATH . '/php-src/configure.ac'); From 0ed1bbc74ad72fdde711941683168c461fe8b74c Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sat, 11 Apr 2026 01:01:21 +0800 Subject: [PATCH 2/2] Fix typo --- src/SPC/util/executor/UnixCMakeExecutor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/util/executor/UnixCMakeExecutor.php b/src/SPC/util/executor/UnixCMakeExecutor.php index d0241f567..e9ffb0e4a 100644 --- a/src/SPC/util/executor/UnixCMakeExecutor.php +++ b/src/SPC/util/executor/UnixCMakeExecutor.php @@ -182,7 +182,7 @@ private function makeCmakeToolchainFile(): string $target_arch = arch2gnu(php_uname('m')); $cflags = getenv('SPC_DEFAULT_C_FLAGS'); $cc = getenv('CC'); - $cxx = getenv('CCX'); + $cxx = getenv('CXX'); $include = BUILD_INCLUDE_PATH; logger()->debug("making cmake tool chain file for {$os} {$target_arch} with CFLAGS='{$cflags}'"); $root = BUILD_ROOT_PATH;