From 9c8b4d627c14e953796fbed991979051ee138ef0 Mon Sep 17 00:00:00 2001 From: henderkes Date: Sun, 19 Oct 2025 09:08:50 +0200 Subject: [PATCH 01/25] also install-modules of course... --- src/SPC/builder/linux/LinuxBuilder.php | 2 +- src/SPC/builder/macos/MacOSBuilder.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index 41b1545d..bb40125a 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -288,7 +288,7 @@ class LinuxBuilder extends UnixBuilderBase 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-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/builder/macos/MacOSBuilder.php b/src/SPC/builder/macos/MacOSBuilder.php index d144457e..119aa3b7 100644 --- a/src/SPC/builder/macos/MacOSBuilder.php +++ b/src/SPC/builder/macos/MacOSBuilder.php @@ -267,7 +267,7 @@ class MacOSBuilder extends UnixBuilderBase $vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars()); $concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : ''; shell()->cd(SOURCE_PATH . '/php-src') - ->exec("make {$concurrency} INSTALL_ROOT=" . BUILD_ROOT_PATH . " {$vars} install-sapi 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"); if (getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') === 'static') { $AR = getenv('AR') ?: 'ar'; From 8ab09898f0f5ccb125e9f4810dbd23cdfa671fa8 Mon Sep 17 00:00:00 2001 From: henderkes Date: Sun, 19 Oct 2025 10:41:14 +0200 Subject: [PATCH 02/25] conditional install-modules --- config/ext.json | 5 +++++ src/SPC/builder/linux/LinuxBuilder.php | 8 +++++++- src/SPC/builder/macos/MacOSBuilder.php | 8 +++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/config/ext.json b/config/ext.json index 59ff4352..51924abf 100644 --- a/config/ext.json +++ b/config/ext.json @@ -341,6 +341,7 @@ "ext-depends": [ "xml" ], + "build-with-php": true, "target": [ "static" ] @@ -461,6 +462,7 @@ "mysqli": { "type": "builtin", "arg-type": "with", + "build-with-php": true, "ext-depends": [ "mysqlnd" ] @@ -468,6 +470,7 @@ "mysqlnd": { "type": "builtin", "arg-type-windows": "with", + "build-with-php": true, "lib-depends": [ "zlib" ] @@ -797,6 +800,7 @@ "type": "builtin", "arg-type": "with-path", "arg-type-windows": "with", + "build-with-php": true, "lib-depends": [ "sqlite" ] @@ -1177,6 +1181,7 @@ "lib-depends": [ "zlib" ], + "build-with-php": true, "target": [ "static" ] diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index bb40125a..3995c3a8 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -7,6 +7,7 @@ namespace SPC\builder\linux; use SPC\builder\unix\UnixBuilderBase; use SPC\exception\PatchException; use SPC\exception\WrongUsageException; +use SPC\store\Config; use SPC\store\FileSystem; use SPC\store\SourcePatcher; use SPC\util\GlobalEnvManager; @@ -283,12 +284,17 @@ class LinuxBuilder extends UnixBuilderBase */ protected function buildEmbed(): void { + $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; + }); + $install_modules = $sharedExts ? 'install-modules' : ''; $vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars()); $concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : ''; 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 {$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/builder/macos/MacOSBuilder.php b/src/SPC/builder/macos/MacOSBuilder.php index 119aa3b7..bcfaf6cf 100644 --- a/src/SPC/builder/macos/MacOSBuilder.php +++ b/src/SPC/builder/macos/MacOSBuilder.php @@ -7,6 +7,7 @@ namespace SPC\builder\macos; use SPC\builder\macos\library\MacOSLibraryBase; use SPC\builder\unix\UnixBuilderBase; use SPC\exception\WrongUsageException; +use SPC\store\Config; use SPC\store\FileSystem; use SPC\store\SourcePatcher; use SPC\util\GlobalEnvManager; @@ -264,10 +265,15 @@ class MacOSBuilder extends UnixBuilderBase */ protected function buildEmbed(): void { + $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; + }); + $install_modules = $sharedExts ? 'install-modules' : ''; $vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars()); $concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : ''; shell()->cd(SOURCE_PATH . '/php-src') - ->exec("make {$concurrency} 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"); if (getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') === 'static') { $AR = getenv('AR') ?: 'ar'; From 4cdefeab81e07c93c5919bcef1532b554acafb96 Mon Sep 17 00:00:00 2001 From: Marc Date: Sun, 19 Oct 2025 11:03:39 +0200 Subject: [PATCH 03/25] test with modules to build linux should use install-modules now, macOS should not (zip is not built with php) --- src/globals/test-extensions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 99e4e31b..03e0c324 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -55,8 +55,8 @@ $extensions = match (PHP_OS_FAMILY) { // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). $shared_extensions = match (PHP_OS_FAMILY) { - 'Linux' => '', - 'Darwin' => '', + 'Linux' => 'mysqli', + 'Darwin' => 'zip', 'Windows' => '', }; From 310335813fa6ad627fec66490d270164c5f5d106 Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 20 Oct 2025 21:23:54 +0200 Subject: [PATCH 04/25] use libedit for postgreqsql --- config/lib.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/lib.json b/config/lib.json index 81335539..6eefb33d 100644 --- a/config/lib.json +++ b/config/lib.json @@ -781,7 +781,7 @@ "libxml2", "openssl", "zlib", - "readline" + "libedit" ], "lib-suggests": [ "icu", From 32efeb970c927c605dd78e646ff5091033076f8a Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 20 Oct 2025 23:00:23 +0200 Subject: [PATCH 05/25] don't build ossfuzzer for zip --- src/SPC/builder/unix/library/libzip.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SPC/builder/unix/library/libzip.php b/src/SPC/builder/unix/library/libzip.php index 931bfcc3..ad0befea 100644 --- a/src/SPC/builder/unix/library/libzip.php +++ b/src/SPC/builder/unix/library/libzip.php @@ -22,6 +22,7 @@ trait libzip '-DBUILD_EXAMPLES=OFF', '-DBUILD_REGRESS=OFF', '-DBUILD_TOOLS=OFF', + '-DBUILD_OSSFUZZ=OFF', ) ->build(); $this->patchPkgconfPrefix(['libzip.pc'], PKGCONF_PATCH_PREFIX); From bba390dbcc8718f48f6cd559e20e6d4571fa91e8 Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 20 Oct 2025 23:04:33 +0200 Subject: [PATCH 06/25] add runtime libs to unixshell (debian 11 is stupid and doesn't add them automatically) --- src/SPC/util/shell/UnixShell.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SPC/util/shell/UnixShell.php b/src/SPC/util/shell/UnixShell.php index 75a0be3d..b8d038b0 100644 --- a/src/SPC/util/shell/UnixShell.php +++ b/src/SPC/util/shell/UnixShell.php @@ -8,6 +8,7 @@ use SPC\builder\freebsd\library\BSDLibraryBase; use SPC\builder\linux\library\LinuxLibraryBase; use SPC\builder\macos\library\MacOSLibraryBase; use SPC\exception\SPCInternalException; +use SPC\util\SPCTarget; use ZM\Logger\ConsoleColor; /** @@ -48,7 +49,7 @@ class UnixShell extends Shell 'CFLAGS' => $library->getLibExtraCFlags(), 'CXXFLAGS' => $library->getLibExtraCXXFlags(), 'LDFLAGS' => $library->getLibExtraLdFlags(), - 'LIBS' => $library->getLibExtraLibs(), + 'LIBS' => $library->getLibExtraLibs() . SPCTarget::getRuntimeLibs(), ]); return $this; } From 2e13be2a7aded02e93f802ab58d9619fb3e28030 Mon Sep 17 00:00:00 2001 From: henderkes Date: Tue, 21 Oct 2025 13:54:34 +0200 Subject: [PATCH 07/25] prevent libedit from building strlcat/strlcpy, no idea why their soure code doesn't prevent this correctly itself --- src/SPC/builder/unix/library/libedit.php | 17 ++++++++++++++--- src/SPC/store/SourcePatcher.php | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/SPC/builder/unix/library/libedit.php b/src/SPC/builder/unix/library/libedit.php index e436ee8b..39e14bf7 100644 --- a/src/SPC/builder/unix/library/libedit.php +++ b/src/SPC/builder/unix/library/libedit.php @@ -4,16 +4,27 @@ declare(strict_types=1); namespace SPC\builder\unix\library; +use SPC\store\FileSystem; use SPC\util\executor\UnixAutoconfExecutor; trait libedit { protected function build(): void { - UnixAutoconfExecutor::create($this) + $make = UnixAutoconfExecutor::create($this) ->appendEnv(['CFLAGS' => '-D__STDC_ISO_10646__=201103L']) - ->configure() - ->make(); + ->configure(); + + foreach (['strlcpy', 'strlcat', 'fgetln'] as $symbol) { + $usymbol = strtoupper($symbol); + FileSystem::replaceFileLineContainsString( + $this->source_dir . '/config.h', + "/* #undef HAVE_{$usymbol} */", + "/* #undef HAVE_{$usymbol} */\n#define {$symbol} libedit_{$symbol}" + ); + } + + $make->make(); $this->patchPkgconfPrefix(['libedit.pc']); } } diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index c08204f5..c7738e92 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -44,7 +44,7 @@ class SourcePatcher } foreach ($builder->getLibs() as $lib) { if ($lib->patchBeforeBuildconf() === true) { - logger()->info("Library [{$lib->getName()}]patched before buildconf"); + logger()->info("Library [{$lib->getName()}] patched before buildconf"); } } // patch windows php 8.1 bug From 4e393886aa1835ddcb58346c5c6736d802d8e891 Mon Sep 17 00:00:00 2001 From: henderkes Date: Tue, 21 Oct 2025 14:23:55 +0200 Subject: [PATCH 08/25] no idea why our source has that uncommented --- src/SPC/builder/unix/library/libedit.php | 26 ++++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/SPC/builder/unix/library/libedit.php b/src/SPC/builder/unix/library/libedit.php index 39e14bf7..f2bcd6e5 100644 --- a/src/SPC/builder/unix/library/libedit.php +++ b/src/SPC/builder/unix/library/libedit.php @@ -9,22 +9,22 @@ use SPC\util\executor\UnixAutoconfExecutor; trait libedit { + public function patchBeforeBuild(): bool + { + FileSystem::replaceFileStr( + $this->source_dir . '/src/sys.h', + '//#define strl', + '#define strl' + ); + return true; + } + protected function build(): void { - $make = UnixAutoconfExecutor::create($this) + UnixAutoconfExecutor::create($this) ->appendEnv(['CFLAGS' => '-D__STDC_ISO_10646__=201103L']) - ->configure(); - - foreach (['strlcpy', 'strlcat', 'fgetln'] as $symbol) { - $usymbol = strtoupper($symbol); - FileSystem::replaceFileLineContainsString( - $this->source_dir . '/config.h', - "/* #undef HAVE_{$usymbol} */", - "/* #undef HAVE_{$usymbol} */\n#define {$symbol} libedit_{$symbol}" - ); - } - - $make->make(); + ->configure() + ->make(); $this->patchPkgconfPrefix(['libedit.pc']); } } From 96592bce3ef5b02cffd3d8282c254f920a2bd609 Mon Sep 17 00:00:00 2001 From: henderkes Date: Tue, 21 Oct 2025 14:26:44 +0200 Subject: [PATCH 09/25] fix --- src/SPC/builder/unix/library/libedit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/unix/library/libedit.php b/src/SPC/builder/unix/library/libedit.php index f2bcd6e5..2de9077f 100644 --- a/src/SPC/builder/unix/library/libedit.php +++ b/src/SPC/builder/unix/library/libedit.php @@ -11,9 +11,9 @@ trait libedit { public function patchBeforeBuild(): bool { - FileSystem::replaceFileStr( + FileSystem::replaceFileRegex( $this->source_dir . '/src/sys.h', - '//#define strl', + '|//#define\s+strl|', '#define strl' ); return true; From ac8a9af89cc969fd5a24df63f37a85bf382128a5 Mon Sep 17 00:00:00 2001 From: Marc Date: Wed, 22 Oct 2025 19:43:54 +0200 Subject: [PATCH 10/25] Update license path for attr package --- config/source.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/source.json b/config/source.json index da58158c..8dc3613d 100644 --- a/config/source.json +++ b/config/source.json @@ -47,7 +47,7 @@ "provide-pre-built": true, "license": { "type": "file", - "path": "doc/COPYING" + "path": "doc/COPYING.LGPL" } }, "brotli": { From 6789ea81ff3c3ba2edef3e4a4494c86faf42f3b1 Mon Sep 17 00:00:00 2001 From: Marc Date: Wed, 22 Oct 2025 19:52:21 +0200 Subject: [PATCH 11/25] Update license path for acl in source.json --- config/source.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/source.json b/config/source.json index 8dc3613d..8a2aaf62 100644 --- a/config/source.json +++ b/config/source.json @@ -439,7 +439,7 @@ "provide-pre-built": true, "license": { "type": "file", - "path": "doc/COPYING" + "path": "doc/COPYING.LGPL" } }, "libaom": { From 55322a282c9a44e49865b9ecb00db40eda7f0522 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 23 Oct 2025 15:19:45 +0800 Subject: [PATCH 12/25] Fix rename cross-device link bug (using copy-delete) --- src/SPC/store/FileSystem.php | 43 +++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/src/SPC/store/FileSystem.php b/src/SPC/store/FileSystem.php index e66aee0a..f6ce371e 100644 --- a/src/SPC/store/FileSystem.php +++ b/src/SPC/store/FileSystem.php @@ -645,6 +645,36 @@ class FileSystem }; } + /** + * Move file or directory, handling cross-device scenarios + * Uses rename() if possible, falls back to copy+delete for cross-device moves + * + * @param string $source Source path + * @param string $dest Destination path + */ + private static function moveFileOrDir(string $source, string $dest): void + { + $source = self::convertPath($source); + $dest = self::convertPath($dest); + + // Try rename first (fast, atomic) + if (@rename($source, $dest)) { + return; + } + + if (is_dir($source)) { + self::copyDir($source, $dest); + self::removeDir($source); + } else { + if (!copy($source, $dest)) { + throw new FileSystemException("Failed to copy file from {$source} to {$dest}"); + } + if (!unlink($source)) { + throw new FileSystemException("Failed to remove source file: {$source}"); + } + } + } + /** * Unzip file with stripping top-level directory */ @@ -675,10 +705,10 @@ class FileSystem if (is_dir($extract_path)) { self::removeDir($extract_path); } - // if only one dir, move its contents to extract_path using rename + // if only one dir, move its contents to extract_path $subdir = self::convertPath("{$temp_dir}/{$contents[0]}"); if (count($contents) === 1 && is_dir($subdir)) { - rename($subdir, $extract_path); + self::moveFileOrDir($subdir, $extract_path); } else { // else, if it contains only one dir, strip dir and copy other files $dircount = 0; @@ -701,17 +731,20 @@ class FileSystem throw new FileSystemException("Cannot scan unzip temp sub-dir: {$dir[0]}"); } foreach ($sub_contents as $sub_item) { - rename(self::convertPath("{$temp_dir}/{$dir[0]}/{$sub_item}"), self::convertPath("{$extract_path}/{$sub_item}")); + self::moveFileOrDir(self::convertPath("{$temp_dir}/{$dir[0]}/{$sub_item}"), self::convertPath("{$extract_path}/{$sub_item}")); } } else { foreach ($dir as $item) { - rename(self::convertPath("{$temp_dir}/{$item}"), self::convertPath("{$extract_path}/{$item}")); + self::moveFileOrDir(self::convertPath("{$temp_dir}/{$item}"), self::convertPath("{$extract_path}/{$item}")); } } // move top-level files to extract_path foreach ($top_files as $top_file) { - rename(self::convertPath("{$temp_dir}/{$top_file}"), self::convertPath("{$extract_path}/{$top_file}")); + self::moveFileOrDir(self::convertPath("{$temp_dir}/{$top_file}"), self::convertPath("{$extract_path}/{$top_file}")); } } + + // Clean up temp directory + self::removeDir($temp_dir); } } From c6de6e705676eebb597972694cfb2f1fb8c49894 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 23 Oct 2025 16:29:46 +0800 Subject: [PATCH 13/25] test zip unarchive --- src/globals/test-extensions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 03e0c324..ad814c0d 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -49,7 +49,7 @@ $prefer_pre_built = false; // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'pdo_pgsql', + 'Linux', 'Darwin' => 'spx', '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 d3e2b4b5b29c26d370d4023992c2da3051d02187 Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 23 Oct 2025 13:11:20 +0200 Subject: [PATCH 14/25] don't even build tools in the first place --- src/SPC/builder/unix/library/attr.php | 2 +- src/SPC/builder/unix/library/libacl.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/unix/library/attr.php b/src/SPC/builder/unix/library/attr.php index b33cf987..67ac5feb 100644 --- a/src/SPC/builder/unix/library/attr.php +++ b/src/SPC/builder/unix/library/attr.php @@ -17,7 +17,7 @@ trait attr ->exec('libtoolize --force --copy') ->exec('./autogen.sh || autoreconf -if') ->configure('--disable-nls') - ->make(); + ->make('install-attributes_h install-data install-libattr_h install-libLTLIBRARIES install-pkgincludeHEADERS install-pkgconfDATA', with_install: false); $this->patchPkgconfPrefix(['libattr.pc'], PKGCONF_PATCH_PREFIX); } } diff --git a/src/SPC/builder/unix/library/libacl.php b/src/SPC/builder/unix/library/libacl.php index 223e09fc..8c5d699d 100644 --- a/src/SPC/builder/unix/library/libacl.php +++ b/src/SPC/builder/unix/library/libacl.php @@ -26,7 +26,7 @@ trait libacl ->exec('libtoolize --force --copy') ->exec('./autogen.sh || autoreconf -if') ->configure('--disable-nls', '--disable-tests') - ->make(); + ->make('install-acl_h install-libacl_h install-data install-libLTLIBRARIES install-pkgincludeHEADERS install-sysincludeHEADERS install-pkgconfDATA', with_install: false); $this->patchPkgconfPrefix(['libacl.pc'], PKGCONF_PATCH_PREFIX); } } From 8a9c8a279dd0a80dccafe7b75e26e913444523b4 Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 23 Oct 2025 20:08:28 +0200 Subject: [PATCH 15/25] 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 3995c3a8..451aca5c 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -211,7 +211,7 @@ class LinuxBuilder extends UnixBuilderBase $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 @@ class LinuxBuilder extends UnixBuilderBase 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 @@ class LinuxBuilder extends UnixBuilderBase $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 @@ class LinuxBuilder extends UnixBuilderBase 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 16/25] 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 a4a531cf..7ff4b331 100644 --- a/src/SPC/builder/extension/swoole.php +++ b/src/SPC/builder/extension/swoole.php @@ -69,12 +69,15 @@ class swoole extends Extension $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 17/25] 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 451aca5c..3995c3a8 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -211,7 +211,7 @@ class LinuxBuilder extends UnixBuilderBase $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 @@ class LinuxBuilder extends UnixBuilderBase 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 @@ class LinuxBuilder extends UnixBuilderBase $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 @@ class LinuxBuilder extends UnixBuilderBase 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 ca6b6b6f..e70ae59a 100644 --- a/src/SPC/store/source/PhpSource.php +++ b/src/SPC/store/source/PhpSource.php @@ -16,7 +16,7 @@ class PhpSource extends CustomSourceBase { $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 18/25] 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 f0fdae54..332e25c9 100644 --- a/src/SPC/builder/unix/library/gettext.php +++ b/src/SPC/builder/unix/library/gettext.php @@ -31,7 +31,7 @@ trait gettext $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 fd68e309..5ccc9484 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 075d7fd3..f196cb1c 100644 --- a/src/SPC/util/executor/UnixAutoconfExecutor.php +++ b/src/SPC/util/executor/UnixAutoconfExecutor.php @@ -50,18 +50,22 @@ class UnixAutoconfExecutor extends Executor * @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 b8d038b0..2fdc1b07 100644 --- a/src/SPC/util/shell/UnixShell.php +++ b/src/SPC/util/shell/UnixShell.php @@ -29,6 +29,7 @@ class UnixShell extends Shell 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 19/25] 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 ad814c0d..0b73801f 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -16,8 +16,8 @@ $test_php_version = [ // '8.1', // '8.2', // '8.3', - '8.4', - // '8.5', + // '8.4', + '8.5', // 'git', ]; @@ -25,7 +25,7 @@ $test_php_version = [ $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 @@ $prefer_pre_built = false; // 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 20/25] 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 8a2aaf62..349ba68c 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 be51bcfdfc3c9c829b5f157bb29d397edd52ae0c Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 24 Oct 2025 13:55:33 +0800 Subject: [PATCH 21/25] Fix libevent build, use newer cmake options --- src/SPC/doctor/item/LinuxToolCheckList.php | 4 ++-- src/SPC/util/executor/UnixCMakeExecutor.php | 2 +- src/globals/test-extensions.php | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/SPC/doctor/item/LinuxToolCheckList.php b/src/SPC/doctor/item/LinuxToolCheckList.php index 2f6e866d..a23ad6d5 100644 --- a/src/SPC/doctor/item/LinuxToolCheckList.php +++ b/src/SPC/doctor/item/LinuxToolCheckList.php @@ -82,14 +82,14 @@ class LinuxToolCheckList return CheckResult::ok(); } - #[AsCheckItem('if cmake version >= 3.18', limit_os: 'Linux')] + #[AsCheckItem('if cmake version >= 3.22', limit_os: 'Linux')] public function checkCMakeVersion(): ?CheckResult { $ver = get_cmake_version(); if ($ver === null) { return CheckResult::fail('Failed to get cmake version'); } - if (version_compare($ver, '3.18.0') < 0) { + if (version_compare($ver, '3.22.0') < 0) { return CheckResult::fail('cmake version is too low (' . $ver . '), please update it manually!'); } return CheckResult::ok($ver); diff --git a/src/SPC/util/executor/UnixCMakeExecutor.php b/src/SPC/util/executor/UnixCMakeExecutor.php index 3e29addf..eceab901 100644 --- a/src/SPC/util/executor/UnixCMakeExecutor.php +++ b/src/SPC/util/executor/UnixCMakeExecutor.php @@ -205,7 +205,7 @@ SET(CMAKE_INSTALL_PREFIX "{$root}") SET(CMAKE_INSTALL_LIBDIR "lib") set(PKG_CONFIG_EXECUTABLE "{$pkgConfigExecutable}") -list(APPEND PKG_CONFIG_EXECUTABLE "--static") +set(PKG_CONFIG_ARGN "--static" CACHE STRING "Extra arguments for pkg-config" FORCE) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index ad814c0d..ade41c32 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -13,10 +13,10 @@ declare(strict_types=1); // test php version (8.1 ~ 8.4 available, multiple for matrix) $test_php_version = [ - // '8.1', + '8.1', // '8.2', // '8.3', - '8.4', + // '8.4', // '8.5', // 'git', ]; @@ -25,7 +25,7 @@ $test_php_version = [ $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,14 +49,14 @@ $prefer_pre_built = false; // 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' => 'event', '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', }; // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). $shared_extensions = match (PHP_OS_FAMILY) { - 'Linux' => 'mysqli', - 'Darwin' => 'zip', + 'Linux' => '', + 'Darwin' => '', 'Windows' => '', }; From eb4445ea59748e42e9c3e1508dffbfd4c17f61e7 Mon Sep 17 00:00:00 2001 From: henderkes Date: Fri, 24 Oct 2025 10:06:29 +0200 Subject: [PATCH 22/25] 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 e70ae59a..1c0be85f 100644 --- a/src/SPC/store/source/PhpSource.php +++ b/src/SPC/store/source/PhpSource.php @@ -16,7 +16,7 @@ class PhpSource extends CustomSourceBase { $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 23/25] 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 dc4f58aa..791cbef4 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 24/25] 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 791cbef4..7baa3650 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 25/25] 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 7baa3650..303cc389 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; }