Skip to content

Commit b4ed4ea

Browse files
authored
Add ext yac (#407)
* add ext yac * enable yac for windows * enable yac test for windows * correct
1 parent 99aadd3 commit b4ed4ea

File tree

4 files changed

+46
-2
lines changed

4 files changed

+46
-2
lines changed

config/ext.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,14 @@
623623
"dom"
624624
]
625625
},
626+
"yac": {
627+
"type": "external",
628+
"source": "yac",
629+
"arg-type-unix": "custom",
630+
"ext-depends-unix": [
631+
"igbinary"
632+
]
633+
},
626634
"yaml": {
627635
"type": "external",
628636
"source": "yaml",

config/source.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,16 @@
673673
"path": "COPYING"
674674
}
675675
},
676+
"yac": {
677+
"type": "url",
678+
"url": "https://pecl.php.net/get/yac",
679+
"path": "php-src/ext/yac",
680+
"filename": "yac.tgz",
681+
"license": {
682+
"type": "file",
683+
"path": "LICENSE"
684+
}
685+
},
676686
"yaml": {
677687
"type": "git",
678688
"path": "php-src/ext/yaml",

src/SPC/builder/extension/yac.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SPC\builder\extension;
6+
7+
use SPC\builder\Extension;
8+
use SPC\store\FileSystem;
9+
use SPC\util\CustomExt;
10+
11+
#[CustomExt('yac')]
12+
class yac extends Extension
13+
{
14+
public function patchBeforeBuildconf(): bool
15+
{
16+
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/yac/storage/allocator/yac_allocator.h', 'defined(HAVE_SHM_MMAP_ANON)', 'defined(YAC_ALLOCATOR_H)');
17+
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/yac/serializer/igbinary.c', '#ifdef YAC_ENABLE_IGBINARY', '#if 1');
18+
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/yac/serializer/json.c', '#if YAC_ENABLE_JSON', '#if 1');
19+
return true;
20+
}
21+
22+
public function getUnixConfigureArg(): string
23+
{
24+
return '--enable-yac --enable-igbinary --enable-json';
25+
}
26+
}

src/globals/test-extensions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

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

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

0 commit comments

Comments
 (0)