From 287e278184377597cc5d6670f9367b978213a679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20L=C3=A9pine?= Date: Thu, 26 Dec 2024 07:12:24 +0100 Subject: [PATCH 1/2] Support AST extension --- config/ext.json | 4 ++++ config/lib.json | 14 ++++++++++++ config/source.json | 10 +++++++++ src/SPC/builder/extension/ast.php | 17 ++++++++++++++ src/SPC/builder/linux/library/ast.php | 12 ++++++++++ src/SPC/builder/macos/library/ast.php | 12 ++++++++++ src/SPC/builder/unix/library/ast.php | 32 +++++++++++++++++++++++++++ src/globals/ext-tests/ast.php | 5 +++++ src/globals/test-extensions.php | 2 +- 9 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 src/SPC/builder/extension/ast.php create mode 100644 src/SPC/builder/linux/library/ast.php create mode 100644 src/SPC/builder/macos/library/ast.php create mode 100644 src/SPC/builder/unix/library/ast.php create mode 100644 src/globals/ext-tests/ast.php diff --git a/config/ext.json b/config/ext.json index ed55386e..c9ecf0ec 100644 --- a/config/ext.json +++ b/config/ext.json @@ -17,6 +17,10 @@ "type": "external", "source": "apcu" }, + "ast": { + "type": "external", + "source": "ast" + }, "bcmath": { "type": "builtin" }, diff --git a/config/lib.json b/config/lib.json index 69f92737..0ec1c5a2 100644 --- a/config/lib.json +++ b/config/lib.json @@ -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": { "source": "brotli", "static-libs-unix": [ diff --git a/config/source.json b/config/source.json index 283561ca..53bb3913 100644 --- a/config/source.json +++ b/config/source.json @@ -26,6 +26,16 @@ "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": { "type": "ghtar", "repo": "google/brotli", diff --git a/src/SPC/builder/extension/ast.php b/src/SPC/builder/extension/ast.php new file mode 100644 index 00000000..8a5e825d --- /dev/null +++ b/src/SPC/builder/extension/ast.php @@ -0,0 +1,17 @@ +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(); + } +} diff --git a/src/globals/ext-tests/ast.php b/src/globals/ext-tests/ast.php new file mode 100644 index 00000000..4e53c872 --- /dev/null +++ b/src/globals/ext-tests/ast.php @@ -0,0 +1,5 @@ + '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,' . '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,' . 'posix,protobuf,readline,redis,session,shmop,simplexml,soap,sockets,sodium,sqlite3,swoole,sysvmsg,sysvsem,' . 'sysvshm,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib', From 6d143659f2f7e0ddad3e406351d4bfd28dbd70a2 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 3 Jan 2025 16:07:47 +0800 Subject: [PATCH 2/2] Adjust ast support --- config/lib.json | 14 ------------ src/SPC/builder/extension/ast.php | 17 -------------- src/SPC/builder/linux/library/ast.php | 12 ---------- src/SPC/builder/macos/library/ast.php | 12 ---------- src/SPC/builder/unix/library/ast.php | 32 --------------------------- src/globals/test-extensions.php | 7 +++--- 6 files changed, 4 insertions(+), 90 deletions(-) delete mode 100644 src/SPC/builder/extension/ast.php delete mode 100644 src/SPC/builder/linux/library/ast.php delete mode 100644 src/SPC/builder/macos/library/ast.php delete mode 100644 src/SPC/builder/unix/library/ast.php diff --git a/config/lib.json b/config/lib.json index 0ec1c5a2..69f92737 100644 --- a/config/lib.json +++ b/config/lib.json @@ -1,18 +1,4 @@ { - "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": { "source": "brotli", "static-libs-unix": [ diff --git a/src/SPC/builder/extension/ast.php b/src/SPC/builder/extension/ast.php deleted file mode 100644 index 8a5e825d..00000000 --- a/src/SPC/builder/extension/ast.php +++ /dev/null @@ -1,17 +0,0 @@ -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(); - } -} diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index a12a0e60..aacd40c5 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -24,6 +24,7 @@ 'macos-14', // 'macos-13', 'ubuntu-latest', + 'windows-latest', ]; // whether enable thread safe @@ -39,8 +40,8 @@ // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'openssl', - 'Windows' => 'openssl', + 'Linux', 'Darwin' => 'ast', + 'Windows' => 'ast', }; // If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`). @@ -68,7 +69,7 @@ function _getCombination(string $type = 'common'): string '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,' . 'sqlite3,tokenizer,xmlwriter,xmlreader,zlib,zip', - 'bulk' => 'apcu,ast,bcmath,bz2,calendar,ctype,curl,dba,dom,event,exif,fileinfo,filter,ftp,gd,gmp,iconv,imagick,imap,' . + 'bulk' => 'apcu,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,' . 'posix,protobuf,readline,redis,session,shmop,simplexml,soap,sockets,sodium,sqlite3,swoole,sysvmsg,sysvsem,' . 'sysvshm,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib',