mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
Add before and after build hooks for phar extension to replace file strings
This commit is contained in:
parent
0c86d82b98
commit
8f10e0d070
@ -9,6 +9,8 @@ use StaticPHP\Attribute\Package\AfterStage;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
use StaticPHP\Util\SourcePatcher;
|
||||
|
||||
#[Extension('phar')]
|
||||
@ -26,4 +28,24 @@ class phar
|
||||
{
|
||||
SourcePatcher::unpatchMicroPhar();
|
||||
}
|
||||
|
||||
#[BeforeStage('ext-phar', 'build')]
|
||||
public function beforeBuildShared(PhpExtensionPackage $pkg): void
|
||||
{
|
||||
FileSystem::replaceFileStr(
|
||||
"{$pkg->getSourceDir()}/config.m4",
|
||||
['$ext_dir/phar.1', '$ext_dir/phar.phar.1'],
|
||||
['${ext_dir}phar.1', '${ext_dir}phar.phar.1']
|
||||
);
|
||||
}
|
||||
|
||||
#[AfterStage('ext-phar', 'build')]
|
||||
public function afterBuildShared(PhpExtensionPackage $pkg): void
|
||||
{
|
||||
FileSystem::replaceFileStr(
|
||||
"{$pkg->getSourceDir()}/config.m4",
|
||||
['${ext_dir}phar.1', '${ext_dir}phar.phar.1'],
|
||||
['$ext_dir/phar.1', '$ext_dir/phar.phar.1']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user