2023-09-18 13:43:58 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\unix\library;
|
|
|
|
|
|
2024-01-07 11:09:26 +08:00
|
|
|
use SPC\store\FileSystem;
|
2025-06-09 19:32:31 +08:00
|
|
|
use SPC\util\executor\UnixAutoconfExecutor;
|
2025-06-28 16:36:05 +08:00
|
|
|
use SPC\util\SPCTarget;
|
2024-01-07 11:09:26 +08:00
|
|
|
|
2023-09-18 13:43:58 +02:00
|
|
|
trait ldap
|
|
|
|
|
{
|
2024-01-07 11:09:26 +08:00
|
|
|
public function patchBeforeBuild(): bool
|
|
|
|
|
{
|
2025-07-03 11:11:21 +07:00
|
|
|
$extra = SPCTarget::getLibc() === 'glibc' ? '-ldl -lpthread -lm -lresolv' : '';
|
2025-03-10 00:39:20 +08:00
|
|
|
FileSystem::replaceFileStr($this->source_dir . '/configure', '"-lssl -lcrypto', '"-lssl -lcrypto -lz ' . $extra);
|
2024-01-07 11:09:26 +08:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-18 13:43:58 +02:00
|
|
|
protected function build(): void
|
|
|
|
|
{
|
2025-06-09 19:32:31 +08:00
|
|
|
UnixAutoconfExecutor::create($this)
|
|
|
|
|
->optionalLib('openssl', '--with-tls=openssl')
|
|
|
|
|
->optionalLib('gmp', '--with-mp=gmp')
|
|
|
|
|
->optionalLib('libsodium', '--with-argon2=libsodium', '--enable-argon2=no')
|
|
|
|
|
->addConfigureArgs(
|
|
|
|
|
'--disable-slapd',
|
|
|
|
|
'--without-systemd',
|
|
|
|
|
'--without-cyrus-sasl',
|
2025-06-22 15:52:01 +07:00
|
|
|
'ac_cv_func_pthread_kill_other_threads_np=no'
|
2023-09-18 13:43:58 +02:00
|
|
|
)
|
2025-06-10 12:28:28 +08:00
|
|
|
->appendEnv([
|
2025-06-22 15:52:01 +07:00
|
|
|
'CFLAGS' => '-Wno-date-time',
|
2025-06-10 12:28:28 +08:00
|
|
|
'LDFLAGS' => "-L{$this->getLibDir()}",
|
|
|
|
|
'CPPFLAGS' => "-I{$this->getIncludeDir()}",
|
|
|
|
|
])
|
2025-06-09 19:32:31 +08:00
|
|
|
->configure()
|
2023-09-23 14:10:35 +08:00
|
|
|
->exec('sed -i -e "s/SUBDIRS= include libraries clients servers tests doc/SUBDIRS= include libraries clients servers/g" Makefile')
|
2025-06-09 19:32:31 +08:00
|
|
|
->make();
|
2025-06-07 21:16:15 +07:00
|
|
|
|
|
|
|
|
FileSystem::replaceFileLineContainsString(BUILD_LIB_PATH . '/pkgconfig/ldap.pc', 'Libs: -L${libdir} -lldap', 'Libs: -L${libdir} -lldap -llber');
|
2023-09-18 13:43:58 +02:00
|
|
|
$this->patchPkgconfPrefix(['ldap.pc', 'lber.pc']);
|
2025-06-10 19:46:55 +07:00
|
|
|
$this->patchLaDependencyPrefix();
|
2023-09-18 13:43:58 +02:00
|
|
|
}
|
|
|
|
|
}
|