From 80f2912026fa5681857aa67cf81ee4f2a8fe7936 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 11 Jun 2025 22:40:43 +0800 Subject: [PATCH] Fix rdkafka with zstd build failed bug, reset test-extensions --- src/SPC/builder/extension/rdkafka.php | 19 +++++++++---------- src/globals/test-extensions.php | 10 +++++----- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/SPC/builder/extension/rdkafka.php b/src/SPC/builder/extension/rdkafka.php index 9f28c627..cb1792c5 100644 --- a/src/SPC/builder/extension/rdkafka.php +++ b/src/SPC/builder/extension/rdkafka.php @@ -11,6 +11,13 @@ use SPC\util\CustomExt; #[CustomExt('rdkafka')] class rdkafka extends Extension { + public function patchBeforeBuildconf(): bool + { + FileSystem::replaceFileStr("{$this->source_dir}/config.m4", "-L\$RDKAFKA_DIR/\$PHP_LIBDIR -lm\n", "-L\$RDKAFKA_DIR/\$PHP_LIBDIR -lm \$RDKAFKA_LIBS\n"); + FileSystem::replaceFileStr("{$this->source_dir}/config.m4", "-L\$RDKAFKA_DIR/\$PHP_LIBDIR -lm\"\n", '-L$RDKAFKA_DIR/$PHP_LIBDIR -lm $RDKAFKA_LIBS"'); + return true; + } + public function patchBeforeMake(): bool { // when compiling rdkafka with inline builds, it shows some errors, I don't know why. @@ -27,18 +34,10 @@ class rdkafka extends Extension return true; } - public function getConfigureArg(bool $shared = false): string + public function getUnixConfigureArg(bool $shared = false): string { $pkgconf_libs = shell()->execWithResult('pkg-config --libs --static rdkafka')[1]; $pkgconf_libs = trim(implode('', $pkgconf_libs)); - return '--with-rdkafka=' . BUILD_ROOT_PATH . ' LIBS="' . $pkgconf_libs . '"'; - } - - public function getUnixConfigureArg(bool $shared = false): string - { - if ($shared) { - return '--with-rdkafka=' . BUILD_ROOT_PATH; - } - return parent::getUnixConfigureArg($shared); + return '--with-rdkafka=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . ' RDKAFKA_LIBS="' . $pkgconf_libs . '"'; } } diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index efcfb1f1..744028d3 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -13,9 +13,9 @@ declare(strict_types=1); // test php version (8.1 ~ 8.4 available, multiple for matrix) $test_php_version = [ - '8.1', - '8.2', - '8.3', + // '8.1', + // '8.2', + // '8.3', '8.4', ]; @@ -45,13 +45,13 @@ $prefer_pre_built = false; // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'apcu,ast,bcmath,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,iconv,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,readline,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib,amqp,brotli,bz2,dio,ds,ev,event,ffi,ftp,gd,gettext,gmp,gmssl,igbinary,imagick,intl,ldap,lz4,memcache,mongodb,msgpack,odbc,opentelemetry,parallel,pdo_odbc,pdo_pgsql,pdo_sqlsrv,pgsql,protobuf,rar,redis,rdkafka,shmop,spx,sqlsrv,ssh2,swoole,sysvmsg,sysvsem,sysvshm,tidy,uuid,uv,xhprof,xlswriter,xsl,xz,yac,yaml,zstd', + 'Linux', 'Darwin' => 'dom', 'Windows' => 'xlswriter,openssl', }; // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). $shared_extensions = match (PHP_OS_FAMILY) { - 'Linux' => 'xdebug', + 'Linux' => '', 'Darwin' => '', 'Windows' => '', };