Skip to content

Commit a7adec1

Browse files
authored
Add extension ev support (#703)
* Add extension ev support * Sort config * Correct ev build arg for windows * Use static-php mirror of nasm * Fix windows ev patch * Oops
1 parent a236ee3 commit a7adec1

File tree

5 files changed

+51
-4
lines changed

5 files changed

+51
-4
lines changed

config/ext.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@
9292
},
9393
"type": "wip"
9494
},
95+
"ev": {
96+
"type": "external",
97+
"source": "ev",
98+
"arg-type-windows": "with"
99+
},
95100
"event": {
96101
"support": {
97102
"Windows": "wip",

config/pkg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"nasm-x86_64-win": {
1111
"type": "url",
12-
"url": "https://www.nasm.us/pub/nasm/releasebuilds/2.16.01/win64/nasm-2.16.01-win64.zip",
12+
"url": "https://dl.static-php.dev/static-php-cli/deps/nasm/nasm-2.16.01-win64.zip",
1313
"extract-files": {
1414
"nasm-2.16.01/nasm.exe": "{php_sdk_path}/bin/nasm.exe",
1515
"nasm-2.16.01/ndisasm.exe": "{php_sdk_path}/bin/ndisasm.exe"

config/source.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,16 @@
9292
"path": "LICENSE"
9393
}
9494
},
95+
"ev": {
96+
"type": "url",
97+
"url": "https://pecl.php.net/get/ev",
98+
"path": "php-src/ext/ev",
99+
"filename": "ev.tgz",
100+
"license": {
101+
"type": "file",
102+
"path": "LICENSE"
103+
}
104+
},
95105
"ext-ds": {
96106
"type": "url",
97107
"url": "https://pecl.php.net/get/ds",

src/SPC/builder/extension/ev.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SPC\builder\extension;
6+
7+
use SPC\builder\Extension;
8+
use SPC\exception\FileSystemException;
9+
use SPC\store\FileSystem;
10+
use SPC\util\CustomExt;
11+
12+
#[CustomExt('ev')]
13+
class ev extends Extension
14+
{
15+
/**
16+
* @throws FileSystemException
17+
*/
18+
public function patchBeforeBuildconf(): bool
19+
{
20+
/*
21+
* replace EXTENSION('ev', php_ev_sources, true, ' /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
22+
* to EXTENSION('ev', php_ev_sources, PHP_EV_SHARED, ' /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
23+
*/
24+
FileSystem::replaceFileLineContainsString(
25+
$this->source_dir . '/config.w32',
26+
'EXTENSION(\'ev\'',
27+
" EXTENSION('ev', php_ev_sources, PHP_EV_SHARED, ' /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');"
28+
);
29+
return true;
30+
}
31+
}

src/globals/test-extensions.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
'ubuntu-24.04',
2929
'ubuntu-22.04-arm',
3030
'ubuntu-24.04-arm',
31+
'windows-latest',
3132
];
3233

3334
// whether enable thread safe
@@ -43,8 +44,8 @@
4344

4445
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
4546
$extensions = match (PHP_OS_FAMILY) {
46-
'Linux', 'Darwin' => 'phar',
47-
'Windows' => 'pgsql,pdo_pgsql',
47+
'Linux', 'Darwin' => 'ev',
48+
'Windows' => 'ev',
4849
};
4950

5051
// If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`).
@@ -63,7 +64,7 @@
6364
// You can use `common`, `bulk`, `minimal` or `none`.
6465
// note: combination is only available for *nix platform. Windows must use `none` combination
6566
$base_combination = match (PHP_OS_FAMILY) {
66-
'Linux', 'Darwin' => 'common',
67+
'Linux', 'Darwin' => 'minimal',
6768
'Windows' => 'none',
6869
};
6970

0 commit comments

Comments
 (0)