feat: declare tool dependencies in package configs via tools field

- Add 'tools' field to ConfigValidator for build-time tool declarations
- Move jom and strawberry-perl from depends@windows to tools@windows in openssl.yml
- Move go-xcaddy/go-win from depends to tools in frankenphp.yml
- Register config/pkg/tool/ path in spc.registry.yml
- Use addInstallPackage for upx tool in php.php (ToolPackage instead of library dep)
- Include 'tool' type in DumpCapabilitiesCommand and InstallPackageCommand package lists
This commit is contained in:
crazywhalecc
2026-07-06 15:10:22 +08:00
parent 1bdbdfc08c
commit dd1e70a394
7 changed files with 22 additions and 8 deletions

View File

@@ -17,7 +17,6 @@ openssl:
- zlib - zlib
depends@windows: depends@windows:
- zlib - zlib
- jom
headers: headers:
- openssl - openssl
static-libs@unix: static-libs@unix:
@@ -26,3 +25,6 @@ openssl:
static-libs@windows: static-libs@windows:
- libssl.lib - libssl.lib
- libcrypto.lib - libcrypto.lib
tools@windows:
- jom
- strawberry-perl

View File

@@ -10,10 +10,8 @@ frankenphp:
license: MIT license: MIT
depends: depends:
- php-embed - php-embed
- go-xcaddy
depends@windows: depends@windows:
- php-embed - php-embed
- go-win
- pthreads4w - pthreads4w
suggests@unix: suggests@unix:
- brotli - brotli
@@ -24,3 +22,7 @@ frankenphp:
- frankenphp - frankenphp
static-bins@windows: static-bins@windows:
- frankenphp.exe - frankenphp.exe
tools:
- go-xcaddy
tools@windows:
- go-win

View File

@@ -10,6 +10,7 @@ package:
- config/pkg/lib/ - config/pkg/lib/
- config/pkg/target/ - config/pkg/target/
- config/pkg/ext/ - config/pkg/ext/
- config/pkg/tool/
artifact: artifact:
config: config:
- config/artifact/ - config/artifact/

View File

@@ -255,9 +255,11 @@ class php extends TargetPackage
$installer->addBuildPackage('php-embed'); $installer->addBuildPackage('php-embed');
} }
// UPX compression: ensure the upx binary package is installed when requested // UPX compression: ensure the upx tool package is installed when requested.
// upx is a ToolPackage now, so it's installed directly rather than added as a
// library dependency (tool packages bypass the DependencyResolver graph).
if ($package->getBuildOption('with-upx-pack')) { if ($package->getBuildOption('with-upx-pack')) {
$additional_packages[] = 'upx'; $installer->addInstallPackage('upx');
} }
return [...$extensions_pkg, ...$additional_packages]; return [...$extensions_pkg, ...$additional_packages];

View File

@@ -54,8 +54,8 @@ class DumpCapabilitiesCommand extends BaseCommand
{ {
$result = []; $result = [];
// library / target / virtual-target // library / target / virtual-target / tool
foreach (PackageLoader::getPackages(['library', 'target', 'virtual-target']) as $name => $pkg) { foreach (PackageLoader::getPackages(['library', 'target', 'virtual-target', 'tool']) as $name => $pkg) {
$installable = []; $installable = [];
$artifact = $pkg->getArtifact(); $artifact = $pkg->getArtifact();
if ($artifact !== null) { if ($artifact !== null) {

View File

@@ -23,7 +23,7 @@ class InstallPackageCommand extends BaseCommand
'The package to install (name or path)', 'The package to install (name or path)',
suggestedValues: function (CompletionInput $input) { suggestedValues: function (CompletionInput $input) {
$packages = []; $packages = [];
foreach (PackageLoader::getPackages(['target', 'virtual-target']) as $name => $_) { foreach (PackageLoader::getPackages(['target', 'virtual-target', 'tool']) as $name => $_) {
$packages[] = $name; $packages[] = $name;
} }
$val = $input->getCompletionValue(); $val = $input->getCompletionValue();

View File

@@ -24,6 +24,10 @@ class ConfigValidator
'lang' => ConfigType::STRING, 'lang' => ConfigType::STRING,
'frameworks' => ConfigType::LIST_ARRAY, // @ 'frameworks' => ConfigType::LIST_ARRAY, // @
// build-time tool dependency declaration (resolved independently of the library
// dependency graph, see PackageInstaller::collectRequiredTools())
'tools' => ConfigType::LIST_ARRAY, // @
// php-extension type fields // php-extension type fields
'php-extension' => ConfigType::ASSOC_ARRAY, 'php-extension' => ConfigType::ASSOC_ARRAY,
'zend-extension' => ConfigType::BOOL, 'zend-extension' => ConfigType::BOOL,
@@ -63,6 +67,9 @@ class ConfigValidator
'lang' => false, 'lang' => false,
'frameworks' => false, // @ 'frameworks' => false, // @
// build-time tool dependency declaration
'tools' => false, // @
// php-extension type fields // php-extension type fields
'php-extension' => false, 'php-extension' => false,