Skip to content

Commit

Permalink
Add ext yac (#407)
Browse files Browse the repository at this point in the history
* add ext yac

* enable yac for windows

* enable yac test for windows

* correct
  • Loading branch information
crazywhalecc committed Apr 11, 2024
1 parent 99aadd3 commit b4ed4ea
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 2 deletions.
8 changes: 8 additions & 0 deletions config/ext.json
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,14 @@
"dom"
]
},
"yac": {
"type": "external",
"source": "yac",
"arg-type-unix": "custom",
"ext-depends-unix": [
"igbinary"
]
},
"yaml": {
"type": "external",
"source": "yaml",
Expand Down
10 changes: 10 additions & 0 deletions config/source.json
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,16 @@
"path": "COPYING"
}
},
"yac": {
"type": "url",
"url": "https://pecl.php.net/get/yac",
"path": "php-src/ext/yac",
"filename": "yac.tgz",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"yaml": {
"type": "git",
"path": "php-src/ext/yaml",
Expand Down
26 changes: 26 additions & 0 deletions src/SPC/builder/extension/yac.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace SPC\builder\extension;

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

#[CustomExt('yac')]
class yac extends Extension
{
public function patchBeforeBuildconf(): bool
{
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/yac/storage/allocator/yac_allocator.h', 'defined(HAVE_SHM_MMAP_ANON)', 'defined(YAC_ALLOCATOR_H)');
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/yac/serializer/igbinary.c', '#ifdef YAC_ENABLE_IGBINARY', '#if 1');
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/yac/serializer/json.c', '#if YAC_ENABLE_JSON', '#if 1');
return true;
}

public function getUnixConfigureArg(): string
{
return '--enable-yac --enable-igbinary --enable-json';
}
}
4 changes: 2 additions & 2 deletions src/globals/test-extensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
$extensions = match (PHP_OS_FAMILY) {
'Linux', 'Darwin' => 'pgsql,intl,xml,openssl',
'Windows' => 'mbstring,pdo_sqlite,mbregex,ffi,ds,simdjson',
'Linux', 'Darwin' => 'yac',
'Windows' => 'mbstring,pdo_sqlite,mbregex,yac',
};

// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).
Expand Down

0 comments on commit b4ed4ea

Please sign in to comment.