37 lines
1.1 KiB
PHP
Raw Normal View History

2023-12-21 14:02:32 +08:00
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\WrongUsageException;
2025-06-09 19:32:31 +08:00
use SPC\util\executor\UnixAutoconfExecutor;
2023-12-21 14:02:32 +08:00
trait unixodbc
{
protected function build(): void
{
$sysconf_selector = match (PHP_OS_FAMILY) {
'Darwin' => match (GNU_ARCH) {
'x86_64' => '/usr/local/etc',
'aarch64' => '/opt/homebrew/etc',
default => throw new WrongUsageException('Unsupported architecture: ' . GNU_ARCH),
},
'Linux' => '/etc',
default => throw new WrongUsageException('Unsupported OS: ' . PHP_OS_FAMILY),
};
2025-06-09 19:32:31 +08:00
UnixAutoconfExecutor::create($this)
->configure(
'--disable-debug',
'--disable-dependency-tracking',
"--with-libiconv-prefix={$this->getBuildRootPath()}",
'--with-included-ltdl',
"--sysconfdir={$sysconf_selector}",
2025-06-09 19:32:31 +08:00
'--enable-gui=no',
2023-12-21 14:02:32 +08:00
)
2025-06-09 19:32:31 +08:00
->make();
2023-12-21 14:02:32 +08:00
$this->patchPkgconfPrefix(['odbc.pc', 'odbccr.pc', 'odbcinst.pc']);
$this->patchLaDependencyPrefix();
2023-12-21 14:02:32 +08:00
}
}