mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
Change librdkafka to cmake
This commit is contained in:
parent
f34ecf9468
commit
4d5641f6ec
@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
namespace SPC\builder\unix\library;
|
||||
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\executor\UnixAutoconfExecutor;
|
||||
use SPC\util\executor\UnixCMakeExecutor;
|
||||
|
||||
trait librdkafka
|
||||
{
|
||||
@ -26,42 +26,18 @@ trait librdkafka
|
||||
|
||||
protected function build(): void
|
||||
{
|
||||
UnixAutoconfExecutor::create($this)
|
||||
->appendEnv(['CFLAGS' => '-Wno-int-conversion -Wno-unused-but-set-variable -Wno-unused-variable'])
|
||||
->optionalLib(
|
||||
'zstd',
|
||||
function ($lib) {
|
||||
putenv("STATIC_LIB_libzstd={$lib->getLibDir()}/libzstd.a");
|
||||
return '--enable-zstd';
|
||||
},
|
||||
'--disable-zstd'
|
||||
UnixCMakeExecutor::create($this)
|
||||
->optionalLib('zstd', ...cmake_boolean_args('WITH_ZSTD'))
|
||||
->optionalLib('curl', ...cmake_boolean_args('WITH_CURL'))
|
||||
->optionalLib('openssl', ...cmake_boolean_args('WITH_SSL'))
|
||||
->optionalLib('zlib', ...cmake_boolean_args('WITH_ZLIB'))
|
||||
->addConfigureArgs(
|
||||
'-DWITH_SASL=OFF',
|
||||
'-DRDKAFKA_BUILD_STATIC=ON',
|
||||
'-DRDKAFKA_BUILD_EXAMPLES=OFF',
|
||||
'-DRDKAFKA_BUILD_TESTS=OFF',
|
||||
'-DENABLE_LZ4_EXT=OFF',
|
||||
)
|
||||
->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-sasl',
|
||||
'--disable-valgrind',
|
||||
)
|
||||
->make();
|
||||
|
||||
$this->patchPkgconfPrefix(['rdkafka.pc', 'rdkafka-static.pc', 'rdkafka++.pc', 'rdkafka++-static.pc']);
|
||||
// remove dynamic libs
|
||||
shell()
|
||||
->exec("rm -rf {$this->getLibDir()}/*.so.*")
|
||||
->exec("rm -rf {$this->getLibDir()}/*.so")
|
||||
->exec("rm -rf {$this->getLibDir()}/*.dylib");
|
||||
->build();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user