From 38cc4cfe7e02437220477e75dfdabdc80cfdd7c8 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 00:32:43 +0700 Subject: [PATCH 01/58] doesn't even work yet, there has to be a better way than to add 2913912309 libraries --- config/lib.json | 6 ++--- src/SPC/builder/extension/grpc.php | 19 +++++++++++++++ src/SPC/builder/unix/library/grpc.php | 35 ++++++++++++++++++--------- 3 files changed, 45 insertions(+), 15 deletions(-) diff --git a/config/lib.json b/config/lib.json index 1a195f66..999feb33 100644 --- a/config/lib.json +++ b/config/lib.json @@ -186,12 +186,12 @@ "grpc": { "source": "grpc", "static-libs-unix": [ - "libgrpc.a", - "libcares.a" + "libgrpc.a" ], "lib-depends": [ "zlib", - "openssl" + "openssl", + "libcares" ], "frameworks": [ "CoreFoundation" diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index 852f2933..e5459807 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -36,9 +36,20 @@ class grpc extends Extension } return false; } + public function patchBeforeConfigure(): bool + { + $libs = ' -l' . join(' -l', $this->getLibraries()); + FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/configure', '-lgrpc', $libs); + return true; + } public function patchBeforeMake(): bool { + $extra_libs = trim(getenv('SPC_EXTRA_LIBS')); + $alibs = join('.a ', $this->getLibraries()) . '.a'; + $libs = BUILD_LIB_PATH . '/lib' . str_replace(' ', ' ' . BUILD_LIB_PATH . '/lib', $alibs); + $extra_libs = str_replace(BUILD_LIB_PATH . '/libgrpc.a', $libs, $extra_libs); + f_putenv('SPC_EXTRA_LIBS=' . $extra_libs); // add -Wno-strict-prototypes GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') . ' -Wno-strict-prototypes'); return true; @@ -48,4 +59,12 @@ class grpc extends Extension { return '--enable-grpc=' . BUILD_ROOT_PATH . '/grpc GRPC_LIB_SUBDIR=' . BUILD_LIB_PATH; } + + private function getLibraries(): array + { + [, $out] = shell()->execWithResult('$PKG_CONFIG --libs-only-l grpc'); + $libs = join(' ', $out) . ' -lupb -lupb_message_lib -lupb_json_lib -lupb_textformat_lib -lupb_mini_descriptor_lib -lupb_wire_lib -lupb_mem_lib -lupb_base_lib -lutf8_range'; + $libs = str_replace('-l', '', $libs); + return explode(' ', $libs); + } } diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index a7472448..a6c329e3 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -4,22 +4,33 @@ declare(strict_types=1); namespace SPC\builder\unix\library; -use SPC\store\FileSystem; +use SPC\util\executor\UnixCMakeExecutor; trait grpc { protected function build(): void { - shell()->cd($this->source_dir) - ->exec('EXTRA_DEFINES=GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK EMBED_OPENSSL=false CXXFLAGS="-L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '" make static -j' . $this->builder->concurrency); - copy($this->source_dir . '/libs/opt/libgrpc.a', BUILD_LIB_PATH . '/libgrpc.a'); - copy($this->source_dir . '/libs/opt/libboringssl.a', BUILD_LIB_PATH . '/libboringssl.a'); - if (!file_exists(BUILD_LIB_PATH . '/libcares.a')) { - copy($this->source_dir . '/libs/opt/libcares.a', BUILD_LIB_PATH . '/libcares.a'); - } - FileSystem::copyDir($this->source_dir . '/include/grpc', BUILD_INCLUDE_PATH . '/grpc'); - FileSystem::copyDir($this->source_dir . '/include/grpc++', BUILD_INCLUDE_PATH . '/grpc++'); - FileSystem::copyDir($this->source_dir . '/include/grpcpp', BUILD_INCLUDE_PATH . '/grpcpp'); - FileSystem::copyDir($this->source_dir . '/src/php/ext/grpc', BUILD_ROOT_PATH . '/grpc_php_ext_src'); + UnixCMakeExecutor::create($this) + ->addConfigureArgs( + '-DgRPC_SSL_PROVIDER=openssl', + '-DgRPC_INSTALL_BINDIR=' . BUILD_BIN_PATH, + '-DgRPC_INSTALL_LIBDIR=' . BUILD_LIB_PATH, + '-DgRPC_INSTALL_SHAREDIR=' . BUILD_ROOT_PATH . '/share/grpc', + '-DOPENSSL_ROOT_DIR=' . BUILD_ROOT_PATH, + '-DOPENSSL_INCLUDE_DIR=' . BUILD_INCLUDE_PATH, + '-DCMAKE_CXX_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK"' + ) + ->build(); + //shell()->cd($this->source_dir) + // ->exec('EXTRA_DEFINES=GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK EMBED_OPENSSL=false CXXFLAGS="-L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '" make static -j' . $this->builder->concurrency); + //copy($this->source_dir . '/libs/opt/libgrpc.a', BUILD_LIB_PATH . '/libgrpc.a'); + //copy($this->source_dir . '/libs/opt/libboringssl.a', BUILD_LIB_PATH . '/libboringssl.a'); + //if (!file_exists(BUILD_LIB_PATH . '/libcares.a')) { + // copy($this->source_dir . '/libs/opt/libcares.a', BUILD_LIB_PATH . '/libcares.a'); + //} + //FileSystem::copyDir($this->source_dir . '/include/grpc', BUILD_INCLUDE_PATH . '/grpc'); + //FileSystem::copyDir($this->source_dir . '/include/grpc++', BUILD_INCLUDE_PATH . '/grpc++'); + //FileSystem::copyDir($this->source_dir . '/include/grpcpp', BUILD_INCLUDE_PATH . '/grpcpp'); + //FileSystem::copyDir($this->source_dir . '/src/php/ext/grpc', BUILD_ROOT_PATH . '/grpc_php_ext_src'); } } From 76d7002646dbd687626206cbafba73cd87e5adaa Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 09:33:29 +0700 Subject: [PATCH 02/58] needed --libs --static --- src/SPC/builder/extension/grpc.php | 10 +++++++--- src/SPC/builder/unix/library/grpc.php | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index e5459807..4cf06f4a 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -62,9 +62,13 @@ class grpc extends Extension private function getLibraries(): array { - [, $out] = shell()->execWithResult('$PKG_CONFIG --libs-only-l grpc'); + [, $out] = shell()->execWithResult('$PKG_CONFIG --libs --static grpc'); $libs = join(' ', $out) . ' -lupb -lupb_message_lib -lupb_json_lib -lupb_textformat_lib -lupb_mini_descriptor_lib -lupb_wire_lib -lupb_mem_lib -lupb_base_lib -lutf8_range'; - $libs = str_replace('-l', '', $libs); - return explode(' ', $libs); + $filtered = str_replace('-pthread', '', $libs); + $filtered = preg_replace('/-L\S+/', '', $filtered); + $filtered = preg_replace('/(?:\S*\/)?lib([a-zA-Z0-9_+-]+)\.a\b/', '-l$1', $filtered); + $out = str_replace('-l', '', $filtered); + $out = preg_replace('/\s+/', ' ', $out); + return explode(' ', trim($out)); } } diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index a6c329e3..8cacd39f 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -21,6 +21,8 @@ trait grpc '-DCMAKE_CXX_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK"' ) ->build(); + copy($this->source_dir . '/third_party/re2/re2.pc', BUILD_LIB_PATH . '/pkgconfig/re2.pc'); + //shell()->cd($this->source_dir) // ->exec('EXTRA_DEFINES=GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK EMBED_OPENSSL=false CXXFLAGS="-L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '" make static -j' . $this->builder->concurrency); //copy($this->source_dir . '/libs/opt/libgrpc.a', BUILD_LIB_PATH . '/libgrpc.a'); From 0ccf1a1c5da430818c18aae9cb5eea820105db8d Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 09:41:36 +0700 Subject: [PATCH 03/58] remove grpc_php_ext_src --- src/SPC/builder/extension/grpc.php | 3 +-- src/SPC/builder/unix/library/grpc.php | 17 ++++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index 4cf06f4a..f1c4ce6f 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -24,8 +24,6 @@ class grpc extends Extension if (!is_link(SOURCE_PATH . '/php-src/ext/grpc')) { if (is_dir($this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc')) { shell()->exec('ln -s ' . $this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc ' . SOURCE_PATH . '/php-src/ext/grpc'); - } elseif (is_dir(BUILD_ROOT_PATH . '/grpc_php_ext_src')) { - shell()->exec('ln -s ' . BUILD_ROOT_PATH . '/grpc_php_ext_src ' . SOURCE_PATH . '/php-src/ext/grpc'); } else { throw new \RuntimeException('Cannot find grpc source code'); } @@ -36,6 +34,7 @@ class grpc extends Extension } return false; } + public function patchBeforeConfigure(): bool { $libs = ' -l' . join(' -l', $this->getLibraries()); diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index 8cacd39f..40e042a5 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -23,16 +23,15 @@ trait grpc ->build(); copy($this->source_dir . '/third_party/re2/re2.pc', BUILD_LIB_PATH . '/pkgconfig/re2.pc'); - //shell()->cd($this->source_dir) + // shell()->cd($this->source_dir) // ->exec('EXTRA_DEFINES=GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK EMBED_OPENSSL=false CXXFLAGS="-L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '" make static -j' . $this->builder->concurrency); - //copy($this->source_dir . '/libs/opt/libgrpc.a', BUILD_LIB_PATH . '/libgrpc.a'); - //copy($this->source_dir . '/libs/opt/libboringssl.a', BUILD_LIB_PATH . '/libboringssl.a'); - //if (!file_exists(BUILD_LIB_PATH . '/libcares.a')) { + // copy($this->source_dir . '/libs/opt/libgrpc.a', BUILD_LIB_PATH . '/libgrpc.a'); + // copy($this->source_dir . '/libs/opt/libboringssl.a', BUILD_LIB_PATH . '/libboringssl.a'); + // if (!file_exists(BUILD_LIB_PATH . '/libcares.a')) { // copy($this->source_dir . '/libs/opt/libcares.a', BUILD_LIB_PATH . '/libcares.a'); - //} - //FileSystem::copyDir($this->source_dir . '/include/grpc', BUILD_INCLUDE_PATH . '/grpc'); - //FileSystem::copyDir($this->source_dir . '/include/grpc++', BUILD_INCLUDE_PATH . '/grpc++'); - //FileSystem::copyDir($this->source_dir . '/include/grpcpp', BUILD_INCLUDE_PATH . '/grpcpp'); - //FileSystem::copyDir($this->source_dir . '/src/php/ext/grpc', BUILD_ROOT_PATH . '/grpc_php_ext_src'); + // } + // FileSystem::copyDir($this->source_dir . '/include/grpc', BUILD_INCLUDE_PATH . '/grpc'); + // FileSystem::copyDir($this->source_dir . '/include/grpc++', BUILD_INCLUDE_PATH . '/grpc++'); + // FileSystem::copyDir($this->source_dir . '/include/grpcpp', BUILD_INCLUDE_PATH . '/grpcpp'); } } From bd0042f079597f9167bce683a41bfa1a44ee8a4f Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 09:43:01 +0700 Subject: [PATCH 04/58] grpc can be built shared too --- src/SPC/builder/extension/grpc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index f1c4ce6f..c129327b 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -56,7 +56,7 @@ class grpc extends Extension public function getUnixConfigureArg(bool $shared = false): string { - return '--enable-grpc=' . BUILD_ROOT_PATH . '/grpc GRPC_LIB_SUBDIR=' . BUILD_LIB_PATH; + return '--enable-grpc=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . '/grpc GRPC_LIB_SUBDIR=' . BUILD_LIB_PATH; } private function getLibraries(): array From 23412d6bfa1cdbb6a88f22183a3250f799fc4222 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 09:46:06 +0700 Subject: [PATCH 05/58] enable tests --- src/globals/test-extensions.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 07d2e039..d06bdc13 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -21,15 +21,15 @@ $test_php_version = [ // test os (macos-13, macos-14, macos-15, ubuntu-latest, windows-latest are available) $test_os = [ - // 'macos-13', // bin/spc for x86_64 - // 'macos-14', // 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-24.04', // bin/spc for x86_64 - // 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64 - // 'ubuntu-24.04-arm', // bin/spc for arm64 - 'windows-latest', // .\bin\spc.ps1 + 'macos-13', // bin/spc for x86_64 + 'macos-14', // 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-24.04', // bin/spc for x86_64 + 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64 + 'ubuntu-24.04-arm', // bin/spc for arm64 + // 'windows-latest', // .\bin\spc.ps1 ]; // whether enable thread safe @@ -48,7 +48,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' => 'imap,swoole', + 'Linux', 'Darwin' => 'grpc', 'Windows' => 'curl', }; From 1f7d3ec91d18fa8b38e2280e1650701f5951e387 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 10:55:21 +0700 Subject: [PATCH 06/58] use =package --- src/SPC/builder/unix/library/grpc.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index 40e042a5..941e74f1 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -12,13 +12,12 @@ trait grpc { UnixCMakeExecutor::create($this) ->addConfigureArgs( - '-DgRPC_SSL_PROVIDER=openssl', + '-DgRPC_SSL_PROVIDER=package', '-DgRPC_INSTALL_BINDIR=' . BUILD_BIN_PATH, '-DgRPC_INSTALL_LIBDIR=' . BUILD_LIB_PATH, '-DgRPC_INSTALL_SHAREDIR=' . BUILD_ROOT_PATH . '/share/grpc', - '-DOPENSSL_ROOT_DIR=' . BUILD_ROOT_PATH, - '-DOPENSSL_INCLUDE_DIR=' . BUILD_INCLUDE_PATH, - '-DCMAKE_CXX_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK"' + '-DCMAKE_C_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"', + '-DCMAKE_CXX_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"' ) ->build(); copy($this->source_dir . '/third_party/re2/re2.pc', BUILD_LIB_PATH . '/pkgconfig/re2.pc'); From bf4b35aa0ab59135ca1bf8637cfbf346ff501dcd Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 12:10:14 +0700 Subject: [PATCH 07/58] use pkgconfig to determine libs --- src/SPC/builder/extension/grpc.php | 3 +-- src/SPC/builder/unix/library/grpc.php | 11 +++++++++ src/SPC/util/SPCConfigUtil.php | 25 ++++++++++++++++++++- src/SPC/util/executor/UnixCMakeExecutor.php | 13 ++++++++++- src/globals/test-extensions.php | 6 ++--- 5 files changed, 51 insertions(+), 7 deletions(-) diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index c129327b..dbad1746 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -61,8 +61,7 @@ class grpc extends Extension private function getLibraries(): array { - [, $out] = shell()->execWithResult('$PKG_CONFIG --libs --static grpc'); - $libs = join(' ', $out) . ' -lupb -lupb_message_lib -lupb_json_lib -lupb_textformat_lib -lupb_mini_descriptor_lib -lupb_wire_lib -lupb_mem_lib -lupb_base_lib -lutf8_range'; + $libs = shell()->execWithResult('$PKG_CONFIG --libs --static grpc')[1][0]; $filtered = str_replace('-pthread', '', $libs); $filtered = preg_replace('/-L\S+/', '', $filtered); $filtered = preg_replace('/(?:\S*\/)?lib([a-zA-Z0-9_+-]+)\.a\b/', '-l$1', $filtered); diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index 941e74f1..38ff99bb 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -4,10 +4,21 @@ declare(strict_types=1); namespace SPC\builder\unix\library; +use SPC\store\FileSystem; use SPC\util\executor\UnixCMakeExecutor; trait grpc { + public function patchBeforeBuild(): bool + { + FileSystem::replaceFileStr( + $this->source_dir . '/third_party/re2/util/pcre.h', + ["#define UTIL_PCRE_H_\n#include ", "#define UTIL_PCRE_H_"], + ["#define UTIL_PCRE_H_", "#define UTIL_PCRE_H_\n#include "], + ); + return true; + } + protected function build(): void { UnixCMakeExecutor::create($this) diff --git a/src/SPC/util/SPCConfigUtil.php b/src/SPC/util/SPCConfigUtil.php index 96c09b48..b347419b 100644 --- a/src/SPC/util/SPCConfigUtil.php +++ b/src/SPC/util/SPCConfigUtil.php @@ -106,10 +106,33 @@ class SPCConfigUtil foreach (array_reverse($libraries) as $library) { $libs = Config::getLib($library, 'static-libs', []); foreach ($libs as $lib) { - if ($withDependencies) { + $noExt = str_replace('.a', '', $lib); + $noExtNoLib = str_replace('lib', '', $noExt); + $pkgconfFileNoExt = BUILD_LIB_PATH . "/pkgconfig/{$noExt}.pc"; + $pkgconfFileNoExtNoLib = BUILD_LIB_PATH . "/pkgconfig/{$noExtNoLib}.pc"; + $llibs = null; + if (file_exists($pkgconfFileNoExt)) { + $llibs = shell()->execWithResult("pkg-config --libs --static {$noExt}")[1][0]; + } elseif (file_exists($pkgconfFileNoExtNoLib)) { + $llibs = shell()->execWithResult("pkg-config --libs --static {$noExtNoLib}")[1][0]; + } + + if (!empty($llibs)) { + $filtered = str_replace('-pthread', '', $llibs); + $filtered = preg_replace('/-L\S+/', '', $filtered); + $filtered = preg_replace('/(?:\S*\/)?lib([a-zA-Z0-9_+-]+)\.a\b/', '-l$1', $filtered); + $filtered = preg_replace('/\s+/', ' ', $filtered); + foreach (explode(' ', $filtered) as $item) { + $short_name[] = $item; + } + } elseif ($withDependencies) { $noExt = str_replace('.a', '', $lib); $requiredLibs = []; $pkgconfFile = BUILD_LIB_PATH . "/pkgconfig/{$noExt}.pc"; + if (!file_exists($pkgconfFile)) { + $noExtNoLib = str_replace('lib', '', $noExt); + $pkgconfFile = BUILD_LIB_PATH . "/pkgconfig/{$noExtNoLib}.pc"; + } if (file_exists($pkgconfFile)) { $lines = file($pkgconfFile); foreach ($lines as $value) { diff --git a/src/SPC/util/executor/UnixCMakeExecutor.php b/src/SPC/util/executor/UnixCMakeExecutor.php index b9c7ef58..dc2aa46c 100644 --- a/src/SPC/util/executor/UnixCMakeExecutor.php +++ b/src/SPC/util/executor/UnixCMakeExecutor.php @@ -24,6 +24,8 @@ class UnixCMakeExecutor extends Executor protected bool $reset = true; + protected array $extra_env = []; + public function build(string $build_pos = '..'): void { // set cmake dir @@ -34,7 +36,7 @@ class UnixCMakeExecutor extends Executor } // prepare shell - $shell = shell()->cd($this->build_dir)->initializeEnv($this->library); + $shell = shell()->cd($this->build_dir)->initializeEnv($this->library)->appendEnv($this->extra_env); // config $this->steps >= 1 && $shell->exec("cmake {$this->getConfigureArgs()} {$this->getDefaultCMakeArgs()} {$build_pos}"); @@ -77,6 +79,15 @@ class UnixCMakeExecutor extends Executor return $this; } + /** + * Add extra environment flags + */ + public function addExtraEnv(array $env): static + { + $this->extra_env = [...$this->extra_env, ...$env]; + return $this; + } + /** * To build steps. * diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index d06bdc13..417b3b67 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -13,9 +13,9 @@ declare(strict_types=1); // test php version (8.1 ~ 8.4 available, multiple for matrix) $test_php_version = [ - '8.1', - '8.2', - '8.3', + // '8.1', + // '8.2', + // '8.3', '8.4', ]; From e490a1763a3c7c5ad03e81caf18017c5fa5b016c Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 12:12:18 +0700 Subject: [PATCH 08/58] use pkgconfig to determine libs fix cs --- .php-cs-fixer.php | 1 + src/SPC/builder/unix/library/grpc.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 47d17866..55fca81a 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -4,6 +4,7 @@ declare(strict_types=1); return (new PhpCsFixer\Config()) ->setRiskyAllowed(true) + ->setUnsupportedPhpVersionAllowed(true) ->setRules([ '@PSR12' => true, '@Symfony' => true, diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index 38ff99bb..954f997d 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -13,8 +13,8 @@ trait grpc { FileSystem::replaceFileStr( $this->source_dir . '/third_party/re2/util/pcre.h', - ["#define UTIL_PCRE_H_\n#include ", "#define UTIL_PCRE_H_"], - ["#define UTIL_PCRE_H_", "#define UTIL_PCRE_H_\n#include "], + ["#define UTIL_PCRE_H_\n#include ", '#define UTIL_PCRE_H_'], + ['#define UTIL_PCRE_H_', "#define UTIL_PCRE_H_\n#include "], ); return true; } From 2b39a6d535938a969f2fe5d0abbfbb196ac2fc31 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 14:29:01 +0700 Subject: [PATCH 09/58] -static-libstdc++ and -static-libgcc for static builds (musl toolchain) --- src/SPC/builder/unix/library/grpc.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index 954f997d..cf4f089e 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -6,6 +6,7 @@ namespace SPC\builder\unix\library; use SPC\store\FileSystem; use SPC\util\executor\UnixCMakeExecutor; +use SPC\util\SPCTarget; trait grpc { @@ -21,16 +22,25 @@ trait grpc protected function build(): void { - UnixCMakeExecutor::create($this) + $cmake = UnixCMakeExecutor::create($this) ->addConfigureArgs( '-DgRPC_SSL_PROVIDER=package', '-DgRPC_INSTALL_BINDIR=' . BUILD_BIN_PATH, '-DgRPC_INSTALL_LIBDIR=' . BUILD_LIB_PATH, '-DgRPC_INSTALL_SHAREDIR=' . BUILD_ROOT_PATH . '/share/grpc', - '-DCMAKE_C_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"', - '-DCMAKE_CXX_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"' - ) - ->build(); + "-DCMAKE_C_FLAGS=\"-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L" . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"', + "-DCMAKE_CXX_FLAGS=\"-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L" . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"' + ); + + if (SPCTarget::isStatic()) { + $cmake->addConfigureArgs( + '-DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++"', + '-DCMAKE_SHARED_LINKER_FLAGS="-static-libgcc -static-libstdc++"', + '-DCMAKE_CXX_STANDARD_LIBRARIES="-static-libgcc -static-libstdc++"', + ); + } + + $cmake->build(); copy($this->source_dir . '/third_party/re2/re2.pc', BUILD_LIB_PATH . '/pkgconfig/re2.pc'); // shell()->cd($this->source_dir) From 31b2e6779dc39c0c1150866b874e392182016ae7 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 14:29:27 +0700 Subject: [PATCH 10/58] cs fix --- src/SPC/builder/unix/library/grpc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index cf4f089e..09362cb7 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -28,8 +28,8 @@ trait grpc '-DgRPC_INSTALL_BINDIR=' . BUILD_BIN_PATH, '-DgRPC_INSTALL_LIBDIR=' . BUILD_LIB_PATH, '-DgRPC_INSTALL_SHAREDIR=' . BUILD_ROOT_PATH . '/share/grpc', - "-DCMAKE_C_FLAGS=\"-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L" . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"', - "-DCMAKE_CXX_FLAGS=\"-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L" . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"' + '-DCMAKE_C_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"', + '-DCMAKE_CXX_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"' ); if (SPCTarget::isStatic()) { From 7d85aacacef7fcc779dd2dcbd9c8ce1979a84a30 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 16:00:28 +0700 Subject: [PATCH 11/58] for some reason alpine docker fails in CI, but not locally, after I added this? --- src/SPC/builder/unix/library/grpc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index 09362cb7..ac4dd677 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace SPC\builder\unix\library; +use SPC\builder\linux\SystemUtil; use SPC\store\FileSystem; use SPC\util\executor\UnixCMakeExecutor; use SPC\util\SPCTarget; @@ -32,7 +33,7 @@ trait grpc '-DCMAKE_CXX_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"' ); - if (SPCTarget::isStatic()) { + if (PHP_OS_FAMILY === 'Linux' && SPCTarget::isStatic() && !SystemUtil::isMuslDist()) { $cmake->addConfigureArgs( '-DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++"', '-DCMAKE_SHARED_LINKER_FLAGS="-static-libgcc -static-libstdc++"', From 024542d36141ff7f7340073f0661d16ea6b4b6ac Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 16:03:28 +0700 Subject: [PATCH 12/58] oh, it will likely be this instead --- src/SPC/store/SourceManager.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/SPC/store/SourceManager.php b/src/SPC/store/SourceManager.php index 251e2fa1..4b5d181f 100644 --- a/src/SPC/store/SourceManager.php +++ b/src/SPC/store/SourceManager.php @@ -94,6 +94,9 @@ class SourceManager // if not, remove the source dir and extract again logger()->notice("Source [{$source}] hash mismatch, removing old source dir and extracting again ..."); + if ($source === 'micro') { + return; + } FileSystem::removeDir($check); $filename = LockFile::getLockFullPath($lock_content); $move_path = LockFile::getExtractPath($lock_name, SOURCE_PATH . '/' . $source); From d66d7b3a73cedc8cacd9bb57efb086ba2c62c2da Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 16:56:39 +0700 Subject: [PATCH 13/58] should be fixed properly --- src/SPC/store/SourceManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/store/SourceManager.php b/src/SPC/store/SourceManager.php index 4b5d181f..239cfcfb 100644 --- a/src/SPC/store/SourceManager.php +++ b/src/SPC/store/SourceManager.php @@ -94,7 +94,7 @@ class SourceManager // if not, remove the source dir and extract again logger()->notice("Source [{$source}] hash mismatch, removing old source dir and extracting again ..."); - if ($source === 'micro') { + if ($source === 'micro' || $source === 'grpc') { return; } FileSystem::removeDir($check); From 71f4e4525601baf6029b22ef714fde99de88c542 Mon Sep 17 00:00:00 2001 From: Marc Date: Mon, 21 Jul 2025 21:22:41 +0700 Subject: [PATCH 14/58] remove workaround --- src/SPC/store/SourceManager.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/SPC/store/SourceManager.php b/src/SPC/store/SourceManager.php index 239cfcfb..251e2fa1 100644 --- a/src/SPC/store/SourceManager.php +++ b/src/SPC/store/SourceManager.php @@ -94,9 +94,6 @@ class SourceManager // if not, remove the source dir and extract again logger()->notice("Source [{$source}] hash mismatch, removing old source dir and extracting again ..."); - if ($source === 'micro' || $source === 'grpc') { - return; - } FileSystem::removeDir($check); $filename = LockFile::getLockFullPath($lock_content); $move_path = LockFile::getExtractPath($lock_name, SOURCE_PATH . '/' . $source); From e07b281577e344e8f07a1b1277e7813614ee2511 Mon Sep 17 00:00:00 2001 From: Marc Date: Mon, 21 Jul 2025 21:25:33 +0700 Subject: [PATCH 15/58] fix build dir conflict --- src/SPC/builder/unix/library/grpc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index ac4dd677..4b355a0d 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -24,6 +24,7 @@ trait grpc protected function build(): void { $cmake = UnixCMakeExecutor::create($this) + ->setBuildDir('fix_BUILD_file_conflict') ->addConfigureArgs( '-DgRPC_SSL_PROVIDER=package', '-DgRPC_INSTALL_BINDIR=' . BUILD_BIN_PATH, From 352955d6084a2151751cfe05dbd3a9d9e46ba843 Mon Sep 17 00:00:00 2001 From: Marc Date: Mon, 21 Jul 2025 21:36:33 +0700 Subject: [PATCH 16/58] absolute dir? --- src/SPC/builder/unix/library/grpc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index 4b355a0d..22539015 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -24,7 +24,7 @@ trait grpc protected function build(): void { $cmake = UnixCMakeExecutor::create($this) - ->setBuildDir('fix_BUILD_file_conflict') + ->setBuildDir($this->source_dir . '/avoid_BUILD_file_conflict') ->addConfigureArgs( '-DgRPC_SSL_PROVIDER=package', '-DgRPC_INSTALL_BINDIR=' . BUILD_BIN_PATH, From 9b207807eb7858c6c92a007699338a49d1608e89 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 00:32:43 +0700 Subject: [PATCH 17/58] doesn't even work yet, there has to be a better way than to add 2913912309 libraries --- config/lib.json | 6 ++--- src/SPC/builder/extension/grpc.php | 19 +++++++++++++++ src/SPC/builder/unix/library/grpc.php | 35 ++++++++++++++++++--------- 3 files changed, 45 insertions(+), 15 deletions(-) diff --git a/config/lib.json b/config/lib.json index 1a195f66..999feb33 100644 --- a/config/lib.json +++ b/config/lib.json @@ -186,12 +186,12 @@ "grpc": { "source": "grpc", "static-libs-unix": [ - "libgrpc.a", - "libcares.a" + "libgrpc.a" ], "lib-depends": [ "zlib", - "openssl" + "openssl", + "libcares" ], "frameworks": [ "CoreFoundation" diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index 852f2933..e5459807 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -36,9 +36,20 @@ class grpc extends Extension } return false; } + public function patchBeforeConfigure(): bool + { + $libs = ' -l' . join(' -l', $this->getLibraries()); + FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/configure', '-lgrpc', $libs); + return true; + } public function patchBeforeMake(): bool { + $extra_libs = trim(getenv('SPC_EXTRA_LIBS')); + $alibs = join('.a ', $this->getLibraries()) . '.a'; + $libs = BUILD_LIB_PATH . '/lib' . str_replace(' ', ' ' . BUILD_LIB_PATH . '/lib', $alibs); + $extra_libs = str_replace(BUILD_LIB_PATH . '/libgrpc.a', $libs, $extra_libs); + f_putenv('SPC_EXTRA_LIBS=' . $extra_libs); // add -Wno-strict-prototypes GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') . ' -Wno-strict-prototypes'); return true; @@ -48,4 +59,12 @@ class grpc extends Extension { return '--enable-grpc=' . BUILD_ROOT_PATH . '/grpc GRPC_LIB_SUBDIR=' . BUILD_LIB_PATH; } + + private function getLibraries(): array + { + [, $out] = shell()->execWithResult('$PKG_CONFIG --libs-only-l grpc'); + $libs = join(' ', $out) . ' -lupb -lupb_message_lib -lupb_json_lib -lupb_textformat_lib -lupb_mini_descriptor_lib -lupb_wire_lib -lupb_mem_lib -lupb_base_lib -lutf8_range'; + $libs = str_replace('-l', '', $libs); + return explode(' ', $libs); + } } diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index a7472448..a6c329e3 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -4,22 +4,33 @@ declare(strict_types=1); namespace SPC\builder\unix\library; -use SPC\store\FileSystem; +use SPC\util\executor\UnixCMakeExecutor; trait grpc { protected function build(): void { - shell()->cd($this->source_dir) - ->exec('EXTRA_DEFINES=GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK EMBED_OPENSSL=false CXXFLAGS="-L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '" make static -j' . $this->builder->concurrency); - copy($this->source_dir . '/libs/opt/libgrpc.a', BUILD_LIB_PATH . '/libgrpc.a'); - copy($this->source_dir . '/libs/opt/libboringssl.a', BUILD_LIB_PATH . '/libboringssl.a'); - if (!file_exists(BUILD_LIB_PATH . '/libcares.a')) { - copy($this->source_dir . '/libs/opt/libcares.a', BUILD_LIB_PATH . '/libcares.a'); - } - FileSystem::copyDir($this->source_dir . '/include/grpc', BUILD_INCLUDE_PATH . '/grpc'); - FileSystem::copyDir($this->source_dir . '/include/grpc++', BUILD_INCLUDE_PATH . '/grpc++'); - FileSystem::copyDir($this->source_dir . '/include/grpcpp', BUILD_INCLUDE_PATH . '/grpcpp'); - FileSystem::copyDir($this->source_dir . '/src/php/ext/grpc', BUILD_ROOT_PATH . '/grpc_php_ext_src'); + UnixCMakeExecutor::create($this) + ->addConfigureArgs( + '-DgRPC_SSL_PROVIDER=openssl', + '-DgRPC_INSTALL_BINDIR=' . BUILD_BIN_PATH, + '-DgRPC_INSTALL_LIBDIR=' . BUILD_LIB_PATH, + '-DgRPC_INSTALL_SHAREDIR=' . BUILD_ROOT_PATH . '/share/grpc', + '-DOPENSSL_ROOT_DIR=' . BUILD_ROOT_PATH, + '-DOPENSSL_INCLUDE_DIR=' . BUILD_INCLUDE_PATH, + '-DCMAKE_CXX_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK"' + ) + ->build(); + //shell()->cd($this->source_dir) + // ->exec('EXTRA_DEFINES=GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK EMBED_OPENSSL=false CXXFLAGS="-L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '" make static -j' . $this->builder->concurrency); + //copy($this->source_dir . '/libs/opt/libgrpc.a', BUILD_LIB_PATH . '/libgrpc.a'); + //copy($this->source_dir . '/libs/opt/libboringssl.a', BUILD_LIB_PATH . '/libboringssl.a'); + //if (!file_exists(BUILD_LIB_PATH . '/libcares.a')) { + // copy($this->source_dir . '/libs/opt/libcares.a', BUILD_LIB_PATH . '/libcares.a'); + //} + //FileSystem::copyDir($this->source_dir . '/include/grpc', BUILD_INCLUDE_PATH . '/grpc'); + //FileSystem::copyDir($this->source_dir . '/include/grpc++', BUILD_INCLUDE_PATH . '/grpc++'); + //FileSystem::copyDir($this->source_dir . '/include/grpcpp', BUILD_INCLUDE_PATH . '/grpcpp'); + //FileSystem::copyDir($this->source_dir . '/src/php/ext/grpc', BUILD_ROOT_PATH . '/grpc_php_ext_src'); } } From 161a92aff7765a62f75c6a5dd9d16b68486daa1a Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 09:33:29 +0700 Subject: [PATCH 18/58] needed --libs --static --- src/SPC/builder/extension/grpc.php | 10 +++++++--- src/SPC/builder/unix/library/grpc.php | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index e5459807..4cf06f4a 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -62,9 +62,13 @@ class grpc extends Extension private function getLibraries(): array { - [, $out] = shell()->execWithResult('$PKG_CONFIG --libs-only-l grpc'); + [, $out] = shell()->execWithResult('$PKG_CONFIG --libs --static grpc'); $libs = join(' ', $out) . ' -lupb -lupb_message_lib -lupb_json_lib -lupb_textformat_lib -lupb_mini_descriptor_lib -lupb_wire_lib -lupb_mem_lib -lupb_base_lib -lutf8_range'; - $libs = str_replace('-l', '', $libs); - return explode(' ', $libs); + $filtered = str_replace('-pthread', '', $libs); + $filtered = preg_replace('/-L\S+/', '', $filtered); + $filtered = preg_replace('/(?:\S*\/)?lib([a-zA-Z0-9_+-]+)\.a\b/', '-l$1', $filtered); + $out = str_replace('-l', '', $filtered); + $out = preg_replace('/\s+/', ' ', $out); + return explode(' ', trim($out)); } } diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index a6c329e3..8cacd39f 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -21,6 +21,8 @@ trait grpc '-DCMAKE_CXX_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK"' ) ->build(); + copy($this->source_dir . '/third_party/re2/re2.pc', BUILD_LIB_PATH . '/pkgconfig/re2.pc'); + //shell()->cd($this->source_dir) // ->exec('EXTRA_DEFINES=GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK EMBED_OPENSSL=false CXXFLAGS="-L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '" make static -j' . $this->builder->concurrency); //copy($this->source_dir . '/libs/opt/libgrpc.a', BUILD_LIB_PATH . '/libgrpc.a'); From 915ffd84c83d7cc98b9da6cac570f9ade6eecb66 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 09:41:36 +0700 Subject: [PATCH 19/58] remove grpc_php_ext_src --- src/SPC/builder/extension/grpc.php | 3 +-- src/SPC/builder/unix/library/grpc.php | 17 ++++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index 4cf06f4a..f1c4ce6f 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -24,8 +24,6 @@ class grpc extends Extension if (!is_link(SOURCE_PATH . '/php-src/ext/grpc')) { if (is_dir($this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc')) { shell()->exec('ln -s ' . $this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc ' . SOURCE_PATH . '/php-src/ext/grpc'); - } elseif (is_dir(BUILD_ROOT_PATH . '/grpc_php_ext_src')) { - shell()->exec('ln -s ' . BUILD_ROOT_PATH . '/grpc_php_ext_src ' . SOURCE_PATH . '/php-src/ext/grpc'); } else { throw new \RuntimeException('Cannot find grpc source code'); } @@ -36,6 +34,7 @@ class grpc extends Extension } return false; } + public function patchBeforeConfigure(): bool { $libs = ' -l' . join(' -l', $this->getLibraries()); diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index 8cacd39f..40e042a5 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -23,16 +23,15 @@ trait grpc ->build(); copy($this->source_dir . '/third_party/re2/re2.pc', BUILD_LIB_PATH . '/pkgconfig/re2.pc'); - //shell()->cd($this->source_dir) + // shell()->cd($this->source_dir) // ->exec('EXTRA_DEFINES=GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK EMBED_OPENSSL=false CXXFLAGS="-L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '" make static -j' . $this->builder->concurrency); - //copy($this->source_dir . '/libs/opt/libgrpc.a', BUILD_LIB_PATH . '/libgrpc.a'); - //copy($this->source_dir . '/libs/opt/libboringssl.a', BUILD_LIB_PATH . '/libboringssl.a'); - //if (!file_exists(BUILD_LIB_PATH . '/libcares.a')) { + // copy($this->source_dir . '/libs/opt/libgrpc.a', BUILD_LIB_PATH . '/libgrpc.a'); + // copy($this->source_dir . '/libs/opt/libboringssl.a', BUILD_LIB_PATH . '/libboringssl.a'); + // if (!file_exists(BUILD_LIB_PATH . '/libcares.a')) { // copy($this->source_dir . '/libs/opt/libcares.a', BUILD_LIB_PATH . '/libcares.a'); - //} - //FileSystem::copyDir($this->source_dir . '/include/grpc', BUILD_INCLUDE_PATH . '/grpc'); - //FileSystem::copyDir($this->source_dir . '/include/grpc++', BUILD_INCLUDE_PATH . '/grpc++'); - //FileSystem::copyDir($this->source_dir . '/include/grpcpp', BUILD_INCLUDE_PATH . '/grpcpp'); - //FileSystem::copyDir($this->source_dir . '/src/php/ext/grpc', BUILD_ROOT_PATH . '/grpc_php_ext_src'); + // } + // FileSystem::copyDir($this->source_dir . '/include/grpc', BUILD_INCLUDE_PATH . '/grpc'); + // FileSystem::copyDir($this->source_dir . '/include/grpc++', BUILD_INCLUDE_PATH . '/grpc++'); + // FileSystem::copyDir($this->source_dir . '/include/grpcpp', BUILD_INCLUDE_PATH . '/grpcpp'); } } From 45d96734dd77372b41455bfb89e7b301a2808bc4 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 09:43:01 +0700 Subject: [PATCH 20/58] grpc can be built shared too --- src/SPC/builder/extension/grpc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index f1c4ce6f..c129327b 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -56,7 +56,7 @@ class grpc extends Extension public function getUnixConfigureArg(bool $shared = false): string { - return '--enable-grpc=' . BUILD_ROOT_PATH . '/grpc GRPC_LIB_SUBDIR=' . BUILD_LIB_PATH; + return '--enable-grpc=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . '/grpc GRPC_LIB_SUBDIR=' . BUILD_LIB_PATH; } private function getLibraries(): array From 8eb77231143a1fff79b8b1f5142bb246f810ffb7 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 09:46:06 +0700 Subject: [PATCH 21/58] enable tests --- src/globals/test-extensions.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 07d2e039..d06bdc13 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -21,15 +21,15 @@ $test_php_version = [ // test os (macos-13, macos-14, macos-15, ubuntu-latest, windows-latest are available) $test_os = [ - // 'macos-13', // bin/spc for x86_64 - // 'macos-14', // 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-24.04', // bin/spc for x86_64 - // 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64 - // 'ubuntu-24.04-arm', // bin/spc for arm64 - 'windows-latest', // .\bin\spc.ps1 + 'macos-13', // bin/spc for x86_64 + 'macos-14', // 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-24.04', // bin/spc for x86_64 + 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64 + 'ubuntu-24.04-arm', // bin/spc for arm64 + // 'windows-latest', // .\bin\spc.ps1 ]; // whether enable thread safe @@ -48,7 +48,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' => 'imap,swoole', + 'Linux', 'Darwin' => 'grpc', 'Windows' => 'curl', }; From 81a59be0c43464f84ed4b773a18fbfce691c8b15 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 10:55:21 +0700 Subject: [PATCH 22/58] use =package --- src/SPC/builder/unix/library/grpc.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index 40e042a5..941e74f1 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -12,13 +12,12 @@ trait grpc { UnixCMakeExecutor::create($this) ->addConfigureArgs( - '-DgRPC_SSL_PROVIDER=openssl', + '-DgRPC_SSL_PROVIDER=package', '-DgRPC_INSTALL_BINDIR=' . BUILD_BIN_PATH, '-DgRPC_INSTALL_LIBDIR=' . BUILD_LIB_PATH, '-DgRPC_INSTALL_SHAREDIR=' . BUILD_ROOT_PATH . '/share/grpc', - '-DOPENSSL_ROOT_DIR=' . BUILD_ROOT_PATH, - '-DOPENSSL_INCLUDE_DIR=' . BUILD_INCLUDE_PATH, - '-DCMAKE_CXX_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK"' + '-DCMAKE_C_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"', + '-DCMAKE_CXX_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"' ) ->build(); copy($this->source_dir . '/third_party/re2/re2.pc', BUILD_LIB_PATH . '/pkgconfig/re2.pc'); From e98e221d93b76ddfac7d6d5c0ec4ffbd40f65c47 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 12:10:14 +0700 Subject: [PATCH 23/58] use pkgconfig to determine libs --- src/SPC/builder/extension/grpc.php | 3 +-- src/SPC/builder/unix/library/grpc.php | 11 +++++++++ src/SPC/util/SPCConfigUtil.php | 25 ++++++++++++++++++++- src/SPC/util/executor/UnixCMakeExecutor.php | 13 ++++++++++- src/globals/test-extensions.php | 6 ++--- 5 files changed, 51 insertions(+), 7 deletions(-) diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index c129327b..dbad1746 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -61,8 +61,7 @@ class grpc extends Extension private function getLibraries(): array { - [, $out] = shell()->execWithResult('$PKG_CONFIG --libs --static grpc'); - $libs = join(' ', $out) . ' -lupb -lupb_message_lib -lupb_json_lib -lupb_textformat_lib -lupb_mini_descriptor_lib -lupb_wire_lib -lupb_mem_lib -lupb_base_lib -lutf8_range'; + $libs = shell()->execWithResult('$PKG_CONFIG --libs --static grpc')[1][0]; $filtered = str_replace('-pthread', '', $libs); $filtered = preg_replace('/-L\S+/', '', $filtered); $filtered = preg_replace('/(?:\S*\/)?lib([a-zA-Z0-9_+-]+)\.a\b/', '-l$1', $filtered); diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index 941e74f1..38ff99bb 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -4,10 +4,21 @@ declare(strict_types=1); namespace SPC\builder\unix\library; +use SPC\store\FileSystem; use SPC\util\executor\UnixCMakeExecutor; trait grpc { + public function patchBeforeBuild(): bool + { + FileSystem::replaceFileStr( + $this->source_dir . '/third_party/re2/util/pcre.h', + ["#define UTIL_PCRE_H_\n#include ", "#define UTIL_PCRE_H_"], + ["#define UTIL_PCRE_H_", "#define UTIL_PCRE_H_\n#include "], + ); + return true; + } + protected function build(): void { UnixCMakeExecutor::create($this) diff --git a/src/SPC/util/SPCConfigUtil.php b/src/SPC/util/SPCConfigUtil.php index 96c09b48..b347419b 100644 --- a/src/SPC/util/SPCConfigUtil.php +++ b/src/SPC/util/SPCConfigUtil.php @@ -106,10 +106,33 @@ class SPCConfigUtil foreach (array_reverse($libraries) as $library) { $libs = Config::getLib($library, 'static-libs', []); foreach ($libs as $lib) { - if ($withDependencies) { + $noExt = str_replace('.a', '', $lib); + $noExtNoLib = str_replace('lib', '', $noExt); + $pkgconfFileNoExt = BUILD_LIB_PATH . "/pkgconfig/{$noExt}.pc"; + $pkgconfFileNoExtNoLib = BUILD_LIB_PATH . "/pkgconfig/{$noExtNoLib}.pc"; + $llibs = null; + if (file_exists($pkgconfFileNoExt)) { + $llibs = shell()->execWithResult("pkg-config --libs --static {$noExt}")[1][0]; + } elseif (file_exists($pkgconfFileNoExtNoLib)) { + $llibs = shell()->execWithResult("pkg-config --libs --static {$noExtNoLib}")[1][0]; + } + + if (!empty($llibs)) { + $filtered = str_replace('-pthread', '', $llibs); + $filtered = preg_replace('/-L\S+/', '', $filtered); + $filtered = preg_replace('/(?:\S*\/)?lib([a-zA-Z0-9_+-]+)\.a\b/', '-l$1', $filtered); + $filtered = preg_replace('/\s+/', ' ', $filtered); + foreach (explode(' ', $filtered) as $item) { + $short_name[] = $item; + } + } elseif ($withDependencies) { $noExt = str_replace('.a', '', $lib); $requiredLibs = []; $pkgconfFile = BUILD_LIB_PATH . "/pkgconfig/{$noExt}.pc"; + if (!file_exists($pkgconfFile)) { + $noExtNoLib = str_replace('lib', '', $noExt); + $pkgconfFile = BUILD_LIB_PATH . "/pkgconfig/{$noExtNoLib}.pc"; + } if (file_exists($pkgconfFile)) { $lines = file($pkgconfFile); foreach ($lines as $value) { diff --git a/src/SPC/util/executor/UnixCMakeExecutor.php b/src/SPC/util/executor/UnixCMakeExecutor.php index b9c7ef58..dc2aa46c 100644 --- a/src/SPC/util/executor/UnixCMakeExecutor.php +++ b/src/SPC/util/executor/UnixCMakeExecutor.php @@ -24,6 +24,8 @@ class UnixCMakeExecutor extends Executor protected bool $reset = true; + protected array $extra_env = []; + public function build(string $build_pos = '..'): void { // set cmake dir @@ -34,7 +36,7 @@ class UnixCMakeExecutor extends Executor } // prepare shell - $shell = shell()->cd($this->build_dir)->initializeEnv($this->library); + $shell = shell()->cd($this->build_dir)->initializeEnv($this->library)->appendEnv($this->extra_env); // config $this->steps >= 1 && $shell->exec("cmake {$this->getConfigureArgs()} {$this->getDefaultCMakeArgs()} {$build_pos}"); @@ -77,6 +79,15 @@ class UnixCMakeExecutor extends Executor return $this; } + /** + * Add extra environment flags + */ + public function addExtraEnv(array $env): static + { + $this->extra_env = [...$this->extra_env, ...$env]; + return $this; + } + /** * To build steps. * diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index d06bdc13..417b3b67 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -13,9 +13,9 @@ declare(strict_types=1); // test php version (8.1 ~ 8.4 available, multiple for matrix) $test_php_version = [ - '8.1', - '8.2', - '8.3', + // '8.1', + // '8.2', + // '8.3', '8.4', ]; From 3dd3cf2814e1491b41fa1cb0a53bf293551fde69 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 12:12:18 +0700 Subject: [PATCH 24/58] use pkgconfig to determine libs fix cs --- .php-cs-fixer.php | 1 + src/SPC/builder/unix/library/grpc.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 47d17866..55fca81a 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -4,6 +4,7 @@ declare(strict_types=1); return (new PhpCsFixer\Config()) ->setRiskyAllowed(true) + ->setUnsupportedPhpVersionAllowed(true) ->setRules([ '@PSR12' => true, '@Symfony' => true, diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index 38ff99bb..954f997d 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -13,8 +13,8 @@ trait grpc { FileSystem::replaceFileStr( $this->source_dir . '/third_party/re2/util/pcre.h', - ["#define UTIL_PCRE_H_\n#include ", "#define UTIL_PCRE_H_"], - ["#define UTIL_PCRE_H_", "#define UTIL_PCRE_H_\n#include "], + ["#define UTIL_PCRE_H_\n#include ", '#define UTIL_PCRE_H_'], + ['#define UTIL_PCRE_H_', "#define UTIL_PCRE_H_\n#include "], ); return true; } From 227210209c1fe7fc1c40fcd657e9c6e61dc9c4c9 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 14:29:01 +0700 Subject: [PATCH 25/58] -static-libstdc++ and -static-libgcc for static builds (musl toolchain) --- src/SPC/builder/unix/library/grpc.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index 954f997d..cf4f089e 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -6,6 +6,7 @@ namespace SPC\builder\unix\library; use SPC\store\FileSystem; use SPC\util\executor\UnixCMakeExecutor; +use SPC\util\SPCTarget; trait grpc { @@ -21,16 +22,25 @@ trait grpc protected function build(): void { - UnixCMakeExecutor::create($this) + $cmake = UnixCMakeExecutor::create($this) ->addConfigureArgs( '-DgRPC_SSL_PROVIDER=package', '-DgRPC_INSTALL_BINDIR=' . BUILD_BIN_PATH, '-DgRPC_INSTALL_LIBDIR=' . BUILD_LIB_PATH, '-DgRPC_INSTALL_SHAREDIR=' . BUILD_ROOT_PATH . '/share/grpc', - '-DCMAKE_C_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"', - '-DCMAKE_CXX_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"' - ) - ->build(); + "-DCMAKE_C_FLAGS=\"-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L" . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"', + "-DCMAKE_CXX_FLAGS=\"-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L" . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"' + ); + + if (SPCTarget::isStatic()) { + $cmake->addConfigureArgs( + '-DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++"', + '-DCMAKE_SHARED_LINKER_FLAGS="-static-libgcc -static-libstdc++"', + '-DCMAKE_CXX_STANDARD_LIBRARIES="-static-libgcc -static-libstdc++"', + ); + } + + $cmake->build(); copy($this->source_dir . '/third_party/re2/re2.pc', BUILD_LIB_PATH . '/pkgconfig/re2.pc'); // shell()->cd($this->source_dir) From b43d0746f465bdc12178cfd2f28088eaf360a7d2 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 14:29:27 +0700 Subject: [PATCH 26/58] cs fix --- src/SPC/builder/unix/library/grpc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index cf4f089e..09362cb7 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -28,8 +28,8 @@ trait grpc '-DgRPC_INSTALL_BINDIR=' . BUILD_BIN_PATH, '-DgRPC_INSTALL_LIBDIR=' . BUILD_LIB_PATH, '-DgRPC_INSTALL_SHAREDIR=' . BUILD_ROOT_PATH . '/share/grpc', - "-DCMAKE_C_FLAGS=\"-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L" . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"', - "-DCMAKE_CXX_FLAGS=\"-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L" . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"' + '-DCMAKE_C_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"', + '-DCMAKE_CXX_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"' ); if (SPCTarget::isStatic()) { From b30f2bc193cfa5b08641a3fb29b3b33ae36a43f2 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 16:00:28 +0700 Subject: [PATCH 27/58] for some reason alpine docker fails in CI, but not locally, after I added this? --- src/SPC/builder/unix/library/grpc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index 09362cb7..ac4dd677 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace SPC\builder\unix\library; +use SPC\builder\linux\SystemUtil; use SPC\store\FileSystem; use SPC\util\executor\UnixCMakeExecutor; use SPC\util\SPCTarget; @@ -32,7 +33,7 @@ trait grpc '-DCMAKE_CXX_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"' ); - if (SPCTarget::isStatic()) { + if (PHP_OS_FAMILY === 'Linux' && SPCTarget::isStatic() && !SystemUtil::isMuslDist()) { $cmake->addConfigureArgs( '-DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++"', '-DCMAKE_SHARED_LINKER_FLAGS="-static-libgcc -static-libstdc++"', From 1f4a3e4b8f9818cbd4e0d430f472f3b8bd9804a9 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 16:03:28 +0700 Subject: [PATCH 28/58] oh, it will likely be this instead --- src/SPC/store/SourceManager.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/SPC/store/SourceManager.php b/src/SPC/store/SourceManager.php index 251e2fa1..4b5d181f 100644 --- a/src/SPC/store/SourceManager.php +++ b/src/SPC/store/SourceManager.php @@ -94,6 +94,9 @@ class SourceManager // if not, remove the source dir and extract again logger()->notice("Source [{$source}] hash mismatch, removing old source dir and extracting again ..."); + if ($source === 'micro') { + return; + } FileSystem::removeDir($check); $filename = LockFile::getLockFullPath($lock_content); $move_path = LockFile::getExtractPath($lock_name, SOURCE_PATH . '/' . $source); From f31f0d6168a9d67c5a9bf4faca11b8ed163694ae Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 21 Jul 2025 16:56:39 +0700 Subject: [PATCH 29/58] should be fixed properly --- src/SPC/store/SourceManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/store/SourceManager.php b/src/SPC/store/SourceManager.php index 4b5d181f..239cfcfb 100644 --- a/src/SPC/store/SourceManager.php +++ b/src/SPC/store/SourceManager.php @@ -94,7 +94,7 @@ class SourceManager // if not, remove the source dir and extract again logger()->notice("Source [{$source}] hash mismatch, removing old source dir and extracting again ..."); - if ($source === 'micro') { + if ($source === 'micro' || $source === 'grpc') { return; } FileSystem::removeDir($check); From bb96db4395216941208c11c3925c8a0418d2c90c Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 22 Jul 2025 10:54:44 +0700 Subject: [PATCH 30/58] rework static lib detection --- src/SPC/builder/extension/grpc.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index dbad1746..b7f9543b 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -37,7 +37,7 @@ class grpc extends Extension public function patchBeforeConfigure(): bool { - $libs = ' -l' . join(' -l', $this->getLibraries()); + $libs = join(' ', $this->getLibraries()); FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/configure', '-lgrpc', $libs); return true; } @@ -45,8 +45,16 @@ class grpc extends Extension public function patchBeforeMake(): bool { $extra_libs = trim(getenv('SPC_EXTRA_LIBS')); - $alibs = join('.a ', $this->getLibraries()) . '.a'; - $libs = BUILD_LIB_PATH . '/lib' . str_replace(' ', ' ' . BUILD_LIB_PATH . '/lib', $alibs); + $libs = array_map(function (string $lib) { + if (str_starts_with($lib, '-l')) { + $staticLib = substr($lib, 2); + $staticLib = BUILD_LIB_PATH . '/lib' . $staticLib . '.a'; + if (file_exists($staticLib)) { + return $staticLib; + } + } + return $lib; + }, $this->getLibraries()); $extra_libs = str_replace(BUILD_LIB_PATH . '/libgrpc.a', $libs, $extra_libs); f_putenv('SPC_EXTRA_LIBS=' . $extra_libs); // add -Wno-strict-prototypes @@ -62,11 +70,9 @@ class grpc extends Extension private function getLibraries(): array { $libs = shell()->execWithResult('$PKG_CONFIG --libs --static grpc')[1][0]; - $filtered = str_replace('-pthread', '', $libs); - $filtered = preg_replace('/-L\S+/', '', $filtered); + $filtered = preg_replace('/-L\S+/', '', $libs); $filtered = preg_replace('/(?:\S*\/)?lib([a-zA-Z0-9_+-]+)\.a\b/', '-l$1', $filtered); - $out = str_replace('-l', '', $filtered); - $out = preg_replace('/\s+/', ' ', $out); + $out = preg_replace('/\s+/', ' ', $filtered); return explode(' ', trim($out)); } } From 307d3dda2044d968c91bdc3b41a2149c05f1bee5 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 22 Jul 2025 11:30:00 +0700 Subject: [PATCH 31/58] join array to string --- src/SPC/builder/extension/grpc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index b7f9543b..7a3ed091 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -55,7 +55,7 @@ class grpc extends Extension } return $lib; }, $this->getLibraries()); - $extra_libs = str_replace(BUILD_LIB_PATH . '/libgrpc.a', $libs, $extra_libs); + $extra_libs = str_replace(BUILD_LIB_PATH . '/libgrpc.a', join(' ', $libs), $extra_libs); f_putenv('SPC_EXTRA_LIBS=' . $extra_libs); // add -Wno-strict-prototypes GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') . ' -Wno-strict-prototypes'); From 22552262b3a05a348205fc86f145240df44d6131 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 22 Jul 2025 11:43:19 +0700 Subject: [PATCH 32/58] add different build dir in again --- src/SPC/builder/unix/library/grpc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index ac4dd677..4dd38308 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -24,6 +24,7 @@ trait grpc protected function build(): void { $cmake = UnixCMakeExecutor::create($this) + ->setBuildDir("{$this->source_dir}/avoid_BUILD_file_conflict") ->addConfigureArgs( '-DgRPC_SSL_PROVIDER=package', '-DgRPC_INSTALL_BINDIR=' . BUILD_BIN_PATH, From e1595e1091e13468f6366d1b8dfc7a80c9fe8686 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 22 Jul 2025 14:46:01 +0800 Subject: [PATCH 33/58] Remove old workaround code --- src/SPC/store/SourceManager.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/SPC/store/SourceManager.php b/src/SPC/store/SourceManager.php index 239cfcfb..251e2fa1 100644 --- a/src/SPC/store/SourceManager.php +++ b/src/SPC/store/SourceManager.php @@ -94,9 +94,6 @@ class SourceManager // if not, remove the source dir and extract again logger()->notice("Source [{$source}] hash mismatch, removing old source dir and extracting again ..."); - if ($source === 'micro' || $source === 'grpc') { - return; - } FileSystem::removeDir($check); $filename = LockFile::getLockFullPath($lock_content); $move_path = LockFile::getExtractPath($lock_name, SOURCE_PATH . '/' . $source); From c5811ae9473996aec9131f8085a3fda9f16343f7 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 22 Jul 2025 14:46:28 +0800 Subject: [PATCH 34/58] Reduce grpc building things --- src/SPC/builder/unix/library/grpc.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index 4dd38308..0148c969 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -26,12 +26,18 @@ trait grpc $cmake = UnixCMakeExecutor::create($this) ->setBuildDir("{$this->source_dir}/avoid_BUILD_file_conflict") ->addConfigureArgs( - '-DgRPC_SSL_PROVIDER=package', '-DgRPC_INSTALL_BINDIR=' . BUILD_BIN_PATH, '-DgRPC_INSTALL_LIBDIR=' . BUILD_LIB_PATH, '-DgRPC_INSTALL_SHAREDIR=' . BUILD_ROOT_PATH . '/share/grpc', '-DCMAKE_C_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"', - '-DCMAKE_CXX_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"' + '-DCMAKE_CXX_FLAGS="-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK -L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '"', + '-DgRPC_BUILD_CODEGEN=OFF', + '-DgRPC_DOWNLOAD_ARCHIVES=OFF', + '-DgRPC_BUILD_TESTS=OFF', + // providers + '-DgRPC_ZLIB_PROVIDER=package', + '-DgRPC_CARES_PROVIDER=package', + '-DgRPC_SSL_PROVIDER=package', ); if (PHP_OS_FAMILY === 'Linux' && SPCTarget::isStatic() && !SystemUtil::isMuslDist()) { From 5dbf40161584b11cf5e72e6e11ab69ecd9de1cab Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 22 Jul 2025 14:46:41 +0800 Subject: [PATCH 35/58] Fix macOS libphp.dylib compatibility --- src/SPC/builder/unix/UnixBuilderBase.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/SPC/builder/unix/UnixBuilderBase.php b/src/SPC/builder/unix/UnixBuilderBase.php index f0e4e169..b8b5e120 100644 --- a/src/SPC/builder/unix/UnixBuilderBase.php +++ b/src/SPC/builder/unix/UnixBuilderBase.php @@ -210,11 +210,22 @@ abstract class UnixBuilderBase extends BuilderBase } // if someone changed to --enable-embed=shared, we need to add LD_LIBRARY_PATH if (getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') === 'shared') { - $ext_path = 'LD_LIBRARY_PATH=' . BUILD_ROOT_PATH . '/lib:$LD_LIBRARY_PATH '; - FileSystem::removeFileIfExists(BUILD_ROOT_PATH . '/lib/libphp.a'); + if (PHP_OS_FAMILY === 'Darwin') { + $ext_path = 'DYLD_LIBRARY_PATH=' . BUILD_LIB_PATH . ':$DYLD_LIBRARY_PATH '; + } else { + $ext_path = 'LD_LIBRARY_PATH=' . BUILD_LIB_PATH . ':$LD_LIBRARY_PATH '; + } + FileSystem::removeFileIfExists(BUILD_LIB_PATH . '/libphp.a'); } else { $ext_path = ''; - FileSystem::removeFileIfExists(BUILD_ROOT_PATH . '/lib/libphp.so'); + $suffix = PHP_OS_FAMILY === 'Darwin' ? 'dylib' : 'so'; + foreach (glob(BUILD_LIB_PATH . "/libphp*.{$suffix}") as $file) { + unlink($file); + } + } + [$ret, $out] = shell()->cd($sample_file_path)->execWithResult(getenv('CC') . ' -o embed embed.c ' . $lens); + if ($ret !== 0) { + throw new RuntimeException('embed failed sanity check: build failed. Error message: ' . implode("\n", $out)); } [$ret, $output] = shell()->cd($sample_file_path)->execWithResult($ext_path . './embed'); if ($ret !== 0 || trim(implode('', $output)) !== 'hello') { @@ -229,8 +240,9 @@ abstract class UnixBuilderBase extends BuilderBase if (!file_exists($frankenphp)) { throw new RuntimeException('FrankenPHP binary not found: ' . $frankenphp); } + $prefix = PHP_OS_FAMILY === 'Darwin' ? 'DYLD_' : 'LD_'; [$ret, $output] = shell() - ->setEnv(['LD_LIBRARY_PATH' => BUILD_LIB_PATH]) + ->setEnv(["{$prefix}LIBRARY_PATH" => BUILD_LIB_PATH]) ->execWithResult("{$frankenphp} version"); if ($ret !== 0 || !str_contains(implode('', $output), 'FrankenPHP')) { throw new RuntimeException('FrankenPHP failed sanity check: ret[' . $ret . ']. out[' . implode('', $output) . ']'); From c0db3a69d7013915bce401ba9df9ee72599bc633 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 22 Jul 2025 14:46:51 +0800 Subject: [PATCH 36/58] Update composer deps --- composer.lock | 365 ++++++++++++++++++++++++++------------------------ 1 file changed, 188 insertions(+), 177 deletions(-) diff --git a/composer.lock b/composer.lock index 3004785e..a05a1e0d 100644 --- a/composer.lock +++ b/composer.lock @@ -8,7 +8,7 @@ "packages": [ { "name": "illuminate/collections", - "version": "v11.44.4", + "version": "v11.45.1", "source": { "type": "git", "url": "https://github.com/illuminate/collections.git", @@ -64,7 +64,7 @@ }, { "name": "illuminate/conditionable", - "version": "v11.44.4", + "version": "v11.45.1", "source": { "type": "git", "url": "https://github.com/illuminate/conditionable.git", @@ -110,7 +110,7 @@ }, { "name": "illuminate/contracts", - "version": "v11.44.4", + "version": "v11.45.1", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", @@ -158,7 +158,7 @@ }, { "name": "illuminate/macroable", - "version": "v11.44.4", + "version": "v11.45.1", "source": { "type": "git", "url": "https://github.com/illuminate/macroable.git", @@ -416,16 +416,16 @@ }, { "name": "symfony/console", - "version": "v6.4.20", + "version": "v6.4.23", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "2e4af9c952617cc3f9559ff706aee420a8464c36" + "reference": "9056771b8eca08d026cd3280deeec3cfd99c4d93" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/2e4af9c952617cc3f9559ff706aee420a8464c36", - "reference": "2e4af9c952617cc3f9559ff706aee420a8464c36", + "url": "https://api.github.com/repos/symfony/console/zipball/9056771b8eca08d026cd3280deeec3cfd99c4d93", + "reference": "9056771b8eca08d026cd3280deeec3cfd99c4d93", "shasum": "" }, "require": { @@ -490,7 +490,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.20" + "source": "https://github.com/symfony/console/tree/v6.4.23" }, "funding": [ { @@ -506,20 +506,20 @@ "type": "tidelift" } ], - "time": "2025-03-03T17:16:38+00:00" + "time": "2025-06-27T19:37:22+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.5.1", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6" + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", - "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", "shasum": "" }, "require": { @@ -532,7 +532,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.5-dev" + "dev-main": "3.6-dev" } }, "autoload": { @@ -557,7 +557,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" }, "funding": [ { @@ -573,11 +573,11 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:20:29+00:00" + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -636,7 +636,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.32.0" }, "funding": [ { @@ -656,7 +656,7 @@ }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", @@ -714,7 +714,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.32.0" }, "funding": [ { @@ -734,7 +734,7 @@ }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", @@ -795,7 +795,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.32.0" }, "funding": [ { @@ -815,19 +815,20 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493", + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493", "shasum": "" }, "require": { + "ext-iconv": "*", "php": ">=7.2" }, "provide": { @@ -875,7 +876,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.32.0" }, "funding": [ { @@ -891,20 +892,20 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2024-12-23T08:48:59+00:00" }, { "name": "symfony/process", - "version": "v7.2.5", + "version": "v7.3.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "87b7c93e57df9d8e39a093d32587702380ff045d" + "reference": "40c295f2deb408d5e9d2d32b8ba1dd61e36f05af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/87b7c93e57df9d8e39a093d32587702380ff045d", - "reference": "87b7c93e57df9d8e39a093d32587702380ff045d", + "url": "https://api.github.com/repos/symfony/process/zipball/40c295f2deb408d5e9d2d32b8ba1dd61e36f05af", + "reference": "40c295f2deb408d5e9d2d32b8ba1dd61e36f05af", "shasum": "" }, "require": { @@ -936,7 +937,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.2.5" + "source": "https://github.com/symfony/process/tree/v7.3.0" }, "funding": [ { @@ -952,20 +953,20 @@ "type": "tidelift" } ], - "time": "2025-03-13T12:21:46+00:00" + "time": "2025-04-17T09:11:12+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.5.1", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0" + "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/e53260aabf78fb3d63f8d79d69ece59f80d5eda0", - "reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f021b05a130d35510bd6b25fe9053c2a8a15d5d4", + "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4", "shasum": "" }, "require": { @@ -983,7 +984,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.5-dev" + "dev-main": "3.6-dev" } }, "autoload": { @@ -1019,7 +1020,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.5.1" + "source": "https://github.com/symfony/service-contracts/tree/v3.6.0" }, "funding": [ { @@ -1035,20 +1036,20 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:20:29+00:00" + "time": "2025-04-25T09:37:31+00:00" }, { "name": "symfony/string", - "version": "v7.2.0", + "version": "v7.3.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "446e0d146f991dde3e73f45f2c97a9faad773c82" + "reference": "f3570b8c61ca887a9e2938e85cb6458515d2b125" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/446e0d146f991dde3e73f45f2c97a9faad773c82", - "reference": "446e0d146f991dde3e73f45f2c97a9faad773c82", + "url": "https://api.github.com/repos/symfony/string/zipball/f3570b8c61ca887a9e2938e85cb6458515d2b125", + "reference": "f3570b8c61ca887a9e2938e85cb6458515d2b125", "shasum": "" }, "require": { @@ -1106,7 +1107,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.2.0" + "source": "https://github.com/symfony/string/tree/v7.3.0" }, "funding": [ { @@ -1122,20 +1123,20 @@ "type": "tidelift" } ], - "time": "2024-11-13T13:31:26+00:00" + "time": "2025-04-20T20:19:01+00:00" }, { "name": "symfony/yaml", - "version": "v7.2.5", + "version": "v7.3.1", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "4c4b6f4cfcd7e52053f0c8bfad0f7f30fb924912" + "reference": "0c3555045a46ab3cd4cc5a69d161225195230edb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/4c4b6f4cfcd7e52053f0c8bfad0f7f30fb924912", - "reference": "4c4b6f4cfcd7e52053f0c8bfad0f7f30fb924912", + "url": "https://api.github.com/repos/symfony/yaml/zipball/0c3555045a46ab3cd4cc5a69d161225195230edb", + "reference": "0c3555045a46ab3cd4cc5a69d161225195230edb", "shasum": "" }, "require": { @@ -1178,7 +1179,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v7.2.5" + "source": "https://github.com/symfony/yaml/tree/v7.3.1" }, "funding": [ { @@ -1194,7 +1195,7 @@ "type": "tidelift" } ], - "time": "2025-03-03T07:12:39+00:00" + "time": "2025-06-03T06:57:57+00:00" }, { "name": "zhamao/logger", @@ -2077,16 +2078,16 @@ }, { "name": "captainhook/captainhook-phar", - "version": "5.25.2", + "version": "5.25.6", "source": { "type": "git", "url": "https://github.com/captainhook-git/captainhook-phar.git", - "reference": "ab47b0561ec7997bf9b88181d090857874f2cf8c" + "reference": "a5dbcd8d20b3dcdb1cbd6948d0d3a058453b3d6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/captainhook-git/captainhook-phar/zipball/ab47b0561ec7997bf9b88181d090857874f2cf8c", - "reference": "ab47b0561ec7997bf9b88181d090857874f2cf8c", + "url": "https://api.github.com/repos/captainhook-git/captainhook-phar/zipball/a5dbcd8d20b3dcdb1cbd6948d0d3a058453b3d6a", + "reference": "a5dbcd8d20b3dcdb1cbd6948d0d3a058453b3d6a", "shasum": "" }, "require": { @@ -2119,7 +2120,7 @@ } ], "description": "PHP git hook manager", - "homepage": "https://github.com/captainhookphp/captainhook", + "homepage": "https://github.com/captainhook-git/captainhook", "keywords": [ "commit-msg", "git", @@ -2130,8 +2131,8 @@ "prepare-commit-msg" ], "support": { - "issues": "https://github.com/captainhookphp/captainhook/issues", - "source": "https://github.com/captainhook-git/captainhook-phar/tree/5.25.2" + "issues": "https://github.com/captainhook-git/captainhook/issues", + "source": "https://github.com/captainhook-git/captainhook-phar/tree/5.25.6" }, "funding": [ { @@ -2139,7 +2140,7 @@ "type": "github" } ], - "time": "2025-03-30T17:19:44+00:00" + "time": "2025-04-08T07:07:48+00:00" }, { "name": "captainhook/hook-installer", @@ -2832,16 +2833,16 @@ }, { "name": "filp/whoops", - "version": "2.18.0", + "version": "2.18.3", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "a7de6c3c6c3c022f5cfc337f8ede6a14460cf77e" + "reference": "59a123a3d459c5a23055802237cb317f609867e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/a7de6c3c6c3c022f5cfc337f8ede6a14460cf77e", - "reference": "a7de6c3c6c3c022f5cfc337f8ede6a14460cf77e", + "url": "https://api.github.com/repos/filp/whoops/zipball/59a123a3d459c5a23055802237cb317f609867e5", + "reference": "59a123a3d459c5a23055802237cb317f609867e5", "shasum": "" }, "require": { @@ -2891,7 +2892,7 @@ ], "support": { "issues": "https://github.com/filp/whoops/issues", - "source": "https://github.com/filp/whoops/tree/2.18.0" + "source": "https://github.com/filp/whoops/tree/2.18.3" }, "funding": [ { @@ -2899,62 +2900,63 @@ "type": "github" } ], - "time": "2025-03-15T12:00:00+00:00" + "time": "2025-06-16T00:02:10+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.75.0", + "version": "v3.84.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "399a128ff2fdaf4281e4e79b755693286cdf325c" + "reference": "38dad0767bf2a9b516b976852200ae722fe984ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/399a128ff2fdaf4281e4e79b755693286cdf325c", - "reference": "399a128ff2fdaf4281e4e79b755693286cdf325c", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/38dad0767bf2a9b516b976852200ae722fe984ca", + "reference": "38dad0767bf2a9b516b976852200ae722fe984ca", "shasum": "" }, "require": { "clue/ndjson-react": "^1.0", "composer/semver": "^3.4", - "composer/xdebug-handler": "^3.0.3", + "composer/xdebug-handler": "^3.0.5", "ext-filter": "*", "ext-hash": "*", "ext-json": "*", "ext-tokenizer": "*", "fidry/cpu-core-counter": "^1.2", "php": "^7.4 || ^8.0", - "react/child-process": "^0.6.5", + "react/child-process": "^0.6.6", "react/event-loop": "^1.0", - "react/promise": "^2.0 || ^3.0", + "react/promise": "^2.11 || ^3.0", "react/socket": "^1.0", "react/stream": "^1.0", - "sebastian/diff": "^4.0 || ^5.1 || ^6.0 || ^7.0", - "symfony/console": "^5.4 || ^6.4 || ^7.0", - "symfony/event-dispatcher": "^5.4 || ^6.4 || ^7.0", - "symfony/filesystem": "^5.4 || ^6.4 || ^7.0", - "symfony/finder": "^5.4 || ^6.4 || ^7.0", - "symfony/options-resolver": "^5.4 || ^6.4 || ^7.0", - "symfony/polyfill-mbstring": "^1.31", - "symfony/polyfill-php80": "^1.31", - "symfony/polyfill-php81": "^1.31", - "symfony/process": "^5.4 || ^6.4 || ^7.2", - "symfony/stopwatch": "^5.4 || ^6.4 || ^7.0" + "sebastian/diff": "^4.0.6 || ^5.1.1 || ^6.0.2 || ^7.0", + "symfony/console": "^5.4.45 || ^6.4.13 || ^7.0", + "symfony/event-dispatcher": "^5.4.45 || ^6.4.13 || ^7.0", + "symfony/filesystem": "^5.4.45 || ^6.4.13 || ^7.0", + "symfony/finder": "^5.4.45 || ^6.4.17 || ^7.0", + "symfony/options-resolver": "^5.4.45 || ^6.4.16 || ^7.0", + "symfony/polyfill-mbstring": "^1.32", + "symfony/polyfill-php80": "^1.32", + "symfony/polyfill-php81": "^1.32", + "symfony/process": "^5.4.47 || ^6.4.20 || ^7.2", + "symfony/stopwatch": "^5.4.45 || ^6.4.19 || ^7.0" }, "require-dev": { "facile-it/paraunit": "^1.3.1 || ^2.6", "infection/infection": "^0.29.14", - "justinrainbow/json-schema": "^5.3 || ^6.2", - "keradus/cli-executor": "^2.1", + "justinrainbow/json-schema": "^5.3 || ^6.4", + "keradus/cli-executor": "^2.2", "mikey179/vfsstream": "^1.6.12", - "php-coveralls/php-coveralls": "^2.7", + "php-coveralls/php-coveralls": "^2.8", "php-cs-fixer/accessible-object": "^1.1", "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.6", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.6", - "phpunit/phpunit": "^9.6.22 || ^10.5.45 || ^11.5.12", - "symfony/var-dumper": "^5.4.48 || ^6.4.18 || ^7.2.3", - "symfony/yaml": "^5.4.45 || ^6.4.18 || ^7.2.3" + "phpunit/phpunit": "^9.6.23 || ^10.5.47 || ^11.5.25", + "symfony/polyfill-php84": "^1.32", + "symfony/var-dumper": "^5.4.48 || ^6.4.23 || ^7.3.1", + "symfony/yaml": "^5.4.45 || ^6.4.23 || ^7.3.1" }, "suggest": { "ext-dom": "For handling output formats in XML", @@ -2995,7 +2997,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.75.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.84.0" }, "funding": [ { @@ -3003,7 +3005,7 @@ "type": "github" } ], - "time": "2025-03-31T18:40:42+00:00" + "time": "2025-07-15T18:21:57+00:00" }, { "name": "humbug/box", @@ -3546,16 +3548,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.13.0", + "version": "1.13.3", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "024473a478be9df5fdaca2c793f2232fe788e414" + "reference": "faed855a7b5f4d4637717c2b3863e277116beb36" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/024473a478be9df5fdaca2c793f2232fe788e414", - "reference": "024473a478be9df5fdaca2c793f2232fe788e414", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/faed855a7b5f4d4637717c2b3863e277116beb36", + "reference": "faed855a7b5f4d4637717c2b3863e277116beb36", "shasum": "" }, "require": { @@ -3594,7 +3596,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.13.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.3" }, "funding": [ { @@ -3602,7 +3604,7 @@ "type": "tidelift" } ], - "time": "2025-02-12T12:17:51+00:00" + "time": "2025-07-05T12:25:42+00:00" }, { "name": "nikic/iter", @@ -3658,16 +3660,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.4.0", + "version": "v5.5.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "447a020a1f875a434d62f2a401f53b82a396e494" + "reference": "ae59794362fe85e051a58ad36b289443f57be7a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/447a020a1f875a434d62f2a401f53b82a396e494", - "reference": "447a020a1f875a434d62f2a401f53b82a396e494", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ae59794362fe85e051a58ad36b289443f57be7a9", + "reference": "ae59794362fe85e051a58ad36b289443f57be7a9", "shasum": "" }, "require": { @@ -3710,9 +3712,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.4.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.5.0" }, - "time": "2024-12-30T11:07:19+00:00" + "time": "2025-05-31T08:24:38+00:00" }, { "name": "nunomaduro/collision", @@ -4404,16 +4406,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "2.1.0", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "9b30d6fd026b2c132b3985ce6b23bec09ab3aa68" + "reference": "b9e61a61e39e02dd90944e9115241c7f7e76bfd8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/9b30d6fd026b2c132b3985ce6b23bec09ab3aa68", - "reference": "9b30d6fd026b2c132b3985ce6b23bec09ab3aa68", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/b9e61a61e39e02dd90944e9115241c7f7e76bfd8", + "reference": "b9e61a61e39e02dd90944e9115241c7f7e76bfd8", "shasum": "" }, "require": { @@ -4445,22 +4447,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/2.1.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.2.0" }, - "time": "2025-02-19T13:28:12+00:00" + "time": "2025-07-13T07:04:09+00:00" }, { "name": "phpstan/phpstan", - "version": "1.12.24", + "version": "1.12.28", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "338b92068f58d9f8035b76aed6cf2b9e5624c025" + "reference": "fcf8b71aeab4e1a1131d1783cef97b23a51b87a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/338b92068f58d9f8035b76aed6cf2b9e5624c025", - "reference": "338b92068f58d9f8035b76aed6cf2b9e5624c025", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/fcf8b71aeab4e1a1131d1783cef97b23a51b87a9", + "reference": "fcf8b71aeab4e1a1131d1783cef97b23a51b87a9", "shasum": "" }, "require": { @@ -4505,7 +4507,7 @@ "type": "github" } ], - "time": "2025-04-16T13:01:53+00:00" + "time": "2025-07-17T17:15:39+00:00" }, { "name": "phpunit/php-code-coverage", @@ -4830,16 +4832,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.45", + "version": "10.5.48", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "bd68a781d8e30348bc297449f5234b3458267ae8" + "reference": "6e0a2bc39f6fae7617989d690d76c48e6d2eb541" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/bd68a781d8e30348bc297449f5234b3458267ae8", - "reference": "bd68a781d8e30348bc297449f5234b3458267ae8", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6e0a2bc39f6fae7617989d690d76c48e6d2eb541", + "reference": "6e0a2bc39f6fae7617989d690d76c48e6d2eb541", "shasum": "" }, "require": { @@ -4849,7 +4851,7 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.12.1", + "myclabs/deep-copy": "^1.13.3", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=8.1", @@ -4911,7 +4913,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.45" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.48" }, "funding": [ { @@ -4922,12 +4924,20 @@ "url": "https://github.com/sebastianbergmann", "type": "github" }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, { "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", "type": "tidelift" } ], - "time": "2025-02-06T16:08:12+00:00" + "time": "2025-07-11T04:07:17+00:00" }, { "name": "psr/event-dispatcher", @@ -6715,16 +6725,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v7.2.0", + "version": "v7.3.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "910c5db85a5356d0fea57680defec4e99eb9c8c1" + "reference": "497f73ac996a598c92409b44ac43b6690c4f666d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/910c5db85a5356d0fea57680defec4e99eb9c8c1", - "reference": "910c5db85a5356d0fea57680defec4e99eb9c8c1", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/497f73ac996a598c92409b44ac43b6690c4f666d", + "reference": "497f73ac996a598c92409b44ac43b6690c4f666d", "shasum": "" }, "require": { @@ -6775,7 +6785,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v7.2.0" + "source": "https://github.com/symfony/event-dispatcher/tree/v7.3.0" }, "funding": [ { @@ -6791,20 +6801,20 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:21:43+00:00" + "time": "2025-04-22T09:11:45+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v3.5.1", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "7642f5e970b672283b7823222ae8ef8bbc160b9f" + "reference": "59eb412e93815df44f05f342958efa9f46b1e586" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7642f5e970b672283b7823222ae8ef8bbc160b9f", - "reference": "7642f5e970b672283b7823222ae8ef8bbc160b9f", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/59eb412e93815df44f05f342958efa9f46b1e586", + "reference": "59eb412e93815df44f05f342958efa9f46b1e586", "shasum": "" }, "require": { @@ -6818,7 +6828,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.5-dev" + "dev-main": "3.6-dev" } }, "autoload": { @@ -6851,7 +6861,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.5.1" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.6.0" }, "funding": [ { @@ -6867,11 +6877,11 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:20:29+00:00" + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/filesystem", - "version": "v7.2.0", + "version": "v7.3.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", @@ -6917,7 +6927,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.2.0" + "source": "https://github.com/symfony/filesystem/tree/v7.3.0" }, "funding": [ { @@ -6937,16 +6947,16 @@ }, { "name": "symfony/finder", - "version": "v7.2.2", + "version": "v7.3.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "87a71856f2f56e4100373e92529eed3171695cfb" + "reference": "ec2344cf77a48253bbca6939aa3d2477773ea63d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/87a71856f2f56e4100373e92529eed3171695cfb", - "reference": "87a71856f2f56e4100373e92529eed3171695cfb", + "url": "https://api.github.com/repos/symfony/finder/zipball/ec2344cf77a48253bbca6939aa3d2477773ea63d", + "reference": "ec2344cf77a48253bbca6939aa3d2477773ea63d", "shasum": "" }, "require": { @@ -6981,7 +6991,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.2.2" + "source": "https://github.com/symfony/finder/tree/v7.3.0" }, "funding": [ { @@ -6997,20 +7007,20 @@ "type": "tidelift" } ], - "time": "2024-12-30T19:00:17+00:00" + "time": "2024-12-30T19:00:26+00:00" }, { "name": "symfony/options-resolver", - "version": "v7.2.0", + "version": "v7.3.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "7da8fbac9dcfef75ffc212235d76b2754ce0cf50" + "reference": "afb9a8038025e5dbc657378bfab9198d75f10fca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/7da8fbac9dcfef75ffc212235d76b2754ce0cf50", - "reference": "7da8fbac9dcfef75ffc212235d76b2754ce0cf50", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/afb9a8038025e5dbc657378bfab9198d75f10fca", + "reference": "afb9a8038025e5dbc657378bfab9198d75f10fca", "shasum": "" }, "require": { @@ -7048,7 +7058,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v7.2.0" + "source": "https://github.com/symfony/options-resolver/tree/v7.3.0" }, "funding": [ { @@ -7064,20 +7074,20 @@ "type": "tidelift" } ], - "time": "2024-11-20T11:17:29+00:00" + "time": "2025-04-04T13:12:05+00:00" }, { "name": "symfony/polyfill-iconv", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-iconv.git", - "reference": "48becf00c920479ca2e910c22a5a39e5d47ca956" + "reference": "5f3b930437ae03ae5dff61269024d8ea1b3774aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/48becf00c920479ca2e910c22a5a39e5d47ca956", - "reference": "48becf00c920479ca2e910c22a5a39e5d47ca956", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/5f3b930437ae03ae5dff61269024d8ea1b3774aa", + "reference": "5f3b930437ae03ae5dff61269024d8ea1b3774aa", "shasum": "" }, "require": { @@ -7128,7 +7138,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-iconv/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-iconv/tree/v1.32.0" }, "funding": [ { @@ -7144,20 +7154,20 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2024-09-17T14:58:18+00:00" }, { "name": "symfony/polyfill-php84", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php84.git", - "reference": "e5493eb51311ab0b1cc2243416613f06ed8f18bd" + "reference": "000df7860439609837bbe28670b0be15783b7fbf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/e5493eb51311ab0b1cc2243416613f06ed8f18bd", - "reference": "e5493eb51311ab0b1cc2243416613f06ed8f18bd", + "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/000df7860439609837bbe28670b0be15783b7fbf", + "reference": "000df7860439609837bbe28670b0be15783b7fbf", "shasum": "" }, "require": { @@ -7204,7 +7214,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php84/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-php84/tree/v1.32.0" }, "funding": [ { @@ -7220,11 +7230,11 @@ "type": "tidelift" } ], - "time": "2024-09-09T12:04:04+00:00" + "time": "2025-02-20T12:04:08+00:00" }, { "name": "symfony/stopwatch", - "version": "v7.2.4", + "version": "v7.3.0", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", @@ -7266,7 +7276,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v7.2.4" + "source": "https://github.com/symfony/stopwatch/tree/v7.3.0" }, "funding": [ { @@ -7286,20 +7296,21 @@ }, { "name": "symfony/var-dumper", - "version": "v7.2.3", + "version": "v7.3.1", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "82b478c69745d8878eb60f9a049a4d584996f73a" + "reference": "6e209fbe5f5a7b6043baba46fe5735a4b85d0d42" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/82b478c69745d8878eb60f9a049a4d584996f73a", - "reference": "82b478c69745d8878eb60f9a049a4d584996f73a", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/6e209fbe5f5a7b6043baba46fe5735a4b85d0d42", + "reference": "6e209fbe5f5a7b6043baba46fe5735a4b85d0d42", "shasum": "" }, "require": { "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { @@ -7349,7 +7360,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v7.2.3" + "source": "https://github.com/symfony/var-dumper/tree/v7.3.1" }, "funding": [ { @@ -7365,20 +7376,20 @@ "type": "tidelift" } ], - "time": "2025-01-17T11:39:41+00:00" + "time": "2025-06-27T19:55:54+00:00" }, { "name": "thecodingmachine/safe", - "version": "v3.1.0", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/thecodingmachine/safe.git", - "reference": "e14ac96126e6c19ea9d1f4029abb51487f4cf2cf" + "reference": "2cdd579eeaa2e78e51c7509b50cc9fb89a956236" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thecodingmachine/safe/zipball/e14ac96126e6c19ea9d1f4029abb51487f4cf2cf", - "reference": "e14ac96126e6c19ea9d1f4029abb51487f4cf2cf", + "url": "https://api.github.com/repos/thecodingmachine/safe/zipball/2cdd579eeaa2e78e51c7509b50cc9fb89a956236", + "reference": "2cdd579eeaa2e78e51c7509b50cc9fb89a956236", "shasum": "" }, "require": { @@ -7488,7 +7499,7 @@ "description": "PHP core functions that throw exceptions instead of returning FALSE on error", "support": { "issues": "https://github.com/thecodingmachine/safe/issues", - "source": "https://github.com/thecodingmachine/safe/tree/v3.1.0" + "source": "https://github.com/thecodingmachine/safe/tree/v3.3.0" }, "funding": [ { @@ -7504,7 +7515,7 @@ "type": "github" } ], - "time": "2025-04-12T06:41:26+00:00" + "time": "2025-05-14T06:15:44+00:00" }, { "name": "theseer/tokenizer", From 4010a84d88c06c1c81391e61058c857edce45392 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 22 Jul 2025 14:59:58 +0700 Subject: [PATCH 37/58] set up tmate --- .github/workflows/tests.yml | 4 ++++ src/globals/test-extensions.php | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5ed6d59d..bb160f5c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -198,3 +198,7 @@ jobs: - name: "Run Build Tests (build - embed for non-windows)" if: ${{ !startsWith(matrix.os, 'windows-') }} run: php src/globals/test-extensions.php build_embed_cmd ${{ matrix.os }} ${{ matrix.php }} + + - name: Setup tmate session + if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 417b3b67..1d0df8de 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -21,14 +21,14 @@ $test_php_version = [ // test os (macos-13, macos-14, macos-15, ubuntu-latest, windows-latest are available) $test_os = [ - 'macos-13', // bin/spc for x86_64 - 'macos-14', // bin/spc for arm64 - 'macos-15', // bin/spc for arm64 + // 'macos-13', // bin/spc for x86_64 + // 'macos-14', // 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-24.04', // bin/spc for x86_64 - 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64 - 'ubuntu-24.04-arm', // bin/spc for arm64 + // '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-24.04-arm', // bin/spc for arm64 // 'windows-latest', // .\bin\spc.ps1 ]; From 107fb08e34d661fa3ff9ae0b89125f3842f7bb75 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 22 Jul 2025 16:26:37 +0700 Subject: [PATCH 38/58] simplify patch logic for grpc (--enable-grpc=PATH does not actually pass a path, needs to be --with-grpc=PATH) --- .github/workflows/tests.yml | 6 +++--- config/ext.json | 2 +- src/SPC/builder/extension/grpc.php | 28 ++++++++++------------------ src/globals/test-extensions.php | 14 +++++++------- 4 files changed, 21 insertions(+), 29 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bb160f5c..17355887 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -199,6 +199,6 @@ jobs: if: ${{ !startsWith(matrix.os, 'windows-') }} run: php src/globals/test-extensions.php build_embed_cmd ${{ matrix.os }} ${{ matrix.php }} - - name: Setup tmate session - if: ${{ failure() }} - uses: mxschmitt/action-tmate@v3 +# - name: Setup tmate session +# if: ${{ failure() }} +# uses: mxschmitt/action-tmate@v3 diff --git a/config/ext.json b/config/ext.json index a5eca9f4..5a3ebbd4 100644 --- a/config/ext.json +++ b/config/ext.json @@ -233,7 +233,7 @@ }, "type": "external", "source": "grpc", - "arg-type-unix": "custom", + "arg-type-unix": "with-prefix", "cpp-extension": true, "lib-depends": [ "grpc" diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index 7a3ed091..d718d7de 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -16,23 +16,20 @@ class grpc extends Extension { public function patchBeforeBuildconf(): bool { - // soft link to the grpc source code if ($this->builder instanceof WindowsBuilder) { - // not support windows yet throw new \RuntimeException('grpc extension does not support windows yet'); } - if (!is_link(SOURCE_PATH . '/php-src/ext/grpc')) { - if (is_dir($this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc')) { - shell()->exec('ln -s ' . $this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc ' . SOURCE_PATH . '/php-src/ext/grpc'); - } else { - throw new \RuntimeException('Cannot find grpc source code'); - } - $macos = $this->builder instanceof MacOSBuilder ? "\n" . ' LDFLAGS="$LDFLAGS -framework CoreFoundation"' : ''; - FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/ext/grpc/config.m4', '/GRPC_LIBDIR=.*$/m', 'GRPC_LIBDIR=' . BUILD_LIB_PATH . $macos); - FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/ext/grpc/config.m4', '/SEARCH_PATH=.*$/m', 'SEARCH_PATH="' . BUILD_ROOT_PATH . '"'); - return true; + if (file_exists(SOURCE_PATH . '/php-src/ext/grpc')) { + return false; } - return false; + // soft link to the grpc source code + if (is_dir($this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc')) { + shell()->exec('ln -s ' . $this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc ' . SOURCE_PATH . '/php-src/ext/grpc'); + } else { + throw new \RuntimeException('Cannot find grpc source code'); + } + FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/grpc/config.m4', 'PHP_ARG_ENABLE(grpc,', 'PHP_ARG_WITH(grpc,'); + return true; } public function patchBeforeConfigure(): bool @@ -62,11 +59,6 @@ class grpc extends Extension return true; } - public function getUnixConfigureArg(bool $shared = false): string - { - return '--enable-grpc=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . '/grpc GRPC_LIB_SUBDIR=' . BUILD_LIB_PATH; - } - private function getLibraries(): array { $libs = shell()->execWithResult('$PKG_CONFIG --libs --static grpc')[1][0]; diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 1d0df8de..5f44332e 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -21,19 +21,19 @@ $test_php_version = [ // test os (macos-13, macos-14, macos-15, ubuntu-latest, windows-latest are available) $test_os = [ - // 'macos-13', // bin/spc for x86_64 + 'macos-13', // bin/spc for x86_64 // 'macos-14', // bin/spc for arm64 - // '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-24.04', // bin/spc for x86_64 - // 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64 - // 'ubuntu-24.04-arm', // bin/spc for arm64 + '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-24.04-arm', // bin/spc for arm64 // 'windows-latest', // .\bin\spc.ps1 ]; // whether enable thread safe -$zts = false; +$zts = true; $no_strip = false; From 5aa9255909b37c5b05ba6dcfa615782067e85b08 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 22 Jul 2025 16:27:05 +0700 Subject: [PATCH 39/58] cs fix --- src/SPC/builder/extension/grpc.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index d718d7de..7225a8fb 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -5,7 +5,6 @@ declare(strict_types=1); namespace SPC\builder\extension; use SPC\builder\Extension; -use SPC\builder\macos\MacOSBuilder; use SPC\builder\windows\WindowsBuilder; use SPC\store\FileSystem; use SPC\util\CustomExt; From cfda1e93a03d40dc5e26a21f87a418a6dc9d1a12 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 22 Jul 2025 17:17:11 +0700 Subject: [PATCH 40/58] add macos ldflags --- src/SPC/builder/extension/grpc.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index 7225a8fb..92deaf06 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -9,6 +9,7 @@ use SPC\builder\windows\WindowsBuilder; use SPC\store\FileSystem; use SPC\util\CustomExt; use SPC\util\GlobalEnvManager; +use SPC\util\SPCTarget; #[CustomExt('grpc')] class grpc extends Extension @@ -28,6 +29,13 @@ class grpc extends Extension throw new \RuntimeException('Cannot find grpc source code'); } FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/grpc/config.m4', 'PHP_ARG_ENABLE(grpc,', 'PHP_ARG_WITH(grpc,'); + if (SPCTarget::getTargetOS() === 'Darwin') { + FileSystem::replaceFileRegex( + SOURCE_PATH . '/php-src/ext/grpc/config.m4', + '/GRPC_LIBDIR=.*$/m', + 'GRPC_LIBDIR=' . BUILD_LIB_PATH . "\n" . 'LDFLAGS="$LDFLAGS -framework CoreFoundation"' + ); + } return true; } From 3ca7c15208899185b36507bc8b443ad98d9876da Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 22 Jul 2025 18:21:33 +0700 Subject: [PATCH 41/58] simplify back to --enable, it actually supports paths :O --- config/ext.json | 2 +- config/lib.json | 1 + src/SPC/builder/extension/grpc.php | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config/ext.json b/config/ext.json index 5a3ebbd4..a5eca9f4 100644 --- a/config/ext.json +++ b/config/ext.json @@ -233,7 +233,7 @@ }, "type": "external", "source": "grpc", - "arg-type-unix": "with-prefix", + "arg-type-unix": "custom", "cpp-extension": true, "lib-depends": [ "grpc" diff --git a/config/lib.json b/config/lib.json index e784b889..92b625be 100644 --- a/config/lib.json +++ b/config/lib.json @@ -193,6 +193,7 @@ "openssl", "libcares" ], + "provide-pre-built": true, "frameworks": [ "CoreFoundation" ] diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index 92deaf06..115c82af 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -28,7 +28,6 @@ class grpc extends Extension } else { throw new \RuntimeException('Cannot find grpc source code'); } - FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/grpc/config.m4', 'PHP_ARG_ENABLE(grpc,', 'PHP_ARG_WITH(grpc,'); if (SPCTarget::getTargetOS() === 'Darwin') { FileSystem::replaceFileRegex( SOURCE_PATH . '/php-src/ext/grpc/config.m4', @@ -46,6 +45,11 @@ class grpc extends Extension return true; } + public function getUnixConfigureArg(bool $shared = false): string + { + return '--enable-grpc=' . ($shared ? 'shared' : '') . BUILD_ROOT_PATH; + } + public function patchBeforeMake(): bool { $extra_libs = trim(getenv('SPC_EXTRA_LIBS')); From 9172c39a260d891b1992a06d8ca75b7262123217 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 22 Jul 2025 18:29:58 +0700 Subject: [PATCH 42/58] change --with-prefix to --with-path, add --enable-path (yes, grpc uses that...) --- config/ext.json | 34 +++++++++++++++--------------- src/SPC/builder/Extension.php | 5 +++-- src/SPC/builder/extension/grpc.php | 5 ----- 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/config/ext.json b/config/ext.json index a5eca9f4..61897bb5 100644 --- a/config/ext.json +++ b/config/ext.json @@ -34,7 +34,7 @@ }, "bz2": { "type": "builtin", - "arg-type-unix": "with-prefix", + "arg-type-unix": "with-path", "arg-type-windows": "with", "lib-depends": [ "bzip2" @@ -185,7 +185,7 @@ "BSD": "wip" }, "type": "builtin", - "arg-type": "with-prefix", + "arg-type": "with-path", "lib-depends": [ "gettext" ] @@ -211,7 +211,7 @@ "BSD": "wip" }, "type": "builtin", - "arg-type": "with-prefix", + "arg-type": "with-path", "lib-depends": [ "gmp" ] @@ -233,7 +233,7 @@ }, "type": "external", "source": "grpc", - "arg-type-unix": "custom", + "arg-type-unix": "enable-path", "cpp-extension": true, "lib-depends": [ "grpc" @@ -244,7 +244,7 @@ "BSD": "wip" }, "type": "builtin", - "arg-type": "with-prefix", + "arg-type": "with-path", "arg-type-windows": "with", "lib-depends-unix": [ "libiconv" @@ -320,7 +320,7 @@ "BSD": "wip" }, "type": "builtin", - "arg-type": "with-prefix", + "arg-type": "with-path", "lib-depends": [ "ldap" ], @@ -529,7 +529,7 @@ }, "notes": true, "type": "builtin", - "arg-type": "with-prefix", + "arg-type": "with-path", "lib-depends": [ "libargon2" ] @@ -571,7 +571,7 @@ "BSD": "wip" }, "type": "builtin", - "arg-type": "with-prefix", + "arg-type": "with-path", "arg-type-windows": "custom", "ext-depends": [ "pdo", @@ -674,7 +674,7 @@ "BSD": "wip" }, "type": "builtin", - "arg-type": "with-prefix", + "arg-type": "with-path", "lib-depends": [ "readline" ], @@ -785,7 +785,7 @@ "BSD": "wip" }, "type": "builtin", - "arg-type": "with-prefix", + "arg-type": "with-path", "arg-type-windows": "with", "lib-depends": [ "sqlite" @@ -811,7 +811,7 @@ }, "type": "external", "source": "ext-ssh2", - "arg-type": "with-prefix", + "arg-type": "with-path", "arg-type-windows": "with", "lib-depends": [ "libssh2" @@ -937,7 +937,7 @@ "BSD": "wip" }, "type": "builtin", - "arg-type": "with-prefix", + "arg-type": "with-path", "lib-depends": [ "tidy" ] @@ -953,7 +953,7 @@ }, "type": "external", "source": "ext-uuid", - "arg-type": "with-prefix", + "arg-type": "with-path", "lib-depends": [ "libuuid" ] @@ -965,7 +965,7 @@ }, "type": "external", "source": "ext-uv", - "arg-type": "with-prefix", + "arg-type": "with-path", "lib-depends": [ "libuv" ], @@ -1067,7 +1067,7 @@ "BSD": "wip" }, "type": "builtin", - "arg-type": "with-prefix", + "arg-type": "with-path", "lib-depends": [ "libxslt" ], @@ -1104,7 +1104,7 @@ }, "type": "external", "source": "yaml", - "arg-type-unix": "with-prefix", + "arg-type-unix": "with-path", "arg-type-windows": "with", "lib-depends": [ "libyaml" @@ -1115,7 +1115,7 @@ "BSD": "wip" }, "type": "builtin", - "arg-type": "with-prefix", + "arg-type": "with-path", "arg-type-windows": "enable", "lib-depends-unix": [ "libzip" diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index b7c56e4a..590b8149 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -86,10 +86,11 @@ class Extension $_name = str_replace('_', '-', $this->name); return match ($arg_type = Config::getExt($this->name, 'arg-type', 'enable')) { 'enable' => '--enable-' . $_name . ($shared ? '=shared' : '') . ' ', + 'enable-path' => '--enable-' . $_name . '=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . ' ', 'with' => '--with-' . $_name . ($shared ? '=shared' : '') . ' ', - 'with-prefix' => '--with-' . $_name . '=' . ($shared ? 'shared,' : '') . '"' . BUILD_ROOT_PATH . '" ', + 'with-path' => '--with-' . $_name . '=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . ' ', 'none', 'custom' => '', - default => throw new WrongUsageException("argType does not accept {$arg_type}, use [enable/with/with-prefix] ."), + default => throw new WrongUsageException("argType does not accept {$arg_type}, use [enable/with/with-path] ."), }; } diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index 115c82af..a782e106 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -45,11 +45,6 @@ class grpc extends Extension return true; } - public function getUnixConfigureArg(bool $shared = false): string - { - return '--enable-grpc=' . ($shared ? 'shared' : '') . BUILD_ROOT_PATH; - } - public function patchBeforeMake(): bool { $extra_libs = trim(getenv('SPC_EXTRA_LIBS')); From bdb705e89a7d4faa95ac25a5d310f0b1ed8da4b9 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 22 Jul 2025 18:38:17 +0700 Subject: [PATCH 43/58] only escape path if required --- src/SPC/builder/Extension.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 590b8149..471cf611 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -83,12 +83,13 @@ class Extension */ public function getEnableArg(bool $shared = false): string { + $escapedPath = str_replace("'", '', escapeshellarg(BUILD_ROOT_PATH)) !== BUILD_ROOT_PATH ? '"' . BUILD_ROOT_PATH . '"' : BUILD_ROOT_PATH; $_name = str_replace('_', '-', $this->name); return match ($arg_type = Config::getExt($this->name, 'arg-type', 'enable')) { 'enable' => '--enable-' . $_name . ($shared ? '=shared' : '') . ' ', - 'enable-path' => '--enable-' . $_name . '=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . ' ', + 'enable-path' => '--enable-' . $_name . '=' . ($shared ? 'shared,' : '') . $escapedPath . ' ', 'with' => '--with-' . $_name . ($shared ? '=shared' : '') . ' ', - 'with-path' => '--with-' . $_name . '=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . ' ', + 'with-path' => '--with-' . $_name . '=' . ($shared ? 'shared,' : '') . $escapedPath . ' ', 'none', 'custom' => '', default => throw new WrongUsageException("argType does not accept {$arg_type}, use [enable/with/with-path] ."), }; From 8c603d59c6bdc5a0b901fe01156471ddf727c32a Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 22 Jul 2025 18:42:34 +0700 Subject: [PATCH 44/58] simplify path --- src/SPC/builder/extension/grpc.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index a782e106..c2c7b6eb 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace SPC\builder\extension; use SPC\builder\Extension; +use SPC\builder\LibraryBase; use SPC\builder\windows\WindowsBuilder; use SPC\store\FileSystem; use SPC\util\CustomExt; @@ -23,8 +24,8 @@ class grpc extends Extension return false; } // soft link to the grpc source code - if (is_dir($this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc')) { - shell()->exec('ln -s ' . $this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc ' . SOURCE_PATH . '/php-src/ext/grpc'); + if (is_dir($this->source_dir . '/src/php/ext/grpc')) { + shell()->exec('ln -s ' . $this->source_dir . '/src/php/ext/grpc ' . SOURCE_PATH . '/php-src/ext/grpc'); } else { throw new \RuntimeException('Cannot find grpc source code'); } From c96d503dae39739a41f590c715d13c9df302f36a Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 22 Jul 2025 18:45:28 +0700 Subject: [PATCH 45/58] fix cs --- src/SPC/builder/extension/grpc.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index c2c7b6eb..36f84869 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -5,7 +5,6 @@ declare(strict_types=1); namespace SPC\builder\extension; use SPC\builder\Extension; -use SPC\builder\LibraryBase; use SPC\builder\windows\WindowsBuilder; use SPC\store\FileSystem; use SPC\util\CustomExt; From f9a8231820937545df07f0a3a93919eed93dd32f Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 22 Jul 2025 19:01:07 +0700 Subject: [PATCH 46/58] simpler check --- src/SPC/builder/Extension.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 471cf611..c34875ac 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace SPC\builder; +use PharIo\Version\BuildMetaData; use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; use SPC\exception\WrongUsageException; @@ -83,7 +84,7 @@ class Extension */ public function getEnableArg(bool $shared = false): string { - $escapedPath = str_replace("'", '', escapeshellarg(BUILD_ROOT_PATH)) !== BUILD_ROOT_PATH ? '"' . BUILD_ROOT_PATH . '"' : BUILD_ROOT_PATH; + $escapedPath = str_contains(BUILD_ROOT_PATH, ' ') ? '"' . BUILD_ROOT_PATH . '"' : BUILD_ROOT_PATH; $_name = str_replace('_', '-', $this->name); return match ($arg_type = Config::getExt($this->name, 'arg-type', 'enable')) { 'enable' => '--enable-' . $_name . ($shared ? '=shared' : '') . ' ', From 4b7020fbbb190b6a069e4f5007f0c016d9da4e0a Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 22 Jul 2025 19:01:46 +0700 Subject: [PATCH 47/58] also escape if it contains a space --- src/SPC/builder/Extension.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index c34875ac..9770b62a 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace SPC\builder; -use PharIo\Version\BuildMetaData; use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; use SPC\exception\WrongUsageException; @@ -84,7 +83,7 @@ class Extension */ public function getEnableArg(bool $shared = false): string { - $escapedPath = str_contains(BUILD_ROOT_PATH, ' ') ? '"' . BUILD_ROOT_PATH . '"' : BUILD_ROOT_PATH; + $escapedPath = str_replace("'", '', escapeshellarg(BUILD_ROOT_PATH)) !== BUILD_ROOT_PATH || str_contains(BUILD_ROOT_PATH, ' ') ? '"' . BUILD_ROOT_PATH . '"' : BUILD_ROOT_PATH; $_name = str_replace('_', '-', $this->name); return match ($arg_type = Config::getExt($this->name, 'arg-type', 'enable')) { 'enable' => '--enable-' . $_name . ($shared ? '=shared' : '') . ' ', From eb56690684ad6a2d506543503e33c5e28b035b89 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 22 Jul 2025 19:03:16 +0700 Subject: [PATCH 48/58] use escapeshellarg --- src/SPC/builder/Extension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 9770b62a..585ecfc7 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -83,7 +83,7 @@ class Extension */ public function getEnableArg(bool $shared = false): string { - $escapedPath = str_replace("'", '', escapeshellarg(BUILD_ROOT_PATH)) !== BUILD_ROOT_PATH || str_contains(BUILD_ROOT_PATH, ' ') ? '"' . BUILD_ROOT_PATH . '"' : BUILD_ROOT_PATH; + $escapedPath = str_replace("'", '', escapeshellarg(BUILD_ROOT_PATH)) !== BUILD_ROOT_PATH || str_contains(BUILD_ROOT_PATH, ' ') ? escapeshellarg(BUILD_ROOT_PATH) : BUILD_ROOT_PATH; $_name = str_replace('_', '-', $this->name); return match ($arg_type = Config::getExt($this->name, 'arg-type', 'enable')) { 'enable' => '--enable-' . $_name . ($shared ? '=shared' : '') . ' ', From 6962d24b52632d18587798f3a275d62df029f941 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 22 Jul 2025 19:12:17 +0700 Subject: [PATCH 49/58] unify CMakeExecutor and AutoConfExecutor --- .../util/executor/UnixAutoconfExecutor.php | 2 +- src/SPC/util/executor/UnixCMakeExecutor.php | 35 ++++++++++++------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/SPC/util/executor/UnixAutoconfExecutor.php b/src/SPC/util/executor/UnixAutoconfExecutor.php index 1c9f496e..8f923b1f 100644 --- a/src/SPC/util/executor/UnixAutoconfExecutor.php +++ b/src/SPC/util/executor/UnixAutoconfExecutor.php @@ -12,7 +12,7 @@ use SPC\util\UnixShell; class UnixAutoconfExecutor extends Executor { - protected ?UnixShell $shell = null; + protected UnixShell $shell; protected array $configure_args = []; diff --git a/src/SPC/util/executor/UnixCMakeExecutor.php b/src/SPC/util/executor/UnixCMakeExecutor.php index dc2aa46c..1a9f90cf 100644 --- a/src/SPC/util/executor/UnixCMakeExecutor.php +++ b/src/SPC/util/executor/UnixCMakeExecutor.php @@ -5,26 +5,36 @@ declare(strict_types=1); namespace SPC\util\executor; use Closure; +use SPC\builder\freebsd\library\BSDLibraryBase; +use SPC\builder\linux\library\LinuxLibraryBase; +use SPC\builder\macos\library\MacOSLibraryBase; use SPC\exception\FileSystemException; use SPC\exception\WrongUsageException; use SPC\store\FileSystem; +use SPC\util\UnixShell; /** * Unix-like OS cmake command executor. */ class UnixCMakeExecutor extends Executor { - protected ?string $build_dir = null; + protected UnixShell $shell; protected array $configure_args = []; + protected ?string $build_dir = null; + protected ?array $custom_default_args = null; protected int $steps = 3; protected bool $reset = true; - protected array $extra_env = []; + public function __construct(protected BSDLibraryBase|LinuxLibraryBase|MacOSLibraryBase $library) + { + parent::__construct($library); + $this->initShell(); + } public function build(string $build_pos = '..'): void { @@ -35,17 +45,14 @@ class UnixCMakeExecutor extends Executor FileSystem::resetDir($this->build_dir); } - // prepare shell - $shell = shell()->cd($this->build_dir)->initializeEnv($this->library)->appendEnv($this->extra_env); - // config - $this->steps >= 1 && $shell->exec("cmake {$this->getConfigureArgs()} {$this->getDefaultCMakeArgs()} {$build_pos}"); + $this->steps >= 1 && $this->shell->exec("cmake {$this->getConfigureArgs()} {$this->getDefaultCMakeArgs()} {$build_pos}"); // make - $this->steps >= 2 && $shell->exec("cmake --build . -j {$this->library->getBuilder()->concurrency}"); + $this->steps >= 2 && $this->shell->exec("cmake --build . -j {$this->library->getBuilder()->concurrency}"); // install - $this->steps >= 3 && $shell->exec('make install'); + $this->steps >= 3 && $this->shell->exec('make install'); } /** @@ -79,12 +86,9 @@ class UnixCMakeExecutor extends Executor return $this; } - /** - * Add extra environment flags - */ - public function addExtraEnv(array $env): static + public function appendEnv(array $env): static { - $this->extra_env = [...$this->extra_env, ...$env]; + $this->shell->appendEnv($env); return $this; } @@ -220,4 +224,9 @@ CMAKE; FileSystem::writeFile(SOURCE_PATH . '/toolchain.cmake', $toolchain); return $created = realpath(SOURCE_PATH . '/toolchain.cmake'); } + + private function initShell(): void + { + $this->shell = shell()->cd($this->build_dir)->initializeEnv($this->library); + } } From a44dc0a5f6ab328ddb6f25d0e023d72578ada114 Mon Sep 17 00:00:00 2001 From: Marc Date: Tue, 22 Jul 2025 19:45:58 +0700 Subject: [PATCH 50/58] cd later --- src/SPC/util/executor/UnixCMakeExecutor.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SPC/util/executor/UnixCMakeExecutor.php b/src/SPC/util/executor/UnixCMakeExecutor.php index 1a9f90cf..71a81951 100644 --- a/src/SPC/util/executor/UnixCMakeExecutor.php +++ b/src/SPC/util/executor/UnixCMakeExecutor.php @@ -45,6 +45,8 @@ class UnixCMakeExecutor extends Executor FileSystem::resetDir($this->build_dir); } + $this->shell = $this->shell->cd($this->build_dir); + // config $this->steps >= 1 && $this->shell->exec("cmake {$this->getConfigureArgs()} {$this->getDefaultCMakeArgs()} {$build_pos}"); @@ -227,6 +229,6 @@ CMAKE; private function initShell(): void { - $this->shell = shell()->cd($this->build_dir)->initializeEnv($this->library); + $this->shell = shell()->initializeEnv($this->library); } } From 22bec873a875737b549807f8bf997165ea1f8353 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 23 Jul 2025 13:55:09 +0700 Subject: [PATCH 51/58] more merge stuff --- config/lib.json | 3 +++ src/SPC/builder/extension/grpc.php | 27 ++++----------------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/config/lib.json b/config/lib.json index 5d356920..1c4525d8 100644 --- a/config/lib.json +++ b/config/lib.json @@ -189,6 +189,9 @@ "static-libs-unix": [ "libgrpc.a" ], + "pkg-configs": [ + "grpc" + ], "lib-depends": [ "zlib", "openssl", diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index 36f84869..7e384355 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -9,6 +9,7 @@ use SPC\builder\windows\WindowsBuilder; use SPC\store\FileSystem; use SPC\util\CustomExt; use SPC\util\GlobalEnvManager; +use SPC\util\SPCConfigUtil; use SPC\util\SPCTarget; #[CustomExt('grpc')] @@ -40,37 +41,17 @@ class grpc extends Extension public function patchBeforeConfigure(): bool { - $libs = join(' ', $this->getLibraries()); + $util = new SPCConfigUtil($this->builder); + $config = $util->config(['grpc']); + $libs = $config['libs']; FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/configure', '-lgrpc', $libs); return true; } public function patchBeforeMake(): bool { - $extra_libs = trim(getenv('SPC_EXTRA_LIBS')); - $libs = array_map(function (string $lib) { - if (str_starts_with($lib, '-l')) { - $staticLib = substr($lib, 2); - $staticLib = BUILD_LIB_PATH . '/lib' . $staticLib . '.a'; - if (file_exists($staticLib)) { - return $staticLib; - } - } - return $lib; - }, $this->getLibraries()); - $extra_libs = str_replace(BUILD_LIB_PATH . '/libgrpc.a', join(' ', $libs), $extra_libs); - f_putenv('SPC_EXTRA_LIBS=' . $extra_libs); // add -Wno-strict-prototypes GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') . ' -Wno-strict-prototypes'); return true; } - - private function getLibraries(): array - { - $libs = shell()->execWithResult('$PKG_CONFIG --libs --static grpc')[1][0]; - $filtered = preg_replace('/-L\S+/', '', $libs); - $filtered = preg_replace('/(?:\S*\/)?lib([a-zA-Z0-9_+-]+)\.a\b/', '-l$1', $filtered); - $out = preg_replace('/\s+/', ' ', $filtered); - return explode(' ', trim($out)); - } } From ee492dcde119095079ba5cf6a0eea846dde4961a Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 23 Jul 2025 14:10:28 +0700 Subject: [PATCH 52/58] patch pc files --- config/lib.json | 3 --- src/SPC/builder/extension/grpc.php | 2 +- src/SPC/builder/unix/library/grpc.php | 1 + 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/config/lib.json b/config/lib.json index 1c4525d8..13f886ca 100644 --- a/config/lib.json +++ b/config/lib.json @@ -186,9 +186,6 @@ }, "grpc": { "source": "grpc", - "static-libs-unix": [ - "libgrpc.a" - ], "pkg-configs": [ "grpc" ], diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index 7e384355..6ddfb008 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -41,7 +41,7 @@ class grpc extends Extension public function patchBeforeConfigure(): bool { - $util = new SPCConfigUtil($this->builder); + $util = new SPCConfigUtil($this->builder, ['libs_only_deps' => true]); $config = $util->config(['grpc']); $libs = $config['libs']; FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/configure', '-lgrpc', $libs); diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index 0148c969..6e40c7f6 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -50,6 +50,7 @@ trait grpc $cmake->build(); copy($this->source_dir . '/third_party/re2/re2.pc', BUILD_LIB_PATH . '/pkgconfig/re2.pc'); + $this->patchPkgconfPrefix(['grpc++.pc', 'grpc.pc', 'grpc++_unsecure.pc', 'grpc_unsecure.pc', 're2.pc']); // shell()->cd($this->source_dir) // ->exec('EXTRA_DEFINES=GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK EMBED_OPENSSL=false CXXFLAGS="-L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '" make static -j' . $this->builder->concurrency); From fa38fa1410fa59c22fe0f9d09cba84b6d8ae68a9 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 23 Jul 2025 14:13:22 +0700 Subject: [PATCH 53/58] easier debugging for breakpoints --- src/SPC/util/SPCConfigUtil.php | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/SPC/util/SPCConfigUtil.php b/src/SPC/util/SPCConfigUtil.php index 7a21a311..45bbc1d5 100644 --- a/src/SPC/util/SPCConfigUtil.php +++ b/src/SPC/util/SPCConfigUtil.php @@ -161,19 +161,6 @@ class SPCConfigUtil $frameworks = []; foreach ($libraries as $library) { - // convert all static-libs to short names - $libs = Config::getLib($library, 'static-libs', []); - foreach ($libs as $lib) { - // check file existence - if (!file_exists(BUILD_LIB_PATH . "/{$lib}")) { - throw new WrongUsageException("Library file '{$lib}' for lib [{$library}] does not exist in '" . BUILD_LIB_PATH . "'. Please build it first."); - } - $lib_names[] = $this->getShortLibName($lib); - } - // add frameworks for macOS - if (SPCTarget::getTargetOS() === 'Darwin') { - $frameworks = array_merge($frameworks, Config::getLib($library, 'frameworks', [])); - } // add pkg-configs libs $pkg_configs = Config::getLib($library, 'pkg-configs', []); foreach ($pkg_configs as $pkg_config) { @@ -187,10 +174,24 @@ class SPCConfigUtil $pc_libs = array_reverse(PkgConfigUtil::getLibsArray($pkg_configs)); $lib_names = [...$lib_names, ...$pc_libs]; } + // convert all static-libs to short names + $libs = Config::getLib($library, 'static-libs', []); + foreach ($libs as $lib) { + // check file existence + if (!file_exists(BUILD_LIB_PATH . "/{$lib}")) { + throw new WrongUsageException("Library file '{$lib}' for lib [{$library}] does not exist in '" . BUILD_LIB_PATH . "'. Please build it first."); + } + $lib_names[] = $this->getShortLibName($lib); + } + // add frameworks for macOS + if (SPCTarget::getTargetOS() === 'Darwin') { + $frameworks = array_merge($frameworks, Config::getLib($library, 'frameworks', [])); + } } // post-process - $lib_names = array_reverse(array_unique(array_filter($lib_names, fn ($x) => $x !== ''))); + $lib_names = array_filter($lib_names, fn ($x) => $x !== ''); + $lib_names = array_reverse(array_unique($lib_names)); $frameworks = array_unique($frameworks); // process frameworks to short_name From cc1f8999484d4a9933a0821bca14a593ca8f653c Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 23 Jul 2025 16:50:26 +0700 Subject: [PATCH 54/58] re2.pc didn't have prefix listed --- src/SPC/builder/unix/library/grpc.php | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index 6e40c7f6..af83d061 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -49,18 +49,10 @@ trait grpc } $cmake->build(); - copy($this->source_dir . '/third_party/re2/re2.pc', BUILD_LIB_PATH . '/pkgconfig/re2.pc'); - $this->patchPkgconfPrefix(['grpc++.pc', 'grpc.pc', 'grpc++_unsecure.pc', 'grpc_unsecure.pc', 're2.pc']); - // shell()->cd($this->source_dir) - // ->exec('EXTRA_DEFINES=GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK EMBED_OPENSSL=false CXXFLAGS="-L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '" make static -j' . $this->builder->concurrency); - // copy($this->source_dir . '/libs/opt/libgrpc.a', BUILD_LIB_PATH . '/libgrpc.a'); - // copy($this->source_dir . '/libs/opt/libboringssl.a', BUILD_LIB_PATH . '/libboringssl.a'); - // if (!file_exists(BUILD_LIB_PATH . '/libcares.a')) { - // copy($this->source_dir . '/libs/opt/libcares.a', BUILD_LIB_PATH . '/libcares.a'); - // } - // FileSystem::copyDir($this->source_dir . '/include/grpc', BUILD_INCLUDE_PATH . '/grpc'); - // FileSystem::copyDir($this->source_dir . '/include/grpc++', BUILD_INCLUDE_PATH . '/grpc++'); - // FileSystem::copyDir($this->source_dir . '/include/grpcpp', BUILD_INCLUDE_PATH . '/grpcpp'); + $re2Content = file_get_contents($this->source_dir . '/third_party/re2/re2.pc'); + $re2Content = 'prefix=' . BUILD_ROOT_PATH . "\nexec_prefix=\${prefix}\n" . $re2Content; + file_put_contents(BUILD_LIB_PATH. '/pkgconfig/re2.pc', $re2Content); + $this->patchPkgconfPrefix(['grpc++.pc', 'grpc.pc', 'grpc++_unsecure.pc', 'grpc_unsecure.pc', 're2.pc']); } } From aa337c0c848ed7cb4d1faed1f56c3e113f10c48e Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 23 Jul 2025 16:51:35 +0700 Subject: [PATCH 55/58] space ._. --- src/SPC/builder/unix/library/grpc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/grpc.php b/src/SPC/builder/unix/library/grpc.php index af83d061..f8fed3d9 100644 --- a/src/SPC/builder/unix/library/grpc.php +++ b/src/SPC/builder/unix/library/grpc.php @@ -52,7 +52,7 @@ trait grpc $re2Content = file_get_contents($this->source_dir . '/third_party/re2/re2.pc'); $re2Content = 'prefix=' . BUILD_ROOT_PATH . "\nexec_prefix=\${prefix}\n" . $re2Content; - file_put_contents(BUILD_LIB_PATH. '/pkgconfig/re2.pc', $re2Content); + file_put_contents(BUILD_LIB_PATH . '/pkgconfig/re2.pc', $re2Content); $this->patchPkgconfPrefix(['grpc++.pc', 'grpc.pc', 'grpc++_unsecure.pc', 'grpc_unsecure.pc', 're2.pc']); } } From d532b57810a73391d29a5390f56856e4151767ef Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 23 Jul 2025 17:21:32 +0700 Subject: [PATCH 56/58] use mbstring extension everywhere --- .github/workflows/release-build.yml | 3 ++- .github/workflows/tests.yml | 1 + .github/workflows/vitepress-deploy.yml | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 5c0c4f0d..3c9852e1 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -42,12 +42,13 @@ jobs: run: echo "SPC_BUILD_DEBUG=--debug" >> $GITHUB_ENV - name: "Install PHP for official runners" - uses: "shivammathur/setup-php@v2" + uses: shivammathur/setup-php@v2 with: coverage: none tools: composer:v2 php-version: "${{ env.PHP_VERSION }}" ini-values: memory_limit=-1 + extensions: curl, openssl, mbstring - name: "Get Composer Cache Directory" id: composer-cache diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 17355887..d02be5ef 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -121,6 +121,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: 8.4 + extensions: curl, openssl, mbstring - name: Define id: gendef diff --git a/.github/workflows/vitepress-deploy.yml b/.github/workflows/vitepress-deploy.yml index b44bef84..52aa8e25 100644 --- a/.github/workflows/vitepress-deploy.yml +++ b/.github/workflows/vitepress-deploy.yml @@ -32,12 +32,13 @@ jobs: cp -r config/* docs/.vitepress/config/ - name: "Install PHP for official runners" - uses: "shivammathur/setup-php@v2" + uses: shivammathur/setup-php@v2 with: coverage: none tools: composer:v2 php-version: 8.4 ini-values: memory_limit=-1 + extensions: curl, openssl, mbstring - name: "Get Composer Cache Directory" id: composer-cache From 4e4cf4bbc70a87a43ee6a698659a253d93445ef0 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 23 Jul 2025 17:33:49 +0700 Subject: [PATCH 57/58] fix weird macos thing?! --- src/SPC/util/SPCConfigUtil.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/SPC/util/SPCConfigUtil.php b/src/SPC/util/SPCConfigUtil.php index 45bbc1d5..941cec2c 100644 --- a/src/SPC/util/SPCConfigUtil.php +++ b/src/SPC/util/SPCConfigUtil.php @@ -143,6 +143,10 @@ class SPCConfigUtil } $pc_cflags = implode(' ', $pc); if ($pc_cflags !== '' && ($pc_cflags = PkgConfigUtil::getCflags($pc_cflags)) !== '') { + $arr = explode(' ', $pc_cflags); + $arr = array_unique($arr); + $arr = array_filter($arr, fn ($x) => !str_starts_with($x, 'SHELL:-Xarch_')); + $pc_cflags = implode(' ', $arr); $includes[] = $pc_cflags; } } From f2a3ae409fe70e6f0e533e64b0f278fd0e525f62 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 23 Jul 2025 21:37:38 +0800 Subject: [PATCH 58/58] Use latest minimal micro.sfx for self-packing --- .github/workflows/release-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 3c9852e1..bee83560 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -10,7 +10,7 @@ on: env: PHP_VERSION: 8.4 - MICRO_VERSION: 8.4.4 + MICRO_VERSION: 8.4.10 jobs: build-release-artifacts: