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