Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extension version and env check method #458

Merged
merged 1 commit into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/SPC/ConsoleApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
use SPC\command\ExtractCommand;
use SPC\command\InstallPkgCommand;
use SPC\command\MicroCombineCommand;
use SPC\command\SwitchPhpVersionCommand;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\HelpCommand;
use Symfony\Component\Console\Command\ListCommand;

/**
* static-php-cli console app entry
Expand All @@ -43,6 +42,7 @@ public function __construct()
new DumpLicenseCommand(),
new ExtractCommand(),
new MicroCombineCommand(),
new SwitchPhpVersionCommand(),

// Dev commands
new AllExtCommand(),
Expand All @@ -51,9 +51,4 @@ public function __construct()
]
);
}

protected function getDefaultCommands(): array
{
return [new HelpCommand(), new ListCommand()];
}
}
2 changes: 1 addition & 1 deletion src/SPC/builder/extension/opcache.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class opcache extends Extension
*/
public function validate(): void
{
if ($this->builder->getPHPVersionID() < 80000) {
if ($this->builder->getPHPVersionID() < 80000 && getenv('SPC_SKIP_PHP_VERSION_CHECK') !== 'yes') {
throw new WrongUsageException('Statically compiled PHP with Zend Opcache only available for PHP >= 8.0 !');
}
}
Expand Down
19 changes: 19 additions & 0 deletions src/SPC/builder/extension/protobuf.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace SPC\builder\extension;

use SPC\builder\Extension;
use SPC\util\CustomExt;

#[CustomExt('protobuf')]
class protobuf extends Extension
{
public function validate(): void
{
if ($this->builder->getPHPVersionID() < 80000 && getenv('SPC_SKIP_PHP_VERSION_CHECK') !== 'yes') {
throw new \RuntimeException('The latest protobuf extension requires PHP 8.0 or later');
}
}
}
7 changes: 7 additions & 0 deletions src/SPC/builder/extension/swow.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
#[CustomExt('swow')]
class swow extends Extension
{
public function validate(): void
{
if ($this->builder->getPHPVersionID() < 80000 && getenv('SPC_SKIP_PHP_VERSION_CHECK') !== 'yes') {
throw new RuntimeException('The latest swow extension requires PHP 8.0 or later');
}
}

public function getUnixConfigureArg(): string
{
$arg = '--enable-swow';
Expand Down
Loading