Add php-micro patch for embed mode

This commit is contained in:
crazywhalecc 2025-12-08 17:00:18 +08:00
parent f4bb0263f6
commit b384345723
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680

View File

@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace Package\Target;
use StaticPHP\Attribute\Package\BeforeStage;
use StaticPHP\Attribute\Package\Target;
use StaticPHP\Attribute\PatchDescription;
use StaticPHP\Package\TargetPackage;
use StaticPHP\Util\FileSystem;
#[Target('php-micro')]
class micro
{
#[BeforeStage('php', 'unix-make-embed', 'php-micro')]
#[PatchDescription('Patch Makefile to build only libphp.la for embedding')]
public function patchBeforeEmbed(TargetPackage $package): void
{
FileSystem::replaceFileStr("{$package->getSourceDir()}/Makefile", 'OVERALL_TARGET =', 'OVERALL_TARGET = libphp.la');
}
}