add ldap patches (why ext-ldap doesn't use pkg-config to find ldap?)

This commit is contained in:
crazywhalecc 2024-01-07 12:07:00 +08:00 committed by Jerry Ma
parent 13e0e12181
commit 25a2684e5a

View File

@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('ldap')]
class ldap extends Extension
{
public function patchBeforeConfigure(): bool
{
$output = shell()->execWithResult('$PKG_CONFIG --libs-only-l --static ldap');
if (!empty($output[1][0])) {
$libs = $output[1][0];
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/configure', '-lldap ', $libs . ' ');
}
return true;
}
}