Add ext-parallel

This commit is contained in:
crazywhalecc 2026-03-12 16:04:25 +08:00
parent 528469514b
commit 32bdacd5a5
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
2 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,9 @@
ext-parallel:
type: php-extension
artifact:
source:
type: pecl
name: parallel
metadata:
license-files: [LICENSE]
license: PHP-3.01

View File

@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace Package\Extension;
use Package\Target\php;
use StaticPHP\Attribute\Package\BeforeStage;
use StaticPHP\Attribute\Package\Extension;
use StaticPHP\Attribute\Package\Validate;
use StaticPHP\Attribute\PatchDescription;
use StaticPHP\Exception\WrongUsageException;
use StaticPHP\Package\PackageBuilder;
use StaticPHP\Package\PhpExtensionPackage;
use StaticPHP\Util\FileSystem;
#[Extension('parallel')]
class parallel extends PhpExtensionPackage
{
#[Validate]
public function validate(PackageBuilder $builder): void
{
if (!$builder->getOption('enable-zts')) {
throw new WrongUsageException('ext-parallel must be built with ZTS builds. Use "--enable-zts" option!');
}
}
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-parallel')]
#[PatchDescription('Fix parallel m4 hardcoded PHP_VERSION check')]
public function patchBeforeBuildconf(): bool
{
FileSystem::replaceFileRegex("{$this->getSourceDir()}/config.m4", '/PHP_VERSION=.*/m', '');
return true;
}
}