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] 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',