force curl to absorb all k5 symbols

This commit is contained in:
henderkes 2026-02-21 17:37:57 +07:00
parent d85f556a93
commit 3fee7deb6d

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\util\executor\UnixCMakeExecutor;
use SPC\util\SPCConfigUtil;
trait curl
{
@ -12,6 +13,13 @@ trait curl
{
shell()->cd($this->source_dir)->exec('sed -i.save s@\${CMAKE_C_IMPLICIT_LINK_LIBRARIES}@@ ./CMakeLists.txt');
$linkerFlags = null;
if ($this->builder->getLib('krb5') && !getenv('SPC_LINK_STATIC')) {
$util = new SPCConfigUtil($this->builder, ['libs_only_deps' => true]);
$config = $util->config(libraries: ['krb5']);
$linkerFlags = $config['LDFLAGS'] . ' -Wl,--whole-archive -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lkrb5support -Wl,--no-whole-archive -Wl,--no-undefined';
}
UnixCMakeExecutor::create($this)
->optionalLib('openssl', '-DCURL_USE_OPENSSL=ON -DCURL_CA_BUNDLE=OFF -DCURL_CA_PATH=OFF -DCURL_CA_FALLBACK=ON', '-DCURL_USE_OPENSSL=OFF -DCURL_ENABLE_SSL=OFF')
->optionalLib('brotli', ...cmake_boolean_args('CURL_BROTLI'))
@ -29,6 +37,7 @@ trait curl
->addConfigureArgs(
'-DBUILD_CURL_EXE=OFF',
'-DBUILD_LIBCURL_DOCS=OFF',
$linkerFlags ? "-DCMAKE_SHARED_LINKER_FLAGS='{$linkerFlags}'" : null
)
->build();