Add ext-yac

This commit is contained in:
crazywhalecc 2026-03-17 15:41:00 +08:00
parent 0a60ebad17
commit 83c266a713
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,14 @@
ext-yac:
type: php-extension
artifact:
source:
type: pecl
name: yac
metadata:
license-files: [LICENSE]
license: PHP-3.01
depends@unix:
- fastlz
- ext-igbinary
php-extension:
arg-type@unix: '--enable-yac@shared_suffix@ --enable-igbinary --enable-json --with-system-fastlz'

View File

@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
namespace Package\Extension;
use Package\Target\php;
use StaticPHP\Attribute\Package\BeforeStage;
use StaticPHP\Attribute\Package\Extension;
use StaticPHP\Package\PackageInstaller;
use StaticPHP\Package\PhpExtensionPackage;
use StaticPHP\Util\FileSystem;
#[Extension('yac')]
class yac extends PhpExtensionPackage
{
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-yac')]
public function patchBeforeBuildconf(PackageInstaller $installer): bool
{
FileSystem::replaceFileStr("{$this->getSourceDir()}/storage/allocator/yac_allocator.h", 'defined(HAVE_SHM_MMAP_ANON)', 'defined(YAC_ALLOCATOR_H)');
FileSystem::replaceFileStr("{$this->getSourceDir()}/serializer/igbinary.c", '#ifdef YAC_ENABLE_IGBINARY', '#if 1');
FileSystem::replaceFileStr("{$this->getSourceDir()}/serializer/json.c", '#if YAC_ENABLE_JSON', '#if 1');
return true;
}
}