mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +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,
|
"cpp-library": true,
|
||||||
"lib-suggests": [
|
"lib-suggests": [
|
||||||
|
"curl",
|
||||||
|
"liblz4",
|
||||||
|
"openssl",
|
||||||
|
"zlib",
|
||||||
"zstd"
|
"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\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", "-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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,6 +40,9 @@ class rdkafka extends Extension
|
|||||||
{
|
{
|
||||||
$pkgconf_libs = shell()->execWithResult('pkg-config --libs --static rdkafka')[1];
|
$pkgconf_libs = shell()->execWithResult('pkg-config --libs --static rdkafka')[1];
|
||||||
$pkgconf_libs = trim(implode('', $pkgconf_libs));
|
$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 . '"';
|
return '--with-rdkafka=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . ' RDKAFKA_LIBS="' . $pkgconf_libs . '"';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,20 +32,28 @@ trait librdkafka
|
|||||||
'zstd',
|
'zstd',
|
||||||
function ($lib) {
|
function ($lib) {
|
||||||
putenv("STATIC_LIB_libzstd={$lib->getLibDir()}/libzstd.a");
|
putenv("STATIC_LIB_libzstd={$lib->getLibDir()}/libzstd.a");
|
||||||
return '';
|
return '--enable-zstd';
|
||||||
},
|
},
|
||||||
'--disable-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(
|
->removeConfigureArgs(
|
||||||
'--with-pic',
|
'--with-pic',
|
||||||
'--enable-pic',
|
'--enable-pic',
|
||||||
)
|
)
|
||||||
->configure(
|
->configure(
|
||||||
'--disable-curl',
|
|
||||||
'--disable-sasl',
|
'--disable-sasl',
|
||||||
'--disable-valgrind',
|
'--disable-valgrind',
|
||||||
'--disable-zlib',
|
|
||||||
'--disable-ssl',
|
|
||||||
)
|
)
|
||||||
->make();
|
->make();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user