From 8a9c8a279dd0a80dccafe7b75e26e913444523b4 Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 23 Oct 2025 20:08:28 +0200 Subject: [PATCH 01/10] why does this fix compilation? --- src/SPC/builder/linux/LinuxBuilder.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index 3995c3a85..451aca5ce 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -211,7 +211,7 @@ protected function buildCgi(): void $concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : ''; shell()->cd(SOURCE_PATH . '/php-src') ->exec('sed -i "s|//lib|/lib|g" Makefile') - ->exec("make {$concurrency} {$vars} cgi"); + ->exec("make -j {$vars} cgi"); if (!$this->getOption('no-strip', false)) { shell()->cd(SOURCE_PATH . '/php-src/sapi/cgi')->exec('strip --strip-unneeded php-cgi'); @@ -247,7 +247,7 @@ protected function buildMicro(): void shell()->cd(SOURCE_PATH . '/php-src') ->exec('sed -i "s|//lib|/lib|g" Makefile') - ->exec("make {$concurrency} {$vars} micro"); + ->exec("make -j {$vars} micro"); $this->processMicroUPX(); @@ -267,7 +267,7 @@ protected function buildFpm(): void $concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : ''; shell()->cd(SOURCE_PATH . '/php-src') ->exec('sed -i "s|//lib|/lib|g" Makefile') - ->exec("make {$concurrency} {$vars} fpm"); + ->exec("make -j {$vars} fpm"); if (!$this->getOption('no-strip', false)) { shell()->cd(SOURCE_PATH . '/php-src/sapi/fpm')->exec('strip --strip-unneeded php-fpm'); @@ -294,7 +294,7 @@ protected function buildEmbed(): void shell()->cd(SOURCE_PATH . '/php-src') ->exec('sed -i "s|//lib|/lib|g" Makefile') ->exec('sed -i "s|^EXTENSION_DIR = .*|EXTENSION_DIR = /' . basename(BUILD_MODULES_PATH) . '|" Makefile') - ->exec("make {$concurrency} INSTALL_ROOT=" . BUILD_ROOT_PATH . " {$vars} install-sapi {$install_modules} install-build install-headers install-programs"); + ->exec('make -j INSTALL_ROOT=' . BUILD_ROOT_PATH . " {$vars} install-sapi {$install_modules} install-build install-headers install-programs"); $ldflags = getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS') ?: ''; $libDir = BUILD_LIB_PATH; From 8e96c649181dc4b33be8f44e480b29d0c4b3ffb3 Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 23 Oct 2025 20:08:52 +0200 Subject: [PATCH 02/10] add stdext to swoole --- src/SPC/builder/extension/swoole.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/extension/swoole.php b/src/SPC/builder/extension/swoole.php index a4a531cf3..7ff4b3314 100644 --- a/src/SPC/builder/extension/swoole.php +++ b/src/SPC/builder/extension/swoole.php @@ -69,12 +69,15 @@ public function getUnixConfigureArg(bool $shared = false): string $arg .= $this->builder->getExt('swoole-hook-pgsql') ? ' --enable-swoole-pgsql' : ' --disable-swoole-pgsql'; $arg .= $this->builder->getExt('swoole-hook-mysql') ? ' --enable-mysqlnd' : ' --disable-mysqlnd'; $arg .= $this->builder->getExt('swoole-hook-sqlite') ? ' --enable-swoole-sqlite' : ' --disable-swoole-sqlite'; - if ($this->builder->getExt('swoole-hook-odbc')) { $config = (new SPCConfigUtil($this->builder, ['libs_only_deps' => true]))->config([], ['unixodbc']); $arg .= ' --with-swoole-odbc=unixODBC,' . BUILD_ROOT_PATH . ' SWOOLE_ODBC_LIBS="' . $config['libs'] . '"'; } + if ($this->getExtVersion() >= '6.1.0') { + $arg .= ' --enable-swoole-stdext'; + } + if (SPCTarget::getTargetOS() === 'Darwin') { $arg .= ' ac_cv_lib_pthread_pthread_barrier_init=no'; } From 8e50af3a7ead6c511e6e5940627c32c6fd21979f Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 23 Oct 2025 21:21:37 +0200 Subject: [PATCH 03/10] update to rc3 --- src/SPC/builder/linux/LinuxBuilder.php | 8 ++++---- src/SPC/store/source/PhpSource.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index 451aca5ce..3995c3a85 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -211,7 +211,7 @@ protected function buildCgi(): void $concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : ''; shell()->cd(SOURCE_PATH . '/php-src') ->exec('sed -i "s|//lib|/lib|g" Makefile') - ->exec("make -j {$vars} cgi"); + ->exec("make {$concurrency} {$vars} cgi"); if (!$this->getOption('no-strip', false)) { shell()->cd(SOURCE_PATH . '/php-src/sapi/cgi')->exec('strip --strip-unneeded php-cgi'); @@ -247,7 +247,7 @@ protected function buildMicro(): void shell()->cd(SOURCE_PATH . '/php-src') ->exec('sed -i "s|//lib|/lib|g" Makefile') - ->exec("make -j {$vars} micro"); + ->exec("make {$concurrency} {$vars} micro"); $this->processMicroUPX(); @@ -267,7 +267,7 @@ protected function buildFpm(): void $concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : ''; shell()->cd(SOURCE_PATH . '/php-src') ->exec('sed -i "s|//lib|/lib|g" Makefile') - ->exec("make -j {$vars} fpm"); + ->exec("make {$concurrency} {$vars} fpm"); if (!$this->getOption('no-strip', false)) { shell()->cd(SOURCE_PATH . '/php-src/sapi/fpm')->exec('strip --strip-unneeded php-fpm'); @@ -294,7 +294,7 @@ protected function buildEmbed(): void shell()->cd(SOURCE_PATH . '/php-src') ->exec('sed -i "s|//lib|/lib|g" Makefile') ->exec('sed -i "s|^EXTENSION_DIR = .*|EXTENSION_DIR = /' . basename(BUILD_MODULES_PATH) . '|" Makefile') - ->exec('make -j INSTALL_ROOT=' . BUILD_ROOT_PATH . " {$vars} install-sapi {$install_modules} install-build install-headers install-programs"); + ->exec("make {$concurrency} INSTALL_ROOT=" . BUILD_ROOT_PATH . " {$vars} install-sapi {$install_modules} install-build install-headers install-programs"); $ldflags = getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS') ?: ''; $libDir = BUILD_LIB_PATH; diff --git a/src/SPC/store/source/PhpSource.php b/src/SPC/store/source/PhpSource.php index ca6b6b6fe..e70ae59ac 100644 --- a/src/SPC/store/source/PhpSource.php +++ b/src/SPC/store/source/PhpSource.php @@ -16,7 +16,7 @@ public function fetch(bool $force = false, ?array $config = null, int $lock_as = { $major = defined('SPC_BUILD_PHP_VERSION') ? SPC_BUILD_PHP_VERSION : '8.4'; if ($major === '8.5') { - Downloader::downloadSource('php-src', ['type' => 'url', 'url' => 'https://github.com/php/php-src/archive/refs/tags/php-8.5.0RC2.tar.gz'], $force); + Downloader::downloadSource('php-src', ['type' => 'url', 'url' => 'https://github.com/php/php-src/archive/refs/tags/php-8.5.0RC3.tar.gz'], $force); } elseif ($major === 'git') { Downloader::downloadSource('php-src', ['type' => 'git', 'url' => 'https://github.com/php/php-src.git', 'rev' => 'master'], $force); } else { From ef5e6649815718f9a1621733e65e9de8f2f15a5d Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 23 Oct 2025 22:14:57 +0200 Subject: [PATCH 04/10] don't build iconv program, or gettext programs --- src/SPC/builder/unix/library/gettext.php | 2 +- src/SPC/builder/unix/library/libiconv.php | 8 +++++++- src/SPC/util/executor/UnixAutoconfExecutor.php | 16 ++++++++++------ src/SPC/util/shell/UnixShell.php | 1 + 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/SPC/builder/unix/library/gettext.php b/src/SPC/builder/unix/library/gettext.php index f0fdae547..332e25c96 100644 --- a/src/SPC/builder/unix/library/gettext.php +++ b/src/SPC/builder/unix/library/gettext.php @@ -31,7 +31,7 @@ protected function build(): void $autoconf->addConfigureArgs('--disable-threads'); } - $autoconf->configure()->make(); + $autoconf->configure()->make(dir: $this->getSourceDir() . '/gettext-runtime/intl'); $this->patchLaDependencyPrefix(); } } diff --git a/src/SPC/builder/unix/library/libiconv.php b/src/SPC/builder/unix/library/libiconv.php index fd68e309d..5ccc94843 100644 --- a/src/SPC/builder/unix/library/libiconv.php +++ b/src/SPC/builder/unix/library/libiconv.php @@ -10,7 +10,13 @@ trait libiconv { protected function build(): void { - UnixAutoconfExecutor::create($this)->configure('--enable-extra-encodings')->make(); + UnixAutoconfExecutor::create($this) + ->configure( + '--enable-extra-encodings', + '--enable-year2038', + ) + ->make('install-lib', with_install: false) + ->make('install-lib', with_install: false, dir: $this->getSourceDir() . '/libcharset'); $this->patchLaDependencyPrefix(); } } diff --git a/src/SPC/util/executor/UnixAutoconfExecutor.php b/src/SPC/util/executor/UnixAutoconfExecutor.php index 075d7fd32..f196cb1ce 100644 --- a/src/SPC/util/executor/UnixAutoconfExecutor.php +++ b/src/SPC/util/executor/UnixAutoconfExecutor.php @@ -50,18 +50,22 @@ public function getConfigureArgsString(): string * @param bool $with_clean Whether to clean before building * @param array $after_env_vars Environment variables postfix */ - public function make(string $target = '', false|string $with_install = 'install', bool $with_clean = true, array $after_env_vars = []): static + public function make(string $target = '', false|string $with_install = 'install', bool $with_clean = true, array $after_env_vars = [], ?string $dir = null): static { - return $this->seekLogFileOnException(function () use ($target, $with_install, $with_clean, $after_env_vars) { + return $this->seekLogFileOnException(function () use ($target, $with_install, $with_clean, $after_env_vars, $dir) { + $shell = $this->shell; + if ($dir) { + $shell = $shell->cd($dir); + } if ($with_clean) { - $this->shell->exec('make clean'); + $shell->exec('make clean'); } $after_env_vars_str = $after_env_vars !== [] ? shell()->setEnv($after_env_vars)->getEnvString() : ''; - $this->shell->exec("make -j{$this->library->getBuilder()->concurrency} {$target} {$after_env_vars_str}"); + $shell->exec("make -j{$this->library->getBuilder()->concurrency} {$target} {$after_env_vars_str}"); if ($with_install !== false) { - $this->shell->exec("make {$with_install}"); + $shell->exec("make {$with_install}"); } - return $this->shell; + return $shell; }); } diff --git a/src/SPC/util/shell/UnixShell.php b/src/SPC/util/shell/UnixShell.php index b8d038b01..2fdc1b077 100644 --- a/src/SPC/util/shell/UnixShell.php +++ b/src/SPC/util/shell/UnixShell.php @@ -29,6 +29,7 @@ public function __construct(?bool $debug = null) public function exec(string $cmd): static { + $cmd = clean_spaces($cmd); /* @phpstan-ignore-next-line */ logger()->info(ConsoleColor::yellow('[EXEC] ') . ConsoleColor::green($cmd)); $original_command = $cmd; From da8debdadea912491cd953414a2c103dbff90735 Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 23 Oct 2025 22:19:53 +0200 Subject: [PATCH 05/10] test php 8.5 with gettext --- src/globals/test-extensions.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index ad814c0de..0b73801f0 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -16,8 +16,8 @@ // '8.1', // '8.2', // '8.3', - '8.4', - // '8.5', + // '8.4', + '8.5', // 'git', ]; @@ -25,7 +25,7 @@ $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-latest', // bin/spc-alpine-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 @@ -49,7 +49,7 @@ // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'spx', + 'Linux', 'Darwin' => 'gettext', 'Windows' => 'bcmath,bz2,calendar,ctype,curl,dom,exif,fileinfo,filter,ftp,iconv,xml,mbstring,mbregex,mysqlnd,openssl,pdo,pdo_mysql,pdo_sqlite,phar,session,simplexml,soap,sockets,sqlite3,tokenizer,xmlwriter,xmlreader,zlib,zip', }; From 7bc4131c0286060b0a5e58737a150dac76b14cdc Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 23 Oct 2025 23:11:30 +0200 Subject: [PATCH 06/10] use correct license for gettext as we only build libs now, update gmp to dynamically check version --- config/source.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/config/source.json b/config/source.json index 8a2aaf62c..349ba68cf 100644 --- a/config/source.json +++ b/config/source.json @@ -306,16 +306,17 @@ "regex": "/href=\"(?gettext-(?[^\"]+)\\.tar\\.xz)\"/", "license": { "type": "file", - "path": "COPYING" + "path": "gettext-runtime/intl/COPYING.LIB" } }, "gmp": { - "type": "url", - "url": "https://dl.static-php.dev/static-php-cli/deps/gmp/gmp-6.3.0.tar.xz", + "type": "filelist", + "url": "https://gmplib.org/download/gmp/", + "regex": "/href=\"(?gmp-(?[^\"]+)\\.tar\\.xz)\"/", "provide-pre-built": true, "alt": { - "type": "ghtagtar", - "repo": "alisw/GMP" + "type": "url", + "url": "https://dl.static-php.dev/static-php-cli/deps/gmp/gmp-6.3.0.tar.xz" }, "license": { "type": "text", From eb4445ea59748e42e9c3e1508dffbfd4c17f61e7 Mon Sep 17 00:00:00 2001 From: henderkes Date: Fri, 24 Oct 2025 10:06:29 +0200 Subject: [PATCH 07/10] use release tarballs from Daniel rather than automatically generated ones from github --- src/SPC/store/source/PhpSource.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/store/source/PhpSource.php b/src/SPC/store/source/PhpSource.php index e70ae59ac..1c0be85fb 100644 --- a/src/SPC/store/source/PhpSource.php +++ b/src/SPC/store/source/PhpSource.php @@ -16,7 +16,7 @@ public function fetch(bool $force = false, ?array $config = null, int $lock_as = { $major = defined('SPC_BUILD_PHP_VERSION') ? SPC_BUILD_PHP_VERSION : '8.4'; if ($major === '8.5') { - Downloader::downloadSource('php-src', ['type' => 'url', 'url' => 'https://github.com/php/php-src/archive/refs/tags/php-8.5.0RC3.tar.gz'], $force); + Downloader::downloadSource('php-src', ['type' => 'url', 'url' => 'https://downloads.php.net/~daniels/php-8.5.0RC3.tar.xz'], $force); } elseif ($major === 'git') { Downloader::downloadSource('php-src', ['type' => 'git', 'url' => 'https://github.com/php/php-src.git', 'rev' => 'master'], $force); } else { From c30b34ae5c6f56b3aef0eb5fd885e7dec4e44024 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 24 Oct 2025 17:02:15 +0800 Subject: [PATCH 08/10] Fix gettext missing symbols on macOS --- src/SPC/builder/extension/gettext.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/extension/gettext.php b/src/SPC/builder/extension/gettext.php index dc4f58aaa..791cbef40 100644 --- a/src/SPC/builder/extension/gettext.php +++ b/src/SPC/builder/extension/gettext.php @@ -15,7 +15,7 @@ class gettext extends Extension public function patchBeforeBuildconf(): bool { if ($this->builder instanceof MacOSBuilder) { - FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/gettext/config.m4', 'AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB', 'AC_CHECK_LIB(intl'); + FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/gettext/config.m4', 'AC_CHECK_LIB([$GETTEXT_CHECK_IN_LIB', 'AC_CHECK_LIB([intl'); } return true; } From 4cdc6a07ae7e269ef1e0a38cac051592e2560eef Mon Sep 17 00:00:00 2001 From: henderkes Date: Fri, 24 Oct 2025 11:49:11 +0200 Subject: [PATCH 09/10] fix php 8.5 --- src/SPC/builder/extension/gettext.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/SPC/builder/extension/gettext.php b/src/SPC/builder/extension/gettext.php index 791cbef40..7baa36502 100644 --- a/src/SPC/builder/extension/gettext.php +++ b/src/SPC/builder/extension/gettext.php @@ -15,7 +15,10 @@ class gettext extends Extension public function patchBeforeBuildconf(): bool { if ($this->builder instanceof MacOSBuilder) { + // new php versions FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/gettext/config.m4', 'AC_CHECK_LIB([$GETTEXT_CHECK_IN_LIB', 'AC_CHECK_LIB([intl'); + // old php versions + FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/gettext/config.m4', 'AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB', 'AC_CHECK_LIB(intl'); } return true; } From 56bac3576818e64d903d7eb3d22b40608f7ef28e Mon Sep 17 00:00:00 2001 From: henderkes Date: Fri, 24 Oct 2025 12:09:24 +0200 Subject: [PATCH 10/10] do both in one go --- src/SPC/builder/extension/gettext.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/SPC/builder/extension/gettext.php b/src/SPC/builder/extension/gettext.php index 7baa36502..303cc3892 100644 --- a/src/SPC/builder/extension/gettext.php +++ b/src/SPC/builder/extension/gettext.php @@ -15,10 +15,11 @@ class gettext extends Extension public function patchBeforeBuildconf(): bool { if ($this->builder instanceof MacOSBuilder) { - // new php versions - FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/gettext/config.m4', 'AC_CHECK_LIB([$GETTEXT_CHECK_IN_LIB', 'AC_CHECK_LIB([intl'); - // old php versions - FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/gettext/config.m4', 'AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB', 'AC_CHECK_LIB(intl'); + FileSystem::replaceFileStr( + SOURCE_PATH . '/php-src/ext/gettext/config.m4', + ['AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB', 'AC_CHECK_LIB([$GETTEXT_CHECK_IN_LIB'], + ['AC_CHECK_LIB(intl', 'AC_CHECK_LIB([intl'] // new php versions use a bracket + ); } return true; }