Fix rdkafka with zstd build failed bug, reset test-extensions

This commit is contained in:
crazywhalecc 2025-06-11 22:40:43 +08:00
parent 70b91867cb
commit 80f2912026
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
2 changed files with 14 additions and 15 deletions

View File

@ -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 . '"';
}
}

View File

@ -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' => '',
};