mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-22 16:25:36 +08:00
Support AST extension
This commit is contained in:
@@ -17,6 +17,10 @@
|
|||||||
"type": "external",
|
"type": "external",
|
||||||
"source": "apcu"
|
"source": "apcu"
|
||||||
},
|
},
|
||||||
|
"ast": {
|
||||||
|
"type": "external",
|
||||||
|
"source": "ast"
|
||||||
|
},
|
||||||
"bcmath": {
|
"bcmath": {
|
||||||
"type": "builtin"
|
"type": "builtin"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,18 @@
|
|||||||
{
|
{
|
||||||
|
"ast": {
|
||||||
|
"source": "ast",
|
||||||
|
"static-libs-unix": [
|
||||||
|
"ast.la",
|
||||||
|
"ast.lo"
|
||||||
|
],
|
||||||
|
"static-libs-windows": [
|
||||||
|
],
|
||||||
|
"headers": [
|
||||||
|
"ast_arginfo.h",
|
||||||
|
"ast_str_defs.h",
|
||||||
|
"php_ast.h"
|
||||||
|
]
|
||||||
|
},
|
||||||
"brotli": {
|
"brotli": {
|
||||||
"source": "brotli",
|
"source": "brotli",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
|
|||||||
@@ -26,6 +26,16 @@
|
|||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ast": {
|
||||||
|
"type": "url",
|
||||||
|
"url": "https://pecl.php.net/get/ast",
|
||||||
|
"path": "php-src/ext/ast",
|
||||||
|
"filename": "ast.tgz",
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
"brotli": {
|
"brotli": {
|
||||||
"type": "ghtar",
|
"type": "ghtar",
|
||||||
"repo": "google/brotli",
|
"repo": "google/brotli",
|
||||||
|
|||||||
17
src/SPC/builder/extension/ast.php
Normal file
17
src/SPC/builder/extension/ast.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
|
use SPC\builder\Extension;
|
||||||
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
|
#[CustomExt('ast')]
|
||||||
|
class ast extends Extension
|
||||||
|
{
|
||||||
|
public function getUnixConfigureArg(): string
|
||||||
|
{
|
||||||
|
return '--with-ast';
|
||||||
|
}
|
||||||
|
}
|
||||||
12
src/SPC/builder/linux/library/ast.php
Normal file
12
src/SPC/builder/linux/library/ast.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\linux\library;
|
||||||
|
|
||||||
|
class ast extends LinuxLibraryBase
|
||||||
|
{
|
||||||
|
use \SPC\builder\unix\library\ast;
|
||||||
|
|
||||||
|
public const NAME = 'ast';
|
||||||
|
}
|
||||||
12
src/SPC/builder/macos/library/ast.php
Normal file
12
src/SPC/builder/macos/library/ast.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\macos\library;
|
||||||
|
|
||||||
|
class ast extends MacOSLibraryBase
|
||||||
|
{
|
||||||
|
use \SPC\builder\unix\library\ast;
|
||||||
|
|
||||||
|
public const NAME = 'ast';
|
||||||
|
}
|
||||||
32
src/SPC/builder/unix/library/ast.php
Normal file
32
src/SPC/builder/unix/library/ast.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\unix\library;
|
||||||
|
|
||||||
|
use SPC\exception\FileSystemException;
|
||||||
|
use SPC\exception\RuntimeException;
|
||||||
|
use SPC\exception\WrongUsageException;
|
||||||
|
|
||||||
|
trait ast
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @throws FileSystemException
|
||||||
|
* @throws RuntimeException
|
||||||
|
* @throws WrongUsageException
|
||||||
|
*/
|
||||||
|
protected function build(): void
|
||||||
|
{
|
||||||
|
shell()->cd($this->source_dir)
|
||||||
|
->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()])
|
||||||
|
->exec('phpize')
|
||||||
|
->execWithEnv(
|
||||||
|
'./configure '
|
||||||
|
)
|
||||||
|
->execWithEnv('make clean')
|
||||||
|
->execWithEnv('make')
|
||||||
|
->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||||
|
|
||||||
|
$this->cleanLaFiles();
|
||||||
|
}
|
||||||
|
}
|
||||||
5
src/globals/ext-tests/ast.php
Normal file
5
src/globals/ext-tests/ast.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
assert(function_exists('ast\parse_code'));
|
||||||
@@ -68,7 +68,7 @@ function _getCombination(string $type = 'common'): string
|
|||||||
'common' => 'bcmath,bz2,calendar,ctype,curl,dom,exif,fileinfo,filter,ftp,gd,gmp,iconv,xml,mbstring,mbregex,' .
|
'common' => 'bcmath,bz2,calendar,ctype,curl,dom,exif,fileinfo,filter,ftp,gd,gmp,iconv,xml,mbstring,mbregex,' .
|
||||||
'mysqlnd,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,redis,session,simplexml,soap,sockets,' .
|
'mysqlnd,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,redis,session,simplexml,soap,sockets,' .
|
||||||
'sqlite3,tokenizer,xmlwriter,xmlreader,zlib,zip',
|
'sqlite3,tokenizer,xmlwriter,xmlreader,zlib,zip',
|
||||||
'bulk' => 'apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,event,exif,fileinfo,filter,ftp,gd,gmp,iconv,imagick,imap,' .
|
'bulk' => 'apcu,ast,bcmath,bz2,calendar,ctype,curl,dba,dom,event,exif,fileinfo,filter,ftp,gd,gmp,iconv,imagick,imap,' .
|
||||||
'intl,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,phar,' .
|
'intl,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,phar,' .
|
||||||
'posix,protobuf,readline,redis,session,shmop,simplexml,soap,sockets,sodium,sqlite3,swoole,sysvmsg,sysvsem,' .
|
'posix,protobuf,readline,redis,session,shmop,simplexml,soap,sockets,sodium,sqlite3,swoole,sysvmsg,sysvsem,' .
|
||||||
'sysvshm,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib',
|
'sysvshm,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib',
|
||||||
|
|||||||
Reference in New Issue
Block a user