mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +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;
|
namespace SPC\builder\unix\library;
|
||||||
|
|
||||||
use SPC\store\FileSystem;
|
use SPC\store\FileSystem;
|
||||||
use SPC\util\executor\UnixAutoconfExecutor;
|
use SPC\util\executor\UnixCMakeExecutor;
|
||||||
|
|
||||||
trait librdkafka
|
trait librdkafka
|
||||||
{
|
{
|
||||||
@ -26,42 +26,18 @@ trait librdkafka
|
|||||||
|
|
||||||
protected function build(): void
|
protected function build(): void
|
||||||
{
|
{
|
||||||
UnixAutoconfExecutor::create($this)
|
UnixCMakeExecutor::create($this)
|
||||||
->appendEnv(['CFLAGS' => '-Wno-int-conversion -Wno-unused-but-set-variable -Wno-unused-variable'])
|
->optionalLib('zstd', ...cmake_boolean_args('WITH_ZSTD'))
|
||||||
->optionalLib(
|
->optionalLib('curl', ...cmake_boolean_args('WITH_CURL'))
|
||||||
'zstd',
|
->optionalLib('openssl', ...cmake_boolean_args('WITH_SSL'))
|
||||||
function ($lib) {
|
->optionalLib('zlib', ...cmake_boolean_args('WITH_ZLIB'))
|
||||||
putenv("STATIC_LIB_libzstd={$lib->getLibDir()}/libzstd.a");
|
->addConfigureArgs(
|
||||||
return '--enable-zstd';
|
'-DWITH_SASL=OFF',
|
||||||
},
|
'-DRDKAFKA_BUILD_STATIC=ON',
|
||||||
'--disable-zstd'
|
'-DRDKAFKA_BUILD_EXAMPLES=OFF',
|
||||||
|
'-DRDKAFKA_BUILD_TESTS=OFF',
|
||||||
|
'-DENABLE_LZ4_EXT=OFF',
|
||||||
)
|
)
|
||||||
->optionalLib(
|
->build();
|
||||||
'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");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user