mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
Add ext-xhprof
This commit is contained in:
parent
20b693d1fa
commit
ca15ccd4d1
18
config/pkg/ext/ext-xhprof.yml
Normal file
18
config/pkg/ext/ext-xhprof.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
ext-xhprof:
|
||||||
|
type: php-extension
|
||||||
|
artifact:
|
||||||
|
source:
|
||||||
|
type: pecl
|
||||||
|
name: xhprof
|
||||||
|
extract: php-src/ext/xhprof-src
|
||||||
|
metadata:
|
||||||
|
license-files: [LICENSE]
|
||||||
|
license: Apache-2.0
|
||||||
|
depends:
|
||||||
|
- ext-ctype
|
||||||
|
php-extension:
|
||||||
|
support:
|
||||||
|
Windows: wip
|
||||||
|
BSD: wip
|
||||||
|
arg-type: enable
|
||||||
|
build-with-php: true
|
||||||
35
src/Package/Extension/xhprof.php
Normal file
35
src/Package/Extension/xhprof.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?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('xhprof')]
|
||||||
|
class xhprof extends PhpExtensionPackage
|
||||||
|
{
|
||||||
|
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-xhprof')]
|
||||||
|
public function patchBeforeBuildconf(PackageInstaller $installer): bool
|
||||||
|
{
|
||||||
|
$php_src = $installer->getTargetPackage('php')->getSourceDir();
|
||||||
|
$link = "{$php_src}/ext/xhprof";
|
||||||
|
if (!is_link($link)) {
|
||||||
|
shell()->cd("{$php_src}/ext")->exec('ln -s xhprof-src/extension xhprof');
|
||||||
|
|
||||||
|
// patch config.m4
|
||||||
|
FileSystem::replaceFileStr(
|
||||||
|
"{$this->getSourceDir()}/extension/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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user