From 1272acd07eb75281ab12afd65fa7e3e54c39ce97 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sat, 11 Apr 2026 01:00:30 +0800 Subject: [PATCH 01/29] 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 7ce2d200..a263d0f5 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -125,6 +125,15 @@ class SourcePatcher 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 02/29] 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 d0241f56..e9ffb0e4 100644 --- a/src/SPC/util/executor/UnixCMakeExecutor.php +++ b/src/SPC/util/executor/UnixCMakeExecutor.php @@ -182,7 +182,7 @@ class UnixCMakeExecutor extends Executor $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; From 1c3dc91845252fbe20c1a8cebc7b4096bdcd8b7e Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 14 Apr 2026 11:25:15 +0800 Subject: [PATCH 03/29] Fix paths for PostgreSQL library and header file copying on Windows --- src/SPC/builder/windows/library/postgresql_win.php | 8 ++++---- src/globals/test-extensions.php | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/SPC/builder/windows/library/postgresql_win.php b/src/SPC/builder/windows/library/postgresql_win.php index 7f708be6..0b6b01a5 100644 --- a/src/SPC/builder/windows/library/postgresql_win.php +++ b/src/SPC/builder/windows/library/postgresql_win.php @@ -10,9 +10,9 @@ class postgresql_win extends WindowsLibraryBase protected function build(): void { - copy($this->source_dir . '\pgsql\lib\libpq.lib', BUILD_LIB_PATH . '\libpq.lib'); - copy($this->source_dir . '\pgsql\lib\libpgport.lib', BUILD_LIB_PATH . '\libpgport.lib'); - copy($this->source_dir . '\pgsql\lib\libpgcommon.lib', BUILD_LIB_PATH . '\libpgcommon.lib'); + copy($this->source_dir . '\lib\libpq.lib', BUILD_LIB_PATH . '\libpq.lib'); + copy($this->source_dir . '\lib\libpgport.lib', BUILD_LIB_PATH . '\libpgport.lib'); + copy($this->source_dir . '\lib\libpgcommon.lib', BUILD_LIB_PATH . '\libpgcommon.lib'); // create libpq folder in buildroot/includes/libpq if (!file_exists(BUILD_INCLUDE_PATH . '\libpq')) { @@ -21,7 +21,7 @@ class postgresql_win extends WindowsLibraryBase $headerFiles = ['libpq-fe.h', 'postgres_ext.h', 'pg_config_ext.h', 'libpq\libpq-fs.h']; foreach ($headerFiles as $header) { - copy($this->source_dir . '\pgsql\include\\' . $header, BUILD_INCLUDE_PATH . '\\' . $header); + copy($this->source_dir . '\include\\' . $header, BUILD_INCLUDE_PATH . '\\' . $header); } } } diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index cbcecb0e..c3d8e995 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -31,7 +31,7 @@ $test_os = [ // 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64 // 'ubuntu-24.04-arm', // bin/spc for arm64 'windows-2022', // .\bin\spc.ps1 - 'windows-2025', + // 'windows-2025', ]; // whether enable thread safe @@ -46,12 +46,12 @@ $upx = false; $frankenphp = false; // prefer downloading pre-built packages to speed up the build process -$prefer_pre_built = false; +$prefer_pre_built = true; // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { 'Linux', 'Darwin' => 'decimal', - 'Windows' => 'decimal', + 'Windows' => 'bcmath,brotli,bz2,ctype,curl,dom,exif,fileinfo,filter,ftp,gd,iconv,intl,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pdo,pdo_mysql,pdo_pgsql,pgsql,session,simdjson,simplexml,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib', }; // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). From be24fd946773e9ec65d6e747dfd4840bcdc4b1de Mon Sep 17 00:00:00 2001 From: henderkes Date: Tue, 14 Apr 2026 23:05:08 +0700 Subject: [PATCH 04/29] remove workaround for zig < 0.16 --- src/SPC/builder/traits/UnixSystemUtilTrait.php | 6 +----- src/globals/test-extensions.php | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/SPC/builder/traits/UnixSystemUtilTrait.php b/src/SPC/builder/traits/UnixSystemUtilTrait.php index 33f824f3..b1921a00 100644 --- a/src/SPC/builder/traits/UnixSystemUtilTrait.php +++ b/src/SPC/builder/traits/UnixSystemUtilTrait.php @@ -50,7 +50,7 @@ trait UnixSystemUtilTrait $defined = array_unique($defined); sort($defined); // export - if (SPCTarget::getTargetOS() === 'Linux') { + if (SPCTarget::getTargetOS() === 'Linux' && ToolchainManager::getToolchainClass() !== ZigToolchain::class) { file_put_contents("{$lib_file}.dynsym", "{\n" . implode("\n", array_map(fn ($x) => " {$x};", $defined)) . "};\n"); } else { file_put_contents("{$lib_file}.dynsym", implode("\n", $defined) . "\n"); @@ -72,10 +72,6 @@ trait UnixSystemUtilTrait if (!is_file($symbol_file)) { throw new SPCInternalException("The symbol file {$symbol_file} does not exist, please check if nm command is available."); } - // https://github.com/ziglang/zig/issues/24662 - if (ToolchainManager::getToolchainClass() === ZigToolchain::class) { - return '-Wl,--export-dynamic'; // needs release 0.16, can be removed then - } // macOS/zig if (SPCTarget::getTargetOS() !== 'Linux' || ToolchainManager::getToolchainClass() === ZigToolchain::class) { return "-Wl,-exported_symbols_list,{$symbol_file}"; diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index c3d8e995..ca634ba0 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -43,20 +43,20 @@ $no_strip = false; $upx = false; // whether to test frankenphp build, only available for macOS and linux -$frankenphp = false; +$frankenphp = true; // prefer downloading pre-built packages to speed up the build process $prefer_pre_built = true; // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'decimal', + 'Linux', 'Darwin' => 'openssl,brotli', 'Windows' => 'bcmath,brotli,bz2,ctype,curl,dom,exif,fileinfo,filter,ftp,gd,iconv,intl,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pdo,pdo_mysql,pdo_pgsql,pgsql,session,simdjson,simplexml,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib', }; // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). $shared_extensions = match (PHP_OS_FAMILY) { - 'Linux' => '', + 'Linux' => 'zstd', 'Darwin' => '', 'Windows' => '', }; From 73dd885342749bc0a2e6bcb5ff9011635e1c2158 Mon Sep 17 00:00:00 2001 From: henderkes Date: Wed, 15 Apr 2026 10:59:13 +0700 Subject: [PATCH 05/29] pin openssl to 3.x --- config/source.json | 2 +- src/globals/test-extensions.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/source.json b/config/source.json index d7224d4d..5fbf8c4c 100644 --- a/config/source.json +++ b/config/source.json @@ -1000,7 +1000,7 @@ "openssl": { "type": "ghrel", "repo": "openssl/openssl", - "match": "openssl.+\\.tar\\.gz", + "match": "openssl-3.+\\.tar\\.gz", "prefer-stable": true, "alt": { "type": "filelist", diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index ca634ba0..0e2b664f 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -24,13 +24,13 @@ $test_php_version = [ // test os (macos-15-intel, macos-15, ubuntu-latest, windows-latest are available) $test_os = [ // 'macos-15-intel', // bin/spc for x86_64 - // 'macos-15', // bin/spc for arm64 + 'macos-15', // bin/spc for arm64 // 'ubuntu-latest', // bin/spc-alpine-docker for x86_64 - // 'ubuntu-22.04', // bin/spc-gnu-docker for x86_64 + 'ubuntu-22.04', // bin/spc-gnu-docker for x86_64 // 'ubuntu-24.04', // bin/spc for x86_64 - // 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64 + 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64 // 'ubuntu-24.04-arm', // bin/spc for arm64 - 'windows-2022', // .\bin\spc.ps1 + // 'windows-2022', // .\bin\spc.ps1 // 'windows-2025', ]; From a9c16b74d77af76cfe750c9ed201b49ea0a18ef1 Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 16 Apr 2026 13:46:12 +0700 Subject: [PATCH 06/29] fix libkrb5 and decimal shard build --- src/SPC/builder/extension/decimal.php | 10 ++++++++-- src/SPC/builder/unix/library/krb5.php | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/extension/decimal.php b/src/SPC/builder/extension/decimal.php index 795bce2d..b337f196 100644 --- a/src/SPC/builder/extension/decimal.php +++ b/src/SPC/builder/extension/decimal.php @@ -16,8 +16,14 @@ class decimal extends Extension { FileSystem::replaceFileStr( $this->source_dir . '/php_decimal.c', - 'zend_module_entry decimal_module_entry', - 'zend_module_entry php_decimal_module_entry' + [ + 'zend_module_entry decimal_module_entry', + 'ZEND_GET_MODULE(decimal)', + ], + [ + 'zend_module_entry php_decimal_module_entry', + 'ZEND_GET_MODULE(php_decimal)' + ] ); FileSystem::replaceFileStr( $this->source_dir . '/config.w32', diff --git a/src/SPC/builder/unix/library/krb5.php b/src/SPC/builder/unix/library/krb5.php index 4cf0ad44..a9cd92ca 100644 --- a/src/SPC/builder/unix/library/krb5.php +++ b/src/SPC/builder/unix/library/krb5.php @@ -44,6 +44,7 @@ trait krb5 ->optionalLib('ldap', '--with-ldap', '--without-ldap') ->optionalLib('libedit', '--with-libedit', '--without-libedit') ->configure(...$args) + ->exec('find . -name Makefile -exec sed -i "s/-Werror=incompatible-pointer-types//g" {} +') ->make(); $this->patchPkgconfPrefix([ 'krb5-gssapi.pc', From 834cc4d16ea992da50eabaf5092d21fb0553e686 Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 16 Apr 2026 13:50:52 +0700 Subject: [PATCH 07/29] fix lint --- src/SPC/builder/extension/decimal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/extension/decimal.php b/src/SPC/builder/extension/decimal.php index b337f196..eab3fdce 100644 --- a/src/SPC/builder/extension/decimal.php +++ b/src/SPC/builder/extension/decimal.php @@ -22,7 +22,7 @@ class decimal extends Extension ], [ 'zend_module_entry php_decimal_module_entry', - 'ZEND_GET_MODULE(php_decimal)' + 'ZEND_GET_MODULE(php_decimal)', ] ); FileSystem::replaceFileStr( From 2073652744ad034f28ec1f05d440e79153048f62 Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 16 Apr 2026 14:29:07 +0700 Subject: [PATCH 08/29] fix macOS --- src/SPC/builder/unix/library/krb5.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/SPC/builder/unix/library/krb5.php b/src/SPC/builder/unix/library/krb5.php index a9cd92ca..85110e25 100644 --- a/src/SPC/builder/unix/library/krb5.php +++ b/src/SPC/builder/unix/library/krb5.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace SPC\builder\unix\library; +use SPC\toolchain\ToolchainManager; +use SPC\toolchain\ZigToolchain; use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\SPCConfigUtil; @@ -39,13 +41,16 @@ trait krb5 $extraEnv['LDFLAGS'] = '-framework Kerberos'; $args[] = 'ac_cv_func_secure_getenv=no'; } - UnixAutoconfExecutor::create($this) + $make = UnixAutoconfExecutor::create($this) ->appendEnv($extraEnv) ->optionalLib('ldap', '--with-ldap', '--without-ldap') ->optionalLib('libedit', '--with-libedit', '--without-libedit') - ->configure(...$args) - ->exec('find . -name Makefile -exec sed -i "s/-Werror=incompatible-pointer-types//g" {} +') - ->make(); + ->configure(...$args); + + if (ToolchainManager::getToolchainClass() === ZigToolchain::class) { + $make->exec('find . -name Makefile -exec sed -i "s/-Werror=incompatible-pointer-types//g" {} +'); + } + $make->make(); $this->patchPkgconfPrefix([ 'krb5-gssapi.pc', 'krb5.pc', From f57986ccbf0200e42420483ecaff4d4534cfafb2 Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 16 Apr 2026 18:06:27 +0700 Subject: [PATCH 09/29] minify embed script --- src/globals/common-tests/embed.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/globals/common-tests/embed.c b/src/globals/common-tests/embed.c index 38d8f39f..c6ba0b26 100644 --- a/src/globals/common-tests/embed.c +++ b/src/globals/common-tests/embed.c @@ -1,17 +1,12 @@ #include -int main(int argc,char **argv){ - - PHP_EMBED_START_BLOCK(argc,argv) - +int main(int argc, char **argv) { + PHP_EMBED_START_BLOCK(argc, argv) zend_file_handle file_handle; - - zend_stream_init_filename(&file_handle,"embed.php"); - - if(!php_execute_script(&file_handle)){ + zend_stream_init_filename(&file_handle, "embed.php"); + if(!php_execute_script(&file_handle)) { php_printf("Failed to execute PHP script.\n"); } - PHP_EMBED_END_BLOCK() return 0; } From 7a65135c68f415efc36216b46946b0e99624841d Mon Sep 17 00:00:00 2001 From: Alex Rock Ancelet Date: Thu, 16 Apr 2026 14:12:07 +0200 Subject: [PATCH 10/29] Add linux mint to ubuntu/debian variants --- src/SPC/doctor/item/LinuxToolCheckList.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/doctor/item/LinuxToolCheckList.php b/src/SPC/doctor/item/LinuxToolCheckList.php index 53b356ff..88c281c3 100644 --- a/src/SPC/doctor/item/LinuxToolCheckList.php +++ b/src/SPC/doctor/item/LinuxToolCheckList.php @@ -109,7 +109,7 @@ class LinuxToolCheckList public function fixBuildTools(array $distro, array $missing): bool { $install_cmd = match ($distro['dist']) { - 'ubuntu', 'debian', 'Deepin' => 'apt-get install -y', + 'ubuntu', 'debian', 'linuxmint', 'Deepin' => 'apt-get install -y', 'alpine' => 'apk add', 'redhat' => 'dnf install -y', 'centos' => 'yum install -y', From ab17fbe2883d9868c0f6320026f3eecae5fb040d Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 16 Apr 2026 20:02:54 +0700 Subject: [PATCH 11/29] zig version 0.15.2 for now --- src/SPC/store/pkg/Zig.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SPC/store/pkg/Zig.php b/src/SPC/store/pkg/Zig.php index c2a81c0d..259368bf 100644 --- a/src/SPC/store/pkg/Zig.php +++ b/src/SPC/store/pkg/Zig.php @@ -82,6 +82,7 @@ class Zig extends CustomPackage if (!$latest_version) { throw new DownloaderException('Could not determine latest Zig version'); } + $latest_version = '0.15.2'; logger()->info("Installing Zig version {$latest_version}"); From 1a395a2b0fc04f161e04f00dca45f4d8c8691a51 Mon Sep 17 00:00:00 2001 From: henderkes Date: Fri, 17 Apr 2026 01:51:01 +0700 Subject: [PATCH 12/29] fix zig 0.16.0 --- src/SPC/builder/Extension.php | 5 ++++- src/SPC/store/pkg/Zig.php | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 9077269e..8517f1e5 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -11,6 +11,8 @@ use SPC\exception\ValidationException; use SPC\exception\WrongUsageException; use SPC\store\Config; use SPC\store\FileSystem; +use SPC\toolchain\ToolchainManager; +use SPC\toolchain\ZigToolchain; use SPC\util\SPCConfigUtil; use SPC\util\SPCTarget; @@ -231,7 +233,8 @@ class Extension if (preg_match('/^(.*_SHARED_LIBADD\s*=\s*)(.*)$/m', $makefileContent, $matches)) { $prefix = $matches[1]; $currentLibs = trim($matches[2]); - $newLibs = trim("{$currentLibs} {$staticLibs} {$lstdcpp}"); + $lzig = ToolchainManager::getToolchainClass() === ZigToolchain::class ? '-lcompiler_rt -lunwind' : ''; + $newLibs = clean_spaces("{$currentLibs} {$staticLibs} {$lstdcpp} {$lzig}"); $deduplicatedLibs = deduplicate_flags($newLibs); FileSystem::replaceFileRegex( diff --git a/src/SPC/store/pkg/Zig.php b/src/SPC/store/pkg/Zig.php index 259368bf..c2a81c0d 100644 --- a/src/SPC/store/pkg/Zig.php +++ b/src/SPC/store/pkg/Zig.php @@ -82,7 +82,6 @@ class Zig extends CustomPackage if (!$latest_version) { throw new DownloaderException('Could not determine latest Zig version'); } - $latest_version = '0.15.2'; logger()->info("Installing Zig version {$latest_version}"); From cc7a22922c84875015412f496a9f2a059cfca4e6 Mon Sep 17 00:00:00 2001 From: henderkes Date: Fri, 17 Apr 2026 14:17:39 +0700 Subject: [PATCH 13/29] add -lcompiler_rt to SPC_COMPILER_EXTRA instead --- src/SPC/builder/Extension.php | 3 +-- src/SPC/builder/linux/LinuxBuilder.php | 3 ++- src/SPC/toolchain/ZigToolchain.php | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 8517f1e5..331d2986 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -233,8 +233,7 @@ class Extension if (preg_match('/^(.*_SHARED_LIBADD\s*=\s*)(.*)$/m', $makefileContent, $matches)) { $prefix = $matches[1]; $currentLibs = trim($matches[2]); - $lzig = ToolchainManager::getToolchainClass() === ZigToolchain::class ? '-lcompiler_rt -lunwind' : ''; - $newLibs = clean_spaces("{$currentLibs} {$staticLibs} {$lstdcpp} {$lzig}"); + $newLibs = clean_spaces("{$currentLibs} {$staticLibs} {$lstdcpp}"); $deduplicatedLibs = deduplicate_flags($newLibs); FileSystem::replaceFileRegex( diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index d959aade..ffc034a7 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -65,7 +65,8 @@ class LinuxBuilder extends UnixBuilderBase // php 8.5 contains opcache extension by default, // if opcache_jit is enabled for 8.5 or opcache enabled, // we need to disable undefined behavior sanitizer. - f_putenv('SPC_COMPILER_EXTRA=-fno-sanitize=undefined'); + $compiler_extra = getenv('SPC_COMPILER_EXTRA') ?: ''; + f_putenv('SPC_COMPILER_EXTRA=' . trim($compiler_extra . ' -fno-sanitize=undefined')); } if ($this->getOption('enable-zts', false)) { diff --git a/src/SPC/toolchain/ZigToolchain.php b/src/SPC/toolchain/ZigToolchain.php index 1b7cc70d..6ff67769 100644 --- a/src/SPC/toolchain/ZigToolchain.php +++ b/src/SPC/toolchain/ZigToolchain.php @@ -64,6 +64,12 @@ class ZigToolchain implements ToolchainInterface $extra_libs = trim($extra_libs . ' -lunwind'); GlobalEnvManager::putenv("SPC_EXTRA_LIBS={$extra_libs}"); } + $compiler_extra = getenv('SPC_COMPILER_EXTRA') ?: ''; + if (!str_contains($compiler_extra, '-lcompiler_rt')) { + // Add unwind library if not already present + $compiler_extra = trim($compiler_extra . ' -lcompiler_rt'); + GlobalEnvManager::putenv("SPC_COMPILER_EXTRA={$compiler_extra}"); + } $cflags = getenv('SPC_DEFAULT_C_FLAGS') ?: getenv('CFLAGS') ?: ''; $has_avx512 = str_contains($cflags, '-mavx512') || str_contains($cflags, '-march=x86-64-v4'); if (!$has_avx512) { From f39d77dde088983553ad141b2fcc7474e9596b37 Mon Sep 17 00:00:00 2001 From: henderkes Date: Fri, 17 Apr 2026 14:19:29 +0700 Subject: [PATCH 14/29] lint --- src/SPC/builder/Extension.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 331d2986..60cc3708 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -11,8 +11,6 @@ use SPC\exception\ValidationException; use SPC\exception\WrongUsageException; use SPC\store\Config; use SPC\store\FileSystem; -use SPC\toolchain\ToolchainManager; -use SPC\toolchain\ZigToolchain; use SPC\util\SPCConfigUtil; use SPC\util\SPCTarget; From b1a77b01e290da6bb115ad8235bd0d339144918e Mon Sep 17 00:00:00 2001 From: Alex Rock Ancelet Date: Thu, 16 Apr 2026 14:12:07 +0200 Subject: [PATCH 15/29] Add linux mint to ubuntu/debian variants --- src/SPC/doctor/item/LinuxToolCheckList.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/doctor/item/LinuxToolCheckList.php b/src/SPC/doctor/item/LinuxToolCheckList.php index 53b356ff..88c281c3 100644 --- a/src/SPC/doctor/item/LinuxToolCheckList.php +++ b/src/SPC/doctor/item/LinuxToolCheckList.php @@ -109,7 +109,7 @@ class LinuxToolCheckList public function fixBuildTools(array $distro, array $missing): bool { $install_cmd = match ($distro['dist']) { - 'ubuntu', 'debian', 'Deepin' => 'apt-get install -y', + 'ubuntu', 'debian', 'linuxmint', 'Deepin' => 'apt-get install -y', 'alpine' => 'apk add', 'redhat' => 'dnf install -y', 'centos' => 'yum install -y', From 0a3c56ba492429f9286c655ed8f4e8e5d2dea89e Mon Sep 17 00:00:00 2001 From: henderkes Date: Fri, 17 Apr 2026 16:03:19 +0700 Subject: [PATCH 16/29] set lcompiler_rt only when building shared extensions --- src/SPC/builder/Extension.php | 8 ++++++++ src/SPC/builder/linux/LinuxBuilder.php | 7 +++++++ src/SPC/toolchain/ZigToolchain.php | 6 ------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 60cc3708..63dc31d0 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -11,6 +11,9 @@ use SPC\exception\ValidationException; use SPC\exception\WrongUsageException; use SPC\store\Config; use SPC\store\FileSystem; +use SPC\toolchain\ToolchainManager; +use SPC\toolchain\ZigToolchain; +use SPC\util\GlobalEnvManager; use SPC\util\SPCConfigUtil; use SPC\util\SPCTarget; @@ -543,6 +546,11 @@ class Extension */ protected function getSharedExtensionEnv(): array { + $compiler_extra = getenv('SPC_COMPILER_EXTRA') ?: ''; + if (!str_contains($compiler_extra, '-lcompiler_rt') && ToolchainManager::getToolchainClass() === ZigToolchain::class) { + $compiler_extra = trim($compiler_extra . ' -lcompiler_rt'); + GlobalEnvManager::putenv("SPC_COMPILER_EXTRA={$compiler_extra}"); + } $config = (new SPCConfigUtil($this->builder, ['no_php' => true]))->getExtensionConfig($this); [$staticLibs, $sharedLibs] = $this->splitLibsIntoStaticAndShared($config['libs']); $preStatic = PHP_OS_FAMILY === 'Darwin' ? '' : '-Wl,--start-group '; diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index ffc034a7..ed26d64f 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -11,6 +11,8 @@ use SPC\store\Config; use SPC\store\DirDiff; use SPC\store\FileSystem; use SPC\store\SourcePatcher; +use SPC\toolchain\ToolchainManager; +use SPC\toolchain\ZigToolchain; use SPC\util\GlobalEnvManager; use SPC\util\SPCConfigUtil; use SPC\util\SPCTarget; @@ -267,6 +269,11 @@ class LinuxBuilder extends UnixBuilderBase */ protected function buildEmbed(): void { + $compiler_extra = getenv('SPC_COMPILER_EXTRA') ?: ''; + if (!str_contains($compiler_extra, '-lcompiler_rt') && ToolchainManager::getToolchainClass() === ZigToolchain::class) { + $compiler_extra = trim($compiler_extra . ' -lcompiler_rt'); + GlobalEnvManager::putenv("SPC_COMPILER_EXTRA={$compiler_extra}"); + } $sharedExts = array_filter($this->exts, static fn ($ext) => $ext->isBuildShared()); $sharedExts = array_filter($sharedExts, static function ($ext) { return Config::getExt($ext->getName(), 'build-with-php') === true; diff --git a/src/SPC/toolchain/ZigToolchain.php b/src/SPC/toolchain/ZigToolchain.php index 6ff67769..1b7cc70d 100644 --- a/src/SPC/toolchain/ZigToolchain.php +++ b/src/SPC/toolchain/ZigToolchain.php @@ -64,12 +64,6 @@ class ZigToolchain implements ToolchainInterface $extra_libs = trim($extra_libs . ' -lunwind'); GlobalEnvManager::putenv("SPC_EXTRA_LIBS={$extra_libs}"); } - $compiler_extra = getenv('SPC_COMPILER_EXTRA') ?: ''; - if (!str_contains($compiler_extra, '-lcompiler_rt')) { - // Add unwind library if not already present - $compiler_extra = trim($compiler_extra . ' -lcompiler_rt'); - GlobalEnvManager::putenv("SPC_COMPILER_EXTRA={$compiler_extra}"); - } $cflags = getenv('SPC_DEFAULT_C_FLAGS') ?: getenv('CFLAGS') ?: ''; $has_avx512 = str_contains($cflags, '-mavx512') || str_contains($cflags, '-march=x86-64-v4'); if (!$has_avx512) { From f52e8ad4490a522a532b7092b5f4d5ed7192a0f5 Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 20 Apr 2026 07:08:48 +0000 Subject: [PATCH 17/29] patch 8.3 src to use avx512 cache vars --- src/SPC/store/SourcePatcher.php | 4 + .../spc_fix_avx512_cache_before_80400.patch | 91 +++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 src/globals/patch/spc_fix_avx512_cache_before_80400.patch diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index 7ce2d200..772ccbb5 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -95,6 +95,10 @@ class SourcePatcher // patch php-src/build/php.m4 PKG_CHECK_MODULES -> PKG_CHECK_MODULES_STATIC FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/build/php.m4', 'PKG_CHECK_MODULES(', 'PKG_CHECK_MODULES_STATIC('); + if ($builder->getPHPVersionID() >= 80300 && $builder->getPHPVersionID() < 80400) { + self::patchFile('spc_fix_avx512_cache_before_80400.patch', SOURCE_PATH . '/php-src'); + } + if ($builder->getOption('enable-micro-win32')) { self::patchMicroWin32(); } else { diff --git a/src/globals/patch/spc_fix_avx512_cache_before_80400.patch b/src/globals/patch/spc_fix_avx512_cache_before_80400.patch new file mode 100644 index 00000000..79393c01 --- /dev/null +++ b/src/globals/patch/spc_fix_avx512_cache_before_80400.patch @@ -0,0 +1,91 @@ +--- a/build/php.m4 ++++ b/build/php.m4 +@@ -2812,27 +2812,26 @@ + dnl PHP_CHECK_AVX512_SUPPORTS + dnl + AC_DEFUN([PHP_CHECK_AVX512_SUPPORTS], [ +- AC_MSG_CHECKING([for avx512 supports in compiler]) +- save_CFLAGS="$CFLAGS" +- CFLAGS="-mavx512f -mavx512cd -mavx512vl -mavx512dq -mavx512bw $CFLAGS" +- +- AC_LINK_IFELSE([AC_LANG_SOURCE([[ +- #include +- int main(void) { +- __m512i mask = _mm512_set1_epi32(0x1); +- char out[32]; +- _mm512_storeu_si512(out, _mm512_shuffle_epi8(mask, mask)); +- return 0; +- }]])], [ ++ AC_CACHE_CHECK([whether compiler supports AVX-512], [php_cv_have_avx512], [ ++ save_CFLAGS="$CFLAGS" ++ CFLAGS="-mavx512f -mavx512cd -mavx512vl -mavx512dq -mavx512bw $CFLAGS" ++ AC_LINK_IFELSE([AC_LANG_SOURCE([[ ++ #include ++ int main(void) { ++ __m512i mask = _mm512_set1_epi32(0x1); ++ char out[32]; ++ _mm512_storeu_si512(out, _mm512_shuffle_epi8(mask, mask)); ++ return 0; ++ }]])], ++ [php_cv_have_avx512=yes], ++ [php_cv_have_avx512=no]) ++ CFLAGS="$save_CFLAGS" ++ ]) ++ if test "$php_cv_have_avx512" = "yes"; then + have_avx512_supports=1 +- AC_MSG_RESULT([yes]) +- ], [ ++ else + have_avx512_supports=0 +- AC_MSG_RESULT([no]) +- ]) +- +- CFLAGS="$save_CFLAGS" +- ++ fi + AC_DEFINE_UNQUOTED([PHP_HAVE_AVX512_SUPPORTS], + [$have_avx512_supports], [Whether the compiler supports AVX512]) + ]) +@@ -2841,24 +2840,26 @@ + dnl PHP_CHECK_AVX512_VBMI_SUPPORTS + dnl + AC_DEFUN([PHP_CHECK_AVX512_VBMI_SUPPORTS], [ +- AC_MSG_CHECKING([for avx512 vbmi supports in compiler]) +- save_CFLAGS="$CFLAGS" +- CFLAGS="-mavx512f -mavx512cd -mavx512vl -mavx512dq -mavx512bw -mavx512vbmi $CFLAGS" +- AC_LINK_IFELSE([AC_LANG_SOURCE([[ +- #include +- int main(void) { +- __m512i mask = _mm512_set1_epi32(0x1); +- char out[32]; +- _mm512_storeu_si512(out, _mm512_permutexvar_epi8(mask, mask)); +- return 0; +- }]])], [ ++ AC_CACHE_CHECK([whether compiler supports AVX-512 VBMI], [php_cv_have_avx512vbmi], [ ++ save_CFLAGS="$CFLAGS" ++ CFLAGS="-mavx512f -mavx512cd -mavx512vl -mavx512dq -mavx512bw -mavx512vbmi $CFLAGS" ++ AC_LINK_IFELSE([AC_LANG_SOURCE([[ ++ #include ++ int main(void) { ++ __m512i mask = _mm512_set1_epi32(0x1); ++ char out[32]; ++ _mm512_storeu_si512(out, _mm512_permutexvar_epi8(mask, mask)); ++ return 0; ++ }]])], ++ [php_cv_have_avx512vbmi=yes], ++ [php_cv_have_avx512vbmi=no]) ++ CFLAGS="$save_CFLAGS" ++ ]) ++ if test "$php_cv_have_avx512vbmi" = "yes"; then + have_avx512_vbmi_supports=1 +- AC_MSG_RESULT([yes]) +- ], [ ++ else + have_avx512_vbmi_supports=0 +- AC_MSG_RESULT([no]) +- ]) +- CFLAGS="$save_CFLAGS" ++ fi + AC_DEFINE_UNQUOTED([PHP_HAVE_AVX512_VBMI_SUPPORTS], + [$have_avx512_vbmi_supports], [Whether the compiler supports AVX512 VBMI]) + ]) From 14fc3f8d87e1044d62d0c80006f24ebf602c0bbc Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 20 Apr 2026 23:55:00 +0800 Subject: [PATCH 18/29] Fix libde265 on arm64 macOS asm build bug --- src/SPC/ConsoleApplication.php | 2 +- src/SPC/builder/unix/library/libde265.php | 3 ++- src/globals/test-extensions.php | 10 +++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/SPC/ConsoleApplication.php b/src/SPC/ConsoleApplication.php index 9685a1d8..b2cf9671 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.8.5'; + public const string VERSION = '2.8.6'; public function __construct() { diff --git a/src/SPC/builder/unix/library/libde265.php b/src/SPC/builder/unix/library/libde265.php index 184a4426..de814ca8 100644 --- a/src/SPC/builder/unix/library/libde265.php +++ b/src/SPC/builder/unix/library/libde265.php @@ -13,7 +13,8 @@ trait libde265 UnixCMakeExecutor::create($this) ->addConfigureArgs( '-DENABLE_SDL=OFF', - '-DENABLE_DECODER=OFF' + '-DENABLE_DECODER=OFF', + '-DHAVE_ARM=OFF', ) ->build(); $this->patchPkgconfPrefix(['libde265.pc']); diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 0e2b664f..3d183ae8 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -26,9 +26,9 @@ $test_os = [ // 'macos-15-intel', // bin/spc for x86_64 'macos-15', // bin/spc for arm64 // 'ubuntu-latest', // bin/spc-alpine-docker for x86_64 - 'ubuntu-22.04', // bin/spc-gnu-docker for x86_64 + // 'ubuntu-22.04', // bin/spc-gnu-docker for x86_64 // 'ubuntu-24.04', // bin/spc for x86_64 - 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64 + // 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64 // 'ubuntu-24.04-arm', // bin/spc for arm64 // 'windows-2022', // .\bin\spc.ps1 // 'windows-2025', @@ -50,13 +50,13 @@ $prefer_pre_built = true; // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'openssl,brotli', + 'Linux', 'Darwin' => 'gd,imagick', 'Windows' => 'bcmath,brotli,bz2,ctype,curl,dom,exif,fileinfo,filter,ftp,gd,iconv,intl,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pdo,pdo_mysql,pdo_pgsql,pgsql,session,simdjson,simplexml,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib', }; // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). $shared_extensions = match (PHP_OS_FAMILY) { - 'Linux' => 'zstd', + 'Linux' => '', 'Darwin' => '', 'Windows' => '', }; @@ -66,7 +66,7 @@ $with_suggested_libs = true; // If you want to test extra libs for extensions, add them below (comma separated, example `libwebp,libavif`). Unnecessary, when $with_suggested_libs is true. $with_libs = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'krb5', + 'Linux', 'Darwin' => 'libde265', 'Windows' => '', }; From 4e9edf6c9d7b77f19b8a8ec9dc3a889b55b30f48 Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Tue, 21 Apr 2026 00:21:52 +0800 Subject: [PATCH 19/29] Update src/SPC/builder/unix/library/libde265.php --- src/SPC/builder/unix/library/libde265.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/libde265.php b/src/SPC/builder/unix/library/libde265.php index de814ca8..116f67aa 100644 --- a/src/SPC/builder/unix/library/libde265.php +++ b/src/SPC/builder/unix/library/libde265.php @@ -14,7 +14,7 @@ trait libde265 ->addConfigureArgs( '-DENABLE_SDL=OFF', '-DENABLE_DECODER=OFF', - '-DHAVE_ARM=OFF', + '-DHAVE_NEON=OFF', ) ->build(); $this->patchPkgconfPrefix(['libde265.pc']); From 450e0e1ecbbb8dc37d09ffaa169a3f6ddd6a8947 Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 23 Apr 2026 18:55:35 +0700 Subject: [PATCH 20/29] Add 'date', 'lexbor', 'random', and 'uri' to extensions --- src/globals/defines.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/globals/defines.php b/src/globals/defines.php index 36ffba79..dae0c491 100644 --- a/src/globals/defines.php +++ b/src/globals/defines.php @@ -25,12 +25,16 @@ const DANGER_CMD = [ // spc internal extensions const SPC_INTERNAL_EXTENSIONS = [ 'core', + 'date', 'hash', 'json', + 'lexbor', 'pcre', + 'random', 'reflection', 'spl', 'standard', + 'uri', ]; // spc extension alias From 0588401ee329a873f99ef3fdd930e6ff7052d12e Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 30 Apr 2026 11:05:49 +0800 Subject: [PATCH 21/29] Improve GitHub source retrieval by using latest release endpoint and enhancing version handling --- src/SPC/store/Downloader.php | 63 +++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/src/SPC/store/Downloader.php b/src/SPC/store/Downloader.php index ccf61dd8..98d9f495 100644 --- a/src/SPC/store/Downloader.php +++ b/src/SPC/store/Downloader.php @@ -98,31 +98,50 @@ class Downloader { logger()->debug("finding {$name} source from github {$type} tarball"); $source['query'] ??= ''; - $data = json_decode(self::curlExec( - url: "https://api.github.com/repos/{$source['repo']}/{$type}{$source['query']}", - hooks: [[CurlHook::class, 'setupGithubToken']], - retries: self::getRetryAttempts() - ), true, 512, JSON_THROW_ON_ERROR); - $url = null; - foreach ($data as $rel) { - if (($rel['prerelease'] ?? false) === true && ($source['prefer-stable'] ?? false)) { - continue; + // Use /releases/latest when possible: it returns the semantically latest stable + // release regardless of publish order, avoiding issues with concurrent release branches. + if ($type === 'releases' && empty($source['query']) && !($source['match'] ?? null)) { + $data = json_decode(self::curlExec( + url: "https://api.github.com/repos/{$source['repo']}/releases/latest", + hooks: [[CurlHook::class, 'setupGithubToken']], + retries: self::getRetryAttempts() + ), true, 512, JSON_THROW_ON_ERROR); + if (!is_array($data) || empty($data['tarball_url'])) { + throw new DownloaderException("failed to find {$name} source"); } - if (($rel['draft'] ?? false) === true && (($source['prefer-stable'] ?? false) || !$rel['tarball_url'])) { - continue; + $url = $data['tarball_url']; + $version = $data['tag_name'] ?? $data['name'] ?? null; + } else { + $data = json_decode(self::curlExec( + url: "https://api.github.com/repos/{$source['repo']}/{$type}{$source['query']}", + hooks: [[CurlHook::class, 'setupGithubToken']], + retries: self::getRetryAttempts() + ), true, 512, JSON_THROW_ON_ERROR); + + $url = null; + $version = null; + foreach ($data as $rel) { + if (($rel['prerelease'] ?? false) === true && ($source['prefer-stable'] ?? false)) { + continue; + } + if (($rel['draft'] ?? false) === true && (($source['prefer-stable'] ?? false) || !$rel['tarball_url'])) { + continue; + } + if (!($source['match'] ?? null)) { + $url = $rel['tarball_url'] ?? null; + $version = $rel['tag_name'] ?? $rel['name'] ?? null; + break; + } + if (preg_match('|' . $source['match'] . '|', $rel['tarball_url'])) { + $url = $rel['tarball_url']; + $version = $rel['tag_name'] ?? $rel['name'] ?? null; + break; + } } - if (!($source['match'] ?? null)) { - $url = $rel['tarball_url'] ?? null; - break; + if (!$url) { + throw new DownloaderException("failed to find {$name} source"); } - if (preg_match('|' . $source['match'] . '|', $rel['tarball_url'])) { - $url = $rel['tarball_url']; - break; - } - } - if (!$url) { - throw new DownloaderException("failed to find {$name} source"); } $headers = self::curlExec( url: $url, @@ -134,7 +153,7 @@ class Downloader if ($matches) { $filename = $matches['filename']; } else { - $filename = "{$name}-" . ($type === 'releases' ? $data['tag_name'] : $data['name']) . '.tar.gz'; + $filename = "{$name}-" . ($version ?? 'latest') . '.tar.gz'; } return [$url, $filename]; From 4eaeeb823012813bb7b0c5c1e791be078bbffc76 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 30 Apr 2026 11:06:08 +0800 Subject: [PATCH 22/29] Make swoole using `6.2.0` --- config/source.json | 1 - 1 file changed, 1 deletion(-) diff --git a/config/source.json b/config/source.json index 5fbf8c4c..a14ac41a 100644 --- a/config/source.json +++ b/config/source.json @@ -1194,7 +1194,6 @@ "path": "php-src/ext/swoole", "type": "ghtar", "repo": "swoole/swoole-src", - "match": "v6\\.+", "prefer-stable": true, "license": { "type": "file", From 93a227bc6dc4a7a5819b3ca44973abb5c4a8a37c Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 30 Apr 2026 11:14:01 +0800 Subject: [PATCH 23/29] Fix mongodb 2.3.0 introduced in-tree build bug --- src/SPC/builder/extension/mongodb.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/SPC/builder/extension/mongodb.php b/src/SPC/builder/extension/mongodb.php index 08861e4e..64108d5c 100644 --- a/src/SPC/builder/extension/mongodb.php +++ b/src/SPC/builder/extension/mongodb.php @@ -5,11 +5,22 @@ declare(strict_types=1); namespace SPC\builder\extension; use SPC\builder\Extension; +use SPC\store\FileSystem; use SPC\util\CustomExt; #[CustomExt('mongodb')] class mongodb extends Extension { + public function patchBeforeBuildconf(): bool + { + FileSystem::replaceFileRegex( + SOURCE_PATH . '/php-src/ext/mongodb/config.m4', + '/^(\s+)(src\/libmongoc\/)/m', + '$1${ac_config_dir}/$2' + ); + return true; + } + public function getUnixConfigureArg(bool $shared = false): string { $arg = ' --enable-mongodb' . ($shared ? '=shared' : '') . ' '; From a9e1327a80cc45baa770cbe3a92d5c8f5343dd76 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 30 Apr 2026 11:22:19 +0800 Subject: [PATCH 24/29] Fix phpunit mock data --- tests/mock/SPC_store.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/mock/SPC_store.php b/tests/mock/SPC_store.php index 99f74fcc..9f9f6f29 100644 --- a/tests/mock/SPC_store.php +++ b/tests/mock/SPC_store.php @@ -12,6 +12,15 @@ use SPC\exception\SPCInternalException; function f_exec(string $command, mixed &$output, mixed &$result_code): bool { $result_code = 0; + if (str_contains($command, 'https://api.github.com/repos/AOMediaCodec/libavif/releases/latest')) { + $output = explode("\n", json_encode([ + 'tag_name' => 'v1.1.1', + 'tarball_url' => 'https://api.github.com/repos/AOMediaCodec/libavif/tarball/v1.1.1', + 'prerelease' => false, + 'draft' => false, + ])); + return true; + } if (str_contains($command, 'https://api.github.com/repos/AOMediaCodec/libavif/releases')) { $output = explode("\n", gzdecode(file_get_contents(__DIR__ . '/../assets/github_api_AOMediaCodec_libavif_releases.json.gz'))); return true; From 7a71a408243c5f312908943a7bc863e744ecbb22 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 30 Apr 2026 11:22:56 +0800 Subject: [PATCH 25/29] Test --- src/globals/test-extensions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 3d183ae8..6db808f6 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -14,7 +14,7 @@ declare(strict_types=1); // test php version (8.1 ~ 8.4 available, multiple for matrix) $test_php_version = [ // '8.1', - // '8.2', + '8.2', // '8.3', // '8.4', '8.5', @@ -50,7 +50,7 @@ $prefer_pre_built = true; // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'gd,imagick', + 'Linux', 'Darwin' => 'swoole,mongodb', 'Windows' => 'bcmath,brotli,bz2,ctype,curl,dom,exif,fileinfo,filter,ftp,gd,iconv,intl,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pdo,pdo_mysql,pdo_pgsql,pgsql,session,simdjson,simplexml,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib', }; @@ -66,7 +66,7 @@ $with_suggested_libs = true; // If you want to test extra libs for extensions, add them below (comma separated, example `libwebp,libavif`). Unnecessary, when $with_suggested_libs is true. $with_libs = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'libde265', + 'Linux', 'Darwin' => '', 'Windows' => '', }; From e21bb528c0f4cbae07839fc1ed44c105227c2e49 Mon Sep 17 00:00:00 2001 From: Marc Date: Wed, 6 May 2026 12:52:50 +0700 Subject: [PATCH 26/29] Apply suggestion from @henderkes --- src/SPC/store/SourcePatcher.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index a263d0f5..c4b4e7b8 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -130,7 +130,7 @@ class SourcePatcher FileSystem::replaceFileStr( SOURCE_PATH . '/php-src/configure', "for ac_arg in '' -std=gnu23", - "for ac_arg in ''" + "for ac_arg in '' -std=gnu17", ); } From 44f9cb1ffd457ec9a7c12464807ce2bcf876a1d1 Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 7 May 2026 16:27:26 +0700 Subject: [PATCH 27/29] fix centos 7 gd build --- src/SPC/builder/unix/library/curl.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/curl.php b/src/SPC/builder/unix/library/curl.php index caa97b8c..d1fab35d 100644 --- a/src/SPC/builder/unix/library/curl.php +++ b/src/SPC/builder/unix/library/curl.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace SPC\builder\unix\library; +use SPC\store\FileSystem; use SPC\util\executor\UnixCMakeExecutor; trait curl @@ -32,8 +33,16 @@ trait curl ) ->build(); - // patch pkgconf $this->patchPkgconfPrefix(['libcurl.pc']); + // On glibc <2.28 without built-in pthreads, FindThreads + // INTERFACE_LINK_LIBRARIES to '-lpthread' + // curls .pc generator walks and prepends '-l' to each + // entry, resulting in -l-lpthread + FileSystem::replaceFileRegex( + BUILD_LIB_PATH . '/pkgconfig/libcurl.pc', + '/-l(-l\S+)/', + '$1' + ); shell()->cd(BUILD_LIB_PATH . '/cmake/CURL/') ->exec("sed -ie 's|\"/lib/libcurl.a\"|\"" . BUILD_LIB_PATH . "/libcurl.a\"|g' CURLTargets-release.cmake"); } From c7738749e24fde6acef8f1731df7102c073f1862 Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 7 May 2026 16:33:39 +0700 Subject: [PATCH 28/29] run tests --- src/globals/test-extensions.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 6db808f6..e7f716b4 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -14,7 +14,7 @@ declare(strict_types=1); // test php version (8.1 ~ 8.4 available, multiple for matrix) $test_php_version = [ // '8.1', - '8.2', + // '8.2', // '8.3', // '8.4', '8.5', @@ -24,11 +24,11 @@ $test_php_version = [ // test os (macos-15-intel, macos-15, ubuntu-latest, windows-latest are available) $test_os = [ // 'macos-15-intel', // bin/spc for x86_64 - 'macos-15', // bin/spc for arm64 + // 'macos-15', // bin/spc for arm64 // 'ubuntu-latest', // bin/spc-alpine-docker for x86_64 - // 'ubuntu-22.04', // bin/spc-gnu-docker for x86_64 + 'ubuntu-22.04', // bin/spc-gnu-docker for x86_64 // 'ubuntu-24.04', // bin/spc for x86_64 - // 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64 + 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64 // 'ubuntu-24.04-arm', // bin/spc for arm64 // 'windows-2022', // .\bin\spc.ps1 // 'windows-2025', @@ -50,7 +50,7 @@ $prefer_pre_built = true; // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'swoole,mongodb', + 'Linux', 'Darwin' => 'curl,gd', 'Windows' => 'bcmath,brotli,bz2,ctype,curl,dom,exif,fileinfo,filter,ftp,gd,iconv,intl,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pdo,pdo_mysql,pdo_pgsql,pgsql,session,simdjson,simplexml,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib', }; From fd4f70d526ef50b6ee321817811d8c097a95d569 Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 7 May 2026 16:51:56 +0700 Subject: [PATCH 29/29] oops --- src/SPC/builder/unix/library/curl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/curl.php b/src/SPC/builder/unix/library/curl.php index d1fab35d..8ed6736d 100644 --- a/src/SPC/builder/unix/library/curl.php +++ b/src/SPC/builder/unix/library/curl.php @@ -34,7 +34,7 @@ trait curl ->build(); $this->patchPkgconfPrefix(['libcurl.pc']); - // On glibc <2.28 without built-in pthreads, FindThreads + // On glibc <2.28 without built-in pthreads, FindThreads sets // INTERFACE_LINK_LIBRARIES to '-lpthread' // curls .pc generator walks and prepends '-l' to each // entry, resulting in -l-lpthread