add extension xhprof

This commit is contained in:
crazywhalecc 2023-12-24 15:27:17 +08:00 committed by Jerry Ma
parent db7532cad3
commit cbfbec41b4
3 changed files with 50 additions and 0 deletions

View File

@ -479,6 +479,13 @@
"libuv" "libuv"
] ]
}, },
"xhprof": {
"type": "external",
"source": "xhprof",
"ext-depends": [
"ctype"
]
},
"xlswriter": { "xlswriter": {
"type": "external", "type": "external",
"source": "xlswriter", "source": "xlswriter",

View File

@ -532,6 +532,16 @@
"path": "COPYING" "path": "COPYING"
} }
}, },
"xhprof": {
"type": "url",
"url": "https://pecl.php.net/get/xhprof",
"path": "php-src/ext/xhprof-src",
"filename": "xhprof.tgz",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"xlswriter": { "xlswriter": {
"type": "url", "type": "url",
"url": "https://pecl.php.net/get/xlswriter", "url": "https://pecl.php.net/get/xlswriter",

View File

@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('xhprof')]
class xhprof extends Extension
{
public function patchBeforeBuildconf(): bool
{
if (!is_link(SOURCE_PATH . '/php-src/ext/xhprof')) {
if (PHP_OS_FAMILY === 'Windows') {
f_passthru('cd ' . SOURCE_PATH . '/php-src/ext && mklink /D xhprof xhprof-src\extension');
} else {
f_passthru('cd ' . SOURCE_PATH . '/php-src/ext && ln -s xhprof-src/extension xhprof');
}
// patch config.m4
FileSystem::replaceFileStr(
SOURCE_PATH . '/php-src/ext/xhprof/config.m4',
'if test -f $phpincludedir/ext/pcre/php_pcre.h; then',
'if test -f $abs_srcdir/ext/pcre/php_pcre.h; then'
);
return true;
}
return false;
}
}