From 99e05aa22b1fb067f79e6d070a7d773615ef245f Mon Sep 17 00:00:00 2001 From: henderkes Date: Sun, 24 May 2026 20:55:11 +0700 Subject: [PATCH 1/7] ext: add ext-fastchart and ext-fastjson registry entries Register two iliaal/fastchart and iliaal/fastjson PHP extensions sourced from ghtar, extracted into php-src/ext/{fastchart,fastjson}. Both target Linux and Darwin. fastchart depends on freetype and suggests libpng, libjpeg, libwebp. --- config/pkg/ext/ext-fastchart.yml | 20 ++++++++++++++++++++ config/pkg/ext/ext-fastjson.yml | 14 ++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 config/pkg/ext/ext-fastchart.yml create mode 100644 config/pkg/ext/ext-fastjson.yml diff --git a/config/pkg/ext/ext-fastchart.yml b/config/pkg/ext/ext-fastchart.yml new file mode 100644 index 00000000..0abbc892 --- /dev/null +++ b/config/pkg/ext/ext-fastchart.yml @@ -0,0 +1,20 @@ +ext-fastchart: + type: php-extension + artifact: + source: + type: ghtar + repo: iliaal/fastchart + extract: php-src/ext/fastchart + prefer-stable: true + metadata: + license-files: [LICENSE] + depends: + - freetype + suggests: + - libpng + - libjpeg + - libwebp + php-extension: + os: + - Linux + - Darwin diff --git a/config/pkg/ext/ext-fastjson.yml b/config/pkg/ext/ext-fastjson.yml new file mode 100644 index 00000000..4644e820 --- /dev/null +++ b/config/pkg/ext/ext-fastjson.yml @@ -0,0 +1,14 @@ +ext-fastjson: + type: php-extension + artifact: + source: + type: ghtar + repo: iliaal/fastjson + extract: php-src/ext/fastjson + prefer-stable: true + metadata: + license-files: [LICENSE] + php-extension: + os: + - Linux + - Darwin From c641c3b8db74d85b08cf9aa7a248b384827cf356 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 25 May 2026 10:25:47 +0800 Subject: [PATCH 2/7] Make mongodb standalone --- src/StaticPHP/Command/Dev/GenExtTestMatrixCommand.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/StaticPHP/Command/Dev/GenExtTestMatrixCommand.php b/src/StaticPHP/Command/Dev/GenExtTestMatrixCommand.php index ecae1705..8668ef76 100644 --- a/src/StaticPHP/Command/Dev/GenExtTestMatrixCommand.php +++ b/src/StaticPHP/Command/Dev/GenExtTestMatrixCommand.php @@ -60,6 +60,7 @@ class GenExtTestMatrixCommand extends BaseCommand 'glfw', 'imagick', 'intl', + 'mongodb', ]; /** From 96ab2de4b1dd53395867bf2c339e26f6acd87378 Mon Sep 17 00:00:00 2001 From: Kevin Boyd Date: Thu, 28 May 2026 22:38:56 -0700 Subject: [PATCH 3/7] Add preliminary MacPorts support --- src/Package/Library/unixodbc.php | 4 +- src/StaticPHP/Doctor/Item/MacOSToolCheck.php | 44 ++++++++++++++++++- .../Toolchain/ClangPortsToolchain.php | 20 +++++++++ src/StaticPHP/Util/GlobalEnvManager.php | 4 +- 4 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 src/StaticPHP/Toolchain/ClangPortsToolchain.php diff --git a/src/Package/Library/unixodbc.php b/src/Package/Library/unixodbc.php index e482e68b..78debadf 100644 --- a/src/Package/Library/unixodbc.php +++ b/src/Package/Library/unixodbc.php @@ -20,8 +20,8 @@ class unixodbc extends LibraryPackage { $sysconf_selector = match ($os = SystemTarget::getTargetOS()) { 'Darwin' => match (SystemTarget::getTargetArch()) { - 'x86_64' => '/usr/local/etc', - 'aarch64' => '/opt/homebrew/etc', + 'x86_64' => is_dir('/usr/local/etc') ? '/usr/local/etc' : '/opt/local/etc', + 'aarch64' => is_dir('/opt/homebrew/etc') ? '/opt/homebrew/etc' : '/opt/local/etc', default => throw new WrongUsageException('Unsupported architecture: ' . GNU_ARCH), }, 'Linux' => '/etc', diff --git a/src/StaticPHP/Doctor/Item/MacOSToolCheck.php b/src/StaticPHP/Doctor/Item/MacOSToolCheck.php index 9a256c08..d1e81a01 100644 --- a/src/StaticPHP/Doctor/Item/MacOSToolCheck.php +++ b/src/StaticPHP/Doctor/Item/MacOSToolCheck.php @@ -45,6 +45,18 @@ class MacOSToolCheck return CheckResult::ok(); } + #[CheckItem('if macports has installed', limit_os: 'Darwin', level: 998)] + public function checkPorts(): ?CheckResult + { + if (($path = MacOSUtil::findCommand('port')) === null) { + return CheckResult::fail('MacPorts is not installed', 'port'); + } + if ($path !== '/opt/local/bin/port' && getenv('GNU_ARCH') === 'aarch64') { + return CheckResult::fail('Current macports (/opt/local/bin/port) is not installed for M1 Mac, please re-install macports!'); + } + return CheckResult::ok(); + } + #[CheckItem('if necessary tools are installed', limit_os: 'Darwin')] public function checkCliTools(): ?CheckResult { @@ -74,6 +86,20 @@ class MacOSToolCheck return null; } + #[CheckItem('if macports llvm are installed', limit_os: 'Darwin')] + public function checkPortsLLVM(): ?CheckResult + { + if (getenv('SPC_USE_LLVM') === 'port') { + $macports_prefix = getenv('MACPORTS_PREFIX') ?: '/opt/local'; + + if (($path = MacOSUtil::findCommand('clang', ["{$macports_prefix}/bin"])) === null) { + return CheckResult::fail('MacPorts llvm is not installed', 'build-tools', ['missing' => ['llvm']]); + } + return CheckResult::ok($path); + } + return null; + } + #[CheckItem('if bison version is 3.0 or later', limit_os: 'Darwin')] public function checkBisonVersion(array $command_path = []): ?CheckResult { @@ -91,7 +117,7 @@ class MacOSToolCheck if ($command_path !== []) { return CheckResult::fail("Current {$bison} version is too old: " . $matches[0]); } - return $this->checkBisonVersion(['/opt/homebrew/opt/bison/bin', '/usr/local/opt/bison/bin']); + return $this->checkBisonVersion(['/opt/homebrew/opt/bison/bin', '/usr/local/opt/bison/bin', '/opt/local/bin']); } return CheckResult::ok($matches[0]); } @@ -108,6 +134,9 @@ class MacOSToolCheck #[FixItem('build-tools')] public function fixBuildTools(array $missing): bool { + $hasBrew = $this->checkBrew()?->isOK(); + $hasMacports = $this->checkPorts()?->isOK(); + $replacement = [ 'glibtoolize' => 'libtool', ]; @@ -115,7 +144,18 @@ class MacOSToolCheck if (isset($replacement[$cmd])) { $cmd = $replacement[$cmd]; } - shell()->exec('brew install --formula ' . escapeshellarg($cmd)); + + if ($hasBrew) { + shell()->exec('brew install --formula ' . escapeshellarg($cmd)); + continue; + } + + if ($hasMacports) { + shell()->exec('port install ' . escapeshellarg($cmd)); + continue; + } + + return false; } return true; } diff --git a/src/StaticPHP/Toolchain/ClangPortsToolchain.php b/src/StaticPHP/Toolchain/ClangPortsToolchain.php new file mode 100644 index 00000000..088a538a --- /dev/null +++ b/src/StaticPHP/Toolchain/ClangPortsToolchain.php @@ -0,0 +1,20 @@ + Date: Thu, 28 May 2026 22:40:33 -0700 Subject: [PATCH 4/7] Add a check for macports alongside Brew in toolchainmanager --- src/StaticPHP/Toolchain/ToolchainManager.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/StaticPHP/Toolchain/ToolchainManager.php b/src/StaticPHP/Toolchain/ToolchainManager.php index 478b08a6..f5f64a79 100644 --- a/src/StaticPHP/Toolchain/ToolchainManager.php +++ b/src/StaticPHP/Toolchain/ToolchainManager.php @@ -41,6 +41,7 @@ class ToolchainManager 'Windows' => MSVCToolchain::class, 'Darwin' => match (getenv('SPC_USE_LLVM') ?: 'system') { 'brew' => ClangBrewToolchain::class, + 'port' => ClangPortsToolchain::class, default => ClangNativeToolchain::class, }, default => throw new WrongUsageException('Unsupported OS family: ' . PHP_OS_FAMILY), From 605739464108b265be7958d1ba8451b1a6dbc997 Mon Sep 17 00:00:00 2001 From: Kevin Boyd Date: Sun, 31 May 2026 22:04:44 -0700 Subject: [PATCH 5/7] Simplify macports checks --- src/StaticPHP/Doctor/Item/MacOSToolCheck.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/StaticPHP/Doctor/Item/MacOSToolCheck.php b/src/StaticPHP/Doctor/Item/MacOSToolCheck.php index d1e81a01..95b0715f 100644 --- a/src/StaticPHP/Doctor/Item/MacOSToolCheck.php +++ b/src/StaticPHP/Doctor/Item/MacOSToolCheck.php @@ -48,12 +48,9 @@ class MacOSToolCheck #[CheckItem('if macports has installed', limit_os: 'Darwin', level: 998)] public function checkPorts(): ?CheckResult { - if (($path = MacOSUtil::findCommand('port')) === null) { + if (MacOSUtil::findCommand('port') === null) { return CheckResult::fail('MacPorts is not installed', 'port'); } - if ($path !== '/opt/local/bin/port' && getenv('GNU_ARCH') === 'aarch64') { - return CheckResult::fail('Current macports (/opt/local/bin/port) is not installed for M1 Mac, please re-install macports!'); - } return CheckResult::ok(); } @@ -127,6 +124,11 @@ class MacOSToolCheck #[FixItem('brew')] public function fixBrew(): bool { + $hasMacports = $this->checkPorts(); + if ($hasMacports->isOK()) { + return true; // Nothing to fix - will use macports instead + } + shell(true)->exec('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'); return true; } From 0761267eb3b5598d424514323fa69c16b6c41664 Mon Sep 17 00:00:00 2001 From: Kevin Boyd Date: Thu, 4 Jun 2026 21:40:01 -0700 Subject: [PATCH 6/7] Combine the macos tool checks into a single checkBrewOrPorts method --- src/StaticPHP/Doctor/Item/MacOSToolCheck.php | 49 +++++++------------- 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/src/StaticPHP/Doctor/Item/MacOSToolCheck.php b/src/StaticPHP/Doctor/Item/MacOSToolCheck.php index 95b0715f..2d011703 100644 --- a/src/StaticPHP/Doctor/Item/MacOSToolCheck.php +++ b/src/StaticPHP/Doctor/Item/MacOSToolCheck.php @@ -33,24 +33,20 @@ class MacOSToolCheck 'glibtoolize', ]; - #[CheckItem('if homebrew has installed', limit_os: 'Darwin', level: 998)] - public function checkBrew(): ?CheckResult + #[CheckItem('if homebrew or macports has installed', limit_os: 'Darwin', level: 998)] + public function checkBrewOrPorts(): ?CheckResult { - if (($path = MacOSUtil::findCommand('brew')) === null) { - return CheckResult::fail('Homebrew is not installed', 'brew'); - } - if ($path !== '/opt/homebrew/bin/brew' && getenv('GNU_ARCH') === 'aarch64') { + $brewPath = MacOSUtil::findCommand('brew'); + $portPath = MacOSUtil::findCommand('port'); + + if ($brewPath && $brewPath !== '/opt/homebrew/bin/brew' && getenv('GNU_ARCH') === 'aarch64') { return CheckResult::fail('Current homebrew (/usr/local/bin/homebrew) is not installed for M1 Mac, please re-install homebrew in /opt/homebrew/ !'); } - return CheckResult::ok(); - } - #[CheckItem('if macports has installed', limit_os: 'Darwin', level: 998)] - public function checkPorts(): ?CheckResult - { - if (MacOSUtil::findCommand('port') === null) { - return CheckResult::fail('MacPorts is not installed', 'port'); + if ($brewPath === null && $portPath === null) { + return CheckResult::fail('Homebrew is not installed', 'brew'); } + return CheckResult::ok(); } @@ -69,8 +65,8 @@ class MacOSToolCheck return CheckResult::ok(); } - #[CheckItem('if homebrew llvm are installed', limit_os: 'Darwin')] - public function checkBrewLLVM(): ?CheckResult + #[CheckItem('if homebrew or macports llvm are installed', limit_os: 'Darwin')] + public function checkBrewOrPortsLLVM(): ?CheckResult { if (getenv('SPC_USE_LLVM') === 'brew') { $homebrew_prefix = getenv('HOMEBREW_PREFIX') ?: (SystemTarget::getTargetArch() === 'aarch64' ? '/opt/homebrew' : '/usr/local/homebrew'); @@ -80,20 +76,16 @@ class MacOSToolCheck } return CheckResult::ok($path); } - return null; - } - #[CheckItem('if macports llvm are installed', limit_os: 'Darwin')] - public function checkPortsLLVM(): ?CheckResult - { if (getenv('SPC_USE_LLVM') === 'port') { - $macports_prefix = getenv('MACPORTS_PREFIX') ?: '/opt/local'; + $macportsPrefix = '/opt/local'; - if (($path = MacOSUtil::findCommand('clang', ["{$macports_prefix}/bin"])) === null) { + if (($path = MacOSUtil::findCommand('clang', ["{$macportsPrefix}/bin"])) === null) { return CheckResult::fail('MacPorts llvm is not installed', 'build-tools', ['missing' => ['llvm']]); } return CheckResult::ok($path); } + return null; } @@ -124,11 +116,6 @@ class MacOSToolCheck #[FixItem('brew')] public function fixBrew(): bool { - $hasMacports = $this->checkPorts(); - if ($hasMacports->isOK()) { - return true; // Nothing to fix - will use macports instead - } - shell(true)->exec('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'); return true; } @@ -136,8 +123,8 @@ class MacOSToolCheck #[FixItem('build-tools')] public function fixBuildTools(array $missing): bool { - $hasBrew = $this->checkBrew()?->isOK(); - $hasMacports = $this->checkPorts()?->isOK(); + $brewPath = MacOSUtil::findCommand('brew'); + $portPath = MacOSUtil::findCommand('port'); $replacement = [ 'glibtoolize' => 'libtool', @@ -147,12 +134,12 @@ class MacOSToolCheck $cmd = $replacement[$cmd]; } - if ($hasBrew) { + if ($brewPath !== null) { shell()->exec('brew install --formula ' . escapeshellarg($cmd)); continue; } - if ($hasMacports) { + if ($portPath !== null) { shell()->exec('port install ' . escapeshellarg($cmd)); continue; } From 728c8dd59839819d6fb9bf6b1f466778498ce48f Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 16 Jun 2026 13:19:03 +0800 Subject: [PATCH 7/7] Make gmssl standalone --- src/StaticPHP/Command/Dev/GenExtTestMatrixCommand.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/StaticPHP/Command/Dev/GenExtTestMatrixCommand.php b/src/StaticPHP/Command/Dev/GenExtTestMatrixCommand.php index 8668ef76..a1743200 100644 --- a/src/StaticPHP/Command/Dev/GenExtTestMatrixCommand.php +++ b/src/StaticPHP/Command/Dev/GenExtTestMatrixCommand.php @@ -61,6 +61,7 @@ class GenExtTestMatrixCommand extends BaseCommand 'imagick', 'intl', 'mongodb', + 'gmssl', ]; /**