Files
static-php-cli/src/SPC/builder/unix/library/krb5.php

55 lines
1.7 KiB
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\util\executor\UnixAutoconfExecutor;
2025-11-18 17:22:27 +01:00
use SPC\util\SPCConfigUtil;
trait krb5
{
protected function build(): void
{
$this->source_dir .= '/src';
shell()->cd($this->source_dir)->exec('autoreconf -if');
2025-11-18 17:22:27 +01:00
$libs = array_map(fn ($x) => $x->getName(), $this->getDependencies(true));
$spc = new SPCConfigUtil($this->builder, ['no_php' => true, 'libs_only_deps' => true]);
$config = $spc->config(libraries: $libs, include_suggest_lib: $this->builder->getOption('with-suggested-libs', false));
$make = UnixAutoconfExecutor::create($this)
2025-11-18 14:35:58 +01:00
->appendEnv([
2025-11-19 10:48:24 +01:00
'CFLAGS' => '-fcommon',
2025-11-18 17:22:27 +01:00
'LIBS' => $config['libs'],
]);
if (getenv('SPC_LD_LIBRARY_PATH') && getenv('SPC_LIBRARY_PATH')) {
$make->appendEnv([
'LD_LIBRARY_PATH' => getenv('SPC_LD_LIBRARY_PATH'),
'LIBRARY_PATH' => getenv('SPC_LIBRARY_PATH'),
]);
}
2025-11-19 13:54:17 +01:00
$args = [
'--disable-nls',
'--disable-rpath',
2025-11-19 13:54:45 +01:00
'--without-system-verto',
];
2025-11-19 13:54:17 +01:00
if (PHP_OS_FAMILY === 'Darwin') {
$args[] = 'ac_cv_func_secure_getenv=no';
}
$make
2025-11-18 14:35:58 +01:00
->optionalLib('ldap', '--with-ldap', '--without-ldap')
2025-11-18 17:50:49 +01:00
->optionalLib('libedit', '--with-libedit', '--without-libedit')
2025-11-19 13:54:17 +01:00
->configure(...$args)
->make();
$this->patchPkgconfPrefix([
'krb5-gssapi.pc',
'krb5.pc',
'kadm-server.pc',
'kadm-client.pc',
'kdb.pc',
'mit-krb5-gssapi.pc',
'mit-krb5.pc',
'gssrpc.pc',
]);
}
}