Skip to content

Commit 808aed2

Browse files
committed
Refactor package stage handling and update class structures for improved flexibility
1 parent e004d10 commit 808aed2

29 files changed

+416
-115
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"ext-mbstring": "*",
1414
"ext-zlib": "*",
1515
"laravel/prompts": "~0.1",
16+
"nette/php-generator": "^4.2",
1617
"php-di/php-di": "^7.1",
1718
"symfony/console": "^5.4 || ^6 || ^7",
1819
"symfony/process": "^7.2",

composer.lock

Lines changed: 162 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Package/Command/SwitchPhpVersionCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use StaticPHP\Artifact\DownloaderOptions;
1010
use StaticPHP\Command\BaseCommand;
1111
use StaticPHP\DI\ApplicationContext;
12-
use StaticPHP\Package\PackageLoader;
12+
use StaticPHP\Registry\PackageLoader;
1313
use StaticPHP\Util\FileSystem;
1414
use StaticPHP\Util\InteractiveTerm;
1515
use Symfony\Component\Console\Attribute\AsCommand;

src/Package/Extension/readline.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Package\Extension;
66

7+
use Package\Target\php;
78
use StaticPHP\Attribute\Package\AfterStage;
89
use StaticPHP\Attribute\Package\BeforeStage;
910
use StaticPHP\Attribute\Package\Extension;
@@ -15,7 +16,7 @@
1516
#[Extension('readline')]
1617
class readline
1718
{
18-
#[BeforeStage('php', 'unix-make-cli', 'ext-readline')]
19+
#[BeforeStage('php', [php::class, 'makeCliForUnix'], 'ext-readline')]
1920
#[PatchDescription('Fix readline static build with musl')]
2021
public function beforeMakeLinuxCli(PackageInstaller $installer, ToolchainInterface $toolchain): void
2122
{
@@ -25,7 +26,7 @@ public function beforeMakeLinuxCli(PackageInstaller $installer, ToolchainInterfa
2526
}
2627
}
2728

28-
#[AfterStage('php', 'unix-make-cli', 'ext-readline')]
29+
#[AfterStage('php', [php::class, 'makeCliForUnix'], 'ext-readline')]
2930
public function afterMakeLinuxCli(PackageInstaller $installer, ToolchainInterface $toolchain): void
3031
{
3132
if ($toolchain->isStatic()) {

src/Package/Library/imap.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Package\Library;
66

7+
use Package\Target\php;
78
use StaticPHP\Attribute\Package\AfterStage;
89
use StaticPHP\Attribute\Package\Library;
910
use StaticPHP\Attribute\PatchDescription;
@@ -13,7 +14,7 @@
1314
#[Library('imap')]
1415
class imap
1516
{
16-
#[AfterStage('php', 'patch-embed-scripts', 'imap')]
17+
#[AfterStage('php', [php::class, 'patchEmbedScripts'], 'imap')]
1718
#[PatchDescription('Fix missing -lcrypt in php-config libs on glibc systems')]
1819
public function afterPatchScripts(): void
1920
{

src/Package/Library/libedit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#[Library('libedit')]
1515
class libedit extends LibraryPackage
1616
{
17-
#[BeforeStage('libedit', 'build')]
17+
#[BeforeStage(stage: 'build')]
1818
public function patchBeforeBuild(): void
1919
{
2020
FileSystem::replaceFileRegex(

src/Package/Library/postgresql.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Package\Library;
66

7+
use Package\Target\php;
78
use StaticPHP\Attribute\Package\BeforeStage;
89
use StaticPHP\Attribute\Package\Library;
910
use StaticPHP\Attribute\PatchDescription;
@@ -12,7 +13,7 @@
1213
#[Library('postgresql')]
1314
class postgresql
1415
{
15-
#[BeforeStage('php', 'unix-configure', 'postgresql')]
16+
#[BeforeStage('php', [php::class, 'configureForUnix'], 'postgresql')]
1617
#[PatchDescription('Patch to avoid explicit_bzero detection issues on some systems')]
1718
public function patchBeforePHPConfigure(TargetPackage $package): void
1819
{

src/Package/Target/micro.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#[Target('php-micro')]
1414
class micro
1515
{
16-
#[BeforeStage('php', 'unix-make-embed', 'php-micro')]
16+
#[BeforeStage('php', [php::class, 'makeEmbedForUnix'], 'php-micro')]
1717
#[PatchDescription('Patch Makefile to build only libphp.la for embedding')]
1818
public function patchBeforeEmbed(TargetPackage $package): void
1919
{

0 commit comments

Comments
 (0)