Add DirDiff utility and enhance package build process

- Introduced DirDiff class for tracking directory file changes.
- Updated ConsoleApplication to use addCommand for build targets.
- Enhanced PackageBuilder with methods for deploying binaries and extracting debug info.
- Improved package installation logic to support shared extensions.
- Added readline extension with patching for static builds.
This commit is contained in:
crazywhalecc
2025-12-04 10:53:49 +08:00
parent c38f174a6b
commit daa87e1350
12 changed files with 544 additions and 11 deletions

View File

@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace Package\Extension;
use StaticPHP\Attribute\Package\AfterStage;
use StaticPHP\Attribute\Package\BeforeStage;
use StaticPHP\Attribute\Package\Extension;
use StaticPHP\Package\PackageInstaller;
use StaticPHP\Toolchain\Interface\ToolchainInterface;
use StaticPHP\Util\SourcePatcher;
#[Extension('readline')]
class readline
{
#[BeforeStage('php', 'unix-make-cli')]
public function beforeMakeLinuxCli(PackageInstaller $installer, ToolchainInterface $toolchain): void
{
if ($toolchain->isStatic()) {
$php_src = $installer->getBuildPackage('php')->getSourceDir();
SourcePatcher::patchFile('musl_static_readline.patch', $php_src);
}
}
#[AfterStage('php', 'unix-make-cli')]
public function afterMakeLinuxCli(PackageInstaller $installer, ToolchainInterface $toolchain): void
{
if ($toolchain->isStatic()) {
$php_src = $installer->getBuildPackage('php')->getSourceDir();
SourcePatcher::patchFile('musl_static_readline.patch', $php_src, true);
}
}
}