mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
add extra features to librdkafka (curl, ssl, sasl
This commit is contained in:
parent
5476385553
commit
5cb6a75e7d
@ -513,6 +513,10 @@
|
||||
],
|
||||
"cpp-library": true,
|
||||
"lib-suggests": [
|
||||
"curl",
|
||||
"liblz4",
|
||||
"openssl",
|
||||
"zlib",
|
||||
"zstd"
|
||||
]
|
||||
},
|
||||
|
||||
@ -15,6 +15,7 @@ class rdkafka extends Extension
|
||||
{
|
||||
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"');
|
||||
FileSystem::replaceFileStr("{$this->source_dir}/config.m4", 'PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,', 'AC_CHECK_LIB([$LIBNAME], [$LIBSYMBOL],');
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -39,6 +40,9 @@ class rdkafka extends Extension
|
||||
{
|
||||
$pkgconf_libs = shell()->execWithResult('pkg-config --libs --static rdkafka')[1];
|
||||
$pkgconf_libs = trim(implode('', $pkgconf_libs));
|
||||
$pkgconf_libs = str_replace(BUILD_LIB_PATH . '/lib', '-l', $pkgconf_libs);
|
||||
$pkgconf_libs = str_replace('.a', '', $pkgconf_libs);
|
||||
$pkgconf_libs = deduplicate_flags($pkgconf_libs);
|
||||
return '--with-rdkafka=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . ' RDKAFKA_LIBS="' . $pkgconf_libs . '"';
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,20 +32,28 @@ trait librdkafka
|
||||
'zstd',
|
||||
function ($lib) {
|
||||
putenv("STATIC_LIB_libzstd={$lib->getLibDir()}/libzstd.a");
|
||||
return '';
|
||||
return '--enable-zstd';
|
||||
},
|
||||
'--disable-zstd'
|
||||
)
|
||||
->optionalLib(
|
||||
'curl',
|
||||
function () {
|
||||
$pkg_libs = shell()->execWithResult('pkg-config --libs --static libcurl')[1];
|
||||
putenv("STATIC_LIB_libcurl={$pkg_libs}");
|
||||
return '--enable-curl';
|
||||
},
|
||||
'--disable-curl'
|
||||
)
|
||||
->optionalLib('openssl', '--enable-ssl', '--disable-ssl')
|
||||
->optionalLib('zlib', '--enable-zlib', '--disable-zlib')
|
||||
->removeConfigureArgs(
|
||||
'--with-pic',
|
||||
'--enable-pic',
|
||||
)
|
||||
->configure(
|
||||
'--disable-curl',
|
||||
'--disable-sasl',
|
||||
'--disable-valgrind',
|
||||
'--disable-zlib',
|
||||
'--disable-ssl',
|
||||
)
|
||||
->make();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user