mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
Add ext-uv
This commit is contained in:
parent
22c5403e98
commit
2327f32e41
18
config/pkg/ext/ext-uv.yml
Normal file
18
config/pkg/ext/ext-uv.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
ext-uv:
|
||||||
|
type: php-extension
|
||||||
|
artifact:
|
||||||
|
source:
|
||||||
|
type: pecl
|
||||||
|
name: uv
|
||||||
|
prefer-stable: false
|
||||||
|
metadata:
|
||||||
|
license-files: [LICENSE]
|
||||||
|
license: PHP-3.01
|
||||||
|
depends:
|
||||||
|
- libuv
|
||||||
|
- ext-sockets
|
||||||
|
php-extension:
|
||||||
|
support:
|
||||||
|
Windows: wip
|
||||||
|
BSD: wip
|
||||||
|
arg-type: with-path
|
||||||
36
src/Package/Extension/uv.php
Normal file
36
src/Package/Extension/uv.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?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\Exception\ValidationException;
|
||||||
|
use StaticPHP\Package\PhpExtensionPackage;
|
||||||
|
use StaticPHP\Runtime\SystemTarget;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
|
#[Extension('uv')]
|
||||||
|
class uv extends PhpExtensionPackage
|
||||||
|
{
|
||||||
|
#[Validate]
|
||||||
|
public function validate(): void
|
||||||
|
{
|
||||||
|
if (php::getPHPVersionID() < 80000 && getenv('SPC_SKIP_PHP_VERSION_CHECK') !== 'yes') {
|
||||||
|
throw new ValidationException('The latest uv extension requires PHP 8.0 or later');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[BeforeStage('ext-uv', [PhpExtensionPackage::class, 'makeForUnix'])]
|
||||||
|
public function patchBeforeSharedMake(PhpExtensionPackage $pkg): bool
|
||||||
|
{
|
||||||
|
if (SystemTarget::getTargetOS() !== 'Linux' || SystemTarget::getTargetArch() !== 'aarch64') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
FileSystem::replaceFileRegex("{$pkg->getSourceDir()}/Makefile", '/^(LDFLAGS =.*)$/m', '$1 -luv -ldl -lrt -pthread');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user