2023-11-05 17:09:48 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\unix\library;
|
|
|
|
|
|
|
|
|
|
use SPC\exception\FileSystemException;
|
|
|
|
|
use SPC\exception\RuntimeException;
|
2025-06-09 19:32:31 +08:00
|
|
|
use SPC\util\executor\UnixAutoconfExecutor;
|
2023-11-05 17:09:48 +08:00
|
|
|
|
|
|
|
|
trait librdkafka
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* @throws FileSystemException
|
|
|
|
|
* @throws RuntimeException
|
|
|
|
|
*/
|
|
|
|
|
protected function build(): void
|
|
|
|
|
{
|
2025-06-09 19:32:31 +08:00
|
|
|
UnixAutoconfExecutor::create($this)
|
|
|
|
|
->optionalLib(
|
|
|
|
|
'zstd',
|
|
|
|
|
function ($lib) {
|
|
|
|
|
putenv("STATIC_LIB_libzstd={$lib->getLibDir()}/libzstd.a");
|
|
|
|
|
return '';
|
|
|
|
|
},
|
|
|
|
|
'--disable-zstd'
|
|
|
|
|
)
|
|
|
|
|
->configure(
|
|
|
|
|
'--disable-curl',
|
|
|
|
|
'--disable-sasl',
|
|
|
|
|
'--disable-valgrind',
|
|
|
|
|
'--disable-zlib',
|
|
|
|
|
'--disable-ssl',
|
2023-11-05 17:09:48 +08:00
|
|
|
)
|
2025-06-09 19:32:31 +08:00
|
|
|
->make();
|
|
|
|
|
|
2023-11-05 17:09:48 +08:00
|
|
|
$this->patchPkgconfPrefix(['rdkafka.pc', 'rdkafka-static.pc', 'rdkafka++.pc', 'rdkafka++-static.pc']);
|
|
|
|
|
// remove dynamic libs
|
|
|
|
|
shell()
|
2025-06-09 19:32:31 +08:00
|
|
|
->exec("rm -rf {$this->getLibDir()}/*.so.*")
|
|
|
|
|
->exec("rm -rf {$this->getLibDir()}/*.so")
|
|
|
|
|
->exec("rm -rf {$this->getLibDir()}/*.dylib");
|
2023-11-05 17:09:48 +08:00
|
|
|
}
|
|
|
|
|
}
|